Add back toggle to enable wifi-only downloads
This commit is contained in:
@@ -24,6 +24,7 @@ import com.aurora.Constants
|
|||||||
import com.aurora.gplayapi.data.models.App
|
import com.aurora.gplayapi.data.models.App
|
||||||
import com.aurora.gplayapi.data.models.File
|
import com.aurora.gplayapi.data.models.File
|
||||||
import com.aurora.store.util.PathUtil
|
import com.aurora.store.util.PathUtil
|
||||||
|
import com.aurora.store.util.Preferences
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import com.tonyodev.fetch2.EnqueueAction
|
import com.tonyodev.fetch2.EnqueueAction
|
||||||
import com.tonyodev.fetch2.NetworkType
|
import com.tonyodev.fetch2.NetworkType
|
||||||
@@ -32,11 +33,13 @@ import com.tonyodev.fetch2core.Extras
|
|||||||
import java.lang.reflect.Modifier
|
import java.lang.reflect.Modifier
|
||||||
|
|
||||||
private fun Request.attachMetaData(context: Context, app: App) {
|
private fun Request.attachMetaData(context: Context, app: App) {
|
||||||
|
val isWifiOnly = Preferences.getBoolean(context, Preferences.PREFERENCE_DOWNLOAD_WIFI_ONLY)
|
||||||
|
|
||||||
apply {
|
apply {
|
||||||
groupId = app.getGroupId(context)
|
groupId = app.getGroupId(context)
|
||||||
tag = app.packageName
|
tag = app.packageName
|
||||||
enqueueAction = EnqueueAction.UPDATE_ACCORDINGLY
|
enqueueAction = EnqueueAction.UPDATE_ACCORDINGLY
|
||||||
networkType = NetworkType.ALL
|
networkType = if (isWifiOnly) NetworkType.WIFI_ONLY else NetworkType.ALL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ object Preferences {
|
|||||||
const val PREFERENCE_DOWNLOAD_ACTIVE = "PREFERENCE_DOWNLOAD_ACTIVE"
|
const val PREFERENCE_DOWNLOAD_ACTIVE = "PREFERENCE_DOWNLOAD_ACTIVE"
|
||||||
const val PREFERENCE_DOWNLOAD_EXTERNAL = "PREFERENCE_DOWNLOAD_EXTERNAL"
|
const val PREFERENCE_DOWNLOAD_EXTERNAL = "PREFERENCE_DOWNLOAD_EXTERNAL"
|
||||||
const val PREFERENCE_DOWNLOAD_DIRECTORY = "PREFERENCE_DOWNLOAD_DIRECTORY"
|
const val PREFERENCE_DOWNLOAD_DIRECTORY = "PREFERENCE_DOWNLOAD_DIRECTORY"
|
||||||
const val PREFERENCE_DOWNLOAD_WIFI = "PREFERENCE_DOWNLOAD_WIFI"
|
const val PREFERENCE_DOWNLOAD_WIFI_ONLY = "PREFERENCE_DOWNLOAD_WIFI_ONLY"
|
||||||
|
|
||||||
const val PREFERENCE_TOS_READ = "PREFERENCE_TOS_READ"
|
const val PREFERENCE_TOS_READ = "PREFERENCE_TOS_READ"
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT_SELECTED_TAB
|
|||||||
import com.aurora.store.util.Preferences.PREFERENCE_DOWNLOAD_ACTIVE
|
import com.aurora.store.util.Preferences.PREFERENCE_DOWNLOAD_ACTIVE
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_DOWNLOAD_DIRECTORY
|
import com.aurora.store.util.Preferences.PREFERENCE_DOWNLOAD_DIRECTORY
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_DOWNLOAD_EXTERNAL
|
import com.aurora.store.util.Preferences.PREFERENCE_DOWNLOAD_EXTERNAL
|
||||||
|
import com.aurora.store.util.Preferences.PREFERENCE_DOWNLOAD_WIFI_ONLY
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_FDROID
|
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_FDROID
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_GOOGLE
|
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_GOOGLE
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_SEARCH
|
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_SEARCH
|
||||||
@@ -158,6 +159,7 @@ class OnboardingFragment : Fragment(R.layout.fragment_onboarding) {
|
|||||||
save(PREFERENCE_DOWNLOAD_ACTIVE, 3)
|
save(PREFERENCE_DOWNLOAD_ACTIVE, 3)
|
||||||
save(PREFERENCE_DOWNLOAD_EXTERNAL, false)
|
save(PREFERENCE_DOWNLOAD_EXTERNAL, false)
|
||||||
save(PREFERENCE_DOWNLOAD_DIRECTORY, PathUtil.getExternalPath(requireContext()))
|
save(PREFERENCE_DOWNLOAD_DIRECTORY, PathUtil.getExternalPath(requireContext()))
|
||||||
|
save(PREFERENCE_DOWNLOAD_WIFI_ONLY, false)
|
||||||
|
|
||||||
/*Network*/
|
/*Network*/
|
||||||
save(PREFERENCE_INSECURE_ANONYMOUS, false)
|
save(PREFERENCE_INSECURE_ANONYMOUS, false)
|
||||||
|
|||||||
@@ -215,6 +215,7 @@
|
|||||||
<string name="pref_downloader_external">"User external storage"</string>
|
<string name="pref_downloader_external">"User external storage"</string>
|
||||||
<string name="pref_downloader_external_desc">External storage is used for downloads, exports, etc.</string>
|
<string name="pref_downloader_external_desc">External storage is used for downloads, exports, etc.</string>
|
||||||
<string name="pref_downloader_path_title">"Download path"</string>
|
<string name="pref_downloader_path_title">"Download path"</string>
|
||||||
|
<string name="pref_downloader_wifi_title">"Download using WiFi only"</string>
|
||||||
<string name="pref_download_directory_error">"Selected path is not writable"</string>
|
<string name="pref_download_directory_error">"Selected path is not writable"</string>
|
||||||
<string name="pref_filter_fdroid_summary">"Removes F-Droid apps from app lists"</string>
|
<string name="pref_filter_fdroid_summary">"Removes F-Droid apps from app lists"</string>
|
||||||
<string name="pref_filter_fdroid_title">"Filter F-Droid apps"</string>
|
<string name="pref_filter_fdroid_title">"Filter F-Droid apps"</string>
|
||||||
|
|||||||
@@ -41,6 +41,12 @@
|
|||||||
app:summary="@string/pref_install_delete_summary"
|
app:summary="@string/pref_install_delete_summary"
|
||||||
app:title="@string/pref_install_delete_title" />
|
app:title="@string/pref_install_delete_title" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:iconSpaceReserved="false"
|
||||||
|
app:key="PREFERENCE_DOWNLOAD_WIFI_ONLY"
|
||||||
|
app:title="@string/pref_downloader_wifi_title" />
|
||||||
|
|
||||||
<SeekBarPreference
|
<SeekBarPreference
|
||||||
android:defaultValue="3"
|
android:defaultValue="3"
|
||||||
android:key="PREFERENCE_DOWNLOAD_ACTIVE"
|
android:key="PREFERENCE_DOWNLOAD_ACTIVE"
|
||||||
|
|||||||
Reference in New Issue
Block a user