@bifold/core 2.1.8 → 2.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/lib/commonjs/assets/icons/code.svg +4 -0
  2. package/lib/commonjs/localization/en/en.json +11 -2
  3. package/lib/commonjs/localization/fr/fr.json +11 -2
  4. package/lib/commonjs/localization/pt-br/pt-br.json +11 -2
  5. package/lib/commonjs/navigators/ContactStack.js +8 -0
  6. package/lib/commonjs/navigators/ContactStack.js.map +1 -1
  7. package/lib/commonjs/navigators/CredentialStack.js +8 -0
  8. package/lib/commonjs/navigators/CredentialStack.js.map +1 -1
  9. package/lib/commonjs/screens/ContactDetails.js +18 -1
  10. package/lib/commonjs/screens/ContactDetails.js.map +1 -1
  11. package/lib/commonjs/screens/CredentialDetails.js +44 -1
  12. package/lib/commonjs/screens/CredentialDetails.js.map +1 -1
  13. package/lib/commonjs/screens/JSONDetails.js +105 -0
  14. package/lib/commonjs/screens/JSONDetails.js.map +1 -0
  15. package/lib/commonjs/theme.js +2 -0
  16. package/lib/commonjs/theme.js.map +1 -1
  17. package/lib/commonjs/types/navigators.js +1 -0
  18. package/lib/commonjs/types/navigators.js.map +1 -1
  19. package/lib/module/assets/icons/code.svg +4 -0
  20. package/lib/module/localization/en/en.json +11 -2
  21. package/lib/module/localization/fr/fr.json +11 -2
  22. package/lib/module/localization/pt-br/pt-br.json +11 -2
  23. package/lib/module/navigators/ContactStack.js +8 -0
  24. package/lib/module/navigators/ContactStack.js.map +1 -1
  25. package/lib/module/navigators/CredentialStack.js +8 -0
  26. package/lib/module/navigators/CredentialStack.js.map +1 -1
  27. package/lib/module/screens/ContactDetails.js +18 -1
  28. package/lib/module/screens/ContactDetails.js.map +1 -1
  29. package/lib/module/screens/CredentialDetails.js +44 -1
  30. package/lib/module/screens/CredentialDetails.js.map +1 -1
  31. package/lib/module/screens/JSONDetails.js +97 -0
  32. package/lib/module/screens/JSONDetails.js.map +1 -0
  33. package/lib/module/theme.js +2 -0
  34. package/lib/module/theme.js.map +1 -1
  35. package/lib/module/types/navigators.js +1 -0
  36. package/lib/module/types/navigators.js.map +1 -1
  37. package/lib/typescript/src/navigators/ContactStack.d.ts.map +1 -1
  38. package/lib/typescript/src/navigators/CredentialStack.d.ts.map +1 -1
  39. package/lib/typescript/src/screens/ContactDetails.d.ts.map +1 -1
  40. package/lib/typescript/src/screens/CredentialDetails.d.ts.map +1 -1
  41. package/lib/typescript/src/screens/JSONDetails.d.ts +6 -0
  42. package/lib/typescript/src/screens/JSONDetails.d.ts.map +1 -0
  43. package/lib/typescript/src/theme.d.ts +62 -59
  44. package/lib/typescript/src/theme.d.ts.map +1 -1
  45. package/lib/typescript/src/types/navigators.d.ts +7 -0
  46. package/lib/typescript/src/types/navigators.d.ts.map +1 -1
  47. package/package.json +5 -3
  48. package/src/assets/icons/code.svg +4 -0
  49. package/src/localization/en/en.json +11 -2
  50. package/src/localization/fr/fr.json +11 -2
  51. package/src/localization/pt-br/pt-br.json +11 -2
  52. package/src/navigators/ContactStack.tsx +9 -0
  53. package/src/navigators/CredentialStack.tsx +9 -0
  54. package/src/screens/ContactDetails.tsx +17 -0
  55. package/src/screens/CredentialDetails.tsx +41 -0
  56. package/src/screens/JSONDetails.tsx +102 -0
  57. package/src/theme.ts +4 -0
  58. package/src/types/navigators.ts +3 -0
@@ -0,0 +1,102 @@
1
+ import { SafeAreaView } from 'react-native-safe-area-context'
2
+ import { View, StyleSheet, Share } from 'react-native'
3
+ import { useTranslation } from 'react-i18next'
4
+ import { useTheme } from '../contexts/theme'
5
+ import { ThemedText } from '../components/texts/ThemedText'
6
+ import { StackScreenProps } from '@react-navigation/stack'
7
+ import { ContactStackParams, Screens } from '../types/navigators'
8
+ import Button, { ButtonType } from '../components/buttons/Button'
9
+ import { testIdWithKey } from '../utils/testable'
10
+ import { ScrollView } from 'react-native-gesture-handler'
11
+ import Clipboard from '@react-native-clipboard/clipboard'
12
+ import Toast from 'react-native-toast-message'
13
+ import { ToastType } from '../components/toast/BaseToast'
14
+
15
+ type JSONDetailsProps = StackScreenProps<ContactStackParams, Screens.JSONDetails>
16
+
17
+ const JSONDetails = ({ route }: JSONDetailsProps) => {
18
+ if (!route?.params) {
19
+ throw new Error('JSONDetails route params were not set properly')
20
+ }
21
+ const { t } = useTranslation()
22
+ const { ColorPallet } = useTheme()
23
+ const { jsonBlob } = route.params
24
+ const styles = StyleSheet.create({
25
+ container: {
26
+ flex: 1,
27
+ backgroundColor: ColorPallet.brand.primaryBackground,
28
+ padding: 20,
29
+ },
30
+ title: {
31
+ marginBottom: 16,
32
+ },
33
+ buttonContainer: {
34
+ width: '100%',
35
+ paddingVertical: 8,
36
+ },
37
+ jsonContainer: {
38
+ padding: 16,
39
+ backgroundColor: ColorPallet.brand.secondaryBackground,
40
+ height: '75%',
41
+ borderWidth: 1,
42
+ borderStyle: 'solid',
43
+ borderRadius: 5,
44
+ },
45
+ })
46
+
47
+ const copyToClipboard = async () => {
48
+ try {
49
+ await Clipboard.setString(jsonBlob)
50
+ Toast.show({
51
+ type: ToastType.Success,
52
+ text1: t('JSONDetails.CopiedSuccess'),
53
+ })
54
+ } catch (e) {
55
+ Toast.show({
56
+ type: ToastType.Error,
57
+ text1: `${t('JSONDetails.CopiedError')}: ${e}`,
58
+ })
59
+ }
60
+ }
61
+
62
+ const shareJSON = async () => {
63
+ await Share.share({
64
+ message: jsonBlob,
65
+ })
66
+ }
67
+
68
+ return (
69
+ <SafeAreaView style={styles.container} edges={['bottom', 'left', 'right']}>
70
+ <View>
71
+ <ScrollView style={styles.jsonContainer} testID={testIdWithKey('JSONDetails.ScrollView')}>
72
+ <ThemedText>{jsonBlob}</ThemedText>
73
+ </ScrollView>
74
+
75
+ <View style={styles.buttonContainer}>
76
+ <Button
77
+ title={t('JSONDetails.Share')}
78
+ buttonType={ButtonType.Primary}
79
+ testID={testIdWithKey('Share')}
80
+ accessibilityLabel={t('JSONDetails.Share')}
81
+ onPress={() => {
82
+ shareJSON()
83
+ }}
84
+ ></Button>
85
+ </View>
86
+ <View style={styles.buttonContainer}>
87
+ <Button
88
+ title={t('JSONDetails.Copy')}
89
+ buttonType={ButtonType.Secondary}
90
+ testID={testIdWithKey('CopyToClipboard')}
91
+ accessibilityLabel={t('JSONDetails.Copy')}
92
+ onPress={() => {
93
+ copyToClipboard()
94
+ }}
95
+ ></Button>
96
+ </View>
97
+ </View>
98
+ </SafeAreaView>
99
+ )
100
+ }
101
+
102
+ export default JSONDetails
package/src/theme.ts CHANGED
@@ -4,6 +4,7 @@ import { SvgProps } from 'react-native-svg'
4
4
  import Arrow from './assets/icons/large-arrow.svg'
5
5
  import IconDelete from './assets/icons/trash.svg'
6
6
  import IconEdit from './assets/icons/pencil.svg'
7
+ import IconCode from './assets/icons/code.svg'
7
8
  import ActivityIndicator from './assets/img/activity-indicator-circle.svg'
8
9
  import AppLockout from './assets/img/app-lockout.svg'
9
10
  import Biometrics from './assets/img/biometrics.svg'
@@ -52,6 +53,7 @@ import TabOneIcon from './assets/img/message-text-icon-outline.svg'
52
53
  import TabTwoIcon from './assets/img/qrcode-scan-icon.svg'
53
54
  import TabThreeFocusedIcon from './assets/img/wallet-icon.svg'
54
55
  import TabThreeIcon from './assets/img/wallet-icon-outline.svg'
56
+ import React from 'react'
55
57
 
56
58
  export interface ISVGAssets {
57
59
  activityIndicator: React.FC<SvgProps>
@@ -108,6 +110,7 @@ export interface ISVGAssets {
108
110
  iconEdit: React.FC<SvgProps>
109
111
  iconWarning: React.FC<SvgProps>
110
112
  iconError: React.FC<SvgProps>
113
+ iconCode: React.FC<SvgProps>
111
114
  tabOneIcon: React.FC<SvgProps>
112
115
  tabOneFocusedIcon: React.FC<SvgProps>
113
116
  tabTwoIcon: React.FC<SvgProps>
@@ -1087,6 +1090,7 @@ export const Assets = {
1087
1090
  homeCenterImg: HomeCenterImg,
1088
1091
  iconDelete: IconDelete,
1089
1092
  iconEdit: IconEdit,
1093
+ iconCode: IconCode,
1090
1094
  iconError: IconError,
1091
1095
  iconWarning: IconWarning,
1092
1096
  tabOneIcon: TabOneIcon,
@@ -51,6 +51,7 @@ export enum Screens {
51
51
  NameWallet = 'Name Wallet',
52
52
  RenameWallet = 'Rename Wallet',
53
53
  RenameContact = 'Rename Contact',
54
+ JSONDetails = 'JSON Details',
54
55
  ScanHelp = 'Scan Help',
55
56
  HistorySettings = 'History Settings',
56
57
  HistoryPage = 'History',
@@ -122,6 +123,7 @@ export type ContactStackParams = {
122
123
  [Screens.CredentialOffer]: { credentialId: string }
123
124
  [Screens.ProofDetails]: { recordId: string; isHistory?: boolean }
124
125
  [Screens.ProofRequest]: { proofId: string }
126
+ [Screens.JSONDetails]: { jsonBlob: string }
125
127
  }
126
128
 
127
129
  export type ProofRequestsStackParams = {
@@ -141,6 +143,7 @@ export type ProofRequestsStackParams = {
141
143
 
142
144
  export type CredentialStackParams = {
143
145
  [Screens.Credentials]: undefined
146
+ [Screens.JSONDetails]: { jsonBlob: string }
144
147
  }
145
148
 
146
149
  export type HomeStackParams = {