Skip to content

Commit

Permalink
Release version 1.33.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyorbin committed Sep 24, 2021
1 parent 6c0a238 commit 7ed2e65
Show file tree
Hide file tree
Showing 17 changed files with 255 additions and 97 deletions.
3 changes: 2 additions & 1 deletion AppboyProject/AppboyProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ class AppboyProject extends Component {
var testDate = new Date();
ReactAppboy.logCustomEvent(this.state.customEventText, {'stringKey': 'stringValue', 'intKey': 42, 'floatKey': 1.23, 'boolKey': true, 'dateKey': testDate});
ReactAppboy.logCustomEvent(this.state.customEventText + 'NoProps');
ReactAppboy.logCustomEvent(this.state.customEventText, {'arrayKey': ['arrayVal1', 'arrayVal2', testDate, [testDate, 'nestedArrayval'], {'dictInArrayKey': testDate}], 'dictKey': {'dictKey1': 'dictVal1', 'dictKey2': testDate, 'dictKey3': {'nestedDictKey1': testDate}, 'dictKey4': ['nestedArrayVal1', 'nestedArrayVal2']}});
this._showToast('Event logged: ' + this.state.customEventText);
}
_setLanguagePress(event) {
Expand Down Expand Up @@ -396,7 +397,7 @@ class AppboyProject extends Component {
}
_logPurchasePress(event) {
var testDate = new Date();
ReactAppboy.logPurchase('reactProductIdentifier', '1.2', 'USD', 2, {'stringKey': 'stringValue', 'intKey': 42, 'floatKey': 1.23, 'boolKey': true, 'dateKey': testDate});
ReactAppboy.logPurchase('reactProductIdentifier', '1.2', 'USD', 2, {'stringKey': 'stringValue', 'intKey': 42, 'floatKey': 1.23, 'boolKey': true, 'dateKey': testDate, 'dictKey':{'dictKey1': 'dictVal1'}});
ReactAppboy.logPurchase('reactProductIdentifier' + 'NoProps', '1.2', 'USD', 2);
this._showToast('Purchase logged');
}
Expand Down
1 change: 1 addition & 0 deletions AppboyProject/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ public void afterInAppMessageViewClosed(IInAppMessage inAppMessage) { }
BrazeInAppMessageManager.getInstance().setCustomInAppMessageManagerListener(new BrazeInAppMessageManagerListener());
}

@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}

/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
Expand Down
10 changes: 5 additions & 5 deletions AppboyProject/android/app/src/main/res/values/braze.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<resources>
<!-- General configuration -->
<!-- The API key is not shown to the user and thus we don't require that it be translated. -->
<string translatable="false" name="com_appboy_api_key">8220f3a6-2e82-4737-a83a-aab39eb1bcef</string>
<string translatable="false" name="com_appboy_server_target">STAGING</string>
<string translatable="false" name="com_braze_api_key">8220f3a6-2e82-4737-a83a-aab39eb1bcef</string>
<string translatable="false" name="com_braze_server_target">STAGING</string>

<bool translatable="false" name="com_appboy_firebase_cloud_messaging_registration_enabled">true</bool>
<string translatable="false" name="com_appboy_firebase_cloud_messaging_sender_id">531790618696</string>
<bool translatable="false" name="com_braze_firebase_cloud_messaging_registration_enabled">true</bool>
<string translatable="false" name="com_braze_firebase_cloud_messaging_sender_id">531790618696</string>

<bool name="com_appboy_handle_push_deep_links_automatically">true</bool>
<bool name="com_braze_handle_push_deep_links_automatically">true</bool>
</resources>
22 changes: 11 additions & 11 deletions AppboyProject/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
PODS:
- Appboy-iOS-SDK (4.3.2):
- Appboy-iOS-SDK/UI (= 4.3.2)
- Appboy-iOS-SDK/ContentCards (4.3.2):
- Appboy-iOS-SDK (4.3.4):
- Appboy-iOS-SDK/UI (= 4.3.4)
- Appboy-iOS-SDK/ContentCards (4.3.4):
- Appboy-iOS-SDK/Core
- SDWebImage (< 6, >= 5.8.2)
- Appboy-iOS-SDK/Core (4.3.2)
- Appboy-iOS-SDK/InAppMessage (4.3.2):
- Appboy-iOS-SDK/Core (4.3.4)
- Appboy-iOS-SDK/InAppMessage (4.3.4):
- Appboy-iOS-SDK/Core
- SDWebImage (< 6, >= 5.8.2)
- Appboy-iOS-SDK/NewsFeed (4.3.2):
- Appboy-iOS-SDK/NewsFeed (4.3.4):
- Appboy-iOS-SDK/Core
- SDWebImage (< 6, >= 5.8.2)
- Appboy-iOS-SDK/UI (4.3.2):
- Appboy-iOS-SDK/UI (4.3.4):
- Appboy-iOS-SDK/ContentCards
- Appboy-iOS-SDK/Core
- Appboy-iOS-SDK/InAppMessage
Expand Down Expand Up @@ -199,8 +199,8 @@ PODS:
- React-cxxreact (= 0.61.5)
- React-jsi (= 0.61.5)
- React-jsinspector (0.61.5)
- react-native-appboy-sdk (1.32.0):
- Appboy-iOS-SDK (~> 4.3.2)
- react-native-appboy-sdk (1.33.0):
- Appboy-iOS-SDK (~> 4.3.4)
- React
- React-RCTActionSheet (0.61.5):
- React-Core/RCTActionSheetHeaders (= 0.61.5)
Expand Down Expand Up @@ -334,7 +334,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
Appboy-iOS-SDK: 173d96a8e903e1dff8bbc200f2a95f39cac9af21
Appboy-iOS-SDK: dd22a28a003c5a1331080ecec398eaa4d7ef4569
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
Expand All @@ -350,7 +350,7 @@ SPEC CHECKSUMS:
React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
react-native-appboy-sdk: 1aa507125262dc879e8cbad2ba119ce95b5e021d
react-native-appboy-sdk: f1a5fda43cad5f3e9ce01d81ed64edffcf5f4bed
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72
Expand Down
2 changes: 1 addition & 1 deletion AppboyProject/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"react": "16.9.0",
"react-native": "^0.61.5",
"react-native-appboy-sdk": "file:../"
"react-native-appboy-sdk": "file:.."
},
"devDependencies": {
"@babel/core": "^7.6.2",
Expand Down
8 changes: 4 additions & 4 deletions AppboyProject/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5001,7 +5001,7 @@ react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0:
integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==

"react-native-appboy-sdk@file:..":
version "1.32.0"
version "1.33.0"

react-native@^0.61.5:
version "0.61.5"
Expand Down Expand Up @@ -5914,9 +5914,9 @@ tmp@^0.0.33:
os-tmpdir "~1.0.2"

[email protected]:
version "1.0.4"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"
integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=
version "1.0.5"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==

to-fast-properties@^2.0.0:
version "2.0.0"
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 1.33.0

##### ⚠ Breaking
- Updated the native Android bridge to [Braze Android SDK 16.0.0](https://github.com/Appboy/appboy-android-sdk/blob/master/CHANGELOG.md#1600).
- Updated the native iOS bridge to [Braze iOS SDK 4.3.4](https://github.com/Appboy/appboy-ios-sdk/blob/master/CHANGELOG.md#434).

##### Added
- Added `ReactAppboy.addToSubscriptionGroup()` and `ReactAppboy.removeFromSubscriptionGroup()` to manage SMS/Email Subscription Groups.
- Custom events and purchases now support nested properties. In addition to integers, floats, booleans, dates, or strings, a JSON object can be provided containing dictionaries of arrays or nested dictionaries. All properties combined can be up to 50 KB in total length.

## 1.32.0

##### ⚠ Breaking
Expand Down
14 changes: 14 additions & 0 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jest.mock('NativeModules', () => {
setDoubleCustomUserAttribute: jest.fn(),
incrementCustomUserAttribute: jest.fn(),
setGender: jest.fn(),
addToSubscriptionGroup: jest.fn(),
removeFromSubscriptionGroup: jest.fn(),
setPushNotificationSubscriptionType: jest.fn(),
setEmailNotificationSubscriptionType: jest.fn(),
addToCustomAttributeArray: jest.fn(),
Expand Down Expand Up @@ -391,6 +393,18 @@ test('it calls AppboyReactBridge.setGender', () => {
expect(NativeModules.AppboyReactBridge.setGender).toBeCalledWith(gender, testCallback);
});

test('it calls AppboyReactBridge.addToSubscriptionGroup', () => {
const groupId = "some_group_id";
ReactAppboy.addToSubscriptionGroup(groupId, testCallback);
expect(NativeModules.AppboyReactBridge.addToSubscriptionGroup).toBeCalledWith(groupId, testCallback);
});

test('it calls AppboyReactBridge.removeFromSubscriptionGroup', () => {
const groupId = "some_group_id";
ReactAppboy.removeFromSubscriptionGroup(groupId, testCallback);
expect(NativeModules.AppboyReactBridge.removeFromSubscriptionGroup).toBeCalledWith(groupId, testCallback);
});

test('it calls AppboyReactBridge.setPushNotificationSubscriptionType', () => {
const sub_type = "some_sub_type";
ReactAppboy.setPushNotificationSubscriptionType(sub_type, testCallback);
Expand Down
10 changes: 5 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ def safeExtGet(prop, fallback) {
}

android {
compileSdkVersion safeExtGet('compileSdkVersion', 30)
buildToolsVersion safeExtGet('buildToolsVersion', '30.0.2')
compileSdkVersion safeExtGet('compileSdkVersion', 31)
buildToolsVersion safeExtGet('buildToolsVersion', '31.0.0')

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 30)
targetSdkVersion safeExtGet('targetSdkVersion', 31)
versionCode 1
versionName '1.0'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
api 'com.appboy:android-sdk-ui:15.0.0'
api 'com.appboy:android-sdk-ui:16.0.0'
api 'com.facebook.react:react-native:+'
}
99 changes: 61 additions & 38 deletions android/src/main/java/com/appboy/reactbridge/AppboyReactBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;

public class AppboyReactBridge extends ReactContextBaseJavaModule {
Expand Down Expand Up @@ -145,51 +146,51 @@ public void logCustomEvent(String eventName, ReadableMap eventProperties) {
}

private AppboyProperties populateEventPropertiesFromReadableMap(ReadableMap eventProperties) {
AppboyProperties properties = new AppboyProperties();
ReadableMapKeySetIterator keySetIterator = eventProperties.keySetIterator();
if (eventProperties == JSONObject.NULL) {
return properties;
return new AppboyProperties();
}

return new AppboyProperties(new JSONObject(parseReadableMap(eventProperties)));
}

private Map parseReadableMap(ReadableMap readableMap) {
ReadableMapKeySetIterator keySetIterator = readableMap.keySetIterator();
Map parsedMap = readableMap.toHashMap();
while (keySetIterator.hasNextKey()) {
String key = keySetIterator.nextKey();
ReadableType readableType = eventProperties.getType(key);
switch (readableType) {
case String:
properties.addProperty(key, eventProperties.getString(key));
break;
case Boolean:
properties.addProperty(key, eventProperties.getBoolean(key));
break;
case Number:
try {
properties.addProperty(key, eventProperties.getDouble(key));
} catch (Exception e) {
try {
properties.addProperty(key, eventProperties.getInt(key));
} catch (Exception e2) {
AppboyLogger.e(TAG, "Could not parse ReadableType.Number from ReadableMap for key: " + key, e2);
}
}
break;
case Map:
try {
if (eventProperties.getMap(key).getString("type").equals("UNIX_timestamp")) {
double unixTimestamp = eventProperties.getMap(key).getDouble("value");
properties.addProperty(key, new Date((long) unixTimestamp));
} else {
AppboyLogger.w(TAG, "Unsupported ReadableMap type received for key: " + key);
}
} catch (Exception e) {
AppboyLogger.e(TAG, "Could not determine type from ReadableMap for key: " + key, e);
}
break;
default:
AppboyLogger.w(TAG, "Could not map ReadableType to an AppboyProperty value for key: " + key);
break;
ReadableType readableType = readableMap.getType(key);
if (readableType == readableType.Map) {
if (readableMap.getMap(key).hasKey("type") &&
readableMap.getMap(key).getString("type").equals("UNIX_timestamp")) {
double unixTimestamp = readableMap.getMap(key).getDouble("value");
parsedMap.put(key, new Date((long) unixTimestamp));
} else {
parsedMap.put(key, parseReadableMap(readableMap.getMap(key)));
}
} else if (readableType == readableType.Array) {
parsedMap.put(key, parseReadableArray(readableMap.getArray(key)));
}
}
return parsedMap;
}

private List parseReadableArray(ReadableArray readableArray) {
List parsedList = readableArray.toArrayList();
for (int i = 0; i < readableArray.size(); i++) {
ReadableType readableType = readableArray.getType(i);
if (readableType == readableType.Map) {
if (readableArray.getMap(i).hasKey("type") &&
readableArray.getMap(i).getString("type").equals("UNIX_timestamp")) {
double unixTimestamp = readableArray.getMap(i).getDouble("value");
parsedList.set(i, new Date((long) unixTimestamp));
} else {
parsedList.set(i, parseReadableMap(readableArray.getMap(i)));
}
} else if (readableType == readableType.Array) {
parsedList.set(i, parseReadableArray(readableArray.getArray(i)));
}
}
return properties;
return parsedList;
}

@ReactMethod
Expand Down Expand Up @@ -437,6 +438,28 @@ public void onSuccess(@NonNull BrazeUser brazeUser) {
});
}

@ReactMethod
public void addToSubscriptionGroup(String groupId, final Callback callback) {
Braze.getInstance(getReactApplicationContext()).getCurrentUser(new SimpleValueCallback<BrazeUser>() {
@Override
public void onSuccess(@NonNull BrazeUser brazeUser) {
boolean result = brazeUser.addToSubscriptionGroup(groupId);
reportResultWithCallback(callback, null, result);
}
});
}

@ReactMethod
public void removeFromSubscriptionGroup(String groupId, final Callback callback) {
Braze.getInstance(getReactApplicationContext()).getCurrentUser(new SimpleValueCallback<BrazeUser>() {
@Override
public void onSuccess(@NonNull BrazeUser brazeUser) {
boolean result = brazeUser.removeFromSubscriptionGroup(groupId);
reportResultWithCallback(callback, null, result);
}
});
}

@ReactMethod
public void setPushNotificationSubscriptionType(String subscriptionType, final Callback callback) {
final NotificationSubscriptionType notificationSubscriptionType;
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/res/values/braze.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--- Internal Braze Usage -->
<string translatable="false" name="com_appboy_sdk_flavor">REACT</string>
<string translatable="false" name="com_braze_sdk_flavor">REACT</string>
</resources>
Loading

0 comments on commit 7ed2e65

Please sign in to comment.