chore: Update SDK and add webworker support for web

This commit is contained in:
Christian Pauly 2022-08-14 16:31:36 +02:00
commit da7e433ea3
6 changed files with 33457 additions and 6 deletions

View file

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

View file

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