react-native-share 11.0.2 → 11.0.4

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.
@@ -4,6 +4,8 @@ import android.app.Activity;
4
4
  import android.content.ActivityNotFoundException;
5
5
  import android.content.Context;
6
6
  import android.content.Intent;
7
+ import android.content.ClipData;
8
+ import android.content.ClipDescription;
7
9
  import android.content.IntentSender;
8
10
  import android.content.pm.PackageManager;
9
11
  import android.net.Uri;
@@ -155,6 +157,14 @@ public abstract class ShareIntent {
155
157
  ShareFiles fileShare = getFileShares(options);
156
158
  if (fileShare.isFile()) {
157
159
  ArrayList<Uri> uriFile = fileShare.getURI();
160
+
161
+ ClipData clip = new ClipData(new ClipDescription("Files", new String[]{fileShare.getType()}), new ClipData.Item(uriFile.get(0)));
162
+
163
+ for (int i = 1; i < uriFile.size(); i++) {
164
+ clip.addItem(new ClipData.Item(uriFile.get(i)));
165
+ }
166
+
167
+ this.getIntent().setClipData(clip);
158
168
  this.getIntent().setAction(Intent.ACTION_SEND_MULTIPLE);
159
169
  this.getIntent().setType(fileShare.getType());
160
170
  this.getIntent().putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriFile);
@@ -173,7 +183,9 @@ public abstract class ShareIntent {
173
183
  this.fileShare = getFileShare(options);
174
184
  if (this.fileShare.isFile()) {
175
185
  Uri uriFile = this.fileShare.getURI();
186
+ ClipData clip = ClipData.newUri(this.reactContext.getContentResolver(), "File", uriFile);
176
187
  this.getIntent().setType(this.fileShare.getType());
188
+ this.getIntent().setClipData(clip);
177
189
  this.getIntent().putExtra(Intent.EXTRA_STREAM, uriFile);
178
190
  this.getIntent().addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
179
191
  if (!TextUtils.isEmpty(message)) {
@@ -87,7 +87,7 @@ RCT_EXPORT_MODULE();
87
87
  // Cannot open facebook
88
88
  NSString *stringURL = @"https://itunes.apple.com/app/facebook/id284882215";
89
89
  NSURL *url = [NSURL URLWithString:stringURL];
90
- [[UIApplication sharedApplication] openURL:url];
90
+ [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
91
91
 
92
92
  NSString *errorMessage = @"Not installed";
93
93
  NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedString(errorMessage, nil)};
@@ -21,7 +21,7 @@
21
21
  NSURL *gplusURL = [NSURL URLWithString:[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
22
22
 
23
23
  if ([[UIApplication sharedApplication] canOpenURL: gplusURL]) {
24
- [[UIApplication sharedApplication] openURL:gplusURL];
24
+ [[UIApplication sharedApplication] openURL:gplusURL options:@{} completionHandler:nil];
25
25
  resolve(@[@true, @""]);
26
26
  } else {
27
27
  // Cannot open gplus
@@ -44,7 +44,7 @@
44
44
  }
45
45
 
46
46
  if ([[UIApplication sharedApplication] canOpenURL: shareURL]) {
47
- [[UIApplication sharedApplication] openURL: shareURL];
47
+ [[UIApplication sharedApplication] openURL:shareURL options:@{} completionHandler:nil];
48
48
  resolve(@[@true, @""]);
49
49
  } else {
50
50
  // Cannot open instagram
@@ -84,7 +84,7 @@
84
84
  resolve: resolve];
85
85
  }
86
86
  } else {
87
- [[UIApplication sharedApplication] openURL: [NSURL URLWithString:@"instagram://camera"]];
87
+ [[UIApplication sharedApplication] openURL: [NSURL URLWithString:@"instagram://camera"] options:@{} completionHandler:nil];
88
88
  resolve(@[@true, @""]);
89
89
  }
90
90
  }
@@ -84,7 +84,7 @@ RCT_EXPORT_MODULE();
84
84
  // Cannot open instagram
85
85
  NSString *stringURL = @"https://itunes.apple.com/app/instagram/id389801252";
86
86
  NSURL *url = [NSURL URLWithString:stringURL];
87
- [[UIApplication sharedApplication] openURL:url];
87
+ [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
88
88
 
89
89
  NSString *errorMessage = @"Not installed";
90
90
  NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedString(errorMessage, nil)};
@@ -107,7 +107,7 @@ resolve:(RCTPromiseResolveBlock)resolve {
107
107
  NSURL * whatsappURL = [NSURL URLWithString:urlWhats];
108
108
 
109
109
  if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
110
- [[UIApplication sharedApplication] openURL: whatsappURL];
110
+ [[UIApplication sharedApplication] openURL:whatsappURL options:@{} completionHandler:nil];
111
111
  resolve(@[@true, @""]);
112
112
  }
113
113
  }
@@ -144,7 +144,7 @@ resolve:(RCTPromiseResolveBlock)resolve {
144
144
  // Cannot open whatsapp
145
145
  NSString *appStoreStringURL = @"https://itunes.apple.com/app/whatsapp-messenger/id310633997";
146
146
  NSURL *appStoreURL = [NSURL URLWithString:appStoreStringURL];
147
- [[UIApplication sharedApplication] openURL:appStoreURL];
147
+ [[UIApplication sharedApplication] openURL:appStoreURL options:@{} completionHandler:nil];
148
148
  return false;
149
149
  }
150
150
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-share",
3
3
  "description": "Social share, sending simple data to other apps.",
4
- "version": "11.0.2",
4
+ "version": "11.0.4",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/react-native-community/react-native-share.git"