Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: onboarding screen with notification permission
- Loading branch information
Showing
16 changed files
with
344 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
client/react-native/common/components/Screens/Accounts/Onboarding/Backup.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react' | ||
import { ScrollView, Text, View } from 'react-native' | ||
import { Flex } from '../../../Library' | ||
import { withNavigation } from 'react-navigation' | ||
import * as onboardingStyle from './style' | ||
import { NextButton, SkipButton } from './Button' | ||
import { withNamespaces } from 'react-i18next' | ||
|
||
const Backup = ({ navigation, t }) => <ScrollView alwaysBounceVertical={false}> | ||
<Flex.Rows style={onboardingStyle.view}> | ||
<Text style={onboardingStyle.title}>{t('onboarding.backup.title')}</Text> | ||
<Text style={onboardingStyle.help}>{t('onboarding.backup.help')}</Text> | ||
<Text style={onboardingStyle.disclaimer}>{t('onboarding.backup.disclaimer')}</Text> | ||
<View style={{ height: 60, flexDirection: 'row' }}> | ||
<SkipButton | ||
onPress={() => navigation.navigate('onboarding/ready')}>{t('skip')}</SkipButton> | ||
<NextButton>{t('onboarding.backup.action')}</NextButton> | ||
</View> | ||
</Flex.Rows> | ||
</ScrollView> | ||
|
||
export default withNamespaces()(withNavigation(Backup)) |
7 changes: 7 additions & 0 deletions
7
client/react-native/common/components/Screens/Accounts/Onboarding/Button.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react' | ||
import { Button } from '../../../Library' | ||
import colors from '../../../../constants/colors' | ||
|
||
export const SkipButton = props => <Button {...props} left color={colors.darkGrey} margin padding small rounded /> | ||
|
||
export const NextButton = props => <Button {...props} color={colors.inputGrey} background={colors.blue} small margin padding center rounded /> |
29 changes: 29 additions & 0 deletions
29
client/react-native/common/components/Screens/Accounts/Onboarding/Contacts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react' | ||
import { Text, View, ScrollView } from 'react-native' | ||
import { Flex } from '../../../Library' | ||
import { withNavigation } from 'react-navigation' | ||
import * as onboardingStyle from './style' | ||
import { NextButton, SkipButton } from './Button' | ||
import { withNamespaces } from 'react-i18next' | ||
import { withCurrentUser } from '../../../../utils/contact' | ||
import { extractPublicKeyFromId, shareLinkSelf } from '../../../../helpers/contacts' | ||
|
||
const Contacts = ({ navigation, currentUser, t }) => <ScrollView alwaysBounceVertical={false}> | ||
<Flex.Rows style={onboardingStyle.view}> | ||
<Text style={onboardingStyle.title}>{t('onboarding.contacts.title')}</Text> | ||
<Text style={onboardingStyle.help}>{t('onboarding.contacts.link-help')}</Text> | ||
<Text style={onboardingStyle.disclaimer}>{t('onboarding.contacts.link-disclaimer')}</Text> | ||
<View style={{ height: 60, flexDirection: 'row' }}> | ||
<SkipButton>{' '}</SkipButton> | ||
<NextButton onPress={() => shareLinkSelf({ id: extractPublicKeyFromId(currentUser.id), displayName: currentUser.displayName })}>{t('onboarding.contacts.link-share')}</NextButton> | ||
</View> | ||
<Text style={onboardingStyle.help}>{t('onboarding.contacts.phone-help')}</Text> | ||
<Text style={onboardingStyle.disclaimer}>{t('onboarding.contacts.phone-disclaimer')}</Text> | ||
<View style={{ height: 60, flexDirection: 'row' }}> | ||
<SkipButton onPress={() => navigation.navigate('onboarding/backup')}>{t('skip')}</SkipButton> | ||
<NextButton>{t('onboarding.contacts.phone-link')}</NextButton> | ||
</View> | ||
</Flex.Rows> | ||
</ScrollView> | ||
|
||
export default withCurrentUser(withNamespaces()(withNavigation(Contacts)), { showOnlyLoaded: true }) |
32 changes: 32 additions & 0 deletions
32
client/react-native/common/components/Screens/Accounts/Onboarding/Notifications.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react' | ||
import { Text, Platform, View, ScrollView } from 'react-native' | ||
import { Flex } from '../../../Library' | ||
import { withNavigation } from 'react-navigation' | ||
import * as onboardingStyle from './style' | ||
import { NextButton, SkipButton } from './Button' | ||
import { enableNativeNotifications } from '../../../../helpers/notifications' | ||
import { withNamespaces } from 'react-i18next' | ||
import { RelayContext } from '../../../../relay' | ||
|
||
const Notifications = ({ navigation, t }) => | ||
<RelayContext.Consumer>{context => | ||
<ScrollView alwaysBounceVertical={false}> | ||
<Flex.Rows style={onboardingStyle.view}> | ||
<Text style={onboardingStyle.title}>{t('onboarding.notifications.title')}</Text> | ||
<Text style={onboardingStyle.help}>{t('onboarding.notifications.help')}</Text> | ||
<Text style={onboardingStyle.disclaimer}> | ||
{Platform.OS === 'ios' && t('onboarding.notifications.disclaimer-apple')} | ||
{Platform.OS === 'android' && t('onboarding.notifications.disclaimer-google')} | ||
</Text> | ||
<View style={{ height: 60, flexDirection: 'row' }}> | ||
<SkipButton | ||
onPress={() => navigation.navigate('onboarding/contacts')}>{t('skip')}</SkipButton> | ||
<NextButton onPress={async () => { | ||
await enableNativeNotifications({ context }) | ||
navigation.navigate('onboarding/contacts') | ||
}}>{t('onboarding.notifications.enable')}</NextButton> | ||
</View> | ||
</Flex.Rows> | ||
</ScrollView> | ||
}</RelayContext.Consumer> | ||
export default withNamespaces()(withNavigation(Notifications)) |
20 changes: 20 additions & 0 deletions
20
client/react-native/common/components/Screens/Accounts/Onboarding/Ready.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react' | ||
import { ScrollView, Text, View } from 'react-native' | ||
import { Flex } from '../../../Library' | ||
import { withNavigation } from 'react-navigation' | ||
import * as onboardingStyle from './style' | ||
import { NextButton } from './Button' | ||
import { withNamespaces } from 'react-i18next' | ||
|
||
const Ready = ({ navigation, t }) => | ||
<ScrollView alwaysBounceVertical={false}> | ||
<Flex.Rows style={onboardingStyle.view}> | ||
<Text style={onboardingStyle.title}>{t('onboarding.ready.title')}</Text> | ||
<View style={{ height: 60, flexDirection: 'row' }}> | ||
<NextButton | ||
onPress={() => navigation.navigate('switch/main')}>{t('close')}</NextButton> | ||
</View> | ||
</Flex.Rows> | ||
</ScrollView> | ||
|
||
export default withNamespaces()(withNavigation(Ready)) |
27 changes: 27 additions & 0 deletions
27
client/react-native/common/components/Screens/Accounts/Onboarding/Welcome.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react' | ||
import { View, Text, ScrollView } from 'react-native' | ||
import { Flex } from '../../../Library' | ||
import { withNavigation } from 'react-navigation' | ||
import * as onboardingStyle from './style' | ||
import { NextButton, SkipButton } from './Button' | ||
import { withNamespaces } from 'react-i18next' | ||
|
||
const Welcome = ({ navigation, t }) => | ||
<ScrollView alwaysBounceVertical={false}> | ||
<Flex.Rows style={onboardingStyle.view}> | ||
<Text style={onboardingStyle.title}>{t('onboarding.welcome.title')}</Text> | ||
<Text style={onboardingStyle.help}>{t('onboarding.welcome.help-1')}</Text> | ||
<Text style={onboardingStyle.help}>{t('onboarding.welcome.help-2')}</Text> | ||
<Text style={onboardingStyle.disclaimer}>{t('onboarding.welcome.disclaimer')}</Text> | ||
<View style={{ height: 60, flexDirection: 'row' }}> | ||
<SkipButton | ||
onPress={() => navigation.navigate('onboarding/ready')} | ||
style={onboardingStyle.skipButton}>{t('onboarding.welcome.skip-everything')}</SkipButton> | ||
<NextButton | ||
onPress={() => navigation.navigate('onboarding/notifications')} | ||
style={onboardingStyle.nextButton}>{t('next')}</NextButton> | ||
</View> | ||
</Flex.Rows> | ||
</ScrollView> | ||
|
||
export default withNamespaces()(withNavigation(Welcome)) |
52 changes: 52 additions & 0 deletions
52
client/react-native/common/components/Screens/Accounts/Onboarding/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { createMaterialTopTabNavigator } from 'react-navigation' | ||
import Welcome from './Welcome' | ||
import Notifications from './Notifications' | ||
import Contacts from './Contacts' | ||
import Backup from './Backup' | ||
import Ready from './Ready' | ||
import { tabIcon } from '../../../../helpers/views' | ||
import { tabNavigatorOptions } from '../../../../constants/styling' | ||
|
||
export default createMaterialTopTabNavigator( | ||
{ | ||
'onboarding/welcome': { | ||
screen: Welcome, | ||
navigationOptions: () => ({ | ||
title: '', | ||
tabBarIcon: tabIcon('lock'), | ||
}), | ||
}, | ||
'onboarding/notifications': { | ||
screen: Notifications, | ||
navigationOptions: () => ({ | ||
title: '', | ||
tabBarIcon: tabIcon('bell'), | ||
}), | ||
}, | ||
'onboarding/contacts': { | ||
screen: Contacts, | ||
navigationOptions: () => ({ | ||
title: '', | ||
tabBarIcon: tabIcon('users'), | ||
}), | ||
}, | ||
'onboarding/backup': { | ||
screen: Backup, | ||
navigationOptions: () => ({ | ||
title: '', | ||
tabBarIcon: tabIcon('archive'), | ||
}), | ||
}, | ||
'onboarding/ready': { | ||
screen: Ready, | ||
navigationOptions: () => ({ | ||
title: '', | ||
tabBarIcon: tabIcon('check-circle'), | ||
}), | ||
}, | ||
}, | ||
{ | ||
initialRouteName: 'onboarding/welcome', | ||
...tabNavigatorOptions, | ||
}, | ||
) |
30 changes: 30 additions & 0 deletions
30
client/react-native/common/components/Screens/Accounts/Onboarding/style.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import colors from '../../../../constants/colors' | ||
|
||
export const title = { | ||
fontSize: 24, | ||
color: colors.blue, | ||
marginBottom: 20, | ||
marginTop: 20, | ||
textAlign: 'center', | ||
} | ||
|
||
export const help = { | ||
fontSize: 16, | ||
color: colors.fakeBlack, | ||
marginBottom: 12, | ||
} | ||
|
||
export const disclaimer = { | ||
fontSize: 12, | ||
color: colors.darkGrey, | ||
marginBottom: 6, | ||
} | ||
|
||
export const view = { | ||
backgroundColor: colors.white, | ||
marginLeft: 'auto', | ||
marginRight: 'auto', | ||
paddingLeft: 10, | ||
paddingRight: 10, | ||
maxWidth: 400, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.