Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/modal/pin/PinModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const Pin = gestureHandlerRootHOC(
dispatch(AppActions.lockAuthorizedUntil(authorizedUntil));

if (context === 'onboarding') {
dispatch(AppActions.setPinInteractionDone());
gotoCreateKeyRef.current();
} else {
dispatch(AppActions.dismissPinModal());
Expand Down
4 changes: 3 additions & 1 deletion src/navigation/onboarding/screens/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
TitleContainer,
} from '../../../components/styled/Containers';
import {H3, Paragraph, TextAlign} from '../../../components/styled/Text';
import {AppEffects} from '../../../store/app';
import {AppActions, AppEffects} from '../../../store/app';
import {useAppDispatch} from '../../../utils/hooks';
import {useThemeType} from '../../../utils/hooks/useThemeType';
import {OnboardingGroupParamList, OnboardingScreens} from '../OnboardingGroup';
Expand Down Expand Up @@ -63,6 +63,7 @@ const NotificationsScreen = ({

const onSkipPressRef = useRef(async () => {
haptic('impactLight');
dispatch(AppActions.setNotificationsInteractionDone());
dispatch(
Analytics.track('Clicked Skip Notifications', {
context: 'onboarding',
Expand Down Expand Up @@ -93,6 +94,7 @@ const NotificationsScreen = ({
const onSetNotificationsPress = async (notificationsAccepted: boolean) => {
const setAndNavigate = (accepted: boolean) => {
haptic('impactLight');
dispatch(AppActions.setNotificationsInteractionDone());
dispatch(AppEffects.setNotifications(accepted));
if (notificationsAccepted) {
dispatch(
Expand Down
35 changes: 22 additions & 13 deletions src/navigation/onboarding/screens/OnboardingStart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ const OnboardingStart = ({navigation}: OnboardingStartScreenProps) => {
const {t} = useTranslation();
const dispatch = useAppDispatch();
const themeType = useThemeType();
const notificationsInteractionDone = useAppSelector(
({APP}) => APP.notificationsInteractionDone,
);
const pinInteractionDone = useAppSelector(({APP}) => APP.pinInteractionDone);
const isPaired = useAppSelector(
({APP, BITPAY_ID}) => !!BITPAY_ID.apiToken[APP.network],
);
Expand Down Expand Up @@ -197,16 +201,6 @@ const OnboardingStart = ({navigation}: OnboardingStartScreenProps) => {
const progressValue = useSharedValue<number>(0);

const onboardingSlides = [
// {
// title: t('Turn crypto into dollars with our BitPay Card'),
// text: t(
// 'Instantly reload your card balance with no conversion fees. Powered by our competitive exchange rates.',
// ),
// subText: t(
// '*Currently available in the USA. More countries coming soon.',
// ),
// img: () => OnboardingImages.card[themeType],
// },
{
title: t('Seamlessly buy & swap'),
text: t(
Expand All @@ -230,6 +224,17 @@ const OnboardingStart = ({navigation}: OnboardingStartScreenProps) => {
},
];

const continueWithoutAnAccount = () => {
haptic('impactLight');
if (!notificationsInteractionDone) {
navigation.navigate('Notifications');
} else if (!pinInteractionDone) {
navigation.navigate('Pin');
} else {
navigation.navigate('CreateKey');
}
};

return (
<OnboardingContainer testID="onboarding-start-view">
<ScrollView scrollEnabled={isNarrowHeight}>
Expand Down Expand Up @@ -309,8 +314,12 @@ const OnboardingStart = ({navigation}: OnboardingStartScreenProps) => {
accessibilityLabel="Continue"
buttonStyle={'primary'}
onPress={() => {
haptic('impactLight');
navigation.navigate('Notifications');
dispatch(
Analytics.track('Clicked Continue', {
context: 'onboarding',
}),
);
continueWithoutAnAccount();
}}>
{t('Continue')}
</Button>
Expand All @@ -330,7 +339,7 @@ const OnboardingStart = ({navigation}: OnboardingStartScreenProps) => {
context: 'onboarding',
}),
);
navigation.navigate('Notifications');
continueWithoutAnAccount();
}}>
<LinkText>{t('Continue without an account')}</LinkText>
</Button>
Expand Down
2 changes: 2 additions & 0 deletions src/navigation/onboarding/screens/Pin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const PinScreen = ({

const onSkipPressRef = useRef(async () => {
haptic('impactLight');
dispatch(AppActions.setPinInteractionDone());
dispatch(
Analytics.track('Clicked Skip Protect Wallet', {
context: 'onboarding',
Expand Down Expand Up @@ -108,6 +109,7 @@ const PinScreen = ({
if (available) {
logger.debug(`[Biometrics] ${biometryType} is supported`);
dispatch(AppActions.biometricLockActive(true));
dispatch(AppActions.setPinInteractionDone());
navigation.navigate('CreateKey');
} else {
dispatch(
Expand Down
8 changes: 8 additions & 0 deletions src/store/app/app.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ export const setNotificationsAccepted = (
payload: notificationsAccepted,
});

export const setNotificationsInteractionDone = (): AppActionType => ({
type: AppActionTypes.SET_NOTIFICATIONS_INTERACTION_DONE,
});

export const setConfirmedTxAccepted = (
confirmedTxAccepted: boolean,
): AppActionType => ({
Expand All @@ -157,6 +161,10 @@ export const setAnnouncementsAccepted = (
payload: announcementsAccepted,
});

export const setPinInteractionDone = (): AppActionType => ({
type: AppActionTypes.SET_PIN_INTERACTION_DONE,
});

export const setEmailNotificationsAccepted = (
accepted: boolean,
email: string | null,
Expand Down
16 changes: 16 additions & 0 deletions src/store/app/app.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ export interface AppState {
showChainSelectorModal: boolean;
chainSelectorModalConfig: ChainSelectorConfig | undefined;
notificationsAccepted: boolean;
notificationsInteractionDone: boolean;
confirmedTxAccepted: boolean;
announcementsAccepted: boolean;
pinInteractionDone: boolean;
emailNotifications: {
accepted: boolean;
email: string | null;
Expand Down Expand Up @@ -211,8 +213,10 @@ const initialState: AppState = {
showChainSelectorModal: false,
chainSelectorModalConfig: undefined,
notificationsAccepted: false,
notificationsInteractionDone: false,
confirmedTxAccepted: false,
announcementsAccepted: false,
pinInteractionDone: false,
emailNotifications: {
accepted: false,
email: null,
Expand Down Expand Up @@ -427,6 +431,12 @@ export const appReducer = (
notificationsAccepted: action.payload,
};

case AppActionTypes.SET_NOTIFICATIONS_INTERACTION_DONE:
return {
...state,
notificationsInteractionDone: true,
};

case AppActionTypes.SET_CONFIRMED_TX_ACCEPTED:
return {
...state,
Expand All @@ -439,6 +449,12 @@ export const appReducer = (
announcementsAccepted: action.payload,
};

case AppActionTypes.SET_PIN_INTERACTION_DONE:
return {
...state,
pinInteractionDone: true,
};

case AppActionTypes.SET_EMAIL_NOTIFICATIONS_ACCEPTED:
return {
...state,
Expand Down
12 changes: 12 additions & 0 deletions src/store/app/app.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ export enum AppActionTypes {
SUCCESS_GENERATE_APP_IDENTITY = 'APP/SUCCESS_GENERATE_APP_IDENTITY',
FAILED_GENERATE_APP_IDENTITY = 'APP/FAILED_GENERATE_APP_IDENTITY',
SET_NOTIFICATIONS_ACCEPTED = 'APP/SET_NOTIFICATIONS_ACCEPTED',
SET_NOTIFICATIONS_INTERACTION_DONE = 'APP/SET_NOTIFICATIONS_INTERACTION_DONE',
SET_CONFIRMED_TX_ACCEPTED = 'APP/SET_CONFIRMED_TX_ACCEPTED',
SET_ANNOUNCEMENTS_ACCEPTED = 'APP/SET_ANNOUNCEMENTS_ACCEPTED',
SET_PIN_INTERACTION_DONE = 'APP/SET_PIN_INTERACTION_DONE',
SET_EMAIL_NOTIFICATIONS_ACCEPTED = 'APP/SET_EMAIL_NOTIFICATIONS_ACCEPTED',
SHOW_ONBOARDING_FINISH_MODAL = 'APP/SHOW_ONBOARDING_FINISH_MODAL',
DISMISS_ONBOARDING_FINISH_MODAL = 'APP/DISMISS_ONBOARDING_FINISH_MODAL',
Expand Down Expand Up @@ -212,6 +214,10 @@ interface SetNotificationsAccepted {
payload: boolean;
}

interface SetNotificationsInteractionDone {
type: typeof AppActionTypes.SET_NOTIFICATIONS_INTERACTION_DONE;
}

interface SetConfirmedTxAccepted {
type: typeof AppActionTypes.SET_CONFIRMED_TX_ACCEPTED;
payload: boolean;
Expand All @@ -222,6 +228,10 @@ interface SetAnnouncementsAccepted {
payload: boolean;
}

interface SetPinInteractionDone {
type: typeof AppActionTypes.SET_PIN_INTERACTION_DONE;
}

interface SetEmailNotificationsAccepted {
type: typeof AppActionTypes.SET_EMAIL_NOTIFICATIONS_ACCEPTED;
payload: {accepted: boolean; email: string | null};
Expand Down Expand Up @@ -465,8 +475,10 @@ export type AppActionType =
| SuccessGenerateAppIdentity
| FailedGenerateAppIdentity
| SetNotificationsAccepted
| SetNotificationsInteractionDone
| SetConfirmedTxAccepted
| SetAnnouncementsAccepted
| SetPinInteractionDone
| SetEmailNotificationsAccepted
| ShowOnboardingFinishModal
| DismissOnboardingFinishModal
Expand Down
Loading