react-native-share 8.2.0 → 8.2.2
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.
|
@@ -27,6 +27,17 @@ public class InstagramShare extends SingleShareIntent {
|
|
|
27
27
|
public void open(ReadableMap options) throws ActivityNotFoundException {
|
|
28
28
|
super.open(options);
|
|
29
29
|
|
|
30
|
+
if (!ShareIntent.hasValidKey("type", options)) {
|
|
31
|
+
Log.e("RNShare", "No type provided");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
String type = options.getString("type");
|
|
35
|
+
|
|
36
|
+
if (type.startsWith("text")) {
|
|
37
|
+
this.openInstagramIntentChooserForText(chooserTitle);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
30
41
|
if (!ShareIntent.hasValidKey("url", options)) {
|
|
31
42
|
Log.e("RNShare", "No url provided");
|
|
32
43
|
return;
|
|
@@ -39,16 +50,10 @@ public class InstagramShare extends SingleShareIntent {
|
|
|
39
50
|
return;
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
|
|
43
|
-
if (!ShareIntent.hasValidKey("type", options)) {
|
|
44
|
-
Log.e("RNShare", "No type provided");
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
String type = options.getString("type");
|
|
48
53
|
String extension = this.getExtension(type);
|
|
49
54
|
Boolean isImage = type.startsWith("image");
|
|
50
55
|
|
|
51
|
-
this.
|
|
56
|
+
this.openInstagramIntentChooserForMedia(url, chooserTitle, isImage, extension);
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
protected void openInstagramUrlScheme(String url) {
|
|
@@ -63,7 +68,14 @@ public class InstagramShare extends SingleShareIntent {
|
|
|
63
68
|
return ext[ext.length -1];
|
|
64
69
|
}
|
|
65
70
|
|
|
66
|
-
protected void
|
|
71
|
+
protected void openInstagramIntentChooserForText(String chooserTitle) {
|
|
72
|
+
this.getIntent().setPackage(PACKAGE);
|
|
73
|
+
this.getIntent().setType("text/plain");
|
|
74
|
+
this.getIntent().setAction(Intent.ACTION_SEND);
|
|
75
|
+
super.openIntentChooser();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
protected void openInstagramIntentChooserForMedia(String url, String chooserTitle, Boolean isImage, String extension) {
|
|
67
79
|
Boolean shouldUseInternalStorage = ShareIntent.hasValidKey("useInternalStorage", options) && options.getBoolean("useInternalStorage");
|
|
68
80
|
ShareFile shareFile = isImage
|
|
69
81
|
? new ShareFile(url, "image/" + extension, "image", shouldUseInternalStorage, this.reactContext)
|
|
@@ -15,7 +15,7 @@ import com.facebook.react.bridge.ReadableMap;
|
|
|
15
15
|
public class SnapChatShare extends SingleShareIntent {
|
|
16
16
|
|
|
17
17
|
private static final String PACKAGE = "com.snapchat.android";
|
|
18
|
-
private static final String CLASS = "com.
|
|
18
|
+
private static final String CLASS = "com.snap.mushroom.MainActivity";
|
|
19
19
|
private static final String PLAY_STORE_LINK = "market://details?id=com.snapchat.android";
|
|
20
20
|
|
|
21
21
|
public SnapChatShare(ReactApplicationContext reactContext) {
|
package/package.json
CHANGED