Skip to content

Commit

Permalink
feat: update and add to in app tours (#1353)
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce McMath <[email protected]>
  • Loading branch information
bryce-mcmath authored Aug 16, 2023
1 parent a58dbc3 commit 5331f9f
Show file tree
Hide file tree
Showing 16 changed files with 227 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Path to sources
sonar.sources=.
sonar.exclusions=**/localization/**/index.ts
sonar.exclusions=**/CredentialOfferTourSteps.tsx,**/CredentialsTourSteps.tsx,**/HomeTourSteps.tsx,**/ProofRequestTourSteps.tsx,**/localization/**/index.ts
#sonar.inclusions=

# Path to tests
Expand All @@ -16,4 +16,4 @@ sonar.exclusions=**/localization/**/index.ts
#sonar.sourceEncoding=UTF-8

# Exclusions for copy-paste detection
sonar.cpd.exclusions=**/HomeTourSteps.tsx,**/request-templates.ts
sonar.cpd.exclusions=**/request-templates.ts
12 changes: 11 additions & 1 deletion app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ import SplashScreen from 'react-native-splash-screen'
import Toast from 'react-native-toast-message'

import bcwallet from './src'
import { credentialOfferTourSteps } from './src/components/tours/CredentialOfferTourSteps'
import { credentialsTourSteps } from './src/components/tours/CredentialsTourSteps'
import { homeTourSteps } from './src/components/tours/HomeTourSteps'
import { proofRequestTourSteps } from './src/components/tours/ProofRequestTourSteps'
import { surveyMonkeyUrl, surveyMonkeyExitUrl } from './src/constants'
import WebDisplay from './src/screens/WebDisplay'
import { initialState, reducer } from './src/store'
Expand Down Expand Up @@ -125,7 +128,14 @@ const App = () => {
visible={surveyVisible}
onClose={toggleSurveyVisibility}
/>
<TourProvider steps={homeTourSteps} overlayColor={'black'} overlayOpacity={0.6}>
<TourProvider
homeTourSteps={homeTourSteps}
credentialsTourSteps={credentialsTourSteps}
credentialOfferTourSteps={credentialOfferTourSteps}
proofRequestTourSteps={proofRequestTourSteps}
overlayColor={'gray'}
overlayOpacity={0.7}
>
<RootStack />
</TourProvider>
<Toast topOffset={15} config={toastConfig} />
Expand Down
2 changes: 1 addition & 1 deletion app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -652,4 +652,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 4266f539fd5c242abd4005c88814b151329c70f6

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/assets/img/notifications-screencap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/assets/img/proof-request-illustration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions app/src/components/tours/CredentialOfferTourSteps.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { useTheme, TourStep, TourBox } from 'aries-bifold'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { Image, Text } from 'react-native'

import useTourImageDimensions from '../../hooks/tour-image-dimensions'

export const credentialOfferTourSteps: TourStep[] = [
{
render: (props) => {
const { currentTour, currentStep, next, stop, previous } = props
const { t } = useTranslation()
const { ColorPallet, TextTheme } = useTheme()
const { imageWidth, imageHeight } = useTourImageDimensions()

return (
<TourBox
title={t('Tour.CredentialOffers')}
hideLeft
rightText={t('Tour.Done')}
onRight={stop}
currentTour={currentTour}
currentStep={currentStep}
previous={previous}
stop={stop}
next={next}
>
<Image
source={require('../../assets/img/credential-offer-illustration.png')}
resizeMode={'contain'}
resizeMethod={'resize'}
style={{
alignSelf: 'center',
width: imageWidth,
height: imageHeight,
}}
/>
<Text
style={{
...TextTheme.normal,
color: ColorPallet.notification.infoText,
}}
allowFontScaling={false}
>
{t('Tour.CredentialOffersDescription')}
</Text>
</TourBox>
)
},
},
]
51 changes: 51 additions & 0 deletions app/src/components/tours/CredentialsTourSteps.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { useTheme, TourStep, TourBox } from 'aries-bifold'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { Image, Text } from 'react-native'

import useTourImageDimensions from '../../hooks/tour-image-dimensions'

export const credentialsTourSteps: TourStep[] = [
{
render: (props) => {
const { currentTour, currentStep, next, stop, previous } = props
const { t } = useTranslation()
const { ColorPallet, TextTheme } = useTheme()
const { imageWidth, imageHeight } = useTourImageDimensions()

return (
<TourBox
title={t('Tour.AddCredentials')}
hideLeft
rightText={t('Tour.Done')}
onRight={stop}
currentTour={currentTour}
currentStep={currentStep}
previous={previous}
stop={stop}
next={next}
>
<Image
source={require('../../assets/img/mobile-phone-scanning-laptop.jpg')}
resizeMode={'contain'}
resizeMethod={'resize'}
style={{
alignSelf: 'center',
width: imageWidth,
height: imageHeight,
}}
/>
<Text
style={{
...TextTheme.normal,
color: ColorPallet.notification.infoText,
}}
allowFontScaling={false}
>
{t('Tour.AddCredentialsDescription')}
</Text>
</TourBox>
)
},
},
]
44 changes: 27 additions & 17 deletions app/src/components/tours/HomeTourSteps.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
import { useTheme, TourStep, TourBox } from 'aries-bifold'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { Image, Text, useWindowDimensions } from 'react-native'
import { Image, Text } from 'react-native'

const calculateImageDimensions = () => {
const { width: windowWidth } = useWindowDimensions() // NOSONAR
const totalHorizontalImagePadding = 90
const imageWidth = Math.floor(windowWidth - totalHorizontalImagePadding)
const imageHeight = Math.floor(imageWidth * 0.66)

return { imageWidth, imageHeight }
}
import useTourImageDimensions from '../../hooks/tour-image-dimensions'

export const homeTourSteps: TourStep[] = [
{
render: (props) => {
const { current, next, stop, previous } = props
const { currentTour, currentStep, next, stop, previous } = props
const { t } = useTranslation()
const { ColorPallet, TextTheme } = useTheme()
const { imageWidth, imageHeight } = calculateImageDimensions()
const { imageWidth, imageHeight } = useTourImageDimensions()

return (
<TourBox
Expand All @@ -27,7 +20,8 @@ export const homeTourSteps: TourStep[] = [
rightText={t('Tour.Next')}
onLeft={stop}
onRight={next}
current={current}
currentTour={currentTour}
currentStep={currentStep}
previous={previous}
stop={stop}
next={next}
Expand All @@ -49,6 +43,7 @@ export const homeTourSteps: TourStep[] = [
...TextTheme.normal,
color: ColorPallet.notification.infoText,
}}
allowFontScaling={false}
>
{t('Tour.AddAndShareDescription')}
</Text>
Expand All @@ -58,9 +53,10 @@ export const homeTourSteps: TourStep[] = [
},
{
render: (props) => {
const { current, next, stop, previous } = props
const { currentTour, currentStep, next, stop, previous } = props
const { t } = useTranslation()
const { ColorPallet, TextTheme } = useTheme()
const { imageWidth, imageHeight } = useTourImageDimensions()

return (
<TourBox
Expand All @@ -69,18 +65,30 @@ export const homeTourSteps: TourStep[] = [
rightText={t('Tour.Next')}
onLeft={previous}
onRight={next}
current={current}
currentTour={currentTour}
currentStep={currentStep}
next={next}
stop={stop}
previous={previous}
stepOn={2}
stepsOutOf={3}
>
<Image
source={require('../../assets/img/notifications-screencap.png')}
resizeMode={'contain'}
resizeMethod={'resize'}
style={{
alignSelf: 'center',
width: imageWidth,
height: imageHeight,
}}
/>
<Text
style={{
...TextTheme.normal,
color: ColorPallet.notification.infoText,
}}
allowFontScaling={false}
>
{t('Tour.NotificationsDescription')}
</Text>
Expand All @@ -90,10 +98,10 @@ export const homeTourSteps: TourStep[] = [
},
{
render: (props) => {
const { current, next, stop, previous } = props
const { currentTour, currentStep, next, stop, previous } = props
const { t } = useTranslation()
const { ColorPallet, TextTheme } = useTheme()
const { imageWidth, imageHeight } = calculateImageDimensions()
const { imageWidth, imageHeight } = useTourImageDimensions()

return (
<TourBox
Expand All @@ -102,7 +110,8 @@ export const homeTourSteps: TourStep[] = [
rightText={t('Tour.Done')}
onLeft={previous}
onRight={stop}
current={current}
currentTour={currentTour}
currentStep={currentStep}
next={next}
stop={stop}
previous={previous}
Expand All @@ -124,6 +133,7 @@ export const homeTourSteps: TourStep[] = [
...TextTheme.normal,
color: ColorPallet.notification.infoText,
}}
allowFontScaling={false}
>
{t('Tour.YourCredentialsDescription')}
</Text>
Expand Down
51 changes: 51 additions & 0 deletions app/src/components/tours/ProofRequestTourSteps.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { useTheme, TourStep, TourBox } from 'aries-bifold'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { Image, Text } from 'react-native'

import useTourImageDimensions from '../../hooks/tour-image-dimensions'

export const proofRequestTourSteps: TourStep[] = [
{
render: (props) => {
const { currentTour, currentStep, next, stop, previous } = props
const { t } = useTranslation()
const { ColorPallet, TextTheme } = useTheme()
const { imageWidth, imageHeight } = useTourImageDimensions()

return (
<TourBox
title={t('Tour.ProofRequests')}
hideLeft
rightText={t('Tour.Done')}
onRight={stop}
currentTour={currentTour}
currentStep={currentStep}
previous={previous}
stop={stop}
next={next}
>
<Image
source={require('../../assets/img/proof-request-illustration.png')}
resizeMode={'contain'}
resizeMethod={'resize'}
style={{
alignSelf: 'center',
width: imageWidth,
height: imageHeight,
}}
/>
<Text
style={{
...TextTheme.normal,
color: ColorPallet.notification.infoText,
}}
allowFontScaling={false}
>
{t('Tour.ProofRequestsDescription')}
</Text>
</TourBox>
)
},
},
]
12 changes: 12 additions & 0 deletions app/src/hooks/tour-image-dimensions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { useWindowDimensions } from 'react-native'

const useTourImageDimensions = () => {
const { width: windowWidth } = useWindowDimensions() // NOSONAR
const totalHorizontalImagePadding = 90
const imageWidth = Math.floor(windowWidth - totalHorizontalImagePadding)
const imageHeight = Math.floor(imageWidth * 0.66)

return { imageWidth, imageHeight }
}

export default useTourImageDimensions
6 changes: 6 additions & 0 deletions app/src/localization/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,16 @@ const translation = {
"DoNotUseAppGuides": "Don't use app guides",
"AddAndShare": "Add and share credentials",
"AddAndShareDescription": "To add and use credentials you scan a QR code displayed by the service provider.",
"AddCredentials": "Add credentials",
"AddCredentialsDescription": "Add credentials by scanning a QR code displayed on the issuer service.",
"Notifications": "Notifications",
"NotificationsDescription": "After you scan a QR code, the credential offer or proof request will appear here, as well as other notable events.",
"YourCredentials": "Your credentials",
"YourCredentialsDescription": "Your added digital credentials appear here. You can review credential details and add and delete credentials.",
"CredentialOffers": "Credential offers",
"CredentialOffersDescription": "An organization has offered you a credential. Review the credentials details and choose to accept or decline it. Accepted credentials will be added to your wallet.",
"ProofRequests": "Proof requests",
"ProofRequestsDescription": "An organization is asking you to prove your credentials. Review what they're asking for and choose to accept or decline it.",
"Skip": "Skip",
"Next": "Next",
"Back": "Back",
Expand Down
6 changes: 6 additions & 0 deletions app/src/localization/fr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,16 @@ const translation = {
"DoNotUseAppGuides": "Don't use app guides (FR)",
"AddAndShare": "Add and share credentials (FR)",
"AddAndShareDescription": "To add and use credentials you scan a QR code displayed by the service provider. (FR)",
"AddCredentials": "Add credentials (FR)",
"AddCredentialsDescription": "Add credentials by scanning a QR code displayed on the issuer service. (FR)",
"Notifications": "Notifications (FR)",
"NotificationsDescription": "After you scan a QR code, the credential offer or proof request will appear here, as well as other notable events. (FR)",
"YourCredentials": "Your credentials (FR)",
"YourCredentialsDescription": "Your added digital credentials appear here. You can review credential details and add and delete credentials. (FR)",
"CredentialOffers": "Credential offers (FR)",
"CredentialOffersDescription": "An organization has offered you a credential. Review the credentials details and choose to accept or decline it. Accepted credentials will be added to your wallet. (FR)",
"ProofRequests": "Proof requests (FR)",
"ProofRequestsDescription": "An organization is asking you to prove your credentials. Review what they're asking for and choose to accept or decline it. (FR)",
"Skip": "Skip (FR)",
"Next": "Next (FR)",
"Back": "Back (FR)",
Expand Down
6 changes: 6 additions & 0 deletions app/src/localization/pt-br/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,16 @@ const translation = {
"DoNotUseAppGuides": "Don't use app guides (PT-BR)",
"AddAndShare": "Add and share credentials (PT-BR)",
"AddAndShareDescription": "To add and use credentials you scan a QR code displayed by the service provider. (PT-BR)",
"AddCredentials": "Add credentials (PT-BR)",
"AddCredentialsDescription": "Add credentials by scanning a QR code displayed on the issuer service. (PT-BR)",
"Notifications": "Notifications (PT-BR)",
"NotificationsDescription": "After you scan a QR code, the credential offer or proof request will appear here, as well as other notable events. (PT-BR)",
"YourCredentials": "Your credentials (PT-BR)",
"YourCredentialsDescription": "Your added digital credentials appear here. You can review credential details and add and delete credentials. (PT-BR)",
"CredentialOffers": "Credential offers (PT-BR)",
"CredentialOffersDescription": "An organization has offered you a credential. Review the credentials details and choose to accept or decline it. Accepted credentials will be added to your wallet. (PT-BR)",
"ProofRequests": "Proof requests (PT-BR)",
"ProofRequestsDescription": "An organization is asking you to prove your credentials. Review what they're asking for and choose to accept or decline it. (PT-BR)",
"Skip": "Skip (PT-BR)",
"Next": "Next (PT-BR)",
"Back": "Back (PT-BR)",
Expand Down
Loading

0 comments on commit 5331f9f

Please sign in to comment.