Skip to content

Commit

Permalink
in-app and ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 committed Oct 2, 2024
1 parent e3382b1 commit bc41fec
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
5 changes: 3 additions & 2 deletions Apps/APN/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export default function App() {
prepare();
const inAppEventListener = registerInAppEventListener();

// TODO: Add this when inapp feature is implemented
// inAppEventListener.remove();
return () => {
inAppEventListener.remove();
};
}, [
applyCustomerIoConfig,
handleCustomerIoConfigChanged,
Expand Down
4 changes: 2 additions & 2 deletions Apps/APN/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"clean-install-ios": "./scripts/clean-run-ios.sh",
"dev:update": "../../scripts/dev:update.sh",
"postinstall": "pod update --project-directory=ios",
"preinstall": "npm run dev:update --legacy-peer-deps",
"ci:install": "npm run preinstall && npm ci --legacy-peer-deps && npm run bundle:ios"
"preinstall": "npm run dev:update",
"ci:install": "npm run preinstall && npm ci"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.19.1",
Expand Down
10 changes: 7 additions & 3 deletions Apps/APN/src/services/CustomerIOService.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { CustomerIO, CioLogLevel } from 'customerio-reactnative';
import {
CustomerIO,
CioLogLevel,
InAppMessageEventType,
} from 'customerio-reactnative';

export const initializeCustomerIoSDK = (sdkConfig) => {
const config = {
Expand Down Expand Up @@ -65,7 +69,7 @@ export const requestPushNotificationsPermission = (options) => {

// TODO: Implement this method when inapp feature is added
export const registerInAppEventListener = () => {
/*const logInAppEvent = (name, params) => {
const logInAppEvent = (name, params) => {
console.log(`in-app message: ${name}, params: `, params);
};

Expand Down Expand Up @@ -114,5 +118,5 @@ export const registerInAppEventListener = () => {
default:
onInAppEventReceived('unsupported event', event);
}
});*/
});
};
3 changes: 1 addition & 2 deletions Apps/FCM/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ export default function App() {

// Remove listeners once unmounted
return () => {
// TODO: Add this when inapp feature is implemented
// inAppEventListener.remove();
inAppEventListener.remove();
};
}, [
applyCustomerIoConfig,
Expand Down
25 changes: 14 additions & 11 deletions Apps/FCM/src/services/CustomerIOService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
CioLogLevel,
CustomerIO,
CioPushPermissionOptions
CioPushPermissionOptions,
InAppMessageEvent,
InAppMessageEventType,
} from 'customerio-reactnative';
import User from '../data/models/user';
import CustomerIoSDKConfig from '../data/sdk/CustomerIoSDKConfig';
Expand All @@ -17,18 +19,19 @@ export const initializeCustomerIoSDK = (sdkConfig: CustomerIoSDKConfig) => {
},
logLevel: CioLogLevel.None, // Add logLevel property
};
if (sdkConfig.debugMode) {
config.logLevel = CioLogLevel.Debug;
}
CustomerIO.initialize(config)
if (sdkConfig.debugMode) {
config.logLevel = CioLogLevel.Debug;
}
CustomerIO.initialize(config)
};

export const onUserLoggedIn = (user: User) => {
CustomerIO.identify({ id: user.email,
CustomerIO.identify({
id: user.email,
traits: {
first_name: user.name,
email: user.email,
}
first_name: user.name,
email: user.email,
}
});
};

Expand Down Expand Up @@ -71,7 +74,7 @@ export const requestPushNotificationsPermission = (


export const registerInAppEventListener = () => {
/*const logInAppEvent = (name: string, params: InAppMessageEvent) => {
const logInAppEvent = (name: string, params: InAppMessageEvent) => {
console.log(`in-app message: ${name}, params: `, params);
};

Expand Down Expand Up @@ -122,5 +125,5 @@ export const registerInAppEventListener = () => {
default:
onInAppEventReceived('unsupported event', event);
}
}); */
});
};

0 comments on commit bc41fec

Please sign in to comment.