Skip to content

Commit

Permalink
chore: apns sample fixes (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 authored Jul 25, 2023
1 parent f51c673 commit a5e4a60
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 60 deletions.
12 changes: 10 additions & 2 deletions Apps/APN/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from 'react';
import { ActivityIndicator } from 'react-native';
import { ActivityIndicator, SafeAreaView, StyleSheet } from 'react-native';
import CustomerIoSDKConfig from './src/data/sdk/CustomerIoSDKConfig';
import AppNavigator from './src/navigation/AppNavigator';
import {
Expand Down Expand Up @@ -106,8 +106,16 @@ export default function App() {
return (
<CustomerIoSdkContext.Provider value={customerIoSdkState}>
<UserStateContext.Provider value={userState}>
<AppNavigator />
<SafeAreaView style={styles.container}>
<AppNavigator />
</SafeAreaView>
</UserStateContext.Provider>
</CustomerIoSdkContext.Provider>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
},
});
14 changes: 7 additions & 7 deletions Apps/APN/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
PODS:
- boost (1.76.0)
- customerio-reactnative (3.1.5):
- customerio-reactnative/nopush (= 3.1.5)
- customerio-reactnative (3.1.6):
- customerio-reactnative/nopush (= 3.1.6)
- CustomerIO/MessagingInApp (= 2.7.4)
- CustomerIO/Tracking (= 2.7.4)
- React-Core
- customerio-reactnative-richpush/apn (3.1.5):
- customerio-reactnative-richpush/apn (3.1.6):
- CustomerIO/MessagingPushAPN (= 2.7.4)
- customerio-reactnative/apn (3.1.5):
- customerio-reactnative/apn (3.1.6):
- CustomerIO/MessagingInApp (= 2.7.4)
- CustomerIO/MessagingPushAPN (= 2.7.4)
- CustomerIO/Tracking (= 2.7.4)
- React-Core
- customerio-reactnative/nopush (3.1.5):
- customerio-reactnative/nopush (3.1.6):
- CustomerIO/MessagingInApp (= 2.7.4)
- CustomerIO/Tracking (= 2.7.4)
- React-Core
Expand Down Expand Up @@ -545,8 +545,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
CustomerIO: fc932c67b92a71cb25edc4699d1bbfcbd74aa960
customerio-reactnative: 8f3913c1251ecfb7e0c62ce235824a95a4ec8a51
customerio-reactnative-richpush: 5d991f0b018db8d098c29f2ccadf7585f45f04cf
customerio-reactnative: 903f1ac499962a6b34518d9fcb15ff709b2eea5c
customerio-reactnative-richpush: 59c7b5c08aaa7f9e7f6e34c3efcbd1c011d79bea
CustomerIOCommon: d26701acf4ffa6e7dfff82d5a4902d9ab034fec5
CustomerIOMessagingInApp: 431a7033a25292c09f8adc8c8e65ddd482ad7932
CustomerIOMessagingPush: c24b9cc5babcd5a707c9d2c5f66deb236a976fe0
Expand Down
1 change: 1 addition & 0 deletions Apps/APN/src/components/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const TextField = ({
onSubmitEditing={onSubmitEditing}
returnKeyType={returnKeyType}
accessibilityLabel={contentDesc}
placeholderTextColor={Colors.INPUT_FIELD_HINT_COLOR}
{...textInputProps}
/>
{leadingIconImageSource && (
Expand Down
1 change: 1 addition & 0 deletions Apps/APN/src/constants/Colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const PRIMARY_COLOR = '#3C437D';
export const SECONDARY_COLOR = '#7131FF';
export const CONTAINER_BACKGROUND_COLOR = '#FFFFFF';
export const INPUT_FIELD_BORDER_COLOR = 'rgba(0, 0, 0, 0.12)';
export const INPUT_FIELD_HINT_COLOR = 'rgba(0, 0, 0, 0.12)';
export const SWITCH_THUMB_COLOR_ON = '#FFFFFF';
export const SWITCH_THUMB_COLOR_OFF = '#F3F3F3';
export const SWITCH_TRACK_COLOR_ON = '#34C759';
Expand Down
26 changes: 0 additions & 26 deletions Apps/APN/src/screens/Attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,7 @@ const Attributes = ({ route }) => {
throw new Error(`Invalid screen prop: ${screen}.`);
}

const isFormValid = () => {
let message;
let emptyFieldMessageBuilder = (fieldName) => {
return `${fieldName} cannot be empty`;
};

if (!attributeName) {
message = emptyFieldMessageBuilder('Attribute Name');
} else if (!attributeValue) {
message = emptyFieldMessageBuilder('Attribute Value');
}

if (message) {
Prompts.showAlert({
title: 'Error',
message: message,
});
return false;
}
return true;
};

const handleSendPress = () => {
if (!isFormValid()) {
return;
}

switch (screen) {
case Screen.DEVICE_ATTRIBUTES:
trackDeviceAttribute(attributeName, attributeValue);
Expand Down
24 changes: 0 additions & 24 deletions Apps/APN/src/screens/CustomEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,7 @@ const CustomEvent = () => {
const [propertyName, setPropertyName] = useState('');
const [propertyValue, setPropertyValue] = useState('');

const isFormValid = () => {
let message;
let emptyFieldMessageBuilder = (fieldName) => {
return `${fieldName} cannot be empty`;
};

if (!eventName) {
message = emptyFieldMessageBuilder('Event Name');
}

if (message) {
Prompts.showAlert({
title: 'Error',
message: message,
});
return false;
}
return true;
};

const handleSendPress = () => {
if (!isFormValid()) {
return;
}

trackEvent(eventName, propertyName, propertyValue);
Prompts.showSnackbar({ text: 'Event sent successfully' });
};
Expand Down
2 changes: 1 addition & 1 deletion Apps/APN/src/screens/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Dashboard = ({ navigation }) => {

eventName = 'appointmentScheduled';
propertyName = 'appointmentTime';
propertyValue = appointmentTime.getTime() / 1000;
propertyValue = Math.round(appointmentTime.getTime() / 1000);
break;

case 2:
Expand Down

0 comments on commit a5e4a60

Please sign in to comment.