From 6adea075e7e175e9afbb90d2369c2acd9a19f934 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 17 Dec 2021 18:23:18 -0500 Subject: [PATCH] Make splash scren stateful; add translations; add message and progress bar for storage migration --- lib/cwtch/cwtchNotifier.dart | 6 ++++ lib/l10n/intl_de.arb | 4 ++- lib/l10n/intl_en.arb | 4 ++- lib/l10n/intl_es.arb | 4 ++- lib/l10n/intl_fr.arb | 32 +++++++++--------- lib/l10n/intl_it.arb | 4 ++- lib/l10n/intl_pl.arb | 4 ++- lib/l10n/intl_pt.arb | 4 ++- lib/l10n/intl_ru.arb | 64 +++++++++++++++++++----------------- lib/model.dart | 5 +++ lib/views/splashView.dart | 30 ++++++++++++++--- 11 files changed, 104 insertions(+), 57 deletions(-) diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index 29ec9ce4..07e70622 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -374,6 +374,12 @@ class CwtchNotifier { break; case "ImportingProfileEvent": break; + case "StartingStorageMigration": + appState.SetModalState(ModalState.storageMigration); + break; + case "DoneStorageMigration": + appState.SetModalState(ModalState.none); + break; default: EnvironmentConfig.debugLog("unhandled event: $type"); } diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb index 3c7bdb25..3809c10d 100644 --- a/lib/l10n/intl_de.arb +++ b/lib/l10n/intl_de.arb @@ -1,6 +1,8 @@ { "@@locale": "de", - "@@last_modified": "2021-12-15T20:46:48+01:00", + "@@last_modified": "2021-12-17T23:48:01+01:00", + "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...", + "loadingCwtch": "Loading Cwtch...", "themeColorLabel": "Color Theme", "themeNameNeon2": "Neon2", "themeNameNeon1": "Neon1", diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 42b7fca9..467c586b 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -1,6 +1,8 @@ { "@@locale": "en", - "@@last_modified": "2021-12-15T20:46:48+01:00", + "@@last_modified": "2021-12-17T23:48:01+01:00", + "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...", + "loadingCwtch": "Loading Cwtch...", "themeColorLabel": "Color Theme", "themeNameNeon2": "Neon2", "themeNameNeon1": "Neon1", diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index 809b2d91..6a055fbb 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -1,6 +1,8 @@ { "@@locale": "es", - "@@last_modified": "2021-12-15T20:46:48+01:00", + "@@last_modified": "2021-12-17T23:48:01+01:00", + "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...", + "loadingCwtch": "Loading Cwtch...", "themeColorLabel": "Color Theme", "themeNameNeon2": "Neon2", "themeNameNeon1": "Neon1", diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index 8140da2c..3d928173 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -1,21 +1,23 @@ { "@@locale": "fr", - "@@last_modified": "2021-12-15T20:46:48+01:00", - "themeColorLabel": "Color Theme", - "themeNameNeon2": "Neon2", - "themeNameNeon1": "Neon1", - "themeNameMidnight": "Midnight", - "themeNameMermaid": "Mermaid", - "themeNamePumpkin": "Pumpkin", - "themeNameGhost": "Ghost", + "@@last_modified": "2021-12-17T23:48:01+01:00", + "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...", + "loadingCwtch": "Loading Cwtch...", + "experimentClickableLinksDescription": "L'expérience des liens cliquables vous permet de cliquer sur les URLs partagés dans les messages", + "themeNameWitch": "Sorcière", "themeNameVampire": "Vampire", - "themeNameWitch": "Witch", + "themeNamePumpkin": "Citrouille", + "themeNameNeon2": "Néon2", + "themeNameNeon1": "Néon1", + "themeNameMidnight": "Minuit", + "themeNameMermaid": "Sirène", + "themeNameGhost": "Fantôme", "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", - "enableExperimentClickableLinks": "Enable Clickable Links", + "themeColorLabel": "Thème de couleur", + "settingImagePreviewsDescription": "Les images seront téléchargées et prévisualisées automatiquement. Veuillez noter que la prévisualisation des images peut souvent conduire à des failles de sécurité, et vous ne devriez pas activer cette expérience si vous utilisez Cwtch avec des contacts non fiables. Les images de profil sont prévues pour Cwtch 1.6.", + "settingImagePreviews": "Aperçu des images et photos de profil", + "settingDownloadFolder": "Dossier de téléchargement", + "enableExperimentClickableLinks": "Activer les liens cliquables", "serverMetricsLabel": "Métriques du serveur", "serverTotalMessagesLabel": "Nombre total de messages", "serverConnectionsLabel": "Connexion", @@ -279,4 +281,4 @@ "newBulletinLabel": "Nouveau bulletin", "createGroupBtn": "Créer", "createGroupTitle": "Créer un groupe" -} +} \ No newline at end of file diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index e30cfb70..621ece9b 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -1,6 +1,8 @@ { "@@locale": "it", - "@@last_modified": "2021-12-15T20:46:48+01:00", + "@@last_modified": "2021-12-17T23:48:01+01:00", + "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...", + "loadingCwtch": "Loading Cwtch...", "themeColorLabel": "Color Theme", "themeNameNeon2": "Neon2", "themeNameNeon1": "Neon1", diff --git a/lib/l10n/intl_pl.arb b/lib/l10n/intl_pl.arb index 78708ee7..6bed7cd6 100644 --- a/lib/l10n/intl_pl.arb +++ b/lib/l10n/intl_pl.arb @@ -1,6 +1,8 @@ { "@@locale": "pl", - "@@last_modified": "2021-12-15T20:46:48+01:00", + "@@last_modified": "2021-12-17T23:48:01+01:00", + "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...", + "loadingCwtch": "Loading Cwtch...", "themeColorLabel": "Color Theme", "themeNameNeon2": "Neon2", "themeNameNeon1": "Neon1", diff --git a/lib/l10n/intl_pt.arb b/lib/l10n/intl_pt.arb index a548ca3a..b77121d2 100644 --- a/lib/l10n/intl_pt.arb +++ b/lib/l10n/intl_pt.arb @@ -1,6 +1,8 @@ { "@@locale": "pt", - "@@last_modified": "2021-12-15T20:46:48+01:00", + "@@last_modified": "2021-12-17T23:48:01+01:00", + "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...", + "loadingCwtch": "Loading Cwtch...", "themeColorLabel": "Color Theme", "themeNameNeon2": "Neon2", "themeNameNeon1": "Neon1", diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index 8751074d..6c1fb55a 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -1,36 +1,40 @@ { "@@locale": "ru", - "@@last_modified": "2021-12-15T20:46:48+01:00", - "themeColorLabel": "Color Theme", - "themeNameNeon2": "Neon2", - "themeNameNeon1": "Neon1", - "themeNameMidnight": "Midnight", - "themeNameMermaid": "Mermaid", - "themeNamePumpkin": "Pumpkin", - "themeNameGhost": "Ghost", - "themeNameVampire": "Vampire", - "themeNameWitch": "Witch", + "@@last_modified": "2021-12-17T23:48:01+01:00", + "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...", + "loadingCwtch": "Loading Cwtch...", + "themeColorLabel": "Тема", + "themeNameNeon2": "Неон2", + "themeNameNeon1": "Неон1", + "themeNameMidnight": "Полночь", + "themeNameMermaid": "Русалка", + "themeNamePumpkin": "Тыква", + "themeNameGhost": "Призрак", + "themeNameVampire": "Вампир", + "themeNameWitch": "Ведьма", "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", - "enableExperimentClickableLinks": "Enable Clickable Links", - "serverConnectionsLabel": "Connection", - "serverTotalMessagesLabel": "Total Messages", - "serverMetricsLabel": "Server Metrics", - "saveBtn": "Сохранить", + "settingDownloadFolder": "Скачать папку", + "settingImagePreviewsDescription": "Автоматическая загрузка изображений. Обратите внимание, что предварительный просмотр изображений часто может использоваться для взлома или деаномизации. Не используйте данную функцию если Вы контактируете с ненадежными контактами. Аватары профиля запланированы для версии Cwtch 1.6.", + "settingImagePreviews": "Предпросмотр изображений и фотографий профиля", + "experimentClickableLinksDescription": "Экспериментальная функция которая позволяет нажимать на URL адреса в сообщениях", + "enableExperimentClickableLinks": "Включить кликабельные ссылки", + "serverConnectionsLabel": "Соединение", + "serverTotalMessagesLabel": "Всего сообщений", + "serverMetricsLabel": "Показатели сервера", + "manageKnownServersShort": "Серверы", + "manageKnownServersLong": "Управление серверами", + "displayNameTooltip": "Введите отображаемое имя", + "manageKnownServersButton": "Управление серверами", + "fieldDescriptionLabel": "Описание", + "groupsOnThisServerLabel": "Группы, в которых я нахожусь, размещены на этом сервере", + "importLocalServerButton": "Импорт %1", + "importLocalServerSelectText": "Выбрать локальный сервер", + "importLocalServerLabel": "Импортировать локальный сервер", + "newMessagesLabel": "Новое сообщение", + "localeRU": "Русский", "profileOnionLabel": "Send this address to contacts you want to connect with", - "manageKnownServersShort": "Servers", - "manageKnownServersLong": "Manage Known Servers", - "displayNameTooltip": "Please enter a display name", - "manageKnownServersButton": "Manage Known Servers", - "fieldDescriptionLabel": "Description", - "groupsOnThisServerLabel": "Groups I am in hosted on this server", - "importLocalServerButton": "Import %1", - "importLocalServerSelectText": "Select Local Server", - "importLocalServerLabel": "Import a locally hosted server", - "newMessagesLabel": "New Messages", + "savePeerHistory": "Хранить историю", + "saveBtn": "Сохранить", "networkStatusOnline": "В сети", "copiedToClipboardNotification": "Скопировано в буфер обмена", "defaultProfileName": "Алиса", @@ -39,7 +43,6 @@ "groupNameLabel": "Имя группы", "serverLabel": "Сервер", "copyBtn": "Копировать", - "localeRU": "Russian", "copyServerKeys": "Копировать ключи", "verfiyResumeButton": "Проверить\/продолжить", "fileCheckingStatus": "Проверка статуса загрузки", @@ -220,7 +223,6 @@ "unblockBtn": "Разблокировать контакт", "dontSavePeerHistory": "Удалить историю", "savePeerHistoryDescription": "Определяет политуку хранения или удаления переписки с данным контактом.", - "savePeerHistory": "Хранить исторую", "blockBtn": "Заблокировать контакт", "displayNameLabel": "Отображаемое имя", "addressLabel": "Адрес", diff --git a/lib/model.dart b/lib/model.dart index e0953b12..86ddbe4c 100644 --- a/lib/model.dart +++ b/lib/model.dart @@ -53,6 +53,11 @@ class AppState extends ChangeNotifier { notifyListeners(); } + void SetModalState(ModalState newState) { + modalState = newState; + notifyListeners(); + } + String? get selectedProfile => _selectedProfile; set selectedProfile(String? newVal) { this._selectedProfile = newVal; diff --git a/lib/views/splashView.dart b/lib/views/splashView.dart index 33eb9097..9e68b2f8 100644 --- a/lib/views/splashView.dart +++ b/lib/views/splashView.dart @@ -1,11 +1,17 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../model.dart'; import '../settings.dart'; -class SplashView extends StatelessWidget { +class SplashView extends StatefulWidget { + @override + _SplashViewState createState() => _SplashViewState(); +} + +class _SplashViewState extends State { @override Widget build(BuildContext context) { return Consumer( @@ -25,10 +31,24 @@ class SplashView extends StatelessWidget { isAntiAlias: true, ), Padding( - padding: const EdgeInsets.all(20.0), - child: Text(appState.appError == "" ? "Loading Cwtch..." : appState.appError, - style: TextStyle(fontSize: 16.0, color: appState.appError == "" ? Provider.of(context).theme.mainTextColor : Provider.of(context).theme.textfieldErrorColor)), - ), + padding: const EdgeInsets.all(20.0), + child: Column(children: [ + Padding( + padding: EdgeInsets.all(6.0), + child: Text( + appState.appError != "" + ? appState.appError + : appState.modalState == ModalState.none + ? AppLocalizations.of(context)!.loadingCwtch + : 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, + child: LinearProgressIndicator( + color: Provider.of(context).theme.defaultButtonActiveColor, + )) + ])), Image(image: AssetImage("assets/Open_Privacy_Logo_lightoutline.png")), ])), ));