Skip to content

Commit

Permalink
Merge branch 'ootb-views' into MB_BannerView
Browse files Browse the repository at this point in the history
  • Loading branch information
hani-iterable authored Mar 21, 2024
2 parents 804ce96 + 26d7b7b commit 94bfd5f
Show file tree
Hide file tree
Showing 25 changed files with 1,604 additions and 1,083 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
## 1.3.17
## Fixed
- Fixes a specific Android issue where apps could crash due to EncryptedSharedPreference being null.

## 1.3.16
## Updates

This release allows you to use projects hosted on Iterable's EU data center. If your project is hosted on Iterable's [European data center (EUDC)](https://support.iterable.com/hc/articles/17572750887444), configure the SDK to use Iterable's EU-based API endpoints:

```javascript
const config = new IterableConfig();
// ... other configuration options ...
config.dataRegion = IterableDataRegion.EU;
Iterable.initialize('<YOUR_API_KEY>', config);
```

## Fixed
- Addressed push notification deep linking issues on Android where the app would restart instead of resuming the last activity upon being backgrounded.
- Resolves an additional push notification problem on Android wherein the customActionHandler and urlHandler were not being invoked in specific scenarios, as documented in issue #470. (Credit to @tnortman-jabra for the report and the fix)

## 1.3.15
## Updates
- Resolves Android build issues caused in 1.3.14
- Fixes a specific Android issue where custom action handlers were not invoked when tapping on push notification when the app is in background.

## 1.3.14
> **Warning**
> This version causes build failure on Android. Please use 1.3.15 which fixes this issue.
## updates
- updates `Iterable.setEmail` and `Iterable.setUserId` to take in null parameter type
- fixes `Iterable.updateUser` on the Android side to merge nested objects in the user profile when `mergeNestedObjects` is set to true

## 1.3.9
### Added

Expand Down
2 changes: 1 addition & 1 deletion Iterable-React-Native-SDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ Pod::Spec.new do |s|

s.swift_version = '5.3'

s.dependency 'Iterable-iOS-SDK', '~> 6.4.12'
s.dependency 'Iterable-iOS-SDK', '~> 6.4.15'
s.dependency 'React-Core'
end
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ For quick reference, the following table lists the versions of the [Android SDK]

| RN SDK Version | Android SDK Version | iOS SDK Version |
| --------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | --------------- |
| [1.3.17](https://www.npmjs.com/package/@iterable/react-native-sdk/v/1.3.16) | [3.4.16](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.4.16) | [6.4.15](https://github.com/Iterable/swift-sdk/releases/tag/6.4.15)
| [1.3.16](https://www.npmjs.com/package/@iterable/react-native-sdk/v/1.3.16) | [3.4.15](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.4.15) | [6.4.15](https://github.com/Iterable/swift-sdk/releases/tag/6.4.15)
| [1.3.15](https://www.npmjs.com/package/@iterable/react-native-sdk/v/1.3.15) | [3.4.14](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.4.14) | [6.4.14](https://github.com/Iterable/swift-sdk/releases/tag/6.4.14)
| [1.3.14](https://www.npmjs.com/package/@iterable/react-native-sdk/v/1.3.14) | [3.4.13](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.4.13) | [6.4.14](https://github.com/Iterable/swift-sdk/releases/tag/6.4.14)
| [1.3.13](https://www.npmjs.com/package/@iterable/react-native-sdk/v/1.3.13) | [3.4.11](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.4.11) | [6.4.12](https://github.com/Iterable/swift-sdk/releases/tag/6.4.12)
| [1.3.12](https://www.npmjs.com/package/@iterable/react-native-sdk/v/1.3.12) | [3.4.10](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.4.10) | [6.4.12](https://github.com/Iterable/swift-sdk/releases/tag/6.4.12)
| [1.3.11](https://www.npmjs.com/package/@iterable/react-native-sdk/v/1.3.11) | [3.4.10](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.4.10) | [6.4.11](https://github.com/Iterable/swift-sdk/releases/tag/6.4.11)
| [1.3.10](https://www.npmjs.com/package/@iterable/react-native-sdk/v/1.3.10) | [3.4.10](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.4.10) | [6.4.10](https://github.com/Iterable/swift-sdk/releases/tag/6.4.10) |
Expand Down
2 changes: 2 additions & 0 deletions SampleApp/javascript/js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { coffees } from './Data';
import { createStackNavigator } from '@react-navigation/stack';
import HomeScreen from './HomeScreen';
import BannerViewScreen from './BannerViewScreen';
import NotificationViewScreen from './NotificationViewScreen';

const Stack = createStackNavigator();

Expand Down Expand Up @@ -55,6 +56,7 @@ export default class App extends React.Component {
<Stack.Navigator>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="BannerView" component={BannerViewScreen} />
<Stack.Screen name="NotificationView" component={NotificationViewScreen} />
</Stack.Navigator>
</NavigationContainer>)
}
Expand Down
13 changes: 7 additions & 6 deletions SampleApp/javascript/js/HomeScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ export default class HomeScreen extends Component {
constructor(props) {
super(props);
}

navigateToCardView() {
console.log("Card View");
}


navigateToBannerView() {
console.log("Banner View");
this.props.navigation.navigate('BannerView');
}

navigateToNotificationView() {
console.log("Notification View");
}

navigateToBannerView() {
this.props.navigation.navigate('BannerView');
this.props.navigation.navigate('NotificationView');
}

render() {
Expand Down
13 changes: 13 additions & 0 deletions SampleApp/javascript/js/NotificationViewScreen.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component } from 'react';
import { RouteProp } from '@react-navigation/native';
import { StackNavigationProp } from '@react-navigation/stack';

declare type NotificationViewScreenProps = {
route: RouteProp<any, 'NotificationView'>;
navigation: StackNavigationProp<any>;
};
export default class NotificationViewScreen extends Component<NotificationViewScreenProps> {
constructor(props: NotificationViewScreenProps);
render(): JSX.Element;
}
export {};
37 changes: 37 additions & 0 deletions SampleApp/javascript/js/NotificationViewScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { Component } from 'react';
import { View } from 'react-native';
import IterableNotificationView from './components/IterableNotificationView';

export default class BannerViewScreen extends Component {
constructor(props) {
super(props);
}

render() {
return <View style={{ flex: 1, padding: 10 }}>
<IterableNotificationView
titleText='Turn on notifications'
titleTextColor='#2489A9'
subTitleText='Get updates on scheduled and trending classes.'
subTitleTextColor='#2489A9'
btnPrimaryText={'Turn on'}
btnPrimaryBgColor={'white'}
btnPrimaryTextColor={'#2489A9'}
backgroundColor={'#C2F0FC'}
/>
<IterableNotificationView
titleText='Turn on notifications 2'
subTitleText='Get updates on scheduled and trending classes.'
titleTextColor='#2489A9'
isShowbtnSecondary={true}
subTitleTextColor='#2489A9'
btnPrimaryText={'Turn on'}
btnPrimaryBgColor={'white'}
btnPrimaryTextColor={'#2489A9'}
backgroundColor={'#C2F0FC'}
btnSecondaryText={'Not now'}
btnSecondaryTextColor={'#2489A9'}
/>
</View>
}
}
68 changes: 68 additions & 0 deletions SampleApp/javascript/js/components/IterableNotificationView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// @ts-nocheck
import React from 'react'
import {
View,
Text,
TouchableOpacity
} from 'react-native'
import {
containerProps,
imageProps,
titleLabelProps,
subTitleLabelProps,
btnPrimaryProps,
btnSecondaryProps
} from '../types/commonType';

type notificationViewProps = containerProps & imageProps & titleLabelProps & subTitleLabelProps & btnPrimaryProps & btnSecondaryProps

const IterableNotificationView = (props: notificationViewProps) => {
const notificationBorderRadius = props.borderRadius ? props.borderRadius : 10;

return (
<View style={{
marginBottom: 20,
borderRadius: notificationBorderRadius,
backgroundColor: props?.backgroundColor ? props?.backgroundColor : '#E4E4E4',
shadowColor: props?.shadowColor ? props?.shadowColor : '#470000',
shadowOffset: {
width: props?.shadowWidth ? props?.shadowWidth : 0,
height: props?.shadowHeight ? props?.shadowHeight : 1
},
shadowOpacity: props?.shadowOpacity ? props?.shadowOpacity : 0.2,
elevation: 1
}}>
<View style={{ paddingHorizontal: 10 }}>
<Text style={{ fontSize: props?.titleFontSize ? props?.titleFontSize : 18, color: props?.titleTextColor ? props?.titleTextColor : 'black', marginVertical: 10, fontWeight: '700' }}>
{props?.titleText ? props?.titleText : 'Notification View Title'}
</Text>
<Text style={{ fontSize: props?.subTitleFontSize ? props?.subTitleFontSize : 16, color: props?.subTitleTextColor ? props?.subTitleTextColor : 'black', marginVertical: 6 }}>
{props?.subTitleText ? props?.subTitleText : "Lorem ipsum dummy text, Lorem ipsum dummy text, Lorem ipsum dummy text, Lorem ipsum dummy text"}
</Text>
<View style={{ flexDirection: 'row', alignItems: 'center', marginVertical: 18 }}>
<TouchableOpacity onPress={() => props?.btnPrimaryOnClick ? props?.btnPrimaryOnClick() : null}
style={{ height: 35, paddingHorizontal: 10, borderRadius: 25, justifyContent: 'center', alignItems: 'center', backgroundColor: props?.btnPrimaryBgColor ? props?.btnPrimaryBgColor : '#6A266D' }}>
<Text style={{
fontSize: props?.btnPrimaryFontSize ? props?.btnPrimaryFontSize : 14,
color: props?.btnPrimaryTextColor ? props?.btnPrimaryTextColor : 'white',
fontWeight: 'bold'
}}>
{props?.btnPrimaryText ? props.btnPrimaryText : "Learn more"}
</Text>
</TouchableOpacity>
{props?.isShowbtnSecondary ? <TouchableOpacity onPress={() => props?.btnSecondaryOnClick ? props?.btnSecondaryOnClick() : null} style={{ justifyContent: 'center', alignItems: 'center', marginLeft: 20 }}>
<Text style={{
fontSize: props?.btnSecondaryFontSize ? props?.btnSecondaryFontSize : 14,
color: props?.btnSecondaryTextColor ? props?.btnSecondaryTextColor : 'black',
fontWeight: 'bold'
}}>
{props?.btnSecondaryText ? props?.btnSecondaryText : "action"}
</Text>
</TouchableOpacity> : null}
</View>
</View>
</View>
)
}

export default IterableNotificationView
2 changes: 1 addition & 1 deletion SampleApp/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "eslint ."
},
"dependencies": {
"@iterable/react-native-sdk": "^1.3.12",
"@iterable/react-native-sdk": "^1.3.16",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/toolbar-android": "^0.1.0-rc.2",
"@react-navigation/bottom-tabs": "^5.4.5",
Expand Down
2 changes: 1 addition & 1 deletion SampleApp/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "eslint ."
},
"dependencies": {
"@iterable/react-native-sdk": "^1.3.12",
"@iterable/react-native-sdk": "^1.3.16",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/toolbar-android": "^0.1.0-rc.2",
"@react-navigation/bottom-tabs": "^5.4.5",
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def getModuleVersion() {

dependencies {
implementation 'com.facebook.react:react-native:+'
api 'com.iterable:iterableapi:3.4.10'
api 'com.iterable:iterableapi:3.4.16'
// api project(':iterableapi') // links to local android SDK repo rather than by release
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void setUserId(@Nullable String userId, @Nullable String authToken) {
@ReactMethod
public void updateUser(ReadableMap dataFields, Boolean mergeNestedObjects) {
IterableLogger.v(TAG, "updateUser");
IterableApi.getInstance().updateUser(optSerializedDataFields(dataFields));
IterableApi.getInstance().updateUser(optSerializedDataFields(dataFields), mergeNestedObjects);
}

@ReactMethod
Expand Down
23 changes: 23 additions & 0 deletions android/src/main/java/com/iterable/reactnative/Serialization.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.iterable.iterableapi.IterableAction;
import com.iterable.iterableapi.IterableActionContext;
import com.iterable.iterableapi.IterableConfig;
import com.iterable.iterableapi.IterableDataRegion;
import com.iterable.iterableapi.IterableInAppCloseAction;
import com.iterable.iterableapi.IterableInAppDeleteActionType;
import com.iterable.iterableapi.IterableInAppHandler;
Expand Down Expand Up @@ -198,6 +199,28 @@ static IterableConfig.Builder getConfigFromReadableMap(ReadableMap iterableConte
configBuilder.setLogLevel(logLevel);
}

if(iterableContextJSON.has("dataRegion")) {
int dataRegion = iterableContextJSON.getInt("dataRegion");
IterableDataRegion iterableDataRegion = IterableDataRegion.US;
switch (dataRegion) {
case 0:
iterableDataRegion = IterableDataRegion.US;
break;
case 1:
iterableDataRegion = IterableDataRegion.EU;
break;
default:
iterableDataRegion = IterableDataRegion.US;
break;
}

configBuilder.setDataRegion(iterableDataRegion);
}

if (iterableContextJSON.has("encryptionEnforced")) {
configBuilder.setEncryptionEnforced(iterableContextJSON.optBoolean("encryptionEnforced"));
}

return configBuilder;
} catch (JSONException e) {
e.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion integration-testing/ios/example/ReactE2E.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ReactE2E: RCTEventEmitter {
let campaignId = params["campaignId"] as! Int
_ = IterableAPISupport.sendInApp(apiKey: apiKey, to: email, withCampaignId: campaignId)
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
_ = IterableAPI.internalImplementation?.inAppManager.scheduleSync()
_ = IterableAPI.implementation?.inAppManager.scheduleSync()
}
break
default:
Expand Down
2 changes: 1 addition & 1 deletion integration-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"e2e:android-release": "npm run build:android-release && npm run test:android-release"
},
"dependencies": {
"@iterable/react-native-sdk": "^1.3.12",
"@iterable/react-native-sdk": "^1.3.16",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/bottom-tabs": "^5.4.5",
"@react-navigation/native": "^5.4.0",
Expand Down
12 changes: 12 additions & 0 deletions ios/RNIterableAPI/Serialization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ extension IterableConfig {
if let useInMemoryStorageForInApp = dict["useInMemoryStorageForInApps"] as? Bool {
config.useInMemoryStorageForInApps = useInMemoryStorageForInApp
}

if let dataRegion = dict["dataRegion"] as? NSNumber {
switch dataRegion {
case 0:
config.dataRegion = IterableDataRegion.US
case 1:
config.dataRegion = IterableDataRegion.EU
default:
config.dataRegion = IterableDataRegion.US
}
}


return config
}
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": "@iterable/react-native-sdk",
"version": "1.3.12",
"version": "1.3.17",
"description": "Iterable SDK for React Native.",
"main": "./js/index.js",
"types": "./js/index.d.ts",
Expand Down
12 changes: 6 additions & 6 deletions ts/Iterable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ class Iterable {
*
* Note: specify a user by calling Iterable.setEmail or Iterable.setUserId, but NOT both.
*
* @param {string | undefined} email email address to associate with the current user
* @param {string | undefined} authToken valid, pre-fecthed JWT the SDK can use to authenticate API requests, optional - if null/undefined, no JWT related action will be taken
* @param {string | null | undefined} email email address to associate with the current user
* @param {string | null | undefined} authToken valid, pre-fetched JWT the SDK can use to authenticate API requests, optional - if null/undefined, no JWT related action will be taken
*/

static setEmail(email: string | undefined, authToken?: string | undefined) {
static setEmail(email?: string | null, authToken?: string | null) {
Iterable.logger.log("setEmail: " + email)

RNIterableAPI.setEmail(email, authToken)
Expand Down Expand Up @@ -262,11 +262,11 @@ class Iterable {
*
* Note: specify a user by calling Iterable.setEmail or Iterable.setUserId, but NOT both.
*
* parameters: @param {string | undefined} userId user ID to associate with the current user
* optional parameter: @param {string | undefined} authToken valid, pre-fecthed JWT the SDK can use to authenticate API requests, optional - if null/undefined, no JWT related action will be taken
* parameters: @param {string | null | undefined} userId user ID to associate with the current user
* optional parameter: @param {string | null | undefined} authToken valid, pre-fetched JWT the SDK can use to authenticate API requests, optional - if null/undefined, no JWT related action will be taken
*/

static setUserId(userId: string | undefined, authToken?: string | undefined) {
static setUserId(userId?: string | null, authToken?: string | null) {
Iterable.logger.log("setUserId: " + userId)

RNIterableAPI.setUserId(userId, authToken)
Expand Down
Loading

0 comments on commit 94bfd5f

Please sign in to comment.