From 71b878fd8c7f9a254e9ca31e76951453ce9a3396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 16 Jun 2025 08:50:19 +0200 Subject: [PATCH] chore: Add hint to init vodozemac also in native implementations --- CHANGELOG.md | 13 +++++++++++-- doc/end-to-end-encryption.md | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eec45c6..c9cb463c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,13 +49,22 @@ For Flutter you can use [flutter_vodozemac](https://pub.dev/packages/flutter_vod just needs to be initialized **once**: ```dart -import 'package:flutter_vodozemac/flutter_vodozemac' as vod; +import 'package:flutter_vodozemac/flutter_vodozemac.dart' as vod; // ... await vod.init(); -final client = Client(/*...*/); +final client = Client('Matrix Client', + // ... + // ... + nativeImplementations: NativeImplementationsIsolate( + compute, + // Also init in NativeImplemenetations if you use it there: + vodozemacInit: () => vod.init(), + ), + // ... +); ``` This should work on Android, iOS, macOS, Linux and Windows. diff --git a/doc/end-to-end-encryption.md b/doc/end-to-end-encryption.md index ac848cd3..8879535d 100644 --- a/doc/end-to-end-encryption.md +++ b/doc/end-to-end-encryption.md @@ -26,4 +26,21 @@ final client = Client(/*...*/); This should work on Android, iOS, macOS, Linux and Windows. -For web you need to compile vodozemac to wasm. [Please refer to the Vodozemac bindings documentation](https://pub.dev/packages/vodozemac#build-for-web). \ No newline at end of file +For web you need to compile vodozemac to wasm. [Please refer to the Vodozemac bindings documentation](https://pub.dev/packages/vodozemac#build-for-web). + +### Using Vodozemac with NativeImplementations + +When using NativeImplementations you have to initialize Vodozemac there as well. +Just pass the same init function to it: + +```dart +final client = Client('Matrix Client', + // ... + // ... + nativeImplementations: NativeImplementationsIsolate( + compute, + vodozemacInit: () => vod.init(), + ), + // ... +); +``` \ No newline at end of file