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
* 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

View File

@ -175,7 +175,7 @@ class ThemeSwitcherWidgetState extends State<ThemeSwitcherWidget> {
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);

View File

@ -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": {}
}
}

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 {
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();
}
}
}

View File

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

View File

@ -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