Skip to content

Commit

Permalink
EddyVerbruggen#538 iOS 7 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Mar 13, 2016
1 parent bf3cdb1 commit c3ca810
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ios/SocialSharing.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,23 @@ - (void)share:(CDVInvokedUrlCommand*)command {
[activityVC setValue:subject forKey:@"subject"];
}

if([[UIApplication sharedApplication] respondsToSelector:(@selector(setCompletionWithItemsHandler:))]){
if ([activityVC respondsToSelector:(@selector(setCompletionWithItemsHandler:))]) {
[activityVC setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError) {
[self cleanupStoredFiles];
NSLog(@"SocialSharing app selected: %@", activityType);
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:completed];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
}else{

// let's suppress this warning otherwise folks will start opening issues while it's not relevant
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[activityVC setCompletionHandler:^(NSString *activityType, BOOL completed) {
[self cleanupStoredFiles];
NSLog(@"SocialSharing app selected: %@", activityType);
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:completed];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
}

NSArray * socialSharingExcludeActivities = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"SocialSharingExcludeActivities"];
Expand Down

0 comments on commit c3ca810

Please sign in to comment.