Skip to content

Commit

Permalink
Release Cordova SDK version 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jerielng committed May 10, 2023
1 parent 567c6ec commit cdc03d7
Show file tree
Hide file tree
Showing 15 changed files with 579 additions and 339 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## 4.0.0

##### Breaking
- Renamed instances of `Appboy` to `Braze`.
- To ensure that your project is properly migrated to the new naming conventions, note and replace the following instances in your project:
- The plugin has been renamed from `cordova-plugin-appboy` to `cordova-plugin-braze`.
- Ensure that you run `cordova plugin remove cordova-plugin-appboy` and then re-add the plugin using the instructions in the [README](./README.md).
- This GitHub repository has been moved to the URL `https://github.com/braze-inc/braze-cordova-sdk`.
- In your project's `config.xml` file, rename instances of `com.appboy` to `com.braze` for each of your configuration property keys.
- The JavaScript class interface `AppboyPlugin` has been renamed to `BrazePlugin`.
- Updated to [Braze Android SDK 25.0.0](https://github.com/braze-inc/braze-android-sdk/blob/master/CHANGELOG.md#2500).
- Updated to [Braze Swift SDK 5.13.0](https://github.com/braze-inc/braze-swift-sdk/releases/tag/5.13.0).
- This update fixes the iOS behavior introduced in version `2.33.0` when logging clicks for content cards. Calling `logContentCardClicked` now only sends a click event for metrics, instead of both sending a click event as well as redirecting to the associated `url` field.
- For instance, to log a content card click and redirect to a URL, you will need two commands:
```
BrazePlugin.logContentCardClicked(contentCardId);
// Your own custom implementation
YourApp.openUrl(contentCard["url"]);
```
- This brings the iOS behavior to match pre-`2.33.0` versions and bring parity with Android's behavior.

##### Added
- Added property methods for Feature Flags: `getFeatureFlagBooleanProperty(id, key)`, `getFeatureFlagStringProperty(id, key)`, `getFeatureFlagNumberProperty(id, key)`

## 3.0.0

##### Added
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="https://github.com/Appboy/appboy-cordova-sdk/blob/master/braze-logo.png" width="300" title="Braze Logo" />
<img src="https://github.com/braze-inc/braze-cordova-sdk/blob/master/braze-logo.png" width="300" title="Braze Logo" />

# Cordova SDK

Expand All @@ -9,8 +9,8 @@ See our [Technical Documentation for Android](https://www.braze.com/docs/develop
# Running the sample application

```
cordova plugin remove cordova-plugin-appboy
cordova plugin add https://github.com/appboy/appboy-cordova-sdk#master
cordova plugin remove cordova-plugin-braze
cordova plugin add https://github.com/braze-inc/braze-cordova-sdk#master
# To run android
cordova run android
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "appboy-cordova-sdk",
"version": "3.0.0",
"main": "www/AppboyPlugin.js"
"name": "braze-cordova-sdk",
"version": "4.0.0",
"main": "www/BrazePlugin.js"
}
15 changes: 8 additions & 7 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-appboy" version="3.0.0">
id="cordova-plugin-braze" version="4.0.0">
<name>Device</name>
<description>Braze Cordova SDK</description>
<license>MIT</license>
<keywords>cordova,appboy,braze</keywords>
<js-module src="www/AppboyPlugin.js" name="AppboyPlugin">
<js-module src="www/BrazePlugin.js" name="BrazePlugin">
<clobbers target="BrazePlugin" />
<clobbers target="AppboyPlugin" />
</js-module>

<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="AppboyPlugin">
<feature name="BrazePlugin">
<param name="android-package" value="com.braze.cordova.BrazePlugin" />
<param name="onload" value="true" />
</feature>
Expand All @@ -38,7 +39,7 @@
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="AppboyPlugin">
<feature name="BrazePlugin">
<param name="ios-package" value="BrazePlugin" />
<param name="onload" value="true" />
</feature>
Expand All @@ -53,9 +54,9 @@
<source url="https://cdn.cocoapods.org/"/>
</config>
<pods use-frameworks="true">
<pod name="BrazeKit" spec="~> 5.11.0" />
<pod name="BrazeUI" spec="~> 5.11.0" />
<pod name="BrazeLocation" spec="~> 5.11.0" />
<pod name="BrazeKit" spec="~> 5.13.0" />
<pod name="BrazeUI" spec="~> 5.13.0" />
<pod name="BrazeLocation" spec="~> 5.13.0" />
</pods>
</podspec>
</platform>
Expand Down
36 changes: 18 additions & 18 deletions sample-project/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.appboy.hellocordova"
<widget id="com.braze.hellocordova"
version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
Expand Down Expand Up @@ -30,15 +30,15 @@
<preference name="android-compileSdkVersion" value="33" />
<preference name="GradleVersion" value="7.3.3" />
<preference name="AndroidXEnabled" value="true" />
<preference name="com.appboy.api_key" value="ec67377e-c490-4959-8c58-c045a254a65a" />
<preference name="com.appboy.android_api_endpoint" value="sondheim.braze.com" />
<preference name="com.appboy.firebase_cloud_messaging_registration_enabled" value="true" />
<preference name="com.appboy.android_fcm_sender_id" value="str_900857597716" />
<preference name="com.appboy.android_default_session_timeout" value="str_5" />
<preference name="com.appboy.android_handle_push_deep_links_automatically" value="true" />
<preference name="com.appboy.android_log_level" value="0" />
<preference name="com.appboy.enable_location_collection" value="false" />
<preference name="com.appboy.geofences_enabled" value="false" />
<preference name="com.braze.api_key" value="ec67377e-c490-4959-8c58-c045a254a65a" />
<preference name="com.braze.android_api_endpoint" value="sondheim.braze.com" />
<preference name="com.braze.firebase_cloud_messaging_registration_enabled" value="true" />
<preference name="com.braze.android_fcm_sender_id" value="str_900857597716" />
<preference name="com.braze.android_default_session_timeout" value="str_5" />
<preference name="com.braze.android_handle_push_deep_links_automatically" value="true" />
<preference name="com.braze.android_log_level" value="0" />
<preference name="com.braze.enable_location_collection" value="false" />
<preference name="com.braze.geofences_enabled" value="false" />

<edit-config
file="app/src/main/AndroidManifest.xml"
Expand All @@ -50,14 +50,14 @@
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<preference name="com.appboy.ios_api_endpoint" value="sondheim.braze.com" />
<preference name="com.appboy.api_key" value="56614add-1d2c-4bd3-a22d-023164fca958" />
<preference name="com.appboy.ios_disable_automatic_push_registration" value="NO" />
<preference name="com.appboy.ios_enable_idfa_automatic_collection" value="YES" />
<preference name="com.appboy.enable_location_collection" value="NO" />
<preference name="com.appboy.geofences_enabled" value="NO" />
<preference name="com.appboy.display_foreground_push_notifications" value="YES" />
<preference name="com.braze.ios_api_endpoint" value="sondheim.braze.com" />
<preference name="com.braze.api_key" value="56614add-1d2c-4bd3-a22d-023164fca958" />
<preference name="com.braze.ios_disable_automatic_push_registration" value="NO" />
<preference name="com.braze.ios_enable_idfa_automatic_collection" value="YES" />
<preference name="com.braze.enable_location_collection" value="NO" />
<preference name="com.braze.geofences_enabled" value="NO" />
<preference name="com.braze.display_foreground_push_notifications" value="YES" />
<preference name="deployment-target" value="11.0" />
<preference name="com.appboy.ios_disable_un_authorization_option_provisional" value="NO" />
<preference name="com.braze.ios_disable_un_authorization_option_provisional" value="NO" />
</platform>
</widget>
6 changes: 3 additions & 3 deletions sample-project/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "com.appboy.hellocordova",
"name": "com.braze.hellocordova",
"version": "2.3.2",
"displayName": "HelloCordova",
"cordova": {
Expand All @@ -8,7 +8,7 @@
"android"
],
"plugins": {
"cordova-plugin-appboy": {}
"cordova-plugin-braze": {}
}
},
"dependencies": {
Expand All @@ -22,7 +22,7 @@
"xcode": "^3.0.1"
},
"devDependencies": {
"appboy-cordova-sdk": "file:../local",
"braze-cordova-sdk": "file:../local",
"cordova-android": "^11.0.0",
"cordova-ios": "^6.2.0"
}
Expand Down
6 changes: 4 additions & 2 deletions sample-project/www/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,18 @@ h1 {
#snackbar {
visibility: hidden; /* Hidden by default. Visible on click */
min-width: 250px; /* Set a default minimum width */
margin-left: -125px; /* Divide value of min-width by 2 */
background-color: #333; /* Black background color */
color: #fff; /* White text color */
text-align: center; /* Centered text */
border-radius: 2px; /* Rounded borders */
padding: 16px; /* Padding */
position: fixed; /* Sit on top of the screen */
z-index: 1; /* Add a z-index if needed */
left: 50%; /* Center the snackbar */
left: 10%; /* Position the snackbar 10% from the left edge of the viewport */
right: 10%; /* Position the snackbar 10% from the right edge of the viewport */
bottom: 30px; /* 30px from the bottom */
max-width: calc(80%); /* Set a maximum width to keep the snackbar within the viewport */
overflow-wrap: break-word; /* Prevent inner HTML from overflowing */
}

/* Show the snackbar when clicking on a button (class added with JavaScript) */
Expand Down
36 changes: 30 additions & 6 deletions sample-project/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,44 +39,68 @@
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device2</p>
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
<div id="test-container">
<button id="requestFlushBtn">Request Data Flush</button>
<br>
<input type="text" id="changeUserInputId" autocorrect="off" autocapitalize="off" placeholder="External ID" />
<button id="changeUserBtn">Change User</button>
<input type="text" id="changeUserInputId" autocorrect="off" autocapitalize="off" />
<br>
<input type="text" id="logCustomEventId" autocorrect="off" autocapitalize="off" placeholder="Event Name" />
<button id="logCustomEventBtn">Log Custom Event</button>
<br>
<input type="text" id="productId" autocorrect="off" autocapitalize="off" placeholder="Product ID" />
<input type="text" id="purchaseAmount" autocorrect="off" autocapitalize="off" placeholder="Purchase Amount" />
<input type="text" id="purchaseCurrency" autocorrect="off" autocapitalize="off" placeholder="Purchase Currency" />
<input type="text" id="purchaseQuantity" autocorrect="off" autocapitalize="off" placeholder="Purchase Quantity" />
<button id="logPurchaseBtn">Log Purchase</button>
<br>
<button id="setCustomUserAttributeBtn">Set Custom User Attribute</button>
<button id="setUserPropertiesBtn">Set User Properties</button>
<button id="launchNewsFeedBtn">Launch News Feed (Deprecated)</button>
<button id="launchContentCardsBtn">Launch Content Cards</button>
<button id="unsetCustomUserAttributeBtn">Unset Custom User Attribute</button>
<button id="setCustomUserAttributeArrayBtn">Set Custom User Attribute Array</button>
<button id="incrementCustomUserAttributeBtn">Increment Custom User Attribute</button>
<button id="addToCustomUserAttributeArrayBtn">Add To Custom Attribute Array</button>
<button id="removeFromCustomUserAttributeArrayBtn">Remove From Custom Attribute Array</button>
<button id="setAttributionDataBtn">Set Attribution Data</button>
<br>
<button id="launchNewsFeedBtn">Launch News Feed (Deprecated)</button>
<button id="launchContentCardsBtn">Launch Content Cards</button>
<br>
<button id="getNewsFeedUnreadCountBtn">Get News Feed Unread Count</button>
<button id="getNewsFeedCardCountBtn">Get News Feed Card Count</button>
<button id="getCardCountForCategoriesBtn">Get News Feed Card Count for Category</button>
<button id="getUnreadCardCountForCategoriesBtn">Get Unread News Feed Card Count for Category</button>
<button id="getAllNewsFeedCardsBtn">Log all News Feed Cards</button>
<br>
<button id="getAllContentCardsBtn">Log all Content Cards</button>
<button id="logContentCardAnalyticsBtn">Log Content Cards Analytics for first Card</button>
<br>
<input type="text" id="aliasName" autocorrect="off" autocapitalize="off" placeholder="Alias Name" />
<input type="text" id="aliasLabel" autocorrect="off" autocapitalize="off" placeholder="Alias Label" />
<button id="addAliasBtn">Add Alias</button>
<input type="text" id="languageCode" autocorrect="off" autocapitalize="off" placeholder="Language Code" />
<button id="setLanguageBtn">Set Language</button>
<button id="wipeData">Clears all SDK data</button>
<button id="enableSdk">Enables the SDK</button>
<button id="disableSdk">Disables the SDK</button>
<button id="getDeviceId">Gets the Device ID</button>
<button id="requestPushPermission">requestPushPermission()</button>
<input type="text" id="featureFlagInputId" autocorrect="off" autocapitalize="off" />
<button id="requestPushPermission">Request Push Permission (Android Only)</button>
<br>
<input type="text" id="featureFlagInputId" autocorrect="off" autocapitalize="off" placeholder="Feature Flag ID" />
<button id="getFeatureFlagBtn">Get Feature Flag</button>
<button id="getAllFeatureFlagsBtn">Get All Feature Flags</button>
<button id="refreshFeatureFlagsBtn">Refresh Feature Flags</button>
<button id="subscribeToFeatureFlagsBtn">Subscribe to Feature Flag Updates</button>
<input type="text" id="featureFlagPropertyKey" autocorrect="off" autocapitalize="off" placeholder="Property Key" />
<select id="featureFlagPropertyType">
<option value="boolean">Boolean</option>
<option value="number">Number</option>
<option value="string">String</option>
</select>
<button id="getFeatureFlagPropertyBtn">Get Feature Flag Property</button>
</div>
<!-- The snackbar to display messages -->
<div id="snackbar"></div>
Expand Down
Loading

0 comments on commit cdc03d7

Please sign in to comment.