Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: react-native-share @ 1.2.0 .. 1.2.1

CHANGELOG.md

@@ -1,3 +1,9 @@
+#### 1.2.1-5 (2019-05-29)
+
+##### Chores
+
+* **codeowners:** add CODEOWNERS file ([ac67e5cd](https://github.com/react-native-community/react-native-share/commit/ac67e5cd9531e5d554b7b9ac0217c777e4d8f9c4))
+
### 1.2.0-4 (2019-05-26)
##### Build System / Dependencies

CODEOWNERS

@@ -0,0 +1 @@
+* @jgcmarins @MateusAndrade @mikehardy

index.js

@@ -170,23 +170,11 @@
TWITTER: NativeModules.RNShare.TWITTER || 'twitter',
WHATSAPP: NativeModules.RNShare.WHATSAPP || 'whatsapp',
INSTAGRAM: NativeModules.RNShare.INSTAGRAM || 'instagram',
- INSTAGRAM_STORIES:
- NativeModules.RNShare.INSTAGRAM_STORIES || 'instagram-stories',
GOOGLEPLUS: NativeModules.RNShare.GOOGLEPLUS || 'googleplus',
EMAIL: NativeModules.RNShare.EMAIL || 'email',
PINTEREST: NativeModules.RNShare.PINTEREST || 'pinterest',
};
- static InstagramStories = {
- SHARE_BACKGROUND_IMAGE:
- NativeModules.RNShare.SHARE_BACKGROUND_IMAGE || 'shareBackgroundImage',
- SHARE_STICKER_IMAGE:
- NativeModules.RNShare.SHARE_STICKER_IMAGE || 'shareStickerImage',
- SHARE_BACKGROUND_AND_STICKER_IMAGE:
- NativeModules.RNShare.SHARE_BACKGROUND_AND_STICKER_IMAGE ||
- 'shareBackgroundAndStickerImage',
- };
-
static open(options: Options | MultipleOptions): Promise<OpenReturn> {
return new Promise((resolve, reject) => {
requireAndAskPermissions(options)

ios/InstagramStories.h

@@ -1,53 +0,0 @@
-//
-// InstagramStories.h
-// RNShare
-//
-// Created by Nikita Logachev on 13.02.2019.
-// link: https://github.com/loga4
-//
-
-#import <UIKit/UIKit.h>
-// import RCTConvert
-#if __has_include(<React/RCTConvert.h>)
-#import <React/RCTConvert.h>
-#elif __has_include("RCTConvert.h")
-#import "RCTConvert.h"
-#else
-#import "React/RCTConvert.h" // Required when used as a Pod in a Swift project
-#endif
-// import RCTBridge
-#if __has_include(<React/RCTBridge.h>)
-#import <React/RCTBridge.h>
-#elif __has_include("RCTBridge.h")
-#import "RCTBridge.h"
-#else
-#import "React/RCTBridge.h" // Required when used as a Pod in a Swift project
-#endif
-// import RCTUIManager
-#if __has_include(<React/RCTUIManager.h>)
-#import <React/RCTUIManager.h>
-#elif __has_include("RCTUIManager.h")
-#import "RCTUIManager.h"
-#else
-#import "React/RCTUIManager.h" // Required when used as a Pod in a Swift project
-#endif
-// import RCTLog
-#if __has_include(<React/RCTLog.h>)
-#import <React/RCTLog.h>
-#elif __has_include("RCTLog.h")
-#import "RCTLog.h"
-#else
-#import "React/RCTLog.h" // Required when used as a Pod in a Swift project
-#endif
-// import RCTUtils
-#if __has_include(<React/RCTUtils.h>)
-#import <React/RCTUtils.h>
-#elif __has_include("RCTUtils.h")
-#import "RCTUtils.h"
-#else
-#import "React/RCTUtils.h" // Required when used as a Pod in a Swift project
-#endif
-@interface InstagramStories : NSObject <RCTBridgeModule>
-
-- (void *) shareSingle:(NSDictionary *)options failureCallback:(RCTResponseErrorBlock)failureCallback successCallback:(RCTResponseSenderBlock)successCallback;
-@end

ios/InstagramStories.m

@@ -1,161 +0,0 @@
-//
-// InstagramStories.m
-// RNShare
-//
-// Created by Nikita Logachev on 13.02.2019.
-// link: https://github.com/loga4
-//
-
-// import RCTLog
-#if __has_include(<React/RCTLog.h>)
-#import <React/RCTLog.h>
-#elif __has_include("RCTLog.h")
-#import "RCTLog.h"
-#else
-#import "React/RCTLog.h" // Required when used as a Pod in a Swift project
-#endif
-
-#import "InstagramStories.h"
-
-@implementation InstagramStories
-RCT_EXPORT_MODULE();
-
-- (void)backgroundImage:(NSData *)backgroundImage attributionURL:(NSString *)attributionURL {
- // Verify app can open custom URL scheme, open if able
-
- NSURL *urlScheme = [NSURL URLWithString:@"instagram-stories://share"];
- if ([[UIApplication sharedApplication] canOpenURL:urlScheme]) {
- // Assign background image asset and attribution link URL to pasteboard
- NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundImage" : backgroundImage, @"com.instagram.sharedSticker.contentURL" : attributionURL}];
- NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
- // This call is iOS 10+, can use 'setItems' depending on what versions you support
- [[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
- [[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];
- } else { // Handle older app versions or app not installed case
- [self fallbackInstagram];
- }
-}
-
-- (void)stickerImage:(NSData *)stickerImage
- backgroundTopColor:(NSString *)backgroundTopColor
-backgroundBottomColor:(NSString *)backgroundBottomColor
- attributionURL:(NSString *)attributionURL
-{
- // Verify app can open custom URL scheme. If able,
- // assign assets to pasteboard, open scheme.
-
- NSURL *urlScheme = [NSURL URLWithString:@"instagram-stories://share"];
- if ([[UIApplication sharedApplication] canOpenURL:urlScheme]) {
-
- // Assign sticker image asset and attribution link URL to pasteboard
-
- NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.stickerImage" : stickerImage, @"com.instagram.sharedSticker.backgroundTopColor" : backgroundTopColor, @"com.instagram.sharedSticker.backgroundBottomColor" : backgroundBottomColor, @"com.instagram.sharedSticker.contentURL" : attributionURL}];
-
- NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
-
- // This call is iOS 10+, can use 'setItems' depending on what versions you support
-
- [[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
- [[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];
-
- } else { // Handle older app versions or app not installed case
- [self fallbackInstagram];
- }
-}
-
-- (void)backgroundImage:(NSData *)backgroundImage stickerImage:(NSData *)stickerImage attributionURL:(NSString *)attributionURL
-{
- // Verify app can open custom URL scheme. If able,
- // assign assets to pasteboard, open scheme.
- NSURL *urlScheme = [NSURL URLWithString:@"instagram-stories://share"];
- if ([[UIApplication sharedApplication] canOpenURL:urlScheme]) {
- // Assign background and sticker image assets and
- // attribution link URL to pasteboard
- NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundImage" : backgroundImage, @"com.instagram.sharedSticker.stickerImage" : stickerImage, @"com.instagram.sharedSticker.contentURL" : attributionURL}];
- NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
- // This call is iOS 10+, can use 'setItems' depending on what versions you support
- [[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
- [[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];
-
- } else { // Handle older app versions or app not installed case
- [self fallbackInstagram];
- }
-}
-
-
-- (void)shareSingle:(NSDictionary *)options
- failureCallback:(RCTResponseErrorBlock)failureCallback
- successCallback:(RCTResponseSenderBlock)successCallback {
-
- NSString *attrURL = [RCTConvert NSString:options[@"attributionURL"]];
- if (attrURL == nil) {
- attrURL = @"";
- }
-
- NSString *method = [RCTConvert NSString:options[@"method"]];
- if (method) {
- if([method isEqualToString:@"shareBackgroundImage"]) {
-
- NSURL *URL = [RCTConvert NSURL:options[@"backgroundImage"]];
- if (URL == nil) {
- RCTLogError(@"key 'backgroundImage' missing in options");
- } else {
- UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:URL]];
-
- [self backgroundImage:UIImagePNGRepresentation(image) attributionURL:attrURL];
- }
- } else if([method isEqualToString:@"shareStickerImage"]) {
- RCTLog(@"method shareStickerImage");
-
- NSString *backgroundTopColor = [RCTConvert NSString:options[@"backgroundTopColor"]];
- if (backgroundTopColor == nil) {
- backgroundTopColor = @"#906df4";
- }
- NSString *backgroundBottomColor = [RCTConvert NSString:options[@"backgroundBottomColor"]];
- if (backgroundBottomColor == nil) {
- backgroundBottomColor = @"#837DF4";
- }
-
- NSURL *URL = [RCTConvert NSURL:options[@"stickerImage"]];
- if (URL == nil) {
- RCTLogError(@"key 'stickerImage' missing in options");
- } else {
- UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:URL]];
-
- [self stickerImage:UIImagePNGRepresentation(image) backgroundTopColor:backgroundTopColor backgroundBottomColor:backgroundBottomColor attributionURL:attrURL];
- }
- } else if([method isEqualToString:@"shareBackgroundAndStickerImage"]) {
- RCTLog(@"method shareBackgroundAndStickerImage");
-
- NSURL *backgroundURL = [RCTConvert NSURL:options[@"backgroundImage"]];
- NSURL *sticketURL = [RCTConvert NSURL:options[@"stickerImage"]];
-
- if (backgroundURL == nil || sticketURL == nil) {
- RCTLogError(@"key 'backgroundImage' or 'stickerImage' missing in options");
- } else {
- UIImage *backgroundImage = [UIImage imageWithData: [NSData dataWithContentsOfURL:backgroundURL]];
- UIImage *stickerImage = [UIImage imageWithData: [NSData dataWithContentsOfURL:sticketURL]];
-
- [self backgroundImage:UIImagePNGRepresentation(backgroundImage) stickerImage:UIImagePNGRepresentation(stickerImage) attributionURL:attrURL];
- }
- }
- } else {
- RCTLogError(@"key 'method' missing in options");
- }
-}
-
-- (void)fallbackInstagram {
- // Cannot open instagram
- NSString *stringURL = @"http://itunes.apple.com/app/instagram/id389801252";
- NSURL *url = [NSURL URLWithString:stringURL];
- [[UIApplication sharedApplication] openURL:url];
-
- NSString *errorMessage = @"Not installed";
- NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedString(errorMessage, nil)};
- NSError *error = [NSError errorWithDomain:@"com.rnshare" code:1 userInfo:userInfo];
-
- NSLog(errorMessage);
-}
-// https://instagram.fhrk1-1.fna.fbcdn.net/vp/80c479ffc246a9320e614fa4def6a3dc/5C667D3F/t51.12442-15/e35/50679864_1663709050595244_6964601913751831460_n.jpg?_nc_ht=instagram.fhrk1-1.fna.fbcdn.net
-@end
-

ios/RNShare.m

@@ -43,7 +43,6 @@
#import "GenericShare.h"
#import "WhatsAppShare.h"
#import "InstagramShare.h"
-#import "InstagramStories.h"
#import "GooglePlusShare.h"
#import "EmailShare.h"
@@ -79,12 +78,7 @@
@"GOOGLEPLUS": @"googleplus",
@"WHATSAPP": @"whatsapp",
@"INSTAGRAM": @"instagram",
- @"INSTAGRAM_STORIES": @"instagram-stories",
@"EMAIL": @"email",
-
- @"SHARE_BACKGROUND_IMAGE": @"shareBackgroundImage",
- @"SHARE_STICKER_IMAGE": @"shareStickerImage",
- @"SHARE_BACKGROUND_AND_STICKER_IMAGE": @"shareBackgroundAndStickerImage",
};
}
@@ -116,10 +110,6 @@
NSLog(@"TRY OPEN instagram");
InstagramShare *shareCtl = [[InstagramShare alloc] init];
[shareCtl shareSingle:options failureCallback: failureCallback successCallback: successCallback];
- } else if([social isEqualToString:@"instagram-stories"]) {
- NSLog(@"TRY OPEN instagram-stories");
- InstagramStories *shareCtl = [[InstagramStories alloc] init];
- [shareCtl shareSingle:options failureCallback: failureCallback successCallback: successCallback];
} else if([social isEqualToString:@"email"]) {
NSLog(@"TRY OPEN email");
EmailShare *shareCtl = [[EmailShare alloc] init];

ios/RNShare.xcodeproj/project.pbxproj

@@ -13,7 +13,6 @@
B3E7B58A1CC2AC0600A0062D /* RNShare.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNShare.m */; };
B3EEE48E1D4844E7008422B6 /* GooglePlusShare.m in Sources */ = {isa = PBXBuildFile; fileRef = B3EEE48D1D4844E7008422B6 /* GooglePlusShare.m */; };
CE0C76371E9E7DE100ED396E /* InstagramShare.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0C76361E9E7DE100ED396E /* InstagramShare.m */; };
- FCC7BB4F221457EF00E1EA39 /* InstagramStories.m in Sources */ = {isa = PBXBuildFile; fileRef = FCC7BB4E221457EF00E1EA39 /* InstagramStories.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -42,8 +41,6 @@
B3EEE48F1D4844F4008422B6 /* GooglePlusShare.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GooglePlusShare.h; sourceTree = "<group>"; };
CE0C76361E9E7DE100ED396E /* InstagramShare.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InstagramShare.m; sourceTree = "<group>"; };
CE0C76621E9E869300ED396E /* InstagramShare.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InstagramShare.h; sourceTree = "<group>"; };
- FCC7BB4D2214566C00E1EA39 /* InstagramStories.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InstagramStories.h; sourceTree = "<group>"; };
- FCC7BB4E221457EF00E1EA39 /* InstagramStories.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InstagramStories.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -88,8 +85,6 @@
B33C228C1D442583006BCD98 /* EmailShare.h */,
B3EEE48D1D4844E7008422B6 /* GooglePlusShare.m */,
B3EEE48F1D4844F4008422B6 /* GooglePlusShare.h */,
- FCC7BB4D2214566C00E1EA39 /* InstagramStories.h */,
- FCC7BB4E221457EF00E1EA39 /* InstagramStories.m */,
);
name = social;
sourceTree = "<group>";
@@ -156,7 +151,6 @@
B3E7B58A1CC2AC0600A0062D /* RNShare.m in Sources */,
B33C22891D4419E8006BCD98 /* WhatsAppShare.m in Sources */,
B33C228B1D442577006BCD98 /* EmailShare.m in Sources */,
- FCC7BB4F221457EF00E1EA39 /* InstagramStories.m in Sources */,
B33C22851D441713006BCD98 /* GenericShare.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

package.json

@@ -1,7 +1,7 @@
{
"name": "react-native-share",
"description": "Social share, sending simple data to other apps.",
- "version": "1.2.0",
+ "version": "1.2.1",
"repository": {
"type": "git",
"url": "git+https://github.com/react-native-community/react-native-share.git"

README.md

@@ -191,7 +191,6 @@
| **PAGESMANAGER** | yes | no | no |
| **WHATSAPP** | yes | yes | no |
| **INSTAGRAM** | yes | yes | no |
-| **INSTAGRAM_STORIES** | no | yes | no |
| **GOOGLEPLUS** | yes | yes | no |
| **EMAIL** | yes | yes | no |
| **PINTEREST** | yes | no | no |
@@ -505,42 +504,6 @@
});
}
```
-#### Static Values for Instagram Stories
-
-These can be assessed using Share.Social property
-For eg.
-```javascript
-import Share from 'react-native-share';
-
-const shareOptions = {
- method: Share.InstagramStories.SHARE_BACKGROUND_AND_STICKER_IMAGE,
- backgroundImage: 'http://urlto.png',
- stickerImage: 'data:image/png;base64,<imageInBase64>', //or you can use "data:" link
- backgroundBottomColor: '#fefefe',
- backgroundTopColor: '#906df4',
- attributionURL: 'http://deep-link-to-app', //in beta
- social: Share.Social.INSTAGRAM_STORIES
-};
-Share.shareSingle(shareOptions);
-```
-
-Supported options for INSTAGRAM_STORIES:
-
-| Name | Type | Description |
-| :---- | :------: | :--- |
-| backgroundImage | string | URL you want to share |
-| stickerImage | string | URL you want to share |
-| method | string | [List](#instagram-stories-method-list) |
-| backgroundBottomColor | string | (optional) default #837DF4 |
-| backgroundTopColor | string | (optional) default #906df4 |
-| attributionURL | string | (optional) facebook beta-test |
-
-#### Instagram stories method list
-| Name | Required options |
-| :---- | :------: |
-| **SHARE_BACKGROUND_IMAGE** | backgroundImage |
-| **SHARE_STICKER_IMAGE** | stickerImage |
-| **SHARE_BACKGROUND_AND_STICKER_IMAGE** | backgroundImage, stickerImage |
#### Adding your implementation of FileProvider