react-native-appboy-sdk
Advanced tools
Comparing version 1.30.0 to 1.31.0
@@ -28,2 +28,3 @@ const ReactAppboy = require('../index'); | ||
changeUser: jest.fn(), | ||
setSdkAuthenticationSignature: jest.fn(), | ||
setSDKFlavor: jest.fn(), | ||
@@ -250,5 +251,11 @@ logCustomEvent: jest.fn(), | ||
expect(NativeModules.AppboyReactBridge.setSDKFlavor).toBeCalled(); | ||
expect(NativeModules.AppboyReactBridge.changeUser).toBeCalledWith(user_id); | ||
expect(NativeModules.AppboyReactBridge.changeUser).toBeCalledWith(user_id, null); | ||
}); | ||
test('it calls AppboyReactBridge.setSdkAuthenticationSignature', () => { | ||
const signature = "signature"; | ||
ReactAppboy.setSdkAuthenticationSignature(signature); | ||
expect(NativeModules.AppboyReactBridge.setSdkAuthenticationSignature).toBeCalledWith(signature); | ||
}); | ||
test('it calls AppboyReactBridge.logCustomEvent', () => { | ||
@@ -600,2 +607,2 @@ const event_name = "event_name"; | ||
expect(inAppMessage.id).toBe(defaultId); | ||
}); | ||
}); |
@@ -0,1 +1,9 @@ | ||
## 1.31.0 | ||
##### ⚠ Breaking | ||
- Updated the native iOS bridge to [Braze iOS SDK 4.3.1](https://github.com/Appboy/appboy-ios-sdk/blob/master/CHANGELOG.md#431). | ||
##### Added | ||
- Added support for new SDK Authentication feature to the Javascript layer. See `setSdkAuthenticationSignature` on the `Appboy` interface, as well as the optional `signature` parameter on `ReactAppboy.changeUser`. | ||
## 1.30.0 | ||
@@ -2,0 +10,0 @@ |
@@ -55,6 +55,16 @@ // Definitions by: ahanriat <https://github.com/ahanriat> | ||
* @param {string} userId - A unique identifier for this user. | ||
* @param {string} signature - An encrypted signature to add to network requests to authenticate the current user. You can update the signature | ||
* using the `setSdkAuthenticationSignature` method. This signature will only have an effect if SDK Authentication is enabled. | ||
*/ | ||
export function changeUser(userId: string): void; | ||
export function changeUser(userId: string, signature?: string): void; | ||
/** | ||
* Sets the signature to be used to authenticate the current user. You can also set the signature when calling `changeUser`. | ||
* This signature will only have an effect if SDK Authentication is enabled. | ||
* | ||
* @param signature - The signature to add to network requests to authenticate the current user. | ||
*/ | ||
export function setSdkAuthenticationSignature(signature: string): void; | ||
/** | ||
* An alias serves as an alternative unique user identifier. Use aliases to identify users along different | ||
@@ -635,2 +645,3 @@ * dimensions than your core user ID: | ||
CONTENT_CARDS_UPDATED: 'contentCardsUpdated', | ||
SDK_AUTHENTICATION_ERROR: 'sdkAuthenticationError', | ||
} | ||
@@ -637,0 +648,0 @@ export const Events : AppboyEvent; |
15
index.js
@@ -108,9 +108,20 @@ const AppboyReactBridge = require('react-native').NativeModules.AppboyReactBridge; | ||
* @param {string} userId - A unique identifier for this user. | ||
* @param {string} signature - An optional authentication signature to be used with the SDK Authentication feature. | ||
*/ | ||
changeUser: function(userId) { | ||
changeUser: function(userId, signature) { | ||
AppboyReactBridge.setSDKFlavor(); | ||
AppboyReactBridge.changeUser(userId, null); | ||
AppboyReactBridge.changeUser(userId, signature != null ? signature : null); | ||
}, | ||
/** | ||
* Sets the signature to be used to authenticate the current user. You can also set the signature when calling `changeUser`. | ||
* This signature will only have an effect if SDK Authentication is enabled. | ||
* | ||
* @param signature - The signature to add to network requests to authenticate the current user. | ||
*/ | ||
setSdkAuthenticationSignature: function(signature) { | ||
AppboyReactBridge.setSdkAuthenticationSignature(signature); | ||
}, | ||
/** | ||
* An alias serves as an alternative unique user identifier. Use aliases to identify users along different | ||
@@ -117,0 +128,0 @@ * dimensions than your core user ID: |
{ | ||
"name": "react-native-appboy-sdk", | ||
"version": "1.30.0", | ||
"version": "1.31.0", | ||
"description": "Braze SDK for React Native.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
219311
3067