@@ -113,6 +113,7 @@ fun RepoDetailsScreen(
113113 packageName : String ,
114114 onNavigateBack : () -> Unit ,
115115 onOpenUrl : (String ) -> Unit ,
116+ onOpenScope : (packageName: String , userId: Int ) -> Unit ,
116117 dataSource : StoreDataSource ,
117118 settings : StoreSettings ,
118119 host : StoreInstallHost ? = null,
@@ -137,6 +138,7 @@ fun RepoDetailsScreen(
137138 val installedScope by viewModel.installedScope.collectAsState()
138139 val installedIsLegacy by viewModel.installedIsLegacy.collectAsState()
139140 val install by viewModel.installState.collectAsState()
141+ val installedUserId by viewModel.installedUserId.collectAsState()
140142
141143 var choosing by remember { mutableStateOf<Release ?>(null ) }
142144 var optionsOpen by remember { mutableStateOf(false ) }
@@ -204,6 +206,8 @@ fun RepoDetailsScreen(
204206 else choosing = release
205207 },
206208 onAcknowledge = viewModel::acknowledgeInstall,
209+ installedUserId = installedUserId,
210+ onOpenScope = { onOpenScope(packageName, it) },
207211 )
208212 }
209213 },
@@ -378,6 +382,9 @@ private fun InstallBar(
378382 install : InstallStep ,
379383 onInstall : (Release ) -> Unit ,
380384 onAcknowledge : () -> Unit ,
385+ /* * The installed copy's user id, so the "Manage" button can open the configuration screen. */
386+ installedUserId : Int? ,
387+ onOpenScope : (userId: Int ) -> Unit ,
381388) {
382389 val context = LocalContext .current
383390 val newest = state.releases.firstOrNull { it.apks.isNotEmpty() } ? : return
@@ -449,31 +456,46 @@ private fun InstallBar(
449456 }
450457 }
451458 else -> {
452- Button (
453- onClick = {
454- onAcknowledge()
455- onInstall(newest)
456- },
457- modifier = Modifier .fillMaxWidth(),
458- ) {
459- Icon (
460- Icons .Rounded .Download ,
461- contentDescription = null ,
462- modifier = Modifier .size(18 .dp),
463- )
464- Spacer (Modifier .width(8 .dp))
465- Text (
466- when {
467- state.upgradable ->
468- stringResource(
469- if (state.sameVersion) UiR .string.store_badge_reinstall
470- else UiR .string.store_badge_update,
471- state.latest?.versionName.orEmpty(),
472- )
473- state.installed != null -> stringResource(UiR .string.store_reinstall)
474- else -> stringResource(UiR .string.store_install)
475- }
476- )
459+ // Installed and current — the next thing is to configure it, not reinstall it.
460+ if (state.installed != null && ! state.upgradable && installedUserId != null ) {
461+ FilledTonalButton (
462+ onClick = { onOpenScope(installedUserId) },
463+ modifier = Modifier .fillMaxWidth(),
464+ ) {
465+ Icon (
466+ Icons .Rounded .Tune ,
467+ contentDescription = null ,
468+ modifier = Modifier .size(18 .dp),
469+ )
470+ Spacer (Modifier .width(8 .dp))
471+ Text (stringResource(UiR .string.nav_manage))
472+ }
473+ } else {
474+ Button (
475+ onClick = {
476+ onAcknowledge()
477+ onInstall(newest)
478+ },
479+ modifier = Modifier .fillMaxWidth(),
480+ ) {
481+ Icon (
482+ Icons .Rounded .Download ,
483+ contentDescription = null ,
484+ modifier = Modifier .size(18 .dp),
485+ )
486+ Spacer (Modifier .width(8 .dp))
487+ Text (
488+ when {
489+ state.upgradable ->
490+ stringResource(
491+ if (state.sameVersion) UiR .string.store_badge_reinstall
492+ else UiR .string.store_badge_update,
493+ state.latest?.versionName.orEmpty(),
494+ )
495+ else -> stringResource(UiR .string.store_install)
496+ }
497+ )
498+ }
477499 }
478500 }
479501 }
0 commit comments