diff --git a/ts/boot/configurePushNotification.ts b/ts/boot/configurePushNotification.ts index e6c4e6b516a..514cd86f88a 100644 --- a/ts/boot/configurePushNotification.ts +++ b/ts/boot/configurePushNotification.ts @@ -8,6 +8,7 @@ import { NonEmptyString } from "italia-ts-commons/lib/strings"; import { Alert } from "react-native"; import PushNotification from "react-native-push-notification"; +import { constNull } from "fp-ts/lib/function"; import { store } from "../App"; import { debugRemotePushNotification, gcmSenderId } from "../config"; import { loadMessages } from "../store/actions/messages"; @@ -16,6 +17,7 @@ import { updateNotificationsPendingMessage } from "../store/actions/notifications"; import { isDevEnv } from "../utils/environment"; +import { setMixpanelPushNotificationToken } from "../mixpanel"; /** * Helper type used to validate the notification payload. @@ -36,6 +38,10 @@ function configurePushNotifications() { PushNotification.configure({ // Called when token is generated onRegister: token => { + // set push notification token on mixpanel + setMixpanelPushNotificationToken(token.token) + .then(constNull) + .catch(constNull); // Dispatch an action to save the token in the store store.dispatch(updateNotificationsInstallationToken(token.token)); }, diff --git a/ts/components/wallet/PaymentMethodsList.tsx b/ts/components/wallet/PaymentMethodsList.tsx index 03e559f23e4..5d339abd0e9 100644 --- a/ts/components/wallet/PaymentMethodsList.tsx +++ b/ts/components/wallet/PaymentMethodsList.tsx @@ -4,7 +4,13 @@ */ import { Badge, ListItem, Text, View } from "native-base"; import * as React from "react"; -import { Alert, FlatList, ListRenderItemInfo, StyleSheet } from "react-native"; +import { + Alert, + FlatList, + ListRenderItemInfo, + Platform, + StyleSheet +} from "react-native"; import { connect } from "react-redux"; import { Option } from "fp-ts/lib/Option"; import { H3 } from "../core/typography/H3"; @@ -61,7 +67,11 @@ const styles = StyleSheet.create({ descriptionPadding: { paddingRight: 24 }, badgeContainer: { height: 18, backgroundColor: IOColors.blue }, - badgeText: { fontSize: 12, lineHeight: 18 } + badgeText: { + fontSize: 12, + lineHeight: 18, + marginBottom: Platform.select({ android: 2, default: 0 }) + } }); export const showPaymentMethodIncomingAlert = () => diff --git a/ts/mixpanel.ts b/ts/mixpanel.ts index ee262c17f6f..e249fea4423 100644 --- a/ts/mixpanel.ts +++ b/ts/mixpanel.ts @@ -33,3 +33,10 @@ const setupMixpanel = async (mp: MixpanelInstance) => { // Identify the user using the device uniqueId await mp.identify(DeviceInfo.getUniqueId()); }; + +export const setMixpanelPushNotificationToken = (token: string) => { + if (mixpanel) { + return mixpanel.setPushRegistrationId(token); + } + return Promise.resolve(); +};