Skip to content

Commit

Permalink
Release version 1.41.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyorbin committed Dec 7, 2022
1 parent 56e1cfb commit 4ff4885
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 279 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ body:
- type: dropdown
id: platform
attributes:
label: Platform
label: Which Platforms?
multiple: false
options:
- iOS
Expand All @@ -21,14 +21,14 @@ body:
- type: input
id: platform_version
attributes:
label: React Native Version
placeholder: ex. iOS 0.64.0
label: Which React Native Version?
placeholder: ex. 0.64.0
validations:
required: true
- type: input
id: sdk_version
attributes:
label: Braze SDK Version
label: Which react-native-appboy-sdk SDK version?
placeholder: ex. 1.40.0
validations:
required: true
Expand Down
48 changes: 0 additions & 48 deletions AppboyProject/AppboyProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class AppboyProject extends Component {
this._addToCustomAttributeArrayPress = this._addToCustomAttributeArrayPress.bind(this);
this._removeFromCustomAttributeArrayPress = this._removeFromCustomAttributeArrayPress.bind(this);
this._incrementCustomAttributePress = this._incrementCustomAttributePress.bind(this);
this._setTwitterData = this._setTwitterData.bind(this);
this._setFacebookData = this._setFacebookData.bind(this);
this._requestFeedRefresh = this._requestFeedRefresh.bind(this);
this._requestImmediateDataFlush = this._requestImmediateDataFlush.bind(this);
this._wipeData = this._wipeData.bind(this);
Expand Down Expand Up @@ -266,14 +264,6 @@ class AppboyProject extends Component {
onPress={this._incrementCustomAttributePress}>
<Text>Increment Custom Attribute Array</Text>
</TouchableHighlight>
<TouchableHighlight
onPress={this._setTwitterData}>
<Text>Set Twitter Data</Text>
</TouchableHighlight>
<TouchableHighlight
onPress={this._setFacebookData}>
<Text>Set Facebook Data</Text>
</TouchableHighlight>
<TouchableHighlight
onPress={this._launchNewsFeedPress}>
<Text>Launch News Feed</Text>
Expand Down Expand Up @@ -467,44 +457,6 @@ class AppboyProject extends Component {
Braze.incrementCustomUserAttribute('intattr', 5);
this._showToast('Attribute incremented');
}
_setTwitterData(event) {
Braze.setTwitterData(6253282, 'billmag', 'Bill', 'Adventurer', 700, 200, 1000,
'https://si0.twimg.com/profile_images/2685532587/fa47382ad67a0135acc62d4c6b49dbdc_bigger.jpeg');
this._showToast('Twitter data set');
}
_setFacebookData(event) {
var profile = {
id: '708379',
first_name: 'Bill',
last_name: 'Mag',
location: {
name: 'new york'
},
age_range: {
min: 21, max: 31
},
email: '[email protected]',
bio: 'adventurer',
gender: 'male',
birthday: '01/01/2016'
};
// May also be a list of strings, e.g. below:
// var likes = ["Messiaen", "Durufle", "Buxtehude"];
var likes = [
{
'name': 'Hot Rabbit',
'id': '199600656843963',
'created_time': '2016-09-25T17:05:01+0000'
},
{
'name': 'This Bridge Called Our Health',
'id': '543928779075283',
'created_time': '2016-09-24T20:43:01+0000'
}
];
Braze.setFacebookData(profile, 500, likes);
this._showToast('Facebook data set');
}

_requestFeedRefresh(event) {
Braze.requestFeedRefresh();
Expand Down
6 changes: 2 additions & 4 deletions AppboyProject/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlinVersion = '1.6.0'

repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.android.tools.build:gradle:7.1.0'
classpath "com.google.gms:google-services:4.3.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
}
}

Expand Down
2 changes: 1 addition & 1 deletion AppboyProject/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# org.gradle.parallel=true

android.useAndroidX=true
android.enableJetifier=true
android.enableJetifier=false
4 changes: 2 additions & 2 deletions AppboyProject/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ PODS:
- React-jsinspector (0.66.4)
- React-logger (0.66.4):
- glog
- react-native-appboy-sdk (1.40.0):
- react-native-appboy-sdk (1.41.0):
- Appboy-iOS-SDK (~> 4.5.1)
- React-Core
- React-perflogger (0.66.4)
Expand Down Expand Up @@ -429,7 +429,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: 94ce921e1d8ce7023366873ec371f3441383b396
React-jsinspector: d0374f7509d407d2264168b6d0fad0b54e300b85
React-logger: 933f80c97c633ee8965d609876848148e3fef438
react-native-appboy-sdk: 60b4dbb70486426ccc00cd04ab105f8f9afc83fa
react-native-appboy-sdk: 7fc3141f4843a1de05e22d530ac3cc87c24b9bee
React-perflogger: 93075d8931c32cd1fce8a98c15d2d5ccc4d891bd
React-RCTActionSheet: 7d3041e6761b4f3044a37079ddcb156575fb6d89
React-RCTAnimation: 743e88b55ac62511ae5c2e22803d4f503f2a3a13
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 1.41.0

##### ⚠ Breaking
- Removed `setFacebookData()`.
- Removed `setTwitterData()`.

##### Changed
- Updated the native Android bridge to [Braze Android SDK 23.3.0](https://github.com/Appboy/appboy-android-sdk/blob/master/CHANGELOG.md#2330).
- Exposes `isControl` field for `ContentCard`.
- Removed `kotlinVersion` gradle template variable. To override the Kotlin version used, please use a Gradle dependency `resolutionStrategy`.

# 1.40.0

##### ⚠ Breaking
Expand Down
53 changes: 0 additions & 53 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,59 +198,6 @@ test('it calls AppboyReactBridge.logPurchase', () => {
expect(NativeModules.AppboyReactBridge.logPurchase).toBeCalledWith(product_id, price, currency_code, quantity, purchase_properties);
});

test('it calls AppboyReactBridge.setTwitterData', () => {
const id = "some_id";
const screen_name = "some_screen_name";
const name = "some_name";
const description = "some_description";
const followers_count = 22;
const friends_count = 33;
const statuses_count = 44;
const profile_image_url = "braze.com"
Braze.setTwitterData(id, screen_name, name, description, followers_count, friends_count, statuses_count, profile_image_url);
expect(NativeModules.AppboyReactBridge.setTwitterData).toBeCalledWith(id, screen_name, name, description, followers_count, friends_count, statuses_count, profile_image_url);
});

test('it does not call AppboyReactBridge.setTwitterData when required arguments are missing, and logs to the console', () => {
let id = null;
const screen_name = "some_screen_name";
const name = "some_name";
const description = "some_description";
let followers_count = 22;
let friends_count = 33;
let statuses_count = 44;
const profile_image_url = "braze.com"
Braze.setTwitterData(id, screen_name, name, description, followers_count, friends_count, statuses_count, profile_image_url);
id = "some_id";
followers_count = null;
Braze.setTwitterData(id, screen_name, name, description, followers_count, friends_count, statuses_count, profile_image_url);
followers_count = 22;
friends_count = null;
Braze.setTwitterData(id, screen_name, name, description, followers_count, friends_count, statuses_count, profile_image_url);
friends_count = 33;
statuses_count = null;
Braze.setTwitterData(id, screen_name, name, description, followers_count, friends_count, statuses_count, profile_image_url);
expect(console.log).toHaveBeenCalledTimes(4);
expect(NativeModules.AppboyReactBridge.setTwitterData).not.toHaveBeenCalled();
});

test('it calls AppboyReactBridge.setFacebookData', () => {
const facebook_user_dictionary = "some_facebook_user_dictionary";
const number_of_friends = 55;
const likes = 600;
Braze.setFacebookData(facebook_user_dictionary, number_of_friends, likes);
expect(NativeModules.AppboyReactBridge.setFacebookData).toBeCalledWith(facebook_user_dictionary, number_of_friends, likes);
});

test('it does not call AppboyReactBridge.setFacebookData when required arguments are missing, and logs to the console', () => {
const facebook_user_dictionary = "some_facebook_user_dictionary";
const number_of_friends = null;
const likes = 600;
Braze.setFacebookData(facebook_user_dictionary, number_of_friends, likes);
expect(console.log).toHaveBeenCalled();
expect(NativeModules.AppboyReactBridge.setFacebookData).not.toHaveBeenCalled();
});

test('it calls AppboyReactBridge.setAttributionData', () => {
const network = "some_network";
const campaign = "some_campaign";
Expand Down
2 changes: 0 additions & 2 deletions __tests__/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jest.mock('react-native', () => {
setCountry: jest.fn(),
setHomeCity: jest.fn(),
setDateOfBirth: jest.fn(),
setTwitterData: jest.fn(),
setFacebookData: jest.fn(),
setAttributionData: jest.fn(),
launchNewsFeed: jest.fn(),
launchContentCards: jest.fn(),
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ android {
}

dependencies {
api 'com.appboy:android-sdk-ui:23.2.1'
api 'com.appboy:android-sdk-ui:23.3.0'
api 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.6.0"
}
21 changes: 0 additions & 21 deletions android/src/main/java/com/appboy/reactbridge/BrazeReactBridge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -322,27 +322,6 @@ class BrazeReactBridge(reactContext: ReactApplicationContext?) : ReactContextBas
}
}

@Suppress("LongParameterList", "UnusedPrivateMember")
@ReactMethod
fun setTwitterData(
id: Int?,
screenName: String?,
name: String?,
description: String?,
followersCount: Int?,
friendsCount: Int?,
statusesCount: Int?,
profileImageUrl: String?
) {
// no-op
}

@Suppress("UnusedPrivateMember")
@ReactMethod
fun setFacebookData(facebookUserDictionary: ReadableMap?, numberOfFriends: Int?, likes: ReadableArray?) {
// no-op
}

@ReactMethod
fun launchNewsFeed() {
val intent = Intent(currentActivity, AppboyFeedActivity::class.java)
Expand Down
10 changes: 9 additions & 1 deletion android/src/main/java/com/appboy/reactbridge/ContentCardUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fun mapContentCard(card: Card): WritableMap {
mappedCard.putBoolean("dismissible", card.isDismissibleByUser)
mappedCard.putString("url", card.url)
mappedCard.putBoolean("openURLInWebView", card.openUriInWebView)
mappedCard.putBoolean("isControl", card.isControl)

// Extras
val extras = Arguments.createMap()
Expand All @@ -38,7 +39,8 @@ fun mapContentCard(card: Card): WritableMap {
CardType.CAPTIONED_IMAGE -> mappedCard.merge(captionedImageCardToWritableMap(card as CaptionedImageCard))
CardType.SHORT_NEWS -> mappedCard.merge(shortNewsCardToWritableMap(card as ShortNewsCard))
CardType.TEXT_ANNOUNCEMENT -> mappedCard.merge(textAnnouncementCardToWritableMap(card as TextAnnouncementCard))
CardType.DEFAULT, CardType.CONTROL -> {}
CardType.CONTROL -> mappedCard.merge(controlCardToWritableMap(card as ControlCard))
CardType.DEFAULT -> {}
}
return mappedCard
}
Expand Down Expand Up @@ -81,3 +83,9 @@ fun bannerImageCardToWritableMap(card: BannerImageCard): WritableMap {
mappedCard.putString("type", "Banner")
return mappedCard
}

fun controlCardToWritableMap(card: ControlCard): WritableMap {
val mappedCard = Arguments.createMap()
mappedCard.putString("type", "Control")
return mappedCard
}
23 changes: 1 addition & 22 deletions iOS/AppboyReactBridge/AppboyReactBridge/AppboyReactBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -325,28 +325,6 @@ - (NSArray *)parseArray:(NSArray *)array {
[self reportResultWithCallback:callback andError:nil andResult:@([[Appboy sharedInstance].user removeFromCustomAttributeArrayWithKey:key value:value])];
}

RCT_EXPORT_METHOD(setTwitterData:(NSUInteger)twitterId withScreenName:(NSString *)screenName withName:(NSString *)name withDescription:(NSString *)description withFollowersCount:(NSUInteger)followersCount withFriendsCount:(NSUInteger)friendsCount withStatusesCount:(NSUInteger)statusesCount andProfileImageUrl:(NSString *)profileImageUrl) {
RCTLogInfo(@"[Appboy sharedInstance].user setTwitterData with screenName %@", screenName);
ABKTwitterUser *twitterUser = [[ABKTwitterUser alloc] init];
twitterUser.userDescription = description;
twitterUser.twitterID = twitterId;
twitterUser.twitterName = name;
twitterUser.profileImageUrl = profileImageUrl;
twitterUser.friendsCount = friendsCount;
twitterUser.followersCount = followersCount;
twitterUser.screenName = screenName;
twitterUser.statusesCount = statusesCount;
[Appboy sharedInstance].user.twitterUser = twitterUser;
}

RCT_EXPORT_METHOD(setFacebookData:(nullable NSDictionary *)facebookUserDictionary withNumberOfFriends:(NSUInteger)numberOfFriends withLikes:(NSArray *)likes) {
RCTLogInfo(@"[Appboy sharedInstance].user setFacebookData");
ABKFacebookUser *facebookUser = [[ABKFacebookUser alloc] initWithFacebookUserDictionary:facebookUserDictionary
numberOfFriends:numberOfFriends
likes:likes];
[Appboy sharedInstance].user.facebookUser = facebookUser;
}

RCT_EXPORT_METHOD(setAttributionData:(NSString *)network withCampaign:(NSString *)campaign withAdGroup:(NSString *)adGroup withCreative:(NSString *)creative) {
RCTLogInfo(@"[Appboy sharedInstance].user setAttributionData");
ABKAttributionData *attributionData = [[ABKAttributionData alloc]
Expand Down Expand Up @@ -455,6 +433,7 @@ - (void) getInAppMessageFromString:(NSString *)inAppMessageJSONString withInAppM
formattedContentCardData[@"dismissible"] = @(card.dismissible);
formattedContentCardData[@"url"] = RCTNullIfNil(card.urlString);
formattedContentCardData[@"openURLInWebView"] = @(card.openUrlInWebView);
formattedContentCardData[@"isControl"] = @(card.isControlCard);

formattedContentCardData[@"extras"] = card.extras ? RCTJSONClean(card.extras) : @{};

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.40.0",
"version": "1.41.0",
"description": "Braze SDK for React Native.",
"main": "src/index.js",
"types": "src/index.d.ts",
Expand Down
Loading

0 comments on commit 4ff4885

Please sign in to comment.