feat: downloads resume where they stopped, and fall back to another source (#623)

This commit is contained in:
kingokksa authored and GitHub committed 2026-10-16 13:45:35 -04:00
1 parent 59a5afa21d
commit 89a0e4d25f
53 files changed
+784 -221

No files matched your search

@@ -77,6 +77,7 @@ import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.gpu.FrameGen
import com.droiddeck.launcher.gpu.Lossless
import com.droiddeck.launcher.input.SecondScreenDisplay
import com.droiddeck.launcher.core.DownloadSource
import com.droiddeck.launcher.core.PhantomProcessLimit
import com.droiddeck.launcher.core.PhantomProcessStatus
import com.droiddeck.launcher.session.SessionPrefs
@@ -131,6 +132,9 @@ class FrontEndState(
val showPhantomGate: Boolean = false,
val orientation: Int = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
val launcherFullscreen: Boolean = true,
val downloadSource: String = DownloadSource.MODE_AUTO,
val downloadMirror: String = "",
val downloadPrefix: String = "",
val animationsEnabled: Boolean = true,
val gameStoresEnabled: Boolean = true,
val gameStoresSpeedTier: String = "fast",
@@ -198,6 +202,9 @@ class FrontEndActions(
val onOrientation: (Int) -> Unit = {},
val onLauncherFullscreen: (Boolean) -> Unit = {},
val onAnimationsEnabled: (Boolean) -> Unit = {},
val onDownloadSource: (String) -> Unit = {},
val onDownloadMirror: (String) -> Unit = {},
val onDownloadPrefix: (String) -> Unit = {},
val onGameStoresEnabled: (Boolean) -> Unit = {},
val onGameStoresSpeedTier: (String) -> Unit = {},
val onStoresOpenTab: (String) -> Unit = {},
@@ -75,6 +75,7 @@ import androidx.compose.ui.layout.boundsInRoot
import androidx.compose.ui.layout.onGloballyPositioned
import com.droiddeck.launcher.core.AppLanguage
import com.droiddeck.launcher.core.DeviceSupport
import com.droiddeck.launcher.core.DownloadSource
import com.droiddeck.launcher.core.PhantomProcessLimit
import com.droiddeck.launcher.core.PhantomProcessStatus
import com.droiddeck.launcher.session.SessionPrefs
@@ -166,7 +167,14 @@ internal fun SetupPanel(
val signedIn = s.offlineAccount != null
var showLimitDetails by rememberSaveable { mutableStateOf(false) }
var editSgdbKey by remember { mutableStateOf(false) }
var editDownloadPrefix by remember { mutableStateOf(false) }
if (editSgdbKey) SgdbKeyDialog(s.sgdbUserKey, onSave = { a.onSgdbKey(it); editSgdbKey = false }, onDismiss = { editSgdbKey = false })
if (editDownloadPrefix) TextEntryDialog(
stringResource(R.string.setup_download_prefix), s.downloadPrefix,
onDismiss = { editDownloadPrefix = false },
onSave = { a.onDownloadPrefix(it); editDownloadPrefix = false },
)
val tabs = listOf(stringResource(R.string.setup_tab_overview), stringResource(R.string.setup_tab_controller), stringResource(R.string.setup_tab_launcher), stringResource(R.string.setup_tab_storage), stringResource(R.string.setup_tab_diagnostics))
var tab by rememberSaveable { mutableStateOf(0) }
val chipFocus = remember { List(tabs.size) { FocusRequester() } }
@@ -390,10 +398,39 @@ internal fun SetupPanel(
)
}
}
val download: @Composable () -> Unit = {
SettingsGroup(stringResource(R.string.setup_group_download)) {
ChoiceRow(
host, "download-source", stringResource(R.string.setup_download_source), null,
listOf(
DownloadSource.MODE_AUTO to stringResource(R.string.setup_download_source_auto),
DownloadSource.MODE_DIRECT to stringResource(R.string.setup_download_source_direct),
DownloadSource.MODE_MIRROR to stringResource(R.string.setup_download_source_mirror),
DownloadSource.MODE_CUSTOM to stringResource(R.string.setup_download_source_custom),
),
s.downloadSource, onPick = a.onDownloadSource,
)
if (s.downloadSource == DownloadSource.MODE_MIRROR) {
ChoiceRow(
host, "download-mirror", stringResource(R.string.setup_download_mirror), null,
DownloadSource.MIRRORS.map { it.host to it.host },
s.downloadMirror, onPick = a.onDownloadMirror,
)
}
if (s.downloadSource == DownloadSource.MODE_CUSTOM) {
ActionRow(
stringResource(R.string.setup_download_prefix),
s.downloadPrefix.takeIf { it.isNotEmpty() },
stringResource(R.string.mode_sgdb_edit),
onClick = { editDownloadPrefix = true },
)
}
}
}
if (wide) Row(horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.Top) {
Column(Modifier.weight(1f)) { look() }
Column(Modifier.weight(1f)) { device(); art() }
} else { look(); device(); art() }
Column(Modifier.weight(1f)) { device(); art(); download() }
} else { look(); device(); art(); download() }
}
STORAGE_TAB -> StoragePanel(s, a)
4 -> {