Skip to content

Commit

Permalink
feat(SettingsScreen): alternative downloader option
Browse files Browse the repository at this point in the history
  • Loading branch information
rushiiMachine committed Aug 4, 2024
1 parent baad8d4 commit 76620c8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -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),
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_download.xml
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 76620c8

Please sign in to comment.