feat: install abort warning dialog
Based on Wing's version in Vendetta Manager
This commit is contained in:
parent
a38a28bf7d
commit
5d54bdeb5d
4 changed files with 85 additions and 3 deletions
|
|
@ -0,0 +1,52 @@
|
|||
package com.aliucord.manager.ui.components.dialogs
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Warning
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.aliucord.manager.R
|
||||
|
||||
@Composable
|
||||
fun InstallerAbortDialog(
|
||||
onConfirm: () -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
confirmButton = {
|
||||
FilledTonalButton(
|
||||
onClick = onConfirm,
|
||||
colors = ButtonDefaults.filledTonalButtonColors(
|
||||
containerColor = MaterialTheme.colorScheme.error,
|
||||
contentColor = MaterialTheme.colorScheme.onError,
|
||||
),
|
||||
) {
|
||||
Text(stringResource(R.string.action_exit_anyways))
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(
|
||||
onClick = onDismiss,
|
||||
colors = ButtonDefaults.textButtonColors(
|
||||
contentColor = MaterialTheme.colorScheme.onErrorContainer
|
||||
),
|
||||
) {
|
||||
Text(stringResource(R.string.action_cancel))
|
||||
}
|
||||
},
|
||||
title = {
|
||||
Text(stringResource(R.string.installer_abort_title))
|
||||
},
|
||||
text = {
|
||||
Text(stringResource(R.string.installer_abort_body))
|
||||
},
|
||||
icon = {
|
||||
Icon(Icons.Filled.Warning, contentDescription = null)
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.errorContainer,
|
||||
iconContentColor = MaterialTheme.colorScheme.onErrorContainer,
|
||||
titleContentColor = MaterialTheme.colorScheme.onErrorContainer,
|
||||
textContentColor = MaterialTheme.colorScheme.onErrorContainer
|
||||
)
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ private fun MainContributors(modifier: Modifier = Modifier) {
|
|||
) {
|
||||
UserEntry("Vendicated", "the ven")
|
||||
UserEntry("Juby210", "Fox")
|
||||
UserEntry("rushii", "explod", "DiamondMiner88")
|
||||
UserEntry("rushii", "explod", "rushiiMachine")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
package com.aliucord.manager.ui.screens.install
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
|
|
@ -15,6 +16,7 @@ import androidx.compose.runtime.*
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
|
@ -26,6 +28,7 @@ import com.aliucord.manager.R
|
|||
import com.aliucord.manager.ui.components.BackButton
|
||||
import com.aliucord.manager.ui.components.back
|
||||
import com.aliucord.manager.ui.components.dialogs.DownloadMethod
|
||||
import com.aliucord.manager.ui.components.dialogs.InstallerAbortDialog
|
||||
import com.aliucord.manager.ui.components.installer.InstallGroup
|
||||
import com.aliucord.manager.ui.components.installer.InstallStatus
|
||||
import com.aliucord.manager.ui.screens.install.InstallModel.InstallStepGroup
|
||||
|
|
@ -58,13 +61,35 @@ class InstallScreen(val data: InstallData) : Screen {
|
|||
expandedGroup = model.currentStep?.group
|
||||
}
|
||||
|
||||
// Exit warning dialog
|
||||
var showAbortWarning by remember { mutableStateOf(false) }
|
||||
if (showAbortWarning) {
|
||||
InstallerAbortDialog(
|
||||
onDismiss = { showAbortWarning = false },
|
||||
onConfirm = {
|
||||
navigator.back(currentActivity = null)
|
||||
model.clearCache()
|
||||
},
|
||||
)
|
||||
} else {
|
||||
BackHandler {
|
||||
showAbortWarning = true
|
||||
}
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text(stringResource(R.string.installer)) },
|
||||
navigationIcon = {
|
||||
// TODO: add confirm to exit dialog to button as well as BackHandler
|
||||
BackButton()
|
||||
IconButton(
|
||||
onClick = { showAbortWarning = true },
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.ic_back),
|
||||
contentDescription = stringResource(R.string.navigation_back),
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
<string name="website">Website</string>
|
||||
<string name="installer">Installer</string>
|
||||
|
||||
<string name="action_cancel">Cancel</string>
|
||||
<string name="action_retry">Retry</string>
|
||||
<string name="action_apply">Apply</string>
|
||||
<string name="action_confirm">Confirm</string>
|
||||
|
|
@ -27,6 +28,7 @@
|
|||
<string name="action_expand">Expand</string>
|
||||
<string name="action_copied">Copied!</string>
|
||||
<string name="action_cleared_cache">Cleared cache!</string>
|
||||
<string name="action_exit_anyways">Exit anyways</string>
|
||||
|
||||
<string name="permissions_grant_title">Grant Permissions</string>
|
||||
<string name="permissions_grant_body">In order for Aliucord Manager to function, file permissions are required. Since shared data is stored in ~/Aliucord, permissions are required in order to access it.</string>
|
||||
|
|
@ -125,6 +127,9 @@
|
|||
<string name="status_failed">Failed</string>
|
||||
<string name="status_queued">Queued</string>
|
||||
|
||||
<string name="installer_abort_title">Really exit?</string>
|
||||
<string name="installer_abort_body">Are you sure you really want to abort an in-progress installation? Cached files will be cleared to avoid corruption.</string>
|
||||
|
||||
<string name="updater_body">A new update has been released for Aliucord Manager! It may be required in order to function properly. Would you like to update?</string>
|
||||
<string name="updater_title">Update to %1$s</string>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue