From 50d554493ddabe4949de89eaee27ed5f1eef91cc Mon Sep 17 00:00:00 2001 From: JarvanMo Date: Mon, 14 Oct 2024 21:24:02 +0800 Subject: [PATCH] fix #642 & #644 --- example/lib/main.dart | 1 + ios/Classes/FluwxPlugin.m | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index efc30f82..1fbc0fb5 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -71,6 +71,7 @@ class _MyAppState extends State { appBar: AppBar(title: const Text('Fluwx sample')), body: ShareSelectorPage(), ), + theme: ThemeData.light(useMaterial3: true), ); } } diff --git a/ios/Classes/FluwxPlugin.m b/ios/Classes/FluwxPlugin.m index e40bd27f..6a6efe83 100644 --- a/ios/Classes/FluwxPlugin.m +++ b/ios/Classes/FluwxPlugin.m @@ -538,13 +538,16 @@ - (void)shareImage:(FlutterMethodCall *)call result:(FlutterResult)result { NSString * imageDataHash = sourceImage[@"imgDataHash"]; dispatch_async(dispatch_get_main_queue(), ^{ + + FlutterStandardTypedData *flutterThumbData = call.arguments[fluwxKeyThumbData]; NSData *thumbData = nil; - if (flutterThumbData != nil){ + + if (![flutterThumbData isKindOfClass:[NSNull class]]){ thumbData = flutterThumbData.data; } - + NSNumber *scene = call.arguments[fluwxKeyScene]; [self sendImageData:imageData @@ -582,7 +585,8 @@ - (void)shareWebPage:(FlutterMethodCall *)call result:(FlutterResult)result { FlutterStandardTypedData *flutterThumbData = call.arguments[fluwxKeyThumbData]; NSData *thumbData = nil; - if (flutterThumbData != nil){ + + if (![flutterThumbData isKindOfClass:[NSNull class]]){ thumbData = flutterThumbData.data; } @@ -612,13 +616,14 @@ - (void)shareMusic:(FlutterMethodCall *)call result:(FlutterResult)result { UIImage *thumbnailImage = [self getCommonThumbnail:call]; dispatch_async(dispatch_get_main_queue(), ^{ + FlutterStandardTypedData *flutterThumbData = call.arguments[fluwxKeyThumbData]; NSData *thumbData = nil; - if (flutterThumbData != nil){ + + if (![flutterThumbData isKindOfClass:[NSNull class]]){ thumbData = flutterThumbData.data; } - NSNumber *scene = call.arguments[fluwxKeyScene]; [self sendMusicURL:call.arguments[@"musicUrl"] dataURL:call.arguments[@"musicDataUrl"] @@ -651,10 +656,12 @@ - (void)shareVideo:(FlutterMethodCall *)call result:(FlutterResult)result { dispatch_async(dispatch_get_main_queue(), ^{ NSNumber *scene = call.arguments[fluwxKeyScene]; + FlutterStandardTypedData *flutterThumbData = call.arguments[fluwxKeyThumbData]; NSData *thumbData = nil; - if (flutterThumbData != nil){ + + if (![flutterThumbData isKindOfClass:[NSNull class]]){ thumbData = flutterThumbData.data; } @@ -698,10 +705,10 @@ - (void)shareFile:(FlutterMethodCall *)call result:(FlutterResult)result { FlutterStandardTypedData *flutterThumbData = call.arguments[fluwxKeyThumbData]; NSData *thumbData = nil; - if (flutterThumbData != nil){ + + if (![flutterThumbData isKindOfClass:[NSNull class]]){ thumbData = flutterThumbData.data; } - [self sendFileData:data fileExtension:fileExtension Title:call.arguments[fluwxKeyTitle] @@ -725,10 +732,12 @@ - (void)shareMiniProgram:(FlutterMethodCall *)call result:(FlutterResult)result dispatch_async(dispatch_get_main_queue(), ^{ + FlutterStandardTypedData *flutterThumbData = call.arguments[fluwxKeyThumbData]; NSData *thumbData = nil; - if (flutterThumbData != nil){ + + if (![flutterThumbData isKindOfClass:[NSNull class]]){ thumbData = flutterThumbData.data; }