Change restart message and make it modal

This commit is contained in:
Hanh 2023-03-08 10:36:50 +10:00
parent 3c83035623
commit 8ac1693c18
10 changed files with 64 additions and 106 deletions

View File

@ -159,9 +159,6 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Change Account Name"),
"changeTransparentKey":
MessageLookupByLibrary.simpleMessage("Change Transparent Key"),
"changingTheModeWillTakeEffectAtNextRestart":
MessageLookupByLibrary.simpleMessage(
"Changing the mode will take effect at next restart"),
"checkTransaction":
MessageLookupByLibrary.simpleMessage("Check Transaction"),
"close": MessageLookupByLibrary.simpleMessage("Close"),
@ -196,13 +193,12 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Current password incorrect"),
"custom": MessageLookupByLibrary.simpleMessage("Custom"),
"dark": MessageLookupByLibrary.simpleMessage("Dark"),
"databaseEncrypted": MessageLookupByLibrary.simpleMessage(
"Database Encrypted. Please Restart the App."),
"databaseEncrypted":
MessageLookupByLibrary.simpleMessage("Database Encrypted"),
"databasePassword":
MessageLookupByLibrary.simpleMessage("Database Password"),
"databaseUpdatedPleaseRestartTheApp":
MessageLookupByLibrary.simpleMessage(
"Database updated. Please restart the app."),
"databaseRestored":
MessageLookupByLibrary.simpleMessage("Database Restored"),
"date": MessageLookupByLibrary.simpleMessage("Date"),
"datetime": MessageLookupByLibrary.simpleMessage("Date/Time"),
"dbImportSuccessful":
@ -348,8 +344,6 @@ class MessageLookup extends MessageLookupByLibrary {
"pleaseConfirm": MessageLookupByLibrary.simpleMessage("Please Confirm"),
"pleaseQuitAndRestartTheAppNow": MessageLookupByLibrary.simpleMessage(
"Please Quit and Restart the app now"),
"pleaseRestartNow":
MessageLookupByLibrary.simpleMessage("Please Restart now"),
"pnl": MessageLookupByLibrary.simpleMessage("Pnl"),
"pnlHistory": MessageLookupByLibrary.simpleMessage("PNL History"),
"pools": MessageLookupByLibrary.simpleMessage("Pool Transfer"),

View File

@ -160,9 +160,6 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Cambiar nombre de la cuenta"),
"changeTransparentKey": MessageLookupByLibrary.simpleMessage(
"Cambiar la clave transparente"),
"changingTheModeWillTakeEffectAtNextRestart":
MessageLookupByLibrary.simpleMessage(
"Cambiar el modo tendrá efecto en el próximo reinicio"),
"checkTransaction":
MessageLookupByLibrary.simpleMessage("Verificar la transacción"),
"close": MessageLookupByLibrary.simpleMessage("Cerrar"),
@ -203,9 +200,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Database Encrypted. Please Restart the App."),
"databasePassword":
MessageLookupByLibrary.simpleMessage("Database Password"),
"databaseUpdatedPleaseRestartTheApp":
MessageLookupByLibrary.simpleMessage(
"Por favor reinicie la aplicación"),
"databaseRestored":
MessageLookupByLibrary.simpleMessage("Database Restored"),
"date": MessageLookupByLibrary.simpleMessage("Fecha"),
"datetime": MessageLookupByLibrary.simpleMessage("Fecha/Hora"),
"dbImportSuccessful":
@ -351,8 +347,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Autentíquese para ver la semilla de la cuenta"),
"pleaseConfirm":
MessageLookupByLibrary.simpleMessage("Por favor, confirmar"),
"pleaseRestartNow":
MessageLookupByLibrary.simpleMessage("Reiniciar ahora"),
"pnl": MessageLookupByLibrary.simpleMessage("G&P"),
"pnlHistory": MessageLookupByLibrary.simpleMessage("Historia de G&P"),
"pools": MessageLookupByLibrary.simpleMessage("Transferir Suministros"),

View File

@ -160,9 +160,6 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Modifier le nom du compte"),
"changeTransparentKey":
MessageLookupByLibrary.simpleMessage("Changer la clé"),
"changingTheModeWillTakeEffectAtNextRestart":
MessageLookupByLibrary.simpleMessage(
"Changer le mode prendra effet au prochain démarrage"),
"checkTransaction":
MessageLookupByLibrary.simpleMessage("Vérifier la Transaction"),
"close": MessageLookupByLibrary.simpleMessage("Fermer"),
@ -193,17 +190,17 @@ class MessageLookup extends MessageLookupByLibrary {
"crypto": MessageLookupByLibrary.simpleMessage("Crypto"),
"currency": MessageLookupByLibrary.simpleMessage("Devise"),
"currentPassword":
MessageLookupByLibrary.simpleMessage("Current password"),
MessageLookupByLibrary.simpleMessage("Mot de Passe courrant"),
"currentPasswordIncorrect":
MessageLookupByLibrary.simpleMessage("Current password incorrect"),
MessageLookupByLibrary.simpleMessage("Mot de Passe incorrect"),
"custom": MessageLookupByLibrary.simpleMessage("Personnaliser"),
"dark": MessageLookupByLibrary.simpleMessage("Sombre"),
"databaseEncrypted": MessageLookupByLibrary.simpleMessage(
"Database Encrypted. Please Restart the App."),
"databaseEncrypted":
MessageLookupByLibrary.simpleMessage("BD encryptée"),
"databasePassword":
MessageLookupByLibrary.simpleMessage("Database Password"),
"databaseUpdatedPleaseRestartTheApp":
MessageLookupByLibrary.simpleMessage("Redémarrer l\'appli SVP"),
MessageLookupByLibrary.simpleMessage("Mot de Passe de la BD"),
"databaseRestored":
MessageLookupByLibrary.simpleMessage("BD Récupèrée"),
"date": MessageLookupByLibrary.simpleMessage("Date"),
"datetime": MessageLookupByLibrary.simpleMessage("Jour/Heure"),
"dbImportSuccessful":
@ -230,7 +227,7 @@ class MessageLookup extends MessageLookupByLibrary {
"editContact":
MessageLookupByLibrary.simpleMessage("Changer le Contact"),
"encryptDatabase":
MessageLookupByLibrary.simpleMessage("Encrypt Database"),
MessageLookupByLibrary.simpleMessage("Encrypter la BD"),
"encryptedBackup": m6,
"encryptionKey": MessageLookupByLibrary.simpleMessage("Clé Publique"),
"enterSecretShareIfAccountIsMultisignature":
@ -270,7 +267,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Adresse invalide"),
"invalidKey": MessageLookupByLibrary.simpleMessage("Clé invalide"),
"invalidPassword":
MessageLookupByLibrary.simpleMessage("Invalid Password"),
MessageLookupByLibrary.simpleMessage("Mot de Passe incorrect"),
"invalidQrCode": m8,
"key": MessageLookupByLibrary.simpleMessage("Clé"),
"keyTool": MessageLookupByLibrary.simpleMessage("Clés Utilitaires"),
@ -312,9 +309,10 @@ class MessageLookup extends MessageLookupByLibrary {
"nameIsEmpty": MessageLookupByLibrary.simpleMessage("Le nom est vide"),
"newAccount": MessageLookupByLibrary.simpleMessage("Nouveau Compte"),
"newLabel": MessageLookupByLibrary.simpleMessage("Nouveau"),
"newPassword": MessageLookupByLibrary.simpleMessage("New Password"),
"newPasswordsDoNotMatch":
MessageLookupByLibrary.simpleMessage("New passwords do not match"),
"newPassword":
MessageLookupByLibrary.simpleMessage("Nouveau Mot de Passe"),
"newPasswordsDoNotMatch": MessageLookupByLibrary.simpleMessage(
"Les nouveaux Mots de Passe ne correspondent pas"),
"newSnapAddress": MessageLookupByLibrary.simpleMessage(
"Nouvelle adresse instantanée"),
"newSubAccount":
@ -351,8 +349,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Veuillez vous authentifier pour voir la graine du compte"),
"pleaseConfirm":
MessageLookupByLibrary.simpleMessage("Veuillez confirmer"),
"pleaseRestartNow":
MessageLookupByLibrary.simpleMessage("Please Restart now"),
"pnl": MessageLookupByLibrary.simpleMessage("P/P"),
"pnlHistory":
MessageLookupByLibrary.simpleMessage("Historique des P/P"),
@ -380,8 +376,8 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Recevoir un payment"),
"received": m13,
"recipient": MessageLookupByLibrary.simpleMessage("Destinataire"),
"repeatNewPassword":
MessageLookupByLibrary.simpleMessage("Repeat New Password"),
"repeatNewPassword": MessageLookupByLibrary.simpleMessage(
"Répéter le Nouveau Mot de Passe"),
"reply": MessageLookupByLibrary.simpleMessage("Répondre"),
"rescan": MessageLookupByLibrary.simpleMessage("Parcourir à nouveau"),
"rescanFrom":

View File

@ -1892,16 +1892,6 @@ class S {
);
}
/// `Changing the mode will take effect at next restart`
String get changingTheModeWillTakeEffectAtNextRestart {
return Intl.message(
'Changing the mode will take effect at next restart',
name: 'changingTheModeWillTakeEffectAtNextRestart',
desc: '',
args: [],
);
}
/// `Sent from {app}`
String sendFrom(Object app) {
return Intl.message(
@ -2062,16 +2052,6 @@ class S {
);
}
/// `Please Restart now`
String get pleaseRestartNow {
return Intl.message(
'Please Restart now',
name: 'pleaseRestartNow',
desc: '',
args: [],
);
}
/// `Disconnected`
String get disconnected {
return Intl.message(
@ -2762,16 +2742,6 @@ class S {
);
}
/// `Database updated. Please restart the app.`
String get databaseUpdatedPleaseRestartTheApp {
return Intl.message(
'Database updated. Please restart the app.',
name: 'databaseUpdatedPleaseRestartTheApp',
desc: '',
args: [],
);
}
/// `Pool Transfer`
String get pools {
return Intl.message(
@ -3102,10 +3072,10 @@ class S {
);
}
/// `Database Encrypted. Please Restart the App.`
/// `Database Encrypted`
String get databaseEncrypted {
return Intl.message(
'Database Encrypted. Please Restart the App.',
'Database Encrypted',
name: 'databaseEncrypted',
desc: '',
args: [],
@ -3121,6 +3091,16 @@ class S {
args: [],
);
}
/// `Database Restored`
String get databaseRestored {
return Intl.message(
'Database Restored',
name: 'databaseRestored',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View File

@ -26,6 +26,7 @@ import 'generated/l10n.dart';
import 'main.dart';
import 'message.dart';
import 'note.dart';
import 'reset.dart';
import 'store.dart';
class HomePage extends StatefulWidget {
@ -527,6 +528,7 @@ class HomeInnerState extends State<HomeInnerPage> with SingleTickerProviderState
final prefs = await SharedPreferences.getInstance();
prefs.setBool('recover', true);
showSnackBar(s.databaseEncrypted);
await showRestartMessage();
}
}
}

View File

@ -183,7 +183,6 @@
"mode": "Mode",
"simple": "Simple",
"advanced": "Advanced",
"changingTheModeWillTakeEffectAtNextRestart": "Changing the mode will take effect at next restart",
"sendFrom": "Sent from {app}",
"defaultMemo": "Default Memo",
"fullBackup": "Full Backup",
@ -200,7 +199,6 @@
"newSubAccount": "New Sub Account",
"noActiveAccount": "No active account",
"closeApplication": "Close Application",
"pleaseRestartNow": "Please Restart now",
"disconnected": "Disconnected",
"ledger": "Ledger",
"mobileCharges": "On Mobile Data, scanning may incur additional charges. Do you want to proceed?",
@ -270,7 +268,6 @@
"set": "Set",
"encryptionKey": "Encryption Key",
"dbImportSuccessful": "Db Import Successful",
"databaseUpdatedPleaseRestartTheApp": "Database updated. Please restart the app.",
"pools": "Pool Transfer",
"fromPool": "From Pool",
"toPool": "To Pool",
@ -304,6 +301,7 @@
"databasePassword": "Database Password",
"currentPasswordIncorrect": "Current password incorrect",
"newPasswordsDoNotMatch": "New passwords do not match",
"databaseEncrypted": "Database Encrypted. Please Restart the App.",
"invalidPassword": "Invalid Password"
"databaseEncrypted": "Database Encrypted",
"invalidPassword": "Invalid Password",
"databaseRestored": "Database Restored"
}

View File

@ -181,7 +181,6 @@
"mode": "Modo",
"simple": "Básico",
"advanced": "Avanzado",
"changingTheModeWillTakeEffectAtNextRestart": "Cambiar el modo tendrá efecto en el próximo reinicio",
"sendFrom": "Enviado desde {app}",
"defaultMemo": "Nota",
"fullBackup": "Copia completa",
@ -198,7 +197,6 @@
"newSubAccount": "Nueva subcuenta",
"noActiveAccount": "Sin cuenta activa",
"closeApplication": "Cierra la aplicación",
"pleaseRestartNow": "Reiniciar ahora",
"disconnected": "Desconectado",
"ledger": "Ledger",
"mobileCharges": "Con datos móviles, el escaneo puede incurrir en cargos adicionales. ¿Quieres proceder?",
@ -268,7 +266,6 @@
"set": "Utilizar",
"encryptionKey": "Clave de encriptación",
"dbImportSuccessful": "Importación exitosa",
"databaseUpdatedPleaseRestartTheApp": "Por favor reinicie la aplicación",
"pools": "Transferir Suministros",
"fromPool": "Del Suministro",
"toPool": "Para Suministro",
@ -303,5 +300,6 @@
"currentPasswordIncorrect": "Current password incorrect",
"newPasswordsDoNotMatch": "New passwords do not match",
"databaseEncrypted": "Database Encrypted. Please Restart the App.",
"invalidPassword": "Invalid Password"
"invalidPassword": "Invalid Password",
"databaseRestored": "Database Restored"
}

View File

@ -181,7 +181,6 @@
"mode": "Mode",
"simple": "Simple",
"advanced": "Avancé",
"changingTheModeWillTakeEffectAtNextRestart": "Changer le mode prendra effet au prochain démarrage",
"sendFrom": "Envoyé via {app}",
"defaultMemo": "Memo",
"fullBackup": "Sauvegarde complète",
@ -268,7 +267,6 @@
"set": "Utiliser",
"encryptionKey": "Clé Publique",
"dbImportSuccessful": "Sauvegarde importée",
"databaseUpdatedPleaseRestartTheApp": "Redémarrer l'appli SVP",
"pools": "Echanger entre Fonds",
"fromPool": "A partir du Fond",
"toPool": "Vers le Fond",
@ -295,13 +293,14 @@
"sweep": "Balayer",
"transparentKey": "Clé Transparente",
"unifiedViewingKey": "Clé publique unifiée",
"encryptDatabase": "Encrypt Database",
"currentPassword": "Current password",
"newPassword": "New Password",
"repeatNewPassword": "Repeat New Password",
"databasePassword": "Database Password",
"currentPasswordIncorrect": "Current password incorrect",
"newPasswordsDoNotMatch": "New passwords do not match",
"databaseEncrypted": "Database Encrypted. Please Restart the App.",
"invalidPassword": "Invalid Password"
"encryptDatabase": "Encrypter la BD",
"currentPassword": "Mot de Passe courrant",
"newPassword": "Nouveau Mot de Passe",
"repeatNewPassword": "Répéter le Nouveau Mot de Passe",
"databasePassword": "Mot de Passe de la BD",
"currentPasswordIncorrect": "Mot de Passe incorrect",
"newPasswordsDoNotMatch": "Les nouveaux Mots de Passe ne correspondent pas",
"databaseEncrypted": "BD encryptée",
"invalidPassword": "Mot de Passe incorrect",
"databaseRestored": "BD Récupèrée"
}

View File

@ -204,28 +204,16 @@ class _FullRestoreState extends State<FullRestorePage> {
try {
if (key.isNotEmpty) {
WarpApi.unzipBackup(key, filename, settings.tempDir);
await showDialog<bool>(
context: context,
barrierDismissible: false,
builder: (context) =>
AlertDialog(
title: Text(s.dbImportSuccessful),
content: Text(s.databaseUpdatedPleaseRestartTheApp),
actions: [
ElevatedButton.icon(onPressed: () => Navigator.of(context).pop(), icon: Icon(Icons.check),
label: Text(s.ok))
]
));
final prefs = await SharedPreferences.getInstance();
await prefs.setBool('recover', true);
}
else {
final file = File(filename);
final backup = await file.readAsString();
WarpApi.importFromZWL(active.coin, "ZWL Imported Account", backup);
}
syncStatus.setAccountRestored(true);
Navigator.of(context).pop();
final prefs = await SharedPreferences.getInstance();
await prefs.setBool('recover', true);
showSnackBar(s.databaseRestored);
await showRestartMessage(); // This doesn't return
}
on String catch (message) {
showSnackBar(message);
@ -233,3 +221,12 @@ class _FullRestoreState extends State<FullRestorePage> {
}
}
}
Future<void> showRestartMessage() async {
final context = navigatorKey.currentContext!;
await showDialog(context: context, barrierDismissible: false, builder:
(context) => AlertDialog(
content: Text(S.of(context).pleaseQuitAndRestartTheAppNow)
)
);
}

View File

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.3.5+396
version: 1.3.5+397
environment:
sdk: ">=2.12.0 <3.0.0"