@@ -257,19 +257,21 @@ - (void)showShareSheetWithLinkProperties:(BranchLinkProperties *)linkProperties
257257 if ([shareViewController respondsToSelector: @selector (completionWithItemsHandler )]) {
258258 shareViewController.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
259259 // Log share completed event
260- [self userCompletedAction: BNCShareCompletedEvent];
261- if (completion || completionError) {
262- if (completion) { completion (activityType, completed); }
263- else if (completionError) { completionError (activityType, completed, activityError); }
264- [BNCFabricAnswers sendEventWithName: @" Branch Share" andAttributes: [self getDictionaryWithCompleteLinkProperties: linkProperties]];
265- }
260+ if (completed && !activityError)
261+ [self userCompletedAction: BNCShareCompletedEvent];
262+ if (completion)
263+ completion (activityType, completed);
264+ else
265+ if (completionError)
266+ completionError (activityType, completed, activityError);
267+ [BNCFabricAnswers sendEventWithName: @" Branch Share" andAttributes: [self getDictionaryWithCompleteLinkProperties: linkProperties]];
266268 };
267269 } else {
268- #pragma clang diagnostic push
269- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
270+ #pragma clang diagnostic push
271+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
270272 // Deprecated in iOS 8. Safe to hide deprecation warnings as the new completion handler is checked for above
271273 shareViewController.completionHandler = completion;
272- #pragma clang diagnostic pop
274+ #pragma clang diagnostic pop
273275 }
274276
275277 UIViewController *presentingViewController;
@@ -278,7 +280,8 @@ - (void)showShareSheetWithLinkProperties:(BranchLinkProperties *)linkProperties
278280 }
279281 else {
280282 Class UIApplicationClass = NSClassFromString (@" UIApplication" );
281- if ([[[[UIApplicationClass sharedApplication ].delegate window ] rootViewController ] respondsToSelector: @selector (presentViewController:animated:completion: )]) {
283+ if ([[[[UIApplicationClass sharedApplication ].delegate window ] rootViewController ]
284+ respondsToSelector: @selector (presentViewController:animated:completion: )]) {
282285 presentingViewController = [[[UIApplicationClass sharedApplication ].delegate window ] rootViewController ];
283286 }
284287 }
0 commit comments