forked from openwallet-foundation/bifold-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added connection notification to credential offer and proof pre…
…sentations (openwallet-foundation#407) * Added connection notification to cred offer and presentaions * Tweaks to connection modal * Seperated PopupModal * added sonarcloud properties * Added scroll to delete modal * Change ConnectionNotification to ConnectionAlert Signed-off-by: wadeking98 <[email protected]>
- Loading branch information
1 parent
2b06559
commit 9d4c05b
Showing
9 changed files
with
440 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
# Path to sources | ||
sonar.sources=. | ||
sonar.exclusions=**/localization/**/index.ts | ||
#sonar.inclusions= | ||
|
||
# Path to tests | ||
#sonar.tests= | ||
#sonar.test.exclusions= | ||
#sonar.test.inclusions= | ||
|
||
# Source encoding | ||
#sonar.sourceEncoding=UTF-8 | ||
|
||
# Exclusions for copy-paste detection | ||
#sonar.cpd.exclusions= |
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,117 @@ | ||
import { useNavigation } from '@react-navigation/core' | ||
import { StackNavigationProp } from '@react-navigation/stack' | ||
import React, { useState } from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import { StyleSheet, Text, View } from 'react-native' | ||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons' | ||
|
||
import { useTheme } from '../../contexts/theme' | ||
import { RootStackParams, Screens, Stacks } from '../../types/navigators' | ||
import PopupModal from '../modals/PopupModal' | ||
|
||
import { InfoBoxType } from './InfoBox' | ||
import UnorderedList from './UnorderedList' | ||
|
||
interface ConnectionAlertProps { | ||
connectionID?: string | ||
} | ||
|
||
const ConnectionAlert: React.FC<ConnectionAlertProps> = ({ connectionID }) => { | ||
const { t } = useTranslation() | ||
const { ListItems, ColorPallet, TextTheme } = useTheme() | ||
const [infoCardVisible, setInfoCardVisible] = useState(false) | ||
|
||
const settingsNavigation = useNavigation<StackNavigationProp<RootStackParams>>() | ||
|
||
const styles = StyleSheet.create({ | ||
modalCenter: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: 'rgba(0,0,0,0.5)', | ||
padding: 20, | ||
}, | ||
notifyTextContainer: { | ||
borderLeftColor: ColorPallet.brand.highlight, | ||
borderLeftWidth: 10, | ||
flex: 1, | ||
paddingLeft: 10, | ||
paddingVertical: 15, | ||
marginVertical: 15, | ||
}, | ||
fakeLink: { | ||
...TextTheme.normal, | ||
...ListItems.recordLink, | ||
textDecorationLine: 'underline', | ||
}, | ||
row: { | ||
flexDirection: 'row', | ||
}, | ||
notifyTitle: { | ||
...TextTheme.title, | ||
marginBottom: 5, | ||
}, | ||
notifyText: { | ||
...TextTheme.normal, | ||
marginVertical: 5, | ||
}, | ||
notifyTextList: { | ||
marginVertical: 6, | ||
}, | ||
informationIcon: { | ||
color: ColorPallet.brand.link, | ||
marginLeft: 10, | ||
}, | ||
}) | ||
|
||
const toggleInfoCard = () => setInfoCardVisible(!infoCardVisible) | ||
|
||
const navigateToSettings = () => { | ||
toggleInfoCard() | ||
settingsNavigation.navigate(Stacks.SettingStack, { screen: Screens.Settings }) | ||
} | ||
|
||
return ( | ||
<View style={styles.notifyTextContainer}> | ||
<View style={styles.row}> | ||
<Text style={styles.notifyTitle}>{t('ConnectionAlert.AddedContacts')}</Text> | ||
<Icon name={'information-outline'} size={30} style={styles.informationIcon} onPress={toggleInfoCard} /> | ||
</View> | ||
{infoCardVisible && ( | ||
<PopupModal | ||
notificationType={InfoBoxType.Info} | ||
title={t('ConnectionAlert.WhatAreContacts')} | ||
bodyContent={ | ||
<View> | ||
<Text style={styles.notifyText}>{t('ConnectionAlert.PopupIntro')}</Text> | ||
<UnorderedList | ||
UnorderedListItems={[ | ||
t('ConnectionAlert.PopupPoint1'), | ||
t('ConnectionAlert.PopupPoint2'), | ||
t('ConnectionAlert.PopupPoint3'), | ||
]} | ||
/> | ||
<Text style={styles.notifyText}> | ||
{t('ConnectionAlert.SettingsInstruction')} | ||
<Text style={styles.fakeLink} onPress={navigateToSettings}> | ||
{t('ConnectionAlert.SettingsLink')} | ||
</Text> | ||
. | ||
</Text> | ||
<Text style={styles.notifyText}>{t('ConnectionAlert.PrivacyMessage')}</Text> | ||
</View> | ||
} | ||
onCallToActionLabel={t('ConnectionAlert.PopupExit')} | ||
onCallToActionPressed={toggleInfoCard} | ||
/> | ||
)} | ||
<Text style={styles.notifyText}> | ||
{t('ConnectionAlert.NotificationBodyUpper') + | ||
(connectionID || t('ContactDetails.AContact').toLowerCase()) + | ||
t('ConnectionAlert.NotificationBodyLower')} | ||
</Text> | ||
</View> | ||
) | ||
} | ||
|
||
export default ConnectionAlert |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react' | ||
import { Modal, StyleSheet, View } from 'react-native' | ||
|
||
import { GenericFn } from '../../types/fn' | ||
import InfoBox, { InfoBoxType } from '../misc/InfoBox' | ||
|
||
interface PopupModalProps { | ||
notificationType: InfoBoxType | ||
title: string | ||
bodyContent?: Element | ||
onCallToActionPressed?: GenericFn | ||
onCallToActionLabel: string | ||
} | ||
|
||
const PopupModal: React.FC<PopupModalProps> = ({ | ||
title, | ||
bodyContent, | ||
onCallToActionPressed, | ||
notificationType, | ||
onCallToActionLabel, | ||
}) => { | ||
const styles = StyleSheet.create({ | ||
modalCenter: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: 'rgba(0,0,0,0.5)', | ||
padding: 20, | ||
}, | ||
}) | ||
|
||
return ( | ||
<Modal transparent> | ||
<View style={styles.modalCenter}> | ||
<InfoBox | ||
notificationType={notificationType} | ||
title={title} | ||
bodyContent={bodyContent} | ||
onCallToActionLabel={onCallToActionLabel} | ||
onCallToActionPressed={onCallToActionPressed} | ||
/> | ||
</View> | ||
</Modal> | ||
) | ||
} | ||
|
||
export default PopupModal |
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
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.