feat: Enable native imaging for web
This commit is contained in:
parent
55705942ef
commit
6e87353e08
5 changed files with 14 additions and 9 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -13,7 +13,8 @@
|
|||
prime
|
||||
|
||||
# libolm package
|
||||
/assets/js/package
|
||||
web/Imaging.js
|
||||
web/Imaging.wasm
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
|
|
|
|||
|
|
@ -122,7 +122,8 @@ abstract class ClientManager {
|
|||
AuthenticationTypes.sso,
|
||||
},
|
||||
nativeImplementations: nativeImplementations,
|
||||
customImageResizer: PlatformInfos.isMobile ? customImageResizer : null,
|
||||
customImageResizer:
|
||||
PlatformInfos.isMobile || kIsWeb ? customImageResizer : null,
|
||||
defaultNetworkRequestTimeout: const Duration(minutes: 30),
|
||||
enableDehydratedDevices: true,
|
||||
shareKeysWith: ShareKeysWith.values
|
||||
|
|
|
|||
|
|
@ -18,12 +18,6 @@ import 'package:native_imaging/native_imaging.dart' as native;
|
|||
Future<MatrixImageFileResizedResponse?> customImageResizer(
|
||||
MatrixImageFileResizeArguments arguments,
|
||||
) async {
|
||||
if (kIsWeb) {
|
||||
throw UnsupportedError(
|
||||
'customImageResizer only supports non-web platforms.',
|
||||
);
|
||||
}
|
||||
|
||||
await native.init();
|
||||
|
||||
var imageBytes = arguments.bytes;
|
||||
|
|
|
|||
|
|
@ -9,4 +9,12 @@ flutter_rust_bridge_codegen build-web --dart-root dart --rust-root $(readlink -f
|
|||
cd ..
|
||||
rm -f ./assets/vodozemac/vodozemac_bindings_dart*
|
||||
mv .vodozemac/dart/web/pkg/vodozemac_bindings_dart* ./assets/vodozemac/
|
||||
rm -rf .vodozemac
|
||||
rm -rf .vodozemac
|
||||
|
||||
# Add native imaging:
|
||||
cd web/
|
||||
curl -L 'https://github.com/famedly/dart_native_imaging/releases/download/v0.2.1/native_imaging.zip' > native_imaging.zip # make sure to sync version with pubspec.yaml
|
||||
unzip native_imaging.zip
|
||||
mv js/* .
|
||||
rmdir js
|
||||
rm native_imaging.zip
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
<title>FluffyChat</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<link rel="stylesheet" type="text/css" href="splash/style.css">
|
||||
<script src="Imaging.js"></script>
|
||||
|
||||
<!-- This script adds the flutter initialization JS code -->
|
||||
<script src="flutter.js" defer></script>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue