feat(SettingsScreen): alternative downloader option

This commit is contained in:
rushiiMachine 2024-08-04 12:03:24 -07:00
parent baad8d4a94
commit 76620c85f6
No known key found for this signature in database
GPG key ID: DCBE5952BB3B6420
3 changed files with 31 additions and 7 deletions

View file

@ -19,6 +19,7 @@ import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.koin.getScreenModel
import com.aliucord.manager.R
import com.aliucord.manager.di.DownloaderSetting
import com.aliucord.manager.ui.components.BackButton
import com.aliucord.manager.ui.components.Theme
import com.aliucord.manager.ui.components.settings.*
@ -75,7 +76,13 @@ class SettingsScreen : Screen {
SettingsHeader(stringResource(R.string.settings_advanced))
Spacer(modifier = Modifier.height(4.dp))
SettingsSwitch(
label = stringResource(R.string.settings_developer_options),
pref = preferences.devMode,
icon = { Icon(painterResource(R.drawable.ic_code), null) }
) {
preferences.devMode = it
}
SettingsSwitch(
label = stringResource(R.string.setting_keep_patched_apks),
@ -88,12 +95,18 @@ class SettingsScreen : Screen {
Spacer(modifier = Modifier.height(14.dp))
SettingsSwitch(
label = stringResource(R.string.settings_developer_options),
pref = preferences.devMode,
icon = { Icon(painterResource(R.drawable.ic_code), null) }
) {
preferences.devMode = it
}
label = stringResource(R.string.setting_alt_downloader),
secondaryLabel = stringResource(R.string.setting_alt_downloader_desc),
icon = { Icon(painterResource(R.drawable.ic_download), null) },
pref = preferences.downloader == DownloaderSetting.Ktor,
onPrefChange = {
preferences.downloader = if (it) {
DownloaderSetting.Ktor
} else {
DownloaderSetting.Android
}
}
)
Button(
modifier = Modifier

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M480,623q-8,0 -15,-2.5t-13,-8.5L308,468q-12,-12 -11.5,-28t11.5,-28q12,-12 28.5,-12.5T365,411l75,75v-286q0,-17 11.5,-28.5T480,160q17,0 28.5,11.5T520,200v286l75,-75q12,-12 28.5,-11.5T652,412q11,12 11.5,28T652,468L508,612q-6,6 -13,8.5t-15,2.5ZM240,800q-33,0 -56.5,-23.5T160,720v-80q0,-17 11.5,-28.5T200,600q17,0 28.5,11.5T240,640v80h480v-80q0,-17 11.5,-28.5T760,600q17,0 28.5,11.5T800,640v80q0,33 -23.5,56.5T720,800L240,800Z" />
</vector>

View file

@ -45,6 +45,8 @@
<string name="setting_dynamic_color">Dynamic color</string>
<string name="setting_keep_patched_apks">Keep patched APKs</string>
<string name="setting_keep_patched_apks_desc">Don\'t delete patched APKs after installing (for installing manually)</string>
<string name="setting_alt_downloader">Alternative downloader</string>
<string name="setting_alt_downloader_desc">Use a custom HTTP client instead of the system DownloadManager. May fix errors on some devices</string>
<string name="theme_system">System</string>
<string name="theme_dark">Dark</string>