Skip to content

Commit 08edd84

Browse files
authored
fix(transfer): #2222 skip transfer intros after first time (#2309)
1 parent 660c9d9 commit 08edd84

File tree

14 files changed

+78
-12
lines changed

14 files changed

+78
-12
lines changed

e2e/channels.e2e.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ d('Transfer', () => {
128128
await element(by.id('NavigationClose')).tap();
129129
await element(by.id('ActivitySavings')).tap();
130130
await element(by.id('TransferToSpending')).tap();
131-
await element(by.id('SpendingIntro-button')).tap();
132131
await element(by.id('N1').withAncestor(by.id('SpendingAmount'))).tap();
133132
await element(by.id('N0').withAncestor(by.id('SpendingAmount'))).multiTap(
134133
5,

src/components/Suggestions.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ import SuggestionCard from './SuggestionCard';
1616
import { ITodo, TTodoType } from '../store/types/todos';
1717
import { channelsNotificationsShown, hideTodo } from '../store/slices/todos';
1818
import { showBottomSheet } from '../store/utils/ui';
19+
import { pinSelector } from '../store/reselect/settings';
20+
import { transferIntroSeenSelector } from '../store/reselect/user';
1921
import {
2022
newChannelsNotificationsSelector,
2123
todosFullSelector,
2224
} from '../store/reselect/todos';
23-
import { pinSelector } from '../store/reselect/settings';
2425
import { useAppDispatch, useAppSelector } from '../hooks/redux';
2526
import type { RootNavigationProp } from '../navigation/types';
2627
import { appName, appStoreUrl, playStoreUrl } from '../constants/app';
@@ -34,6 +35,7 @@ const Suggestions = (): ReactElement => {
3435
const pinTodoDone = useAppSelector(pinSelector);
3536
const suggestions = useAppSelector(todosFullSelector);
3637
const newChannels = useAppSelector(newChannelsNotificationsSelector);
38+
const transferIntroSeen = useAppSelector(transferIntroSeenSelector);
3739
const [index, setIndex] = useState(0);
3840

3941
// this code is needed in order to avoid flashing wrong balance on channel open
@@ -73,7 +75,11 @@ const Suggestions = (): ReactElement => {
7375
}
7476

7577
if (id === 'lightning') {
76-
navigation.navigate('TransferRoot', { screen: 'TransferIntro' });
78+
if (transferIntroSeen) {
79+
navigation.navigate('TransferRoot', { screen: 'Funding' });
80+
} else {
81+
navigation.navigate('TransferRoot', { screen: 'TransferIntro' });
82+
}
7783
}
7884

7985
if (id === 'lightningSettingUp') {
@@ -111,7 +117,7 @@ const Suggestions = (): ReactElement => {
111117
});
112118
}
113119
},
114-
[navigation, pinTodoDone, onShare],
120+
[navigation, transferIntroSeen, pinTodoDone, onShare],
115121
);
116122

117123
const handleRenderItem = useCallback(

src/screens/Activity/ActivitySavings.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import ActivityList from './ActivityList';
1515
import { useBalance } from '../../hooks/wallet';
1616
import { useAppSelector } from '../../hooks/redux';
1717
import { EActivityType } from '../../store/types/activity';
18-
import { isGeoBlockedSelector } from '../../store/reselect/user';
18+
import {
19+
isGeoBlockedSelector,
20+
spendingIntroSeenSelector,
21+
} from '../../store/reselect/user';
1922
import { activityItemsSelector } from '../../store/reselect/activity';
2023
import { WalletScreenProps } from '../../navigation/types';
2124

@@ -28,6 +31,7 @@ const ActivitySavings = ({
2831
const { onchainBalance, balanceInTransferToSavings } = useBalance();
2932
const items = useAppSelector(activityItemsSelector);
3033
const isGeoBlocked = useAppSelector(isGeoBlockedSelector);
34+
const spendingIntroSeen = useAppSelector(spendingIntroSeenSelector);
3135

3236
const savingsItems = useMemo(() => {
3337
return items.filter((item) => {
@@ -45,7 +49,11 @@ const ActivitySavings = ({
4549
const showOnboarding = onchainBalance === 0 && savingsItems.length === 0;
4650

4751
const onTransfer = (): void => {
48-
navigation.navigate('TransferRoot', { screen: 'SpendingIntro' });
52+
if (spendingIntroSeen) {
53+
navigation.navigate('TransferRoot', { screen: 'SpendingAmount' });
54+
} else {
55+
navigation.navigate('TransferRoot', { screen: 'SpendingIntro' });
56+
}
4957
};
5058

5159
const canTransfer = !!onchainBalance && !isGeoBlocked;

src/screens/Activity/ActivitySpending.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { useBalance } from '../../hooks/wallet';
1616
import { useAppSelector } from '../../hooks/redux';
1717
import { EActivityType } from '../../store/types/activity';
1818
import { spendingOnboardingSelector } from '../../store/reselect/aggregations';
19+
import { savingsIntroSeenSelector } from '../../store/reselect/user';
1920
import { WalletScreenProps } from '../../navigation/types';
2021

2122
const imageSrc = require('../../assets/illustrations/coin-stack-x-2.png');
@@ -26,6 +27,7 @@ const ActivitySpending = ({
2627
const { t } = useTranslation('wallet');
2728
const { lightningBalance, balanceInTransferToSpending } = useBalance();
2829
const isSpendingOnboarding = useAppSelector(spendingOnboardingSelector);
30+
const savingsIntroSeen = useAppSelector(savingsIntroSeenSelector);
2931

3032
const filter = useMemo(() => {
3133
return {
@@ -35,7 +37,11 @@ const ActivitySpending = ({
3537
}, []);
3638

3739
const onTransfer = (): void => {
38-
navigation.navigate('TransferRoot', { screen: 'SavingsIntro' });
40+
if (savingsIntroSeen) {
41+
navigation.navigate('TransferRoot', { screen: 'Availability' });
42+
} else {
43+
navigation.navigate('TransferRoot', { screen: 'SavingsIntro' });
44+
}
3945
};
4046

4147
const canTransfer = !!lightningBalance;

src/screens/Transfer/Funding.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import RectangleButton from '../../components/buttons/RectangleButton';
1010
import SafeAreaInset from '../../components/SafeAreaInset';
1111
import NavigationHeader from '../../components/NavigationHeader';
1212
import { useBalance } from '../../hooks/wallet';
13-
import { isGeoBlockedSelector } from '../../store/reselect/user';
13+
import {
14+
isGeoBlockedSelector,
15+
spendingIntroSeenSelector,
16+
} from '../../store/reselect/user';
1417
import { TRANSACTION_DEFAULTS } from '../../utils/wallet/constants';
1518
import { showBottomSheet } from '../../store/utils/ui';
1619
import type { TransferScreenProps } from '../../navigation/types';
@@ -21,9 +24,14 @@ const Funding = ({
2124
const { t } = useTranslation('lightning');
2225
const { onchainBalance } = useBalance();
2326
const isGeoBlocked = useAppSelector(isGeoBlockedSelector);
27+
const spendingIntroSeen = useAppSelector(spendingIntroSeenSelector);
2428

2529
const onTransfer = (): void => {
26-
navigation.navigate('SpendingIntro');
30+
if (spendingIntroSeen) {
31+
navigation.navigate('SpendingAmount');
32+
} else {
33+
navigation.navigate('SpendingIntro');
34+
}
2735
};
2836

2937
const onFund = (): void => {

src/screens/Transfer/SavingsIntro.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Trans, useTranslation } from 'react-i18next';
33

44
import { Display } from '../../styles/text';
55
import OnboardingScreen from '../../components/OnboardingScreen';
6+
import { useAppDispatch } from '../../hooks/redux';
7+
import { updateUser } from '../../store/slices/user';
68
import type { TransferScreenProps } from '../../navigation/types';
79

810
const imageSrc = require('../../assets/illustrations/piggybank.png');
@@ -11,13 +13,15 @@ const SavingsIntro = ({
1113
navigation,
1214
}: TransferScreenProps<'SavingsIntro'>): ReactElement => {
1315
const { t } = useTranslation('lightning');
16+
const dispatch = useAppDispatch();
1417

1518
const onClose = (): void => {
1619
navigation.navigate('Wallet');
1720
};
1821

1922
const onContinue = (): void => {
2023
navigation.navigate('Availability');
24+
dispatch(updateUser({ savingsIntroSeen: true }));
2125
};
2226

2327
return (

src/screens/Transfer/SpendingIntro.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Trans, useTranslation } from 'react-i18next';
33

44
import { Display } from '../../styles/text';
55
import OnboardingScreen from '../../components/OnboardingScreen';
6+
import { useAppDispatch } from '../../hooks/redux';
7+
import { updateUser } from '../../store/slices/user';
68
import type { TransferScreenProps } from '../../navigation/types';
79

810
const imageSrc = require('../../assets/illustrations/coin-stack-x.png');
@@ -11,9 +13,11 @@ const SpendingIntro = ({
1113
navigation,
1214
}: TransferScreenProps<'SpendingIntro'>): ReactElement => {
1315
const { t } = useTranslation('lightning');
16+
const dispatch = useAppDispatch();
1417

1518
const onContinue = (): void => {
1619
navigation.navigate('SpendingAmount');
20+
dispatch(updateUser({ spendingIntroSeen: true }));
1721
};
1822

1923
return (

src/screens/Transfer/TransferIntro.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Trans, useTranslation } from 'react-i18next';
33

44
import { Display } from '../../styles/text';
55
import OnboardingScreen from '../../components/OnboardingScreen';
6+
import { useAppDispatch } from '../../hooks/redux';
7+
import { updateUser } from '../../store/slices/user';
68
import type { TransferScreenProps } from '../../navigation/types';
79

810
const imageSrc = require('../../assets/illustrations/lightning.png');
@@ -11,9 +13,11 @@ const TransferIntro = ({
1113
navigation,
1214
}: TransferScreenProps<'TransferIntro'>): ReactElement => {
1315
const { t } = useTranslation('lightning');
16+
const dispatch = useAppDispatch();
1417

1518
const onContinue = (): void => {
1619
navigation.navigate('Funding');
20+
dispatch(updateUser({ transferIntroSeen: true }));
1721
};
1822

1923
return (

src/store/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const persistConfig = {
3232
key: 'root',
3333
storage: reduxStorage,
3434
// increase version after store shape changes
35-
version: 45,
35+
version: 46,
3636
stateReconciler: autoMergeLevel2,
3737
blacklist: ['receive', 'ui'],
3838
migrate: createMigrate(migrations, { debug: __ENABLE_MIGRATION_DEBUG__ }),

src/store/migrations/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ const migrations = {
3434
},
3535
};
3636
},
37+
46: (state): PersistedState => {
38+
return {
39+
...state,
40+
user: {
41+
...state.user,
42+
transferIntroSeen: false,
43+
spendingIntroSeen: false,
44+
savingsIntroSeen: false,
45+
},
46+
};
47+
},
3748
};
3849

3950
export default migrations;

0 commit comments

Comments
 (0)