react-native-share 7.7.1 → 7.8.0
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.
- package/ios/InstagramShare.m +19 -10
- package/ios/RNShare.m +1 -1
- package/package.json +1 -1
package/ios/InstagramShare.m
CHANGED
|
@@ -16,17 +16,26 @@
|
|
|
16
16
|
successCallback:(RCTResponseSenderBlock)successCallback {
|
|
17
17
|
|
|
18
18
|
NSLog(@"Try open view");
|
|
19
|
-
|
|
20
|
-
NSURL * fileURL = [NSURL URLWithString: options[@"url"]];
|
|
21
|
-
AVURLAsset* videoAsset = [AVURLAsset URLAssetWithURL:fileURL options:nil];
|
|
22
|
-
CMTime videoDuration = videoAsset.duration;
|
|
23
|
-
float videoDurationSeconds = CMTimeGetSeconds(videoDuration);
|
|
24
|
-
|
|
25
|
-
NSLog(@"Video duration: %f seconds for file %@", videoDurationSeconds, videoAsset.URL.absoluteString);
|
|
26
|
-
|
|
19
|
+
|
|
27
20
|
NSURL * shareURL;
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
float videoDurationSeconds = 0.0f;
|
|
22
|
+
NSString* url = options[@"url"];
|
|
23
|
+
if (url) {
|
|
24
|
+
NSURL * fileURL = [NSURL URLWithString: options[@"url"]];
|
|
25
|
+
AVURLAsset* videoAsset = [AVURLAsset URLAssetWithURL:fileURL options:nil];
|
|
26
|
+
CMTime videoDuration = videoAsset.duration;
|
|
27
|
+
float videoDurationSeconds = CMTimeGetSeconds(videoDuration);
|
|
28
|
+
|
|
29
|
+
NSLog(@"Video duration: %f seconds for file %@", videoDurationSeconds, videoAsset.URL.absoluteString);
|
|
30
|
+
} else {
|
|
31
|
+
//this will send message directly to instagram DM with plain text
|
|
32
|
+
shareURL = [NSURL URLWithString:[NSString stringWithFormat:@"instagram://sharesheet?text=%@", options[@"message"]]];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (shareURL) {
|
|
36
|
+
NSLog(@"url is already available, no need to do anything");
|
|
37
|
+
} else if (videoDurationSeconds <= 60.0f) {
|
|
38
|
+
// Instagram doesn't allow sharing videos longer than 60 seconds on iOS anymore. (next button is not responding, trim is unavailable)
|
|
30
39
|
NSString *phIdentifier= [options[@"url"] stringByReplacingOccurrencesOfString:@"ph://" withString:@""];
|
|
31
40
|
NSString * urlString = [NSString stringWithFormat:@"instagram://library?LocalIdentifier=%@", phIdentifier];
|
|
32
41
|
shareURL = [NSURL URLWithString:urlString];
|
package/ios/RNShare.m
CHANGED
|
@@ -63,7 +63,7 @@ EmailShare *shareCtl;
|
|
|
63
63
|
|
|
64
64
|
- (BOOL)isImageMimeType:(NSString *)data {
|
|
65
65
|
NSRange range = [data rangeOfString:@"data:image" options:NSCaseInsensitiveSearch];
|
|
66
|
-
if (range.location != NSNotFound) {
|
|
66
|
+
if (data && range.location != NSNotFound) {
|
|
67
67
|
return true;
|
|
68
68
|
} else {
|
|
69
69
|
return false;
|
package/package.json
CHANGED