Skip to content

Commit

Permalink
Release React Native SDK v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiffany Lu committed Apr 25, 2017
1 parent 9bb6356 commit 0500c14
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 46 deletions.
50 changes: 39 additions & 11 deletions AppboyProject/AppboyProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ import {
View,
TouchableHighlight,
Linking,
Alert
Alert,
TextInput
} from 'react-native';

const ReactAppboy = require('react-native-appboy-sdk');

class AppboyProject extends Component {
constructor(props) {
super(props);
this.state = {};
this.state = { userIdText : 'theAppboyTestUser' };
this._updateCardCount = this._updateCardCount.bind(this);
this._changeUserPress = this._changeUserPress.bind(this);
}

componentDidMount() {
Expand Down Expand Up @@ -82,10 +84,20 @@ class AppboyProject extends Component {
render() {
return (
<View style={styles.container}>
<TouchableHighlight
onPress={this._changeUserPress}>
<Text>Change User</Text>
</TouchableHighlight>
<View style={{
flexDirection: 'row',
alignItems: 'center'
}}>
<TouchableHighlight
onPress={this._changeUserPress}>
<Text>Click to Set User ID:</Text>
</TouchableHighlight>
<TextInput
style={{height: 40, width: 150, borderColor: 'gray', borderWidth: .5, paddingLeft: 5, marginLeft: 5, fontSize: 14 }}
onChangeText={(userIdText) => this.setState({userIdText})}
value={this.state.userIdText}
/>
</View>
<TouchableHighlight
onPress={this._logCustomEventPress}>
<Text>Log Custom Event</Text>
Expand All @@ -106,10 +118,6 @@ class AppboyProject extends Component {
onPress={this._logUserPropertiesPress}>
<Text>Set User Properties</Text>
</TouchableHighlight>
<TouchableHighlight
onPress={this._launchNewsFeedPress}>
<Text>Launch News Feed</Text>
</TouchableHighlight>
<TouchableHighlight
onPress={this._launchFeedbackPress}>
<Text>Launch Feedback</Text>
Expand Down Expand Up @@ -138,14 +146,26 @@ class AppboyProject extends Component {
onPress={this._setFacebookData}>
<Text>Set Facebook Data</Text>
</TouchableHighlight>
<TouchableHighlight
onPress={this._launchNewsFeedPress}>
<Text>Launch News Feed</Text>
</TouchableHighlight>
<TouchableHighlight onPress={this._updateCardCount}>
<Text>Unread Cards (Click to Refresh): {this.state.unreadCardCount} / {this.state.cardCount}</Text>
</TouchableHighlight>
<TouchableHighlight
onPress={this._requestFeedRefresh}>
<Text>Request Feed Refresh</Text>
</TouchableHighlight>
<TouchableHighlight
onPress={this._requestImmediateDataFlush}>
<Text>Request Immediate Data Flush</Text>
</TouchableHighlight>
</View>
);
}
_changeUserPress(event) {
ReactAppboy.changeUser('theAppboyTestUser');
ReactAppboy.changeUser(this.state.userIdText);
}
_logCustomEventPress(event) {
ReactAppboy.logCustomEvent('reactCustomEvent', {'p1': 'p2'});
Expand Down Expand Up @@ -238,6 +258,14 @@ class AppboyProject extends Component {
];
ReactAppboy.setFacebookData(profile, 500, likes);
}

_requestFeedRefresh(event) {
ReactAppboy.requestFeedRefresh();
}

_requestImmediateDataFlush(event) {
ReactAppboy.requestImmediateDataFlush();
}
}

const styles = StyleSheet.create({
Expand Down
19 changes: 1 addition & 18 deletions AppboyProject/ios/AppboyProject.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */,
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation-tvOS.a in Frameworks */,
2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */,
2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */,
2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */,
2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */,
2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */,
2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -496,8 +488,6 @@
children = (
13B07F961A680F5B00A75B9A /* AppboyProject.app */,
00E356EE1AD99517003FC87E /* AppboyProjectTests.xctest */,
2D02E47B1E0B4A5D006451C7 /* AppboyProject-tvOS.app */,
2D02E4901E0B4A5D006451C7 /* AppboyProject-tvOSTests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -568,15 +558,13 @@
2D02E4771E0B4A5D006451C7 /* Sources */,
2D02E4781E0B4A5D006451C7 /* Frameworks */,
2D02E4791E0B4A5D006451C7 /* Resources */,
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */,
);
buildRules = (
);
dependencies = (
);
name = "AppboyProject-tvOS";
productName = "AppboyProject-tvOS";
productReference = 2D02E47B1E0B4A5D006451C7 /* AppboyProject-tvOS.app */;
productType = "com.apple.product-type.application";
};
2D02E48F1E0B4A5D006451C7 /* AppboyProject-tvOSTests */ = {
Expand All @@ -594,7 +582,6 @@
);
name = "AppboyProject-tvOSTests";
productName = "AppboyProject-tvOSTests";
productReference = 2D02E4901E0B4A5D006451C7 /* AppboyProject-tvOSTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
Expand Down Expand Up @@ -900,7 +887,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -940,7 +926,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
5023267F6F486A63BC767021 /* [CP] Copy Pods Resources */ = {
Expand Down Expand Up @@ -997,16 +983,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */,
2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
2D02E48C1E0B4A5D006451C7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2DCD954D1E0B4F2C00145EB5 /* AppboyProjectTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
1 change: 1 addition & 0 deletions AppboyProject/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

target 'AppboyProject' do
platform :ios, '8.0'
pod 'Appboy-iOS-SDK'
end
23 changes: 14 additions & 9 deletions AppboyProject/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
PODS:
- Appboy-iOS-SDK (2.25.0):
- SDWebImage (~> 3.7)
- SDWebImage (3.8.2):
- SDWebImage/Core (= 3.8.2)
- SDWebImage/Core (3.8.2)
- Appboy-iOS-SDK (2.29.0):
- Appboy-iOS-SDK/UI (= 2.29.0)
- Appboy-iOS-SDK/UI (2.29.0):
- SDWebImage/GIF (~> 4.0)
- FLAnimatedImage (1.0.12)
- SDWebImage/Core (4.0.0)
- SDWebImage/GIF (4.0.0):
- FLAnimatedImage (~> 1.0)
- SDWebImage/Core

DEPENDENCIES:
- Appboy-iOS-SDK

SPEC CHECKSUMS:
Appboy-iOS-SDK: 720819acf77bcb7bdad658d26c064278a39639d9
SDWebImage: 098e97e6176540799c27e804c96653ee0833d13c
Appboy-iOS-SDK: 4c415ccf7e22e131326a9bcb89c840f87f6fdd2f
FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
SDWebImage: 76a6348bdc74eb5a55dd08a091ef298e56b55e41

PODFILE CHECKSUM: 4a8044a2dc577ba6222e659d250842e0517dbda0
PODFILE CHECKSUM: 2f9e055aff739205d78aff436edf9dc0a9a94678

COCOAPODS: 1.1.1
COCOAPODS: 1.2.1
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## 1.3.0

##### Breaking
- Updates the native iOS bridge to use [Appboy iOS SDK 2.29.0](https://github.com/Appboy/appboy-ios-sdk/blob/master/CHANGELOG.md#2290), which drops support for iOS 7.
- Updates the native Android bridge to use [Appboy Android SDK 2.0.0](https://github.com/Appboy/appboy-android-sdk/blob/master/CHANGELOG.md#200).

##### Added
- Adds `ReactAppboy.requestImmediateDataFlush()` for requesting an immediate flush of any data waiting to be sent to Appboy's servers.
- Adds `ReactAppboy.requestFeedRefresh()` for requesting a refresh of the News Feed.
- See https://github.com/Appboy/appboy-react-sdk/pull/12. Thanks @stief510!
- Added the ability to pass an optional dictionary of News Feed launch options to `launchNewsFeed()`. See `NewsFeedLaunchOptions` for supported keys.
- For more information on currently supported `NewsFeedLaunchOptions` keys, see the card width and card margin properties on [ABKFeedViewController](http://appboy.github.io/appboy-ios-sdk/docs/interface_a_b_k_feed_view_controller.html).
- See https://github.com/Appboy/appboy-react-sdk/pull/10. Thanks @mihalychk!

## 1.2.0

##### Breaking
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

Effective marketing automation is an essential part of successfully scaling and managing your business. Appboy empowers you to build better customer relationships through a seamless, multi-channel approach that addresses all aspects of the user life cycle Appboy helps you engage your users on an ongoing basis. Visit the following link for details and we'll have you up and running in no time!

See our [Technical Documentation](http://documentation.appboy.com "Appboy Technical Documentation") for instructions on integrating Appboy into your React Native App.
See our Technical Documentation ([iOS](https://www.appboy.com/documentation/React_Native/iOS/), [Android](https://www.appboy.com/documentation/React_Native/Android_and_FireOS/)) for instructions on integrating Appboy into your React Native App.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ android {
}

dependencies {
compile 'com.appboy:android-sdk-ui:1.15.3'
compile 'com.appboy:android-sdk-ui:2.0.0'
compile 'com.facebook.react:react-native:0.19.+'
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ private void reportResultWithCallback(Callback callback, String error, Object re
AppboyLogger.w(TAG, "Warning: AppboyReactBridge callback was null.");
}
}

@ReactMethod
public void setSDKFlavor() {
// Dummy method required for the iOS SDK flavor implementation; see AppboyReactBridge.setSDKFlavor()
// in index.js. The Android bridge sets the REACT SDK flavor via an appboy.xml parameter.
}

@ReactMethod
public void requestImmediateDataFlush() {
Appboy.getInstance(getReactApplicationContext()).requestImmediateDataFlush();
}

@ReactMethod
public void changeUser(String userName) {
Expand Down Expand Up @@ -349,8 +360,7 @@ public void launchNewsFeed(ReadableMap launchOptions) {

@ReactMethod
public void requestFeedRefresh() {
final Appboy mAppboy = Appboy.getInstance(getReactApplicationContext());
mAppboy.requestFeedRefresh();
Appboy.getInstance(getReactApplicationContext()).requestFeedRefresh();
}

private CardCategory getCardCategoryFromString(String categoryString) {
Expand Down
5 changes: 5 additions & 0 deletions android/src/main/res/values/appboy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--- Internal Appboy Usage -->
<string name="com_appboy_sdk_flavor">REACT</string>
</resources>
11 changes: 10 additions & 1 deletion iOS/AppboyReactBridge/AppboyReactBridge/AppboyReactBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ - (void)reportResultWithCallback:(RCTResponseSenderBlock)callback andError:(NSSt
}
}

RCT_EXPORT_METHOD(setSDKFlavor) {
[Appboy sharedInstance].sdkFlavor = REACT;

This comment has been minimized.

Copy link
@sen-lu

sen-lu May 17, 2017

Contributor

Hi @dcvz,

The REACT value is one of the ABKSDKFlavor enums declared in Appboy.h of the Appboy iOS SDK.
Is this value throwing an error in your project?

Best,
Tiff

This comment has been minimized.

Copy link
@sen-lu

sen-lu May 17, 2017

Contributor

Hi @dcvz,

We're unable to reproduce this failure in our AppboyProject sample app. Are you experiencing this in our sample app, or in your own project? If you are experiencing this in our sample app, have you followed the README instructions here? If you are experiencing this in your own application, could you please contact [email protected] with your issue and attach a sample application that mimics your setup?

Best,
Tiff

}

// Returns the deep link from the push dictionary in application:didFinishLaunchingWithOptions: launchOptions, if one exists
// For more context see getInitialURL() in index.js
RCT_EXPORT_METHOD(getInitialUrl:(RCTResponseSenderBlock)callback) {
Expand Down Expand Up @@ -258,7 +262,7 @@ - (ABKCardCategory)getCardCategoryForString:(NSString *)category {
RCT_EXPORT_METHOD(requestFeedRefresh) {
[[Appboy sharedInstance] requestFeedRefresh];
}

RCT_EXPORT_METHOD(getCardCountForCategories:(NSString *)category callback:(RCTResponseSenderBlock)callback) {
ABKCardCategory cardCategory = [self getCardCategoryForString:category];
if (cardCategory == 0) {
Expand All @@ -285,5 +289,10 @@ - (ABKCardCategory)getCardCategoryForString:(NSString *)category {
[mainViewController presentViewController:feedbackModal animated:YES completion:nil];
}

RCT_EXPORT_METHOD(requestImmediateDataFlush) {
RCTLogInfo(@"requestImmediateDataFlush called");
[[Appboy sharedInstance] flushDataAndProcessRequestQueue];
}

RCT_EXPORT_MODULE();
@end
14 changes: 12 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const AppboyReactBridge = require('react-native').NativeModules.AppboyReactBridge;
AppboyReactBridge.setSDKFlavor();

/**
* This default callback logs errors and null or false results. AppboyReactBridge methods with callbacks will
Expand Down Expand Up @@ -371,8 +372,9 @@ var ReactAppboy = {
AppboyReactBridge.launchNewsFeed(launchOptions);
},


// Refresh news feed
/**
* Requests a News Feed refresh.
*/
requestFeedRefresh: function() {
AppboyReactBridge.requestFeedRefresh();
},
Expand Down Expand Up @@ -407,6 +409,14 @@ var ReactAppboy = {
AppboyReactBridge.launchFeedback();
},

// Flush Controls
/**
* Requests an immediate flush of any data waiting to be sent to Appboy's servers.
*/
requestImmediateDataFlush: function() {
AppboyReactBridge.requestImmediateDataFlush();
},

// Enums
CardCategory: {
'ADVERTISING': 'advertising',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-appboy-sdk",
"version": "1.2.0",
"version": "1.3.0",
"description": "Appboy SDK for React Native.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 0500c14

Please sign in to comment.