Skip to content

Commit

Permalink
fix #642 & #644
Browse files Browse the repository at this point in the history
  • Loading branch information
JarvanMo committed Oct 14, 2024
1 parent 2bfec53 commit 50d5544
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class _MyAppState extends State<MyApp> {
appBar: AppBar(title: const Text('Fluwx sample')),
body: ShareSelectorPage(),
),
theme: ThemeData.light(useMaterial3: true),
);
}
}
Expand Down
27 changes: 18 additions & 9 deletions ios/Classes/FluwxPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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]
Expand All @@ -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;
}

Expand Down

0 comments on commit 50d5544

Please sign in to comment.