Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
builds
  • Loading branch information
xster committed May 5, 2017
commit b7d6538bdf2dd3f90839dc20f78dc5d2515f8908
4 changes: 2 additions & 2 deletions packages/share/ios/Classes/SharePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#import <Flutter/Flutter.h>

@interface SharePlugin : NSObject
- initWithFlutterViewController:
(FlutterViewController *)flutterViewController;
- initWithController:
(FlutterViewController *)controller;
@end
25 changes: 12 additions & 13 deletions packages/share/ios/Classes/SharePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,26 @@

@implementation SharePlugin

- (instancetype)initWithFlutterViewController:
(FlutterViewController *)flutterViewController {
- (instancetype)initWithController:
(FlutterViewController *)controller {
FlutterMethodChannel *shareChannel = [FlutterMethodChannel
methodChannelNamed:PLATFORM_CHANNEL
binaryMessenger:flutterViewController
codec:[FlutterStandardMethodCodec sharedInstance]];
methodChannelWithName:PLATFORM_CHANNEL
binaryMessenger:controller];

[shareChannel setMethodCallHandler:^(FlutterMethodCall *call,
FlutterResultReceiver result) {
FlutterResult result) {
if ([@"share" isEqualToString:call.method]) {
UIActivityViewController *activityViewController =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similary here as for SharePlugin.java, you could consider moving out the platform-specific code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

[[UIActivityViewController alloc] initWithActivityItems:@[call.arguments]
applicationActivities:nil];
[flutterViewController presentViewController:activityViewController
animated:YES
completion:nil];
result(nil, nil);
[controller presentViewController:activityViewController
animated:YES
completion:nil];
result(nil);
} else {
result(nil, [FlutterError errorWithCode:@"UNKNOWN_METHOD"
message:@"Unknown share method called"
details:nil]);
result([FlutterError errorWithCode:@"UNKNOWN_METHOD"
message:@"Unknown share method called"
details:nil]);
}
}];
}
Expand Down