Skip to content

Commit 8529ce2

Browse files
authored
feat(onboarding): add geoblock footnote (#2403)
1 parent afc3938 commit 8529ce2

File tree

7 files changed

+43
-19
lines changed

7 files changed

+43
-19
lines changed

src/screens/Onboarding/Slideshow.tsx

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@ import Animated, {
2323
} from 'react-native-reanimated';
2424
import Carousel, { ICarouselInstance } from 'react-native-reanimated-carousel';
2525

26+
import { IThemeColors } from '../../styles/themes';
27+
import { View as ThemedView } from '../../styles/components';
28+
import { BodyM, BodyMB, Display, Footnote } from '../../styles/text';
2629
import SafeAreaInset from '../../components/SafeAreaInset';
2730
import Dot from '../../components/SliderDots';
2831
import Button from '../../components/buttons/Button';
2932
import ButtonTertiary from '../../components/buttons/ButtonTertiary';
30-
import { useAppDispatch } from '../../hooks/redux';
33+
import { useAppDispatch, useAppSelector } from '../../hooks/redux';
3134
import type { OnboardingStackScreenProps } from '../../navigation/types';
3235
import { updateUser } from '../../store/slices/user';
33-
import { View as ThemedView } from '../../styles/components';
34-
import { BodyM, BodyMB, Display } from '../../styles/text';
35-
import { IThemeColors } from '../../styles/themes';
36+
import { isGeoBlockedSelector } from '../../store/reselect/user';
3637

3738
type Slide = {
3839
color: keyof IThemeColors;
@@ -68,6 +69,7 @@ const Slide = ({
6869
}: SlideProps): ReactElement => {
6970
const { t } = useTranslation('onboarding');
7071
const dimensions = useWindowDimensions();
72+
const isGeoBlocked = useAppSelector(isGeoBlockedSelector);
7173

7274
// because we can't properly scala image inside the <Swiper let's calculate with by hand
7375
const imageStyles = useMemo(
@@ -93,14 +95,20 @@ const Slide = ({
9395
parent={Display}
9496
components={{ accent: <Display color={color} /> }}
9597
/>
96-
<Trans
97-
style={styles.text}
98-
t={t}
99-
i18nKey={`slide${index}_text`}
100-
parent={BodyM}
101-
color="secondary"
102-
components={{ accent: <BodyMB color="primary" /> }}
103-
/>
98+
99+
<View style={styles.text}>
100+
<Trans
101+
t={t}
102+
i18nKey={`slide${index}_text`}
103+
parent={BodyM}
104+
color="secondary"
105+
components={{ accent: <BodyMB color="primary" /> }}
106+
/>
107+
108+
{index === 1 && isGeoBlocked && (
109+
<Footnote style={styles.note}>{t('slide1_note')}</Footnote>
110+
)}
111+
</View>
104112

105113
{isLast ? (
106114
<View style={styles.buttonsContainer}>
@@ -276,7 +284,10 @@ const styles = StyleSheet.create({
276284
},
277285
text: {
278286
marginTop: 4,
279-
minHeight: 90,
287+
minHeight: 110,
288+
},
289+
note: {
290+
marginTop: 6,
280291
},
281292
buttonsContainer: {
282293
flexDirection: 'row',

src/screens/Onboarding/Welcome.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Display, BodyM } from '../../styles/text';
88
import SafeAreaInset from '../../components/SafeAreaInset';
99
import Button from '../../components/buttons/Button';
1010
import DetectSwipe from '../../components/DetectSwipe';
11+
import { setGeoBlock } from '../../store/utils/user';
1112
import type { OnboardingStackScreenProps } from '../../navigation/types';
1213

1314
const backgroundSrc = require('../../assets/illustrations/figures.png');
@@ -19,6 +20,7 @@ const OnboardingWelcomeScreen = ({
1920
const { t } = useTranslation('onboarding');
2021

2122
const onGetStarted = (): void => {
23+
setGeoBlock();
2224
navigation.navigate('Slideshow');
2325
};
2426

src/store/utils/user.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { updateUser } from '../slices/user';
33
import { isGeoBlocked } from '../../utils/blocktank';
44

55
export const setGeoBlock = async (): Promise<boolean> => {
6-
const response = await isGeoBlocked();
7-
dispatch(updateUser({ isGeoBlocked: response }));
8-
return response;
6+
const isBlocked = await isGeoBlocked();
7+
dispatch(updateUser({ isGeoBlocked: isBlocked }));
8+
return isBlocked;
99
};

src/styles/text.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,11 @@ export const Caption13Up = styled.Text<TextProps>(({ theme, color }) => ({
148148
color: theme.colors[color ?? 'primary'],
149149
letterSpacing: Platform.OS === 'ios' ? 0.8 : undefined,
150150
}));
151+
152+
export const Footnote = styled.Text<TextProps>(({ theme, color }) => ({
153+
...theme.fonts.medium,
154+
fontSize: '12px',
155+
lineHeight: '16px',
156+
color: theme.colors[color ?? 'white32'],
157+
letterSpacing: Platform.OS === 'ios' ? 0.4 : undefined,
158+
}));

src/utils/blocktank/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export const isGeoBlocked = async (fromStorage = false): Promise<boolean> => {
350350
try {
351351
let geoBlocked: boolean | undefined;
352352
if (fromStorage) {
353-
geoBlocked = getUserStore()?.isGeoBlocked;
353+
geoBlocked = getUserStore().isGeoBlocked;
354354
if (geoBlocked !== undefined) {
355355
return geoBlocked;
356356
}

src/utils/i18n/locales/en/lightning.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"string": "You can use your Bitkit savings or send bitcoin from a different wallet."
2222
},
2323
"text_blocked": {
24-
"string": "At this time, Bitkit cannot provide automatic Lightning connections to residents of the United States and Canada."
24+
"string": "Bitkit does not currently provide Lightning services in your country, but you can still connect to other nodes directly."
2525
},
2626
"text_blocked_cjit": {
27-
"string": "Bitkit does not currently provide Lightning services to the USA or Canada, but you can still connect to other nodes directly."
27+
"string": "Bitkit does not currently provide Lightning services in your country, but you can still connect to other nodes directly."
2828
},
2929
"button1": {
3030
"string": "Transfer from Savings"

src/utils/i18n/locales/en/onboarding.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
"slide1_text": {
4242
"string": "Spend bitcoin faster than ever. Enjoy instant and cheap payments with friends, family, and merchants."
4343
},
44+
"slide1_note": {
45+
"string": "*Bitkit does not currently provide Lightning services in your country, but you can still connect to other nodes."
46+
},
4447
"slide2_header": {
4548
"string": "Bitcoiners,\n<accent>borderless</accent>"
4649
},

0 commit comments

Comments
 (0)