Merge remote-tracking branch 'upstream/main' into yiffed

This commit is contained in:
Inex Code 2020-10-11 17:47:09 +03:00
commit 57481c2fb0
6 changed files with 84 additions and 14 deletions

View file

@ -29,7 +29,7 @@ An experimental fork of FluffyChat.
* Change password * Change password
* End-To-End-Encryption * End-To-End-Encryption
## How to build # How to build
1. [Install flutter](https://flutter.dev) 1. [Install flutter](https://flutter.dev)
@ -39,29 +39,47 @@ git clone --recurse-submodules https://gitlab.com/ChristianPauly/fluffychat-flut
cd fluffychat-flutter 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 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" // 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 ### 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 ### Docker

View file

@ -175,7 +175,7 @@ class ThemeSwitcherWidgetState extends State<ThemeSwitcherWidget> {
BuildContext context; BuildContext context;
Future loadSelection(MatrixState matrix) async { 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( selectedTheme = Themes.values.firstWhere(
(e) => e.toString() == 'Themes.' + item, (e) => e.toString() == 'Themes.' + item,
orElse: () => Themes.system); orElse: () => Themes.system);

View file

@ -1291,7 +1291,7 @@
"username": {} "username": {}
} }
}, },
"sentCallInformations": "{senderName} enviou informacións da chamada", "sentCallInformations": "{senderName} enviou información da chamada",
"@sentCallInformations": { "@sentCallInformations": {
"type": "text", "type": "text",
"placeholders": { "placeholders": {
@ -1702,5 +1702,25 @@
"@yourOwnUsername": { "@yourOwnUsername": {
"type": "text", "type": "text",
"placeholders": {} "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": {}
} }
} }

View file

@ -199,9 +199,30 @@ Future<void> migrate(String clientName, Database db, Store store) async {
}); });
} }
// see https://github.com/mogol/flutter_secure_storage/issues/161#issuecomment-704578453
class AsyncMutex {
Completer<void> _completer;
Future<void> lock() async {
while (_completer != null) {
await _completer.future;
}
_completer = Completer<void>();
}
void unlock() {
assert(_completer != null);
final completer = _completer;
_completer = null;
completer.complete();
}
}
class Store { class Store {
final LocalStorage storage; final LocalStorage storage;
final FlutterSecureStorage secureStorage; final FlutterSecureStorage secureStorage;
static final _mutex = AsyncMutex();
Store() Store()
: storage = LocalStorage('LocalStorage'), : storage = LocalStorage('LocalStorage'),
@ -217,9 +238,12 @@ class Store {
} }
} }
try { try {
await _mutex.lock();
return await secureStorage.read(key: key); return await secureStorage.read(key: key);
} catch (_) { } catch (_) {
return null; return null;
} finally {
_mutex.unlock();
} }
} }
@ -231,7 +255,12 @@ class Store {
if (value == null) { if (value == null) {
return await secureStorage.delete(key: key); return await secureStorage.delete(key: key);
} else { } 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 { try {
await _mutex.lock();
return await secureStorage.readAll(); return await secureStorage.readAll();
} catch (_) { } catch (_) {
return {}; return {};
} finally {
_mutex.unlock();
} }
} }
} }

View file

@ -250,7 +250,7 @@ class MatrixLocals extends MatrixLocalizations {
@override @override
String userLeftTheChat(String targetName) { String userLeftTheChat(String targetName) {
return l10n.userLeftTheChat(userLeftTheChat); return l10n.userLeftTheChat(targetName);
} }
@override @override

View file

@ -41,7 +41,7 @@ dependencies:
path_provider: ^1.5.1 path_provider: ^1.5.1
webview_flutter: ^0.3.19+9 webview_flutter: ^0.3.19+9
share: ^0.6.3+5 share: ^0.6.3+5
flutter_secure_storage: ^3.3.1+1 flutter_secure_storage: ^3.3.4
http: ^0.12.0+4 http: ^0.12.0+4
universal_html: ^1.1.12 universal_html: ^1.1.12
receive_sharing_intent: ^1.3.3 receive_sharing_intent: ^1.3.3