mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-06 03:18:23 +00:00
Show backup dialog if any account needs backup
This commit is contained in:
@@ -15,6 +15,11 @@ import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -40,6 +45,8 @@ import com.greenart7c3.nostrsigner.service.toShortenHex
|
||||
import com.greenart7c3.nostrsigner.ui.components.AmberButton
|
||||
import com.greenart7c3.nostrsigner.ui.components.AmberWarningCard
|
||||
import com.greenart7c3.nostrsigner.ui.navigation.Route
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Composable
|
||||
fun ApplicationsScreen(
|
||||
@@ -48,6 +55,13 @@ fun ApplicationsScreen(
|
||||
navController: NavController,
|
||||
) {
|
||||
val applications = Amber.instance.getDatabase(account.npub).applicationDao().getAllFlow(account.hexKey).collectAsStateWithLifecycle(emptyList())
|
||||
var hasAccountsWithoutBackup by remember { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
launch(Dispatchers.IO) {
|
||||
hasAccountsWithoutBackup = LocalPreferences.allAccounts(Amber.instance).any { !it.didBackup }
|
||||
}
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier,
|
||||
@@ -65,7 +79,7 @@ fun ApplicationsScreen(
|
||||
)
|
||||
}
|
||||
|
||||
if (!account.didBackup) {
|
||||
if (hasAccountsWithoutBackup) {
|
||||
if (killSwitch.value) {
|
||||
Spacer(Modifier.height(4.dp))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user