react-native-share 5.1.1 → 5.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -340,7 +340,7 @@ public abstract class ShareIntent {
|
|
|
340
340
|
} else {
|
|
341
341
|
chooser = Intent.createChooser(this.getIntent(), this.chooserTitle);
|
|
342
342
|
}
|
|
343
|
-
chooser.
|
|
343
|
+
chooser.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
|
344
344
|
|
|
345
345
|
if (ShareIntent.hasValidKey("showAppsToView", options) && ShareIntent.hasValidKey("url", options)) {
|
|
346
346
|
Intent viewIntent = new Intent(Intent.ACTION_VIEW);
|
|
@@ -78,11 +78,11 @@ public abstract class SingleShareIntent extends ShareIntent {
|
|
|
78
78
|
if (TargetChosenReceiver.isSupported()) {
|
|
79
79
|
IntentSender sender = TargetChosenReceiver.getSharingSenderIntent(this.reactContext);
|
|
80
80
|
Intent chooser = Intent.createChooser(this.getIntent(), this.chooserTitle, sender);
|
|
81
|
-
chooser.
|
|
81
|
+
chooser.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
|
82
82
|
activity.startActivityForResult(chooser, RNShareModule.SHARE_REQUEST_CODE);
|
|
83
83
|
} else {
|
|
84
84
|
Intent chooser = Intent.createChooser(this.getIntent(), this.chooserTitle);
|
|
85
|
-
chooser.
|
|
85
|
+
chooser.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
|
86
86
|
activity.startActivityForResult(chooser, RNShareModule.SHARE_REQUEST_CODE);
|
|
87
87
|
TargetChosenReceiver.sendCallback(true, true, "OK");
|
|
88
88
|
}
|
package/ios/RNShare.m
CHANGED
|
@@ -262,13 +262,23 @@ RCT_EXPORT_METHOD(open:(NSDictionary *)options
|
|
|
262
262
|
shareController.excludedActivityTypes = excludedActivityTypes;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
__weak UIActivityViewController* weakShareController = shareController;
|
|
265
266
|
shareController.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, __unused NSArray *returnedItems, NSError *activityError) {
|
|
267
|
+
|
|
268
|
+
// always dismiss since this may be called from cancelled shares
|
|
269
|
+
// but the share menu would remain open, and our callback would fire again on close
|
|
270
|
+
[controller dismissViewControllerAnimated:true completion:nil];
|
|
271
|
+
|
|
266
272
|
if (activityError) {
|
|
267
|
-
[controller dismissViewControllerAnimated:true completion:nil];
|
|
268
273
|
failureCallback(activityError);
|
|
269
|
-
} else
|
|
274
|
+
} else {
|
|
270
275
|
successCallback(@[@(completed), RCTNullIfNil(activityType)]);
|
|
271
276
|
}
|
|
277
|
+
|
|
278
|
+
// clear the completion handler to prevent cycles
|
|
279
|
+
if(weakShareController){
|
|
280
|
+
weakShareController.completionWithItemsHandler = nil;
|
|
281
|
+
}
|
|
272
282
|
};
|
|
273
283
|
|
|
274
284
|
shareController.modalPresentationStyle = UIModalPresentationPopover;
|
package/package.json
CHANGED