react-native-share 7.3.6 → 7.3.9
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.
|
@@ -15,9 +15,9 @@ public class WhatsAppBusinessShare extends SingleShareIntent {
|
|
|
15
15
|
private static final String PLAY_STORE_LINK = "market://details?id=com.whatsapp.w4b";
|
|
16
16
|
|
|
17
17
|
private static final String START_CONVERSATION_CLASS = "com.whatsapp.Conversation";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
private static final int START_ACTIVITY_TIME_GAP_MS =
|
|
18
|
+
|
|
19
|
+
// must be small enough so that both activities are triggered while the app is still on foreground
|
|
20
|
+
private static final int START_ACTIVITY_TIME_GAP_MS = 10;
|
|
21
21
|
|
|
22
22
|
public WhatsAppBusinessShare(ReactApplicationContext reactContext) {
|
|
23
23
|
super(reactContext);
|
|
@@ -27,22 +27,22 @@ public class WhatsAppBusinessShare extends SingleShareIntent {
|
|
|
27
27
|
super.open(options);
|
|
28
28
|
|
|
29
29
|
if (options.hasKey("whatsAppNumber")) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
try {
|
|
31
|
+
// create an empty conversation in case it's not on contacts
|
|
32
|
+
this.getIntent().setComponent(new ComponentName(PACKAGE, START_CONVERSATION_CLASS));
|
|
33
|
+
this.openIntentChooser();
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
try {
|
|
35
|
+
// leave room for the conversation to be created
|
|
37
36
|
Thread.sleep(START_ACTIVITY_TIME_GAP_MS);
|
|
38
|
-
|
|
37
|
+
|
|
38
|
+
} catch (Exception ex) {
|
|
39
39
|
ex.printStackTrace();
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
// share to conversation
|
|
43
|
-
this.getIntent().setComponent(new ComponentName(PACKAGE, SHARE_TO_CONVERSATION_CLASS));
|
|
44
41
|
}
|
|
45
42
|
|
|
43
|
+
// restore default behavior to share to conversation
|
|
44
|
+
this.getIntent().setComponent(null);
|
|
45
|
+
|
|
46
46
|
// extra params here
|
|
47
47
|
this.openIntentChooser();
|
|
48
48
|
}
|
|
@@ -15,9 +15,9 @@ public class WhatsAppShare extends SingleShareIntent {
|
|
|
15
15
|
private static final String PLAY_STORE_LINK = "market://details?id=com.whatsapp";
|
|
16
16
|
|
|
17
17
|
private static final String START_CONVERSATION_CLASS = "com.whatsapp.Conversation";
|
|
18
|
-
private static final String SHARE_TO_CONVERSATION_CLASS = "com.whatsapp.ContactPicker";
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
// must be small enough so that both activities are triggered while the app is still on foreground
|
|
20
|
+
private static final int START_ACTIVITY_TIME_GAP_MS = 10;
|
|
21
21
|
|
|
22
22
|
public WhatsAppShare(ReactApplicationContext reactContext) {
|
|
23
23
|
super(reactContext);
|
|
@@ -27,22 +27,22 @@ public class WhatsAppShare extends SingleShareIntent {
|
|
|
27
27
|
super.open(options);
|
|
28
28
|
|
|
29
29
|
if (options.hasKey("whatsAppNumber")) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
try {
|
|
31
|
+
// create an empty conversation in case it's not on contacts
|
|
32
|
+
this.getIntent().setComponent(new ComponentName(PACKAGE, START_CONVERSATION_CLASS));
|
|
33
|
+
this.openIntentChooser();
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
// leave room for the conversation to be created
|
|
36
|
-
try {
|
|
35
|
+
// leave room for the conversation to be created
|
|
37
36
|
Thread.sleep(START_ACTIVITY_TIME_GAP_MS);
|
|
38
|
-
|
|
37
|
+
|
|
38
|
+
} catch (Exception ex) {
|
|
39
39
|
ex.printStackTrace();
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
// share to conversation
|
|
43
|
-
this.getIntent().setComponent(new ComponentName(PACKAGE, SHARE_TO_CONVERSATION_CLASS));
|
|
44
41
|
}
|
|
45
42
|
|
|
43
|
+
// restore default behavior to share to conversation
|
|
44
|
+
this.getIntent().setComponent(null);
|
|
45
|
+
|
|
46
46
|
// extra params here
|
|
47
47
|
this.openIntentChooser();
|
|
48
48
|
}
|
package/ios/RNShare.m
CHANGED
|
@@ -246,10 +246,15 @@ RCT_EXPORT_METHOD(open:(NSDictionary *)options
|
|
|
246
246
|
RCTLogError(@"No `urls` to save in Files");
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
|
-
if (@available(iOS 11.0, *)) {
|
|
249
|
+
if (@available(iOS 11.0, macCatalyst 13.1, *)) {
|
|
250
250
|
resolveBlock = successCallback;
|
|
251
251
|
rejectBlock = failureCallback;
|
|
252
|
-
UIDocumentPickerViewController *documentPicker =
|
|
252
|
+
UIDocumentPickerViewController *documentPicker = nil;
|
|
253
|
+
if (@available(iOS 15.0, macCatalyst 15.0, *)) {
|
|
254
|
+
documentPicker = [[UIDocumentPickerViewController alloc] initForExportingURLs:urls asCopy:YES];
|
|
255
|
+
} else {
|
|
256
|
+
documentPicker = [[UIDocumentPickerViewController alloc] initWithURLs:urls inMode:UIDocumentPickerModeExportToService];
|
|
257
|
+
}
|
|
253
258
|
[documentPicker setDelegate:self];
|
|
254
259
|
[controller presentViewController:documentPicker animated:YES completion:nil];
|
|
255
260
|
return;
|
|
@@ -66,7 +66,9 @@
|
|
|
66
66
|
} else {
|
|
67
67
|
self->linkMetadata.originalURL = metadata.originalURL;
|
|
68
68
|
self->linkMetadata.URL = metadata.URL;
|
|
69
|
-
self->linkMetadata.title
|
|
69
|
+
if(!self->linkMetadata.title) {
|
|
70
|
+
self->linkMetadata.title = metadata.title;
|
|
71
|
+
}
|
|
70
72
|
self->linkMetadata.imageProvider = metadata.imageProvider;
|
|
71
73
|
if (self->linkMetadata.imageProvider) {
|
|
72
74
|
self->linkMetadata.iconProvider = self->linkMetadata.imageProvider;
|
package/package.json
CHANGED