Merge pull request 'migrateMsg' (#266) from migrateMsg into trunk
continuous-integration/drone/push Build is pending Details

Reviewed-on: #266
Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
This commit is contained in:
Sarah Jamie Lewis 2021-12-18 21:54:59 +00:00
commit 1f376c7ed1
12 changed files with 111 additions and 58 deletions

View File

@ -355,6 +355,12 @@ class CwtchNotifier {
break; break;
case "ImportingProfileEvent": case "ImportingProfileEvent":
break; break;
case "StartingStorageMigration":
appState.SetModalState(ModalState.storageMigration);
break;
case "DoneStorageMigration":
appState.SetModalState(ModalState.none);
break;
default: default:
EnvironmentConfig.debugLog("unhandled event: $type"); EnvironmentConfig.debugLog("unhandled event: $type");
} }

View File

@ -1,6 +1,8 @@
{ {
"@@locale": "de", "@@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", "themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2", "themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1", "themeNameNeon1": "Neon1",

View File

@ -1,6 +1,8 @@
{ {
"@@locale": "en", "@@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", "themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2", "themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1", "themeNameNeon1": "Neon1",

View File

@ -1,6 +1,8 @@
{ {
"@@locale": "es", "@@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", "themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2", "themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1", "themeNameNeon1": "Neon1",

View File

@ -1,21 +1,23 @@
{ {
"@@locale": "fr", "@@locale": "fr",
"@@last_modified": "2021-12-15T20:46:48+01:00", "@@last_modified": "2021-12-17T23:48:01+01:00",
"themeColorLabel": "Color Theme", "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...",
"themeNameNeon2": "Neon2", "loadingCwtch": "Loading Cwtch...",
"themeNameNeon1": "Neon1", "experimentClickableLinksDescription": "L'expérience des liens cliquables vous permet de cliquer sur les URLs partagés dans les messages",
"themeNameMidnight": "Midnight", "themeNameWitch": "Sorcière",
"themeNameMermaid": "Mermaid",
"themeNamePumpkin": "Pumpkin",
"themeNameGhost": "Ghost",
"themeNameVampire": "Vampire", "themeNameVampire": "Vampire",
"themeNameWitch": "Witch", "themeNamePumpkin": "Citrouille",
"themeNameNeon2": "Néon2",
"themeNameNeon1": "Néon1",
"themeNameMidnight": "Minuit",
"themeNameMermaid": "Sirène",
"themeNameGhost": "Fantôme",
"themeNameCwtch": "Cwtch", "themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder", "themeColorLabel": "Thème de couleur",
"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.", "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": "Image Previews and Profile Pictures", "settingImagePreviews": "Aperçu des images et photos de profil",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages", "settingDownloadFolder": "Dossier de téléchargement",
"enableExperimentClickableLinks": "Enable Clickable Links", "enableExperimentClickableLinks": "Activer les liens cliquables",
"serverMetricsLabel": "Métriques du serveur", "serverMetricsLabel": "Métriques du serveur",
"serverTotalMessagesLabel": "Nombre total de messages", "serverTotalMessagesLabel": "Nombre total de messages",
"serverConnectionsLabel": "Connexion", "serverConnectionsLabel": "Connexion",
@ -279,4 +281,4 @@
"newBulletinLabel": "Nouveau bulletin", "newBulletinLabel": "Nouveau bulletin",
"createGroupBtn": "Créer", "createGroupBtn": "Créer",
"createGroupTitle": "Créer un groupe" "createGroupTitle": "Créer un groupe"
} }

View File

@ -1,6 +1,8 @@
{ {
"@@locale": "it", "@@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", "themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2", "themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1", "themeNameNeon1": "Neon1",

View File

@ -1,6 +1,8 @@
{ {
"@@locale": "pl", "@@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", "themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2", "themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1", "themeNameNeon1": "Neon1",

View File

@ -1,6 +1,8 @@
{ {
"@@locale": "pt", "@@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", "themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2", "themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1", "themeNameNeon1": "Neon1",

View File

@ -1,36 +1,40 @@
{ {
"@@locale": "ru", "@@locale": "ru",
"@@last_modified": "2021-12-15T20:46:48+01:00", "@@last_modified": "2021-12-17T23:48:01+01:00",
"themeColorLabel": "Color Theme", "storageMigrationModalMessage": "Migrating profiles to new storage format. This could take a few minutes...",
"themeNameNeon2": "Neon2", "loadingCwtch": "Loading Cwtch...",
"themeNameNeon1": "Neon1", "themeColorLabel": "Тема",
"themeNameMidnight": "Midnight", "themeNameNeon2": "Неон2",
"themeNameMermaid": "Mermaid", "themeNameNeon1": "Неон1",
"themeNamePumpkin": "Pumpkin", "themeNameMidnight": "Полночь",
"themeNameGhost": "Ghost", "themeNameMermaid": "Русалка",
"themeNameVampire": "Vampire", "themeNamePumpkin": "Тыква",
"themeNameWitch": "Witch", "themeNameGhost": "Призрак",
"themeNameVampire": "Вампир",
"themeNameWitch": "Ведьма",
"themeNameCwtch": "Cwtch", "themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder", "settingDownloadFolder": "Скачать папку",
"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.", "settingImagePreviewsDescription": "Автоматическая загрузка изображений. Обратите внимание, что предварительный просмотр изображений часто может использоваться для взлома или деаномизации. Не используйте данную функцию если Вы контактируете с ненадежными контактами. Аватары профиля запланированы для версии Cwtch 1.6.",
"settingImagePreviews": "Image Previews and Profile Pictures", "settingImagePreviews": "Предпросмотр изображений и фотографий профиля",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages", "experimentClickableLinksDescription": "Экспериментальная функция которая позволяет нажимать на URL адреса в сообщениях",
"enableExperimentClickableLinks": "Enable Clickable Links", "enableExperimentClickableLinks": "Включить кликабельные ссылки",
"serverConnectionsLabel": "Connection", "serverConnectionsLabel": "Соединение",
"serverTotalMessagesLabel": "Total Messages", "serverTotalMessagesLabel": "Всего сообщений",
"serverMetricsLabel": "Server Metrics", "serverMetricsLabel": "Показатели сервера",
"saveBtn": "Сохранить", "manageKnownServersShort": "Серверы",
"manageKnownServersLong": "Управление серверами",
"displayNameTooltip": "Введите отображаемое имя",
"manageKnownServersButton": "Управление серверами",
"fieldDescriptionLabel": "Описание",
"groupsOnThisServerLabel": "Группы, в которых я нахожусь, размещены на этом сервере",
"importLocalServerButton": "Импорт %1",
"importLocalServerSelectText": "Выбрать локальный сервер",
"importLocalServerLabel": "Импортировать локальный сервер",
"newMessagesLabel": "Новое сообщение",
"localeRU": "Русский",
"profileOnionLabel": "Send this address to contacts you want to connect with", "profileOnionLabel": "Send this address to contacts you want to connect with",
"manageKnownServersShort": "Servers", "savePeerHistory": "Хранить историю",
"manageKnownServersLong": "Manage Known Servers", "saveBtn": "Сохранить",
"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",
"networkStatusOnline": "В сети", "networkStatusOnline": "В сети",
"copiedToClipboardNotification": "Скопировано в буфер обмена", "copiedToClipboardNotification": "Скопировано в буфер обмена",
"defaultProfileName": "Алиса", "defaultProfileName": "Алиса",
@ -39,7 +43,6 @@
"groupNameLabel": "Имя группы", "groupNameLabel": "Имя группы",
"serverLabel": "Сервер", "serverLabel": "Сервер",
"copyBtn": "Копировать", "copyBtn": "Копировать",
"localeRU": "Russian",
"copyServerKeys": "Копировать ключи", "copyServerKeys": "Копировать ключи",
"verfiyResumeButton": "Проверить\/продолжить", "verfiyResumeButton": "Проверить\/продолжить",
"fileCheckingStatus": "Проверка статуса загрузки", "fileCheckingStatus": "Проверка статуса загрузки",
@ -220,7 +223,6 @@
"unblockBtn": "Разблокировать контакт", "unblockBtn": "Разблокировать контакт",
"dontSavePeerHistory": "Удалить историю", "dontSavePeerHistory": "Удалить историю",
"savePeerHistoryDescription": "Определяет политуку хранения или удаления переписки с данным контактом.", "savePeerHistoryDescription": "Определяет политуку хранения или удаления переписки с данным контактом.",
"savePeerHistory": "Хранить исторую",
"blockBtn": "Заблокировать контакт", "blockBtn": "Заблокировать контакт",
"displayNameLabel": "Отображаемое имя", "displayNameLabel": "Отображаемое имя",
"addressLabel": "Адрес", "addressLabel": "Адрес",

View File

@ -110,7 +110,7 @@ class FlwtchState extends State<Flwtch> {
supportedLocales: AppLocalizations.supportedLocales, supportedLocales: AppLocalizations.supportedLocales,
title: 'Cwtch', title: 'Cwtch',
theme: mkThemeData(settings), theme: mkThemeData(settings),
home: appState.cwtchInit == true ? ShiftRightFixer(child: ProfileMgrView()) : SplashView(), home: (!appState.cwtchInit || appState.modalState != ModalState.none) ? SplashView() : ShiftRightFixer(child: ProfileMgrView()),
), ),
); );
}, },

View File

@ -26,8 +26,14 @@ class ChatMessage {
}; };
} }
enum ModalState {
none,
storageMigration
}
class AppState extends ChangeNotifier { class AppState extends ChangeNotifier {
bool cwtchInit = false; bool cwtchInit = false;
ModalState modalState = ModalState.none;
bool cwtchIsClosing = false; bool cwtchIsClosing = false;
String appError = ""; String appError = "";
String? _selectedProfile; String? _selectedProfile;
@ -47,6 +53,11 @@ class AppState extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
void SetModalState(ModalState newState) {
modalState = newState;
notifyListeners();
}
String? get selectedProfile => _selectedProfile; String? get selectedProfile => _selectedProfile;
set selectedProfile(String? newVal) { set selectedProfile(String? newVal) {
this._selectedProfile = newVal; this._selectedProfile = newVal;

View File

@ -1,11 +1,17 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../model.dart'; import '../model.dart';
import '../settings.dart'; import '../settings.dart';
class SplashView extends StatelessWidget { class SplashView extends StatefulWidget {
@override
_SplashViewState createState() => _SplashViewState();
}
class _SplashViewState extends State<SplashView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer<AppState>( return Consumer<AppState>(
@ -25,10 +31,24 @@ class SplashView extends StatelessWidget {
isAntiAlias: true, isAntiAlias: true,
), ),
Padding( Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
child: Text(appState.appError == "" ? "Loading Cwtch..." : appState.appError, child: Column(children: [
style: TextStyle(fontSize: 16.0, color: appState.appError == "" ? Provider.of<Settings>(context).theme.mainTextColor : Provider.of<Settings>(context).theme.textfieldErrorColor)), 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<Settings>(context).theme.mainTextColor : Provider.of<Settings>(context).theme.textfieldErrorColor))),
Visibility(
visible: appState.modalState == ModalState.storageMigration,
child: LinearProgressIndicator(
color: Provider.of<Settings>(context).theme.defaultButtonActiveColor,
))
])),
Image(image: AssetImage("assets/Open_Privacy_Logo_lightoutline.png")), Image(image: AssetImage("assets/Open_Privacy_Logo_lightoutline.png")),
])), ])),
)); ));