diff --git a/README.md b/README.md index 399cf2a..7900aab 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ An experimental fork of FluffyChat. * Change password * End-To-End-Encryption -## How to build +# How to build 1. [Install flutter](https://flutter.dev) @@ -39,29 +39,47 @@ git clone --recurse-submodules https://gitlab.com/ChristianPauly/fluffychat-flut cd fluffychat-flutter ``` -### Android / iOS +3. Choose your target platform below and enable support for it. -3. For Android install CMake from the SDK Manager +4. Debug with: `flutter run` -4. Install ninja: +### Android + +* Install CMake from the SDK Manager + +* Install ninja: ``` sudo apt install ninja-build ``` -5. Outcomment the Google Services plugin at the end of the file `android/app/build.gradle`: +* Outcomment the Google Services plugin at the end of the file `android/app/build.gradle`: ``` // apply plugin: "com.google.gms.google-services" ``` -6. `flutter run` +* Build with: `flutter build apk` + +### iOS / iPadOS + +* With xcode you can't build a release version without our cert. :-/ Use `flutter run --profile` to have a working version on your iOS device. ### Web -3. `flutter channel beta && flutter upgrade` +* Enable web support in Flutter: https://flutter.dev/docs/get-started/web -4. `flutter config --enable-web` +* Build with: `flutter build web --release` + +### Desktop (Linux, Windows, macOS) + +* Enable Desktop support in Flutter: https://flutter.dev/desktop + +* Build with one of these: +``` +flutter build linux --release +flutter build windows --release +flutter build macos --release +``` -5. `flutter run` ### Docker diff --git a/lib/components/theme_switcher.dart b/lib/components/theme_switcher.dart index 7cb2c49..5fecdde 100644 --- a/lib/components/theme_switcher.dart +++ b/lib/components/theme_switcher.dart @@ -175,7 +175,7 @@ class ThemeSwitcherWidgetState extends State { BuildContext context; Future loadSelection(MatrixState matrix) async { - String item = await matrix.store.getItem('theme') ?? 'light'; + String item = await matrix.store.getItem('theme') ?? 'system'; selectedTheme = Themes.values.firstWhere( (e) => e.toString() == 'Themes.' + item, orElse: () => Themes.system); diff --git a/lib/l10n/intl_gl.arb b/lib/l10n/intl_gl.arb index 5cb4196..313197d 100644 --- a/lib/l10n/intl_gl.arb +++ b/lib/l10n/intl_gl.arb @@ -1291,7 +1291,7 @@ "username": {} } }, - "sentCallInformations": "{senderName} enviou informaciĆ³ns da chamada", + "sentCallInformations": "{senderName} enviou informaciĆ³n da chamada", "@sentCallInformations": { "type": "text", "placeholders": { @@ -1702,5 +1702,25 @@ "@yourOwnUsername": { "type": "text", "placeholders": {} + }, + "privacy": "Privacidade", + "@privacy": { + "type": "text", + "placeholders": {} + }, + "enableEmotesGlobally": "Activar paquete emote globalmente", + "@enableEmotesGlobally": { + "type": "text", + "placeholders": {} + }, + "emotePacks": "Paquetes de Emotes para a sala", + "@emotePacks": { + "type": "text", + "placeholders": {} + }, + "changeDeviceName": "Cambiar nome do dispositivo", + "@changeDeviceName": { + "type": "text", + "placeholders": {} } } diff --git a/lib/utils/famedlysdk_store.dart b/lib/utils/famedlysdk_store.dart index d57559e..42aeb84 100644 --- a/lib/utils/famedlysdk_store.dart +++ b/lib/utils/famedlysdk_store.dart @@ -199,9 +199,30 @@ Future migrate(String clientName, Database db, Store store) async { }); } +// see https://github.com/mogol/flutter_secure_storage/issues/161#issuecomment-704578453 +class AsyncMutex { + Completer _completer; + + Future lock() async { + while (_completer != null) { + await _completer.future; + } + + _completer = Completer(); + } + + void unlock() { + assert(_completer != null); + final completer = _completer; + _completer = null; + completer.complete(); + } +} + class Store { final LocalStorage storage; final FlutterSecureStorage secureStorage; + static final _mutex = AsyncMutex(); Store() : storage = LocalStorage('LocalStorage'), @@ -217,9 +238,12 @@ class Store { } } try { + await _mutex.lock(); return await secureStorage.read(key: key); } catch (_) { return null; + } finally { + _mutex.unlock(); } } @@ -231,7 +255,12 @@ class Store { if (value == null) { return await secureStorage.delete(key: key); } else { - return await secureStorage.write(key: key, value: value); + try { + await _mutex.lock(); + return await secureStorage.write(key: key, value: value); + } finally { + _mutex.unlock(); + } } } @@ -245,9 +274,12 @@ class Store { } } try { + await _mutex.lock(); return await secureStorage.readAll(); } catch (_) { return {}; + } finally { + _mutex.unlock(); } } } diff --git a/lib/utils/matrix_locals.dart b/lib/utils/matrix_locals.dart index fe79cf5..38be8bc 100644 --- a/lib/utils/matrix_locals.dart +++ b/lib/utils/matrix_locals.dart @@ -250,7 +250,7 @@ class MatrixLocals extends MatrixLocalizations { @override String userLeftTheChat(String targetName) { - return l10n.userLeftTheChat(userLeftTheChat); + return l10n.userLeftTheChat(targetName); } @override diff --git a/pubspec.yaml b/pubspec.yaml index e278cec..f7f6b5e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,7 +41,7 @@ dependencies: path_provider: ^1.5.1 webview_flutter: ^0.3.19+9 share: ^0.6.3+5 - flutter_secure_storage: ^3.3.1+1 + flutter_secure_storage: ^3.3.4 http: ^0.12.0+4 universal_html: ^1.1.12 receive_sharing_intent: ^1.3.3