From c4ebed0a7142721593025d8d9562ba1502bee684 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Thu, 10 Mar 2022 16:10:28 -0800 Subject: [PATCH] splash on shutdown; android stability: check if lcg started --- LIBCWTCH-GO-MACOS.version | 2 +- LIBCWTCH-GO.version | 2 +- .../kotlin/im/cwtch/flwtch/FlwtchWorker.kt | 32 +-- .../kotlin/im/cwtch/flwtch/MainActivity.kt | 1 + lib/l10n/intl_cy.arb | 9 +- lib/l10n/intl_da.arb | 9 +- lib/l10n/intl_de.arb | 9 +- lib/l10n/intl_el.arb | 9 +- lib/l10n/intl_en.arb | 9 +- lib/l10n/intl_es.arb | 9 +- lib/l10n/intl_fr.arb | 31 +-- lib/l10n/intl_it.arb | 9 +- lib/l10n/intl_lb.arb | 183 +++++++++--------- lib/l10n/intl_no.arb | 9 +- lib/l10n/intl_pl.arb | 9 +- lib/l10n/intl_pt.arb | 9 +- lib/l10n/intl_ro.arb | 9 +- lib/l10n/intl_ru.arb | 9 +- lib/main.dart | 13 +- lib/models/appstate.dart | 2 +- lib/models/profile.dart | 2 +- lib/views/splashView.dart | 5 +- 22 files changed, 248 insertions(+), 133 deletions(-) diff --git a/LIBCWTCH-GO-MACOS.version b/LIBCWTCH-GO-MACOS.version index 20c15581..368ca44f 100644 --- a/LIBCWTCH-GO-MACOS.version +++ b/LIBCWTCH-GO-MACOS.version @@ -1 +1 @@ -2022-03-03-19-53-v1.6.0-4-g4b881b9 \ No newline at end of file +2022-03-10-17-32-v1.6.0-6-gc2874db \ No newline at end of file diff --git a/LIBCWTCH-GO.version b/LIBCWTCH-GO.version index aa80e80c..79a33b2e 100644 --- a/LIBCWTCH-GO.version +++ b/LIBCWTCH-GO.version @@ -1 +1 @@ -2022-03-04-00-54-v1.6.0-4-g4b881b9 \ No newline at end of file +2022-03-10-22-49-v1.6.0-6-gc2874db \ No newline at end of file diff --git a/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt b/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt index 34cb2961..52037442 100644 --- a/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt +++ b/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt @@ -32,6 +32,8 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : private var notificationSimple: String? = null private var notificationConversationInfo: String? = null + private val TAG: String = "FlwtchWorker.kt" + override suspend fun doWork(): Result { // Hack to uncomment and deploy if your device has zombie workers you need to kill @@ -60,18 +62,24 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : } private fun handleCwtch(method: String, args: String): Result { + if (method != "Start") { + if (Cwtch.started() != 1.toLong()) { + Log.e(TAG, "libCwtch-go reports it is not initialized yet") + return Result.failure() + } + } val a = JSONObject(args) when (method) { "Start" -> { - Log.i("FlwtchWorker.kt", "handleAppInfo Start") + Log.i(TAG, "handleAppInfo Start") val appDir = (a.get("appDir") as? String) ?: "" val torPath = (a.get("torPath") as? String) ?: "tor" - Log.i("FlwtchWorker.kt", "appDir: '$appDir' torPath: '$torPath'") + Log.i(TAG, "appDir: '$appDir' torPath: '$torPath'") if (Cwtch.startCwtch(appDir, torPath) != 0.toLong()) return Result.failure() - Log.i("FlwtchWorker.kt", "startCwtch success, starting coroutine AppbusEvent loop...") + Log.i(TAG, "startCwtch success, starting coroutine AppbusEvent loop...") val downloadIDs = mutableMapOf() while (true) { try { @@ -119,8 +127,8 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : "" } val loader = FlutterInjector.instance().flutterLoader() - Log.i("FlwtchWorker.kt", "notification for " + evt.EventType + " " + handle + " " + conversationId + " " + channelId) - Log.i("FlwtchWorker.kt", data.toString()); + Log.i(TAG, "notification for " + evt.EventType + " " + handle + " " + conversationId + " " + channelId) + Log.i(TAG, data.toString()); val key = loader.getLookupKeyForAsset(data.getString("picture"))//"assets/profiles/001-centaur.png") val fh = applicationContext.assets.open(key) @@ -183,18 +191,18 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : Log.d("FlwtchWorker->FileDownloadProgressUpdate", e.toString() + " :: " + e.getStackTrace()); } } else if (evt.EventType == "FileDownloaded") { - Log.d("FlwtchWorker", "file downloaded!"); + Log.d(TAG, "file downloaded!"); val data = JSONObject(evt.Data); val tempFile = data.getString("TempFile"); val fileKey = data.getString("FileKey"); if (tempFile != "" && tempFile != data.getString("FilePath")) { val filePath = data.getString("FilePath"); - Log.i("FlwtchWorker", "moving " + tempFile + " to " + filePath); + Log.i(TAG, "moving " + tempFile + " to " + filePath); val sourcePath = Paths.get(tempFile); val targetUri = Uri.parse(filePath); val os = this.applicationContext.getContentResolver().openOutputStream(targetUri); val bytesWritten = Files.copy(sourcePath, os); - Log.d("FlwtchWorker", "copied " + bytesWritten.toString() + " bytes"); + Log.d("TAG", "copied " + bytesWritten.toString() + " bytes"); if (bytesWritten != 0L) { os?.flush(); os?.close(); @@ -214,7 +222,7 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : LocalBroadcastManager.getInstance(applicationContext).sendBroadcast(intent) } } catch (e: Exception) { - Log.e("FlwtchWorker", "Error in handleCwtch: " + e.toString() + " :: " + e.getStackTrace()); + Log.e(TAG, "Error in handleCwtch: " + e.toString() + " :: " + e.getStackTrace()); } } } @@ -242,7 +250,7 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : val profile = (a.get("ProfileOnion") as? String) ?: "" val conversation = a.getInt("conversation").toLong() val indexI = a.getInt("index").toLong() - Log.d("FlwtchWorker", "Cwtch GetMessage " + profile + " " + conversation.toString() + " " + indexI.toString()) + Log.d(TAG, "Cwtch GetMessage " + profile + " " + conversation.toString() + " " + indexI.toString()) return Result.success(Data.Builder().putString("result", Cwtch.getMessage(profile, conversation, indexI)).build()) } "GetMessageByID" -> { @@ -285,7 +293,7 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : val profile = (a.get("ProfileOnion") as? String) ?: "" val conversation = a.getInt("conversation").toLong() val message = (a.get("message") as? String) ?: "" - Log.i("FlwtchWorker.kt", "SendMessage: $message") + Log.i(TAG, "SendMessage: $message") Cwtch.sendMessage(profile, conversation, message) } "SendInvitation" -> { @@ -421,7 +429,7 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : ?: "New Message From " } else -> { - Log.i("FlwtchWorker", "unknown command: " + method); + Log.i(TAG, "unknown command: " + method); return Result.failure() } } diff --git a/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt b/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt index be363968..499c01ce 100644 --- a/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt +++ b/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt @@ -136,6 +136,7 @@ class MainActivity: FlutterActivity() { shutdownClickChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL_SHUTDOWN_CLICK) } + // MethodChannel CHANNEL_APP_INFO handler (Flutter Channel for requests for Android environment info) private fun handleAppInfo(@NonNull call: MethodCall, @NonNull result: Result) { when (call.method) { CALL_APP_INFO -> result.success(getNativeLibDir()) diff --git a/lib/l10n/intl_cy.arb b/lib/l10n/intl_cy.arb index 1fc9e5d5..787654f7 100644 --- a/lib/l10n/intl_cy.arb +++ b/lib/l10n/intl_cy.arb @@ -1,6 +1,13 @@ { "@@locale": "cy", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "deleteConfirmLabel": "Teipiwch DILEU i gadarnhau", "deleteConfirmText": "DILEU", "localeDa": "Daneg", diff --git a/lib/l10n/intl_da.arb b/lib/l10n/intl_da.arb index 592b6852..83c5aac6 100644 --- a/lib/l10n/intl_da.arb +++ b/lib/l10n/intl_da.arb @@ -1,6 +1,13 @@ { "@@locale": "da", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "serverLabel": "Server", "profileOnionLabel": "Send denne adresse til personer du ønsker forbindelse med", "saveBtn": "Gem", diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb index 0ada706f..001ced72 100644 --- a/lib/l10n/intl_de.arb +++ b/lib/l10n/intl_de.arb @@ -1,6 +1,13 @@ { "@@locale": "de", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "deleteConfirmLabel": "Gib LÖSCHEN ein, um zu bestätigen", "localeDa": "Dänisch", "localeCy": "Walisisch", diff --git a/lib/l10n/intl_el.arb b/lib/l10n/intl_el.arb index 82d2e6eb..7c8f3f6b 100644 --- a/lib/l10n/intl_el.arb +++ b/lib/l10n/intl_el.arb @@ -1,6 +1,13 @@ { "@@locale": "el", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "localeCy": "Ουαλικά", "localeDa": "Δανικά", "server": "Διακομιστής", diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 9b2e7140..2fc132df 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -1,6 +1,13 @@ { "@@locale": "en", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "localeDa": "Danish", "localeCy": "Welsh", "localeEl": "Greek", diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index fcc2a99e..0bc2cc72 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -1,6 +1,13 @@ { "@@locale": "es", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "localeDa": "Danés", "groupInviteSettingsWarning": "¡Has recibido una invitación para unirte a un grupo! Por favor habilita el experimento de chat grupal en Configuración para ver esta invitación", "plainServerDescription": "Te recomendamos que protejas tus servidores de Cwtch con una contraseña. Si no estableces una contraseña en este servidor, cualquiera que tenga acceso a este dispositivo podrá acceder a la información sobre este servidor incluyendo claves criptográficas confidenciales", diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index 3dbc8730..be859fa4 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -1,6 +1,24 @@ { "@@locale": "fr", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", + "contactSuggestion": "Il s'agit d'une suggestion de contact pour:", + "contactGoto": "Aller à la conversation avec %1", + "acceptGroupBtn": "Accepter", + "yourDisplayName": "Votre nom d'usage", + "profileName": "Nom d'usage", + "displayNameLabel": "Nom d'usage", + "displayNameTooltip": "Veuillez entrer un nom d'usage s'il vous plaît", + "acceptGroupInviteLabel": "Voulez-vous accepter l'invitation au groupe de", + "encryptedProfileDescription": "Le chiffrement d'un profil à l'aide d'un mot de passe le protège des autres personnes susceptibles d'utiliser également cet appareil. Les profils chiffrés ne peuvent pas être déchiffrés, affichés ou accessibles tant que le mot de passe correct n'a pas été saisi pour les déverrouiller.", + "notificationContentSimpleEvent": "Événement ordinaire", + "placeholderEnterMessage": "Saisissez un message", "localeDa": "Danois", "localeCy": "Gallois", "conversationNotificationPolicySettingDescription": "Contrôler le comportement de notification de cette conversation", @@ -9,7 +27,6 @@ "localeLb": "Luxembourgeois", "notificationPolicySettingDescription": "Contrôle le comportement de notification d'application par défaut", "notificationContentSettingDescription": "Contrôle le contenu des notifications de conversation", - "notificationContentSimpleEvent": "Plain-Evénement", "conversationNotificationPolicySettingLabel": "Politique de notification des conversations", "notificationContentContactInfo": "Informations sur les conversations", "notificationContentSettingLabel": "Contenu des notifications", @@ -46,7 +63,6 @@ "fileSharingSettingsDownloadFolderDescription": "Lorsque les fichiers sont téléchargés automatiquement (par exemple, les fichiers image, lorsque les aperçus d'image sont activés), un emplacement par défaut pour télécharger les fichiers est nécessaire.", "descriptionACNCircuitInfo": "Informations détaillées sur le chemin que le réseau de communication anonyme utilise pour se connecter à cette conversation.", "msgConfirmSend": "Êtes-vous sûr de vouloir envoyer", - "acceptGroupInviteLabel": "Voulez-vous accepter l'invitation au groupe de", "msgFileTooBig": "La taille du fichier ne peut pas dépasser 10 Go", "msgAddToAccept": "Ajoutez ce compte à vos contacts afin d'accepter ce fichier.", "btnSendFile": "Envoyer le fichier", @@ -78,7 +94,6 @@ "importLocalServerButton": "Importer %1", "groupsOnThisServerLabel": "Les groupes dont je fais partie sont hébergés sur ce serveur", "fieldDescriptionLabel": "Description", - "displayNameTooltip": "Veuillez entrer un nom d'usage s'il vous plaît", "savePeerHistoryDescription": "Détermine s'il faut ou non supprimer tout historique associé au contact.", "newMessagesLabel": "Nouveaux messages", "localeRU": "Russe", @@ -141,11 +156,8 @@ "archiveConversation": "Archiver cette conversation", "blockedMessageMessage": "Ce message provient d'un profil que vous avez bloqué.", "showMessageButton": "Afficher le message", - "placeholderEnterMessage": "saisissez un message", - "encryptedProfileDescription": "Le chiffrement d'un profil à l'aide d'un mot de passe le protège des autres personnes susceptibles d'utiliser également cet appareil. Les profils chiffrés ne peuvent pas être déchiffrés , affichés ou accessibles tant que le mot de passe correct n'a pas été saisi pour les déverrouiller.", "plainProfileDescription": "Nous vous recommandons de protéger vos profils Cwtch par un mot de passe. Si vous ne définissez pas de mot de passe sur ce profil, toute personne ayant accès à cet appareil peut être en mesure d'accéder aux informations relatives à ce profil, y compris les contacts, les messages et les clés de chiffrement sensibles.", "addContactConfirm": "Ajouter le contact %1", - "contactGoto": "Aller à la conversation avec %1", "addContact": "Ajouter le contact", "settingUIColumnOptionSame": "Même réglage que pour le mode portrait", "settingUIColumnDouble14Ratio": "Double (1:4)", @@ -200,7 +212,6 @@ "addListItemBtn": "Ajouter un élément", "addProfileTitle": "Ajouter un nouveau profil", "editProfileTitle": "Modifier le profil", - "profileName": "Pseudo", "defaultProfileName": "Alice", "newProfile": "Nouveau profil", "deleteConfirmText": "SUPPRIMER", @@ -233,7 +244,6 @@ "reallyLeaveThisGroupPrompt": "Êtes-vous sûr de vouloir quitter cette conversation ? Tous les messages et attributs seront supprimés.", "yesLeave": "Oui, quittez cette conversation", "noPasswordWarning": "Ne pas utiliser de mot de passe sur ce compte signifie que toutes les données stockées localement ne seront pas chiffrées.", - "yourDisplayName": "Pseudo", "currentPasswordLabel": "Mot de passe actuel", "password1Label": "Mot de passe", "password2Label": "Saisissez à nouveau le mot de passe", @@ -263,7 +273,6 @@ "chatHistoryDefault": "Cette conversation sera supprimée lorsque Cwtch sera fermé ! L'historique des messages peut être activé pour la conversation via le menu Paramètres en haut à droite.", "accepted": "Accepté !", "rejected": "Rejeté !", - "contactSuggestion": "Il s'agit d'une suggestion de contact pour : ", "sendAnInvitation": "Vous avez envoyé une invitation pour : ", "torVersion": "Version de Tor", "torStatus": "Statut de Tor", @@ -291,7 +300,6 @@ "largeTextLabel": "Large", "cwtchSettingsTitle": "Préférences Cwtch", "saveBtn": "Sauvegarder", - "displayNameLabel": "Pseudo", "copiedToClipboardNotification": "Copié dans le presse-papier", "addressLabel": "Adresse", "puzzleGameBtn": "Puzzle", @@ -299,7 +307,6 @@ "listsBtn": "Listes", "chatBtn": "Discuter", "rejectGroupBtn": "Refuser", - "acceptGroupBtn": "Accepter", "newGroupBtn": "Créer un nouveau groupe", "copyBtn": "Copier", "pendingLabel": "En attente", diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index c398c300..f8ba429b 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -1,6 +1,13 @@ { "@@locale": "it", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "localeDa": "Danese", "localeCy": "Gallese", "settingTheme": "Usa Temi Leggeri", diff --git a/lib/l10n/intl_lb.arb b/lib/l10n/intl_lb.arb index 0094b855..1f570db0 100644 --- a/lib/l10n/intl_lb.arb +++ b/lib/l10n/intl_lb.arb @@ -1,8 +1,100 @@ { "@@locale": "lb", - "@@last_modified": "2022-03-04T17:33:01+01:00", - "localeDa": "Danish", - "localeCy": "Welsh", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", + "newPassword": "Neit Passwuert", + "yesLeave": "Jo, Konversatioun verloossen", + "leaveConversation": "Konversatioun verloossen", + "titleManageServers": "Server managen", + "titleManageProfiles": "Meng Profiller managen", + "titleManageContacts": "Konversatiounen", + "localeIt": "Italienesch", + "localeEs": "Spuenesch", + "todoPlaceholder": "Todo...", + "networkStatusOnline": "Online", + "smallTextLabel": "Kleng", + "builddate": "Opegbaut op : %2", + "version": "Versioun %1", + "versionTor": "Versioun %1 mad Tor %2", + "settingInterfaceZoom": "Zoom Level", + "largeTextLabel": "Grouss", + "themeDark": "Donkel", + "themeLight": "Hell", + "localeDe": "Däitsch", + "localePt": "Portugisesch", + "localeFr": "Franséisch", + "localeEn": "Englesch", + "settingLanguage": "Sprooch", + "versionBuilddate": "Versioun: %1 Opgebaut op: %2", + "cwtchSettingsTitle": "Cwtch Astellungen", + "unlock": "Entsperren", + "yourServers": "Meng Server", + "addNewProfileBtn": "Neien Profil dobäifügen", + "yourProfiles": "Meng Profiller", + "password": "Passwuert", + "deleteProfileConfirmBtn": "Wierklech d'Profil läschen", + "deleteConfirmLabel": "Schreif LÄSCHEN fir ze confirméieren", + "deleteConfirmText": "LÄSCHEN", + "deleteProfileBtn": "Profil läschen", + "saveProfileBtn": "Profil späicheren", + "passwordErrorEmpty": "Passwuert kann net eidel sinn", + "createProfileBtn": "Profil erstellen", + "password2Label": "Passwuert nei aginn", + "password1Label": "Passwuert", + "currentPasswordLabel": "Aktuellt Passwuert", + "radioNoPassword": "Onverschlësselt (keen Passwuert)", + "radioUsePassword": "Passwuert", + "newProfile": "Neien Profil", + "editProfile": "Profil editéieren", + "bulletinsBtn": "Bulletins", + "acknowledgedLabel": "Unerkannt", + "addListItemBtn": "Item dobäifügen", + "addProfileTitle": "Neien Profil dobäifügen", + "editProfileTitle": "Profil editéieren", + "defaultProfileName": "Alice", + "deleteBtn": "Läschen", + "unblockBtn": "Kontakt entblockéieren", + "dontSavePeerHistory": "Verlaf läschen", + "savePeerHistory": "Verlaf späicheren", + "blockBtn": "Kontakt blockéieren", + "saveBtn": "Späicheren", + "addressLabel": "Adress", + "puzzleGameBtn": "Puzzle Spill", + "listsBtn": "Leschten", + "chatBtn": "Chat", + "rejectGroupBtn": "Refuséieren", + "acceptGroupBtn": "Acceptéieren", + "newGroupBtn": "Neien Grupp erstellen", + "copyBtn": "Kopéieren", + "couldNotSendMsgError": "Dësen Message konnt net geschéckt ginn", + "peerBlockedMessage": "Kontakt ass blockéiert", + "dmTooltip": "Klicke fir ee Direkten Message", + "peerNotOnline": "Kontakt ass offline. Applikatiounen kennen elo grad net genotzt ginn.", + "searchList": "Lescht sichen", + "update": "Update", + "inviteToGroupLabel": "An d'Grupp alueden", + "inviteBtn": "Alueden", + "groupNameLabel": "Gruppennumm", + "viewServerInfo": "Server Info", + "localeRU": "Russesch", + "settingDownloadFolder": "Download Dossier", + "themeNameCwtch": "Cwtch", + "themeNameWitch": "Witch", + "themeNameGhost": "Ghost", + "themeNameVampire": "Vampire", + "themeNamePumpkin": "Pumpkin", + "themeNameMermaid": "Mermaid", + "themeNameMidnight": "Midnight", + "themeNameNeon1": "Neon 1", + "themeNameNeon2": "Neon 2", + "localeCy": "Waliser", + "localeDa": "Dänesch", "serverSynced": "Synchroniséiert", "serverConnectivityDisconnected": "Server getrennt", "serverConnectivityConnected": "Server verbonnen", @@ -77,16 +169,6 @@ "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...", "loadingCwtch": "Loading Cwtch...", "themeColorLabel": "Color Theme", - "themeNameNeon2": "Neon2", - "themeNameNeon1": "Neon1", - "themeNameMidnight": "Midnight", - "themeNameMermaid": "Mermaid", - "themeNamePumpkin": "Pumpkin", - "themeNameGhost": "Ghost", - "themeNameVampire": "Vampire", - "themeNameWitch": "Witch", - "themeNameCwtch": "Cwtch", - "settingDownloadFolder": "Download Folder", "settingImagePreviewsDescription": "Images will be downloaded and previewed automatically. Please note that image previews can often lead to security vulnerabilities, and you should not enable this Experiment if you use Cwtch with untrusted contacts. Profile pictures are planned for Cwtch 1.6.", "settingImagePreviews": "Image Previews and Profile Pictures", "experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages", @@ -104,7 +186,6 @@ "importLocalServerSelectText": "Select Local Server", "importLocalServerLabel": "Import a locally hosted server", "newMessagesLabel": "New Messages", - "localeRU": "Russian", "copyServerKeys": "Copy keys", "verfiyResumeButton": "Verify\/resume", "fileCheckingStatus": "Checking download status", @@ -198,19 +279,13 @@ "rejected": "Rejected!", "accepted": "Accepted!", "chatHistoryDefault": "This conversation will be deleted when Cwtch is closed! Message history can be enabled per-conversation via the Settings menu in the upper right.", - "newPassword": "New Password", - "yesLeave": "Yes, Leave This Conversation", "reallyLeaveThisGroupPrompt": "Are you sure you want to leave this conversation? All messages and attributes will be deleted.", - "leaveConversation": "Leave This Conversation", "inviteToGroup": "You have been invited to join a group:", - "titleManageServers": "Manage Servers", "successfullAddedContact": "Successfully added ", "descriptionBlockUnknownConnections": "If turned on, this option will automatically close connections from Cwtch users that have not been added to your contact list.", "descriptionExperimentsGroups": "The group experiment allows Cwtch to connect with untrusted server infrastructure to facilitate communication with more than one contact.", "descriptionExperiments": "Cwtch experiments are optional, opt-in features that add additional functionality to Cwtch that may have different privacy considerations than traditional 1:1 metadata resistant chat e.g. group chat, bot integration etc.", - "titleManageProfiles": "Manage Cwtch Profiles", "tooltipUnlockProfiles": "Unlock encrypted profiles by entering their password.", - "titleManageContacts": "Conversations", "tooltipAddContact": "Add a new contact or conversation", "tooltipOpenSettings": "Open the settings pane", "contactAlreadyExists": "Contact Already Exists", @@ -218,100 +293,32 @@ "conversationSettings": "Conversation Settings", "enterCurrentPasswordForDelete": "Please enter current password to delete this profile.", "enableGroups": "Enable Group Chat", - "localeIt": "Italiana", - "localeEs": "Espanol", - "todoPlaceholder": "Todo...", "addNewItem": "Add a new item to the list", "addListItem": "Add a New List Item", "newConnectionPaneTitle": "New Connection", - "networkStatusOnline": "Online", "networkStatusConnecting": "Connecting to network and contacts...", "networkStatusAttemptingTor": "Attempting to connect to Tor network", "networkStatusDisconnected": "Disconnected from the internet, check your connection", "viewGroupMembershipTooltip": "View Group Membership", "loadingTor": "Loading tor...", - "smallTextLabel": "Small", "defaultScalingText": "Default size text (scale factor:", - "builddate": "Built on: %2", - "version": "Version %1", - "versionTor": "Version %1 with tor %2", "experimentsEnabled": "Enable Experiments", - "themeDark": "Dark", - "themeLight": "Light", "settingTheme": "Use Light Themes", - "largeTextLabel": "Large", - "settingInterfaceZoom": "Zoom level", - "localeDe": "Deutsche", - "localePt": "Portuguesa", - "localeFr": "Frances", - "localeEn": "English", - "settingLanguage": "Language", "blockUnknownLabel": "Block Unknown Contacts", "zoomLabel": "Interface zoom (mostly affects text and button sizes)", - "versionBuilddate": "Version: %1 Built on: %2", - "cwtchSettingsTitle": "Cwtch Settings", - "unlock": "Unlock", - "yourServers": "Your Servers", - "yourProfiles": "Your Profiles", "error0ProfilesLoadedForPassword": "0 profiles loaded with that password", - "password": "Password", "enterProfilePassword": "Enter a password to view your profiles", - "addNewProfileBtn": "Add new profile", - "deleteConfirmText": "DELETE", - "deleteProfileConfirmBtn": "Really Delete Profile", - "deleteConfirmLabel": "Type DELETE to confirm", - "deleteProfileBtn": "Delete Profile", "passwordChangeError": "Error changing password: Supplied password rejected", "passwordErrorMatch": "Passwords do not match", - "saveProfileBtn": "Save Profile", - "createProfileBtn": "Create Profile", - "passwordErrorEmpty": "Password cannot be empty", - "password2Label": "Reenter password", - "password1Label": "Password", - "currentPasswordLabel": "Current Password", "yourDisplayName": "Your Display Name", "noPasswordWarning": "Not using a password on this account means that all data stored locally will not be encrypted", - "radioNoPassword": "Unencrypted (No password)", - "radioUsePassword": "Password", - "editProfile": "Edit Profile", - "newProfile": "New Profile", - "defaultProfileName": "Alice", "profileName": "Display name", - "editProfileTitle": "Edit Profile", - "addProfileTitle": "Add new profile", - "deleteBtn": "Delete", - "unblockBtn": "Unblock Contact", - "dontSavePeerHistory": "Delete History", "savePeerHistoryDescription": "Determines whether to delete any history associated with the contact.", - "savePeerHistory": "Save History", - "blockBtn": "Block Contact", - "saveBtn": "Save", "displayNameLabel": "Display Name", "copiedToClipboardNotification": "Copied to Clipboard", - "addressLabel": "Address", - "puzzleGameBtn": "Puzzle Game", - "bulletinsBtn": "Bulletins", - "listsBtn": "Lists", - "chatBtn": "Chat", - "rejectGroupBtn": "Reject", - "acceptGroupBtn": "Accept", "acceptGroupInviteLabel": "Do you want to accept the invitation to", - "newGroupBtn": "Create new group", - "copyBtn": "Copy", "peerOfflineMessage": "Contact is offline, messages can't be delivered right now", - "peerBlockedMessage": "Contact is blocked", "pendingLabel": "Pending", - "acknowledgedLabel": "Acknowledged", - "couldNotSendMsgError": "Could not send this message", - "dmTooltip": "Click to DM", "membershipDescription": "Below is a list of users who have sent messages to the group. This list may not reflect all users who have access to the group.", - "addListItemBtn": "Add Item", - "peerNotOnline": "Contact is offline. Applications cannot be used right now.", - "searchList": "Search List", - "update": "Update", - "inviteBtn": "Invite", - "inviteToGroupLabel": "Invite to group", - "groupNameLabel": "Group Name", - "viewServerInfo": "Server Info", "serverNotSynced": "Syncing New Messages (This can take some time)..." } \ No newline at end of file diff --git a/lib/l10n/intl_no.arb b/lib/l10n/intl_no.arb index 4d9aa52e..b30ed5ee 100644 --- a/lib/l10n/intl_no.arb +++ b/lib/l10n/intl_no.arb @@ -1,6 +1,13 @@ { "@@locale": "no", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "localeDa": "Dansk", "localeCy": "Walisisk", "serverLabel": "Tjener", diff --git a/lib/l10n/intl_pl.arb b/lib/l10n/intl_pl.arb index cf53d4ff..a8608aa8 100644 --- a/lib/l10n/intl_pl.arb +++ b/lib/l10n/intl_pl.arb @@ -1,6 +1,13 @@ { "@@locale": "pl", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "deleteConfirmLabel": "Wpisz USUŃ aby potwierdzić", "localeLb": "Luksemburski", "localeNo": "Norweski", diff --git a/lib/l10n/intl_pt.arb b/lib/l10n/intl_pt.arb index 4528d5a1..580fe3aa 100644 --- a/lib/l10n/intl_pt.arb +++ b/lib/l10n/intl_pt.arb @@ -1,6 +1,13 @@ { "@@locale": "pt", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "localeDa": "Danish", "localeCy": "Welsh", "localeEl": "Greek", diff --git a/lib/l10n/intl_ro.arb b/lib/l10n/intl_ro.arb index cd8f5760..142462ed 100644 --- a/lib/l10n/intl_ro.arb +++ b/lib/l10n/intl_ro.arb @@ -1,6 +1,13 @@ { "@@locale": "ro", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "deleteProfileConfirmBtn": "Sigur ștergeti profilul", "deleteConfirmLabel": "Tastați ȘTERGE pentru a confirma", "localeDa": "Daneză", diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index b37ae80d..aa62972d 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -1,6 +1,13 @@ { "@@locale": "ru", - "@@last_modified": "2022-03-04T17:33:01+01:00", + "@@last_modified": "2022-03-11T01:06:46+01:00", + "shuttingDownApp": "Shutting down...", + "successfullyImportedProfile": "Successfully Imported Profile: %profile", + "failedToImportProfile": "Error Importing Profile", + "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", + "importProfile": "Import Profile", + "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", + "exportProfile": "Export Profile", "deleteConfirmLabel": "Введите УДАЛИТЬ, чтобы продолжить", "deleteConfirmText": "УДАЛИТЬ", "localeCy": "Валлийский", diff --git a/lib/main.dart b/lib/main.dart index d85569f7..f9a694ae 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -153,9 +153,8 @@ class FlwtchState extends State with WindowListener { Widget continueButton = ElevatedButton( child: Text(AppLocalizations.of(navKey.currentContext!)!.shutdownCwtchAction), onPressed: () { - // Directly call the shutdown command, Android will do this for us... - Provider.of(navKey.currentContext!, listen: false).shutdown(); Provider.of(navKey.currentContext!, listen: false).cwtchIsClosing = true; + Navigator.of(navKey.currentContext!).pop(); // dismiss dialog }); // set up the AlertDialog @@ -175,10 +174,17 @@ class FlwtchState extends State with WindowListener { builder: (BuildContext context) { return alert; }, - ); + ).then((val) { + if (Provider.of(navKey.currentContext!, listen: false).cwtchIsClosing) { + globalAppState.SetModalState(ModalState.shutdown); + // Directly call the shutdown command, Android will do this for us... + Provider.of(navKey.currentContext!, listen: false).shutdown(); + } + }); } Future shutdown() async { + globalAppState.SetModalState(ModalState.shutdown); await cwtch.Shutdown(); // Wait a few seconds as shutting down things takes a little time.. Future.delayed(Duration(seconds: 1)).then((value) { @@ -248,6 +254,7 @@ class FlwtchState extends State with WindowListener { @override void dispose() async { + globalAppState.SetModalState(ModalState.shutdown); await cwtch.Shutdown(); windowManager.removeListener(this); cwtch.dispose(); diff --git a/lib/models/appstate.dart b/lib/models/appstate.dart index 9d78dcbb..7ad2f0cc 100644 --- a/lib/models/appstate.dart +++ b/lib/models/appstate.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:flutter/widgets.dart'; -enum ModalState { none, storageMigration } +enum ModalState { none, storageMigration, shutdown } class AppState extends ChangeNotifier { bool cwtchInit = false; diff --git a/lib/models/profile.dart b/lib/models/profile.dart index 378b1177..6b7f6b0f 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -172,7 +172,7 @@ class ProfileInfoState extends ChangeNotifier { var profileContact = this._contacts.getContact(contact["identifier"]); if (profileContact != null) { profileContact.status = contact["status"]; - profileContact.totalMessages = contact["numMessages"]; + profileContact.totalMessages = contact["numMessages"]; // Todo: trigger cache update (bulk upload) profileContact.unreadMessages = contact["numUnread"]; profileContact.lastMessageTime = DateTime.fromMillisecondsSinceEpoch(1000 * int.parse(contact["lastMsgTime"])); } else { diff --git a/lib/views/splashView.dart b/lib/views/splashView.dart index 1beedc8d..d74d5285 100644 --- a/lib/views/splashView.dart +++ b/lib/views/splashView.dart @@ -49,11 +49,12 @@ class _SplashViewState extends State { ? appState.appError : appState.modalState == ModalState.none ? AppLocalizations.of(context)!.loadingCwtch - : AppLocalizations.of(context)!.storageMigrationModalMessage, + : appState.modalState == ModalState.storageMigration ? AppLocalizations.of(context)!.storageMigrationModalMessage + : AppLocalizations.of(context)!.shuttingDownApp, // Todo l10n AppLocalizations.of(context)!.storageMigrationModalMessage style: TextStyle( fontSize: 16.0, color: appState.appError == "" ? Provider.of(context).theme.mainTextColor : Provider.of(context).theme.textfieldErrorColor))), Visibility( - visible: appState.modalState == ModalState.storageMigration, + visible: appState.modalState == ModalState.storageMigration || appState.modalState == ModalState.shutdown, child: LinearProgressIndicator( color: Provider.of(context).theme.defaultButtonActiveColor, ))