Merge branch 'krille/updatesdk' into 'main'

chore: Update SDK and add webworker support for web

See merge request famedly/fluffychat!984
This commit is contained in:
Krille Fear 2022-08-14 14:51:36 +00:00
commit 61907b94f0
6 changed files with 33457 additions and 6 deletions

1
.gitignore vendored
View File

@ -62,3 +62,4 @@ ios/Podfile.lock
/linux/out /linux/out
/macos/out /macos/out
.vs .vs
assets/js/package/olm.js

View File

@ -7,6 +7,7 @@ import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:vrouter/vrouter.dart'; import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/utils/client_manager.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
import 'settings_emotes_view.dart'; import 'settings_emotes_view.dart';
@ -206,10 +207,10 @@ class EmotesSettingsController extends State<EmotesSettings> {
); );
try { try {
file = (await file.generateThumbnail( file = (await file.generateThumbnail(
compute: Matrix.of(context).client.runInBackground, nativeImplementations: ClientManager.nativeImplementations,
))!; ))!;
} catch (_) { } catch (e, s) {
// do nothing Logs().w('Unable to create thumbnail', e, s);
} }
final uploadResp = await showFutureLoadingDialog( final uploadResp = await showFutureLoadingDialog(
context: context, context: context,

View File

@ -83,6 +83,10 @@ abstract class ClientManager {
await Store().setItem(clientNamespace, jsonEncode(clientNamesList)); await Store().setItem(clientNamespace, jsonEncode(clientNamesList));
} }
static NativeImplementations get nativeImplementations => kIsWeb
? NativeImplementationsWebWorker(Uri.parse('native_executor.js'))
: NativeImplementationsIsolate(compute);
static Client createClient(String clientName) { static Client createClient(String clientName) {
return Client( return Client(
clientName, clientName,
@ -109,7 +113,7 @@ abstract class ClientManager {
PlatformInfos.isMacOS) PlatformInfos.isMacOS)
AuthenticationTypes.sso AuthenticationTypes.sso
}, },
compute: compute, nativeImplementations: nativeImplementations,
customImageResizer: PlatformInfos.isMobile ? customImageResizer : null, customImageResizer: PlatformInfos.isMobile ? customImageResizer : null,
); );
} }

View File

@ -1063,7 +1063,7 @@ packages:
name: matrix name: matrix
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.11.0" version: "0.11.2"
matrix_api_lite: matrix_api_lite:
dependency: transitive dependency: transitive
description: description:

View File

@ -61,7 +61,7 @@ dependencies:
keyboard_shortcuts: ^0.1.4 keyboard_shortcuts: ^0.1.4
localstorage: ^4.0.0+1 localstorage: ^4.0.0+1
lottie: ^1.2.2 lottie: ^1.2.2
matrix: ^0.11.0 matrix: ^0.11.2
matrix_homeserver_recommendations: ^0.3.0 matrix_homeserver_recommendations: ^0.3.0
matrix_link_text: ^1.0.2 matrix_link_text: ^1.0.2
native_imaging: native_imaging:

33445
web/native_executor.js Normal file

File diff suppressed because one or more lines are too long