@bifold/core 2.2.0 → 2.3.0

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 (262) hide show
  1. package/lib/commonjs/App.js +1 -2
  2. package/lib/commonjs/App.js.map +1 -1
  3. package/lib/commonjs/assets/oca-bundles.json +4 -4
  4. package/lib/commonjs/components/inputs/PINInput.js +4 -2
  5. package/lib/commonjs/components/inputs/PINInput.js.map +1 -1
  6. package/lib/commonjs/components/misc/CredentialCard11.js +34 -13
  7. package/lib/commonjs/components/misc/CredentialCard11.js.map +1 -1
  8. package/lib/commonjs/components/modals/DeveloperModal.js +2 -8
  9. package/lib/commonjs/components/modals/DeveloperModal.js.map +1 -1
  10. package/lib/commonjs/components/views/Banner.js +162 -0
  11. package/lib/commonjs/components/views/Banner.js.map +1 -0
  12. package/lib/commonjs/components/views/HeaderWithBanner.js +17 -0
  13. package/lib/commonjs/components/views/HeaderWithBanner.js.map +1 -0
  14. package/lib/commonjs/components/views/KeyboardView.js +21 -8
  15. package/lib/commonjs/components/views/KeyboardView.js.map +1 -1
  16. package/lib/commonjs/container-api.js +1 -0
  17. package/lib/commonjs/container-api.js.map +1 -1
  18. package/lib/commonjs/container-impl.js +2 -0
  19. package/lib/commonjs/container-impl.js.map +1 -1
  20. package/lib/commonjs/contexts/network.js +36 -0
  21. package/lib/commonjs/contexts/network.js.map +1 -1
  22. package/lib/commonjs/contexts/reducers/store.js +30 -14
  23. package/lib/commonjs/contexts/reducers/store.js.map +1 -1
  24. package/lib/commonjs/contexts/store.js +3 -3
  25. package/lib/commonjs/contexts/store.js.map +1 -1
  26. package/lib/commonjs/index.js +0 -8
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/commonjs/localization/en/en.json +3 -0
  29. package/lib/commonjs/localization/fr/fr.json +3 -1
  30. package/lib/commonjs/localization/pt-br/pt-br.json +3 -1
  31. package/lib/commonjs/modules/history/ui/HistorySettings.js.map +1 -1
  32. package/lib/commonjs/modules/openid/screens/OpenIDProofChangeCredential.js +1 -1
  33. package/lib/commonjs/modules/openid/screens/OpenIDProofChangeCredential.js.map +1 -1
  34. package/lib/commonjs/navigators/ContactStack.js +0 -16
  35. package/lib/commonjs/navigators/ContactStack.js.map +1 -1
  36. package/lib/commonjs/navigators/DeliveryStack.js +0 -16
  37. package/lib/commonjs/navigators/DeliveryStack.js.map +1 -1
  38. package/lib/commonjs/navigators/MainStack.js.map +1 -1
  39. package/lib/commonjs/navigators/NotificationStack.js +0 -16
  40. package/lib/commonjs/navigators/NotificationStack.js.map +1 -1
  41. package/lib/commonjs/navigators/OnboardingScreens.js.map +1 -1
  42. package/lib/commonjs/navigators/defaultStackOptions.js +2 -0
  43. package/lib/commonjs/navigators/defaultStackOptions.js.map +1 -1
  44. package/lib/commonjs/screens/Chat.js +11 -1
  45. package/lib/commonjs/screens/Chat.js.map +1 -1
  46. package/lib/commonjs/screens/CredentialDetails.js.map +1 -1
  47. package/lib/commonjs/screens/PINChange.js +9 -6
  48. package/lib/commonjs/screens/PINChange.js.map +1 -1
  49. package/lib/commonjs/screens/PINEnter.js +10 -8
  50. package/lib/commonjs/screens/PINEnter.js.map +1 -1
  51. package/lib/commonjs/screens/PINVerify.js +13 -11
  52. package/lib/commonjs/screens/PINVerify.js.map +1 -1
  53. package/lib/commonjs/screens/Terms.js +1 -19
  54. package/lib/commonjs/screens/Terms.js.map +1 -1
  55. package/lib/commonjs/screens/ToggleBiometry.js +2 -1
  56. package/lib/commonjs/screens/ToggleBiometry.js.map +1 -1
  57. package/lib/commonjs/services/logger.js +32 -8
  58. package/lib/commonjs/services/logger.js.map +1 -1
  59. package/lib/commonjs/types/state.js +4 -0
  60. package/lib/module/App.js +1 -2
  61. package/lib/module/App.js.map +1 -1
  62. package/lib/module/assets/oca-bundles.json +4 -4
  63. package/lib/module/components/inputs/PINInput.js +4 -2
  64. package/lib/module/components/inputs/PINInput.js.map +1 -1
  65. package/lib/module/components/misc/CredentialCard11.js +34 -13
  66. package/lib/module/components/misc/CredentialCard11.js.map +1 -1
  67. package/lib/module/components/modals/DeveloperModal.js +2 -8
  68. package/lib/module/components/modals/DeveloperModal.js.map +1 -1
  69. package/lib/module/components/views/Banner.js +152 -0
  70. package/lib/module/components/views/Banner.js.map +1 -0
  71. package/lib/module/components/views/HeaderWithBanner.js +10 -0
  72. package/lib/module/components/views/HeaderWithBanner.js.map +1 -0
  73. package/lib/module/components/views/KeyboardView.js +22 -9
  74. package/lib/module/components/views/KeyboardView.js.map +1 -1
  75. package/lib/module/container-api.js +1 -0
  76. package/lib/module/container-api.js.map +1 -1
  77. package/lib/module/container-impl.js +2 -0
  78. package/lib/module/container-impl.js.map +1 -1
  79. package/lib/module/contexts/network.js +37 -1
  80. package/lib/module/contexts/network.js.map +1 -1
  81. package/lib/module/contexts/reducers/store.js +30 -14
  82. package/lib/module/contexts/reducers/store.js.map +1 -1
  83. package/lib/module/contexts/store.js +3 -3
  84. package/lib/module/contexts/store.js.map +1 -1
  85. package/lib/module/index.js +1 -2
  86. package/lib/module/index.js.map +1 -1
  87. package/lib/module/localization/en/en.json +3 -0
  88. package/lib/module/localization/fr/fr.json +3 -1
  89. package/lib/module/localization/pt-br/pt-br.json +3 -1
  90. package/lib/module/modules/history/ui/HistorySettings.js.map +1 -1
  91. package/lib/module/modules/openid/screens/OpenIDProofChangeCredential.js +1 -1
  92. package/lib/module/modules/openid/screens/OpenIDProofChangeCredential.js.map +1 -1
  93. package/lib/module/navigators/ContactStack.js +0 -16
  94. package/lib/module/navigators/ContactStack.js.map +1 -1
  95. package/lib/module/navigators/DeliveryStack.js +0 -16
  96. package/lib/module/navigators/DeliveryStack.js.map +1 -1
  97. package/lib/module/navigators/MainStack.js.map +1 -1
  98. package/lib/module/navigators/NotificationStack.js +0 -16
  99. package/lib/module/navigators/NotificationStack.js.map +1 -1
  100. package/lib/module/navigators/OnboardingScreens.js.map +1 -1
  101. package/lib/module/navigators/defaultStackOptions.js +2 -0
  102. package/lib/module/navigators/defaultStackOptions.js.map +1 -1
  103. package/lib/module/screens/Chat.js +11 -1
  104. package/lib/module/screens/Chat.js.map +1 -1
  105. package/lib/module/screens/CredentialDetails.js.map +1 -1
  106. package/lib/module/screens/PINChange.js +9 -6
  107. package/lib/module/screens/PINChange.js.map +1 -1
  108. package/lib/module/screens/PINEnter.js +10 -8
  109. package/lib/module/screens/PINEnter.js.map +1 -1
  110. package/lib/module/screens/PINVerify.js +13 -11
  111. package/lib/module/screens/PINVerify.js.map +1 -1
  112. package/lib/module/screens/Terms.js +1 -19
  113. package/lib/module/screens/Terms.js.map +1 -1
  114. package/lib/module/screens/ToggleBiometry.js +2 -1
  115. package/lib/module/screens/ToggleBiometry.js.map +1 -1
  116. package/lib/module/services/logger.js +32 -8
  117. package/lib/module/services/logger.js.map +1 -1
  118. package/lib/module/types/state.js +1 -1
  119. package/lib/typescript/src/App.d.ts.map +1 -1
  120. package/lib/typescript/src/components/chat/ChatActions.d.ts.map +1 -1
  121. package/lib/typescript/src/components/chat/ChatBubble.d.ts.map +1 -1
  122. package/lib/typescript/src/components/chat/MessageInput.d.ts.map +1 -1
  123. package/lib/typescript/src/components/inputs/PINInput.d.ts +1 -0
  124. package/lib/typescript/src/components/inputs/PINInput.d.ts.map +1 -1
  125. package/lib/typescript/src/components/listItems/ContactCredentialListItem.d.ts.map +1 -1
  126. package/lib/typescript/src/components/misc/CredentialCard11.d.ts.map +1 -1
  127. package/lib/typescript/src/components/misc/CredentialCard11ActionFooter.d.ts.map +1 -1
  128. package/lib/typescript/src/components/misc/PINHeader.d.ts.map +1 -1
  129. package/lib/typescript/src/components/modals/DeveloperModal.d.ts.map +1 -1
  130. package/lib/typescript/src/components/tour/TourOverlay.d.ts.map +1 -1
  131. package/lib/typescript/src/components/views/Banner.d.ts +16 -0
  132. package/lib/typescript/src/components/views/Banner.d.ts.map +1 -0
  133. package/lib/typescript/src/components/views/HeaderWithBanner.d.ts +5 -0
  134. package/lib/typescript/src/components/views/HeaderWithBanner.d.ts.map +1 -0
  135. package/lib/typescript/src/components/views/KeyboardView.d.ts +1 -0
  136. package/lib/typescript/src/components/views/KeyboardView.d.ts.map +1 -1
  137. package/lib/typescript/src/container-api.d.ts +3 -0
  138. package/lib/typescript/src/container-api.d.ts.map +1 -1
  139. package/lib/typescript/src/container-impl.d.ts +1 -0
  140. package/lib/typescript/src/container-impl.d.ts.map +1 -1
  141. package/lib/typescript/src/contexts/navigation.d.ts.map +1 -1
  142. package/lib/typescript/src/contexts/network.d.ts.map +1 -1
  143. package/lib/typescript/src/contexts/reducers/store.d.ts +6 -4
  144. package/lib/typescript/src/contexts/reducers/store.d.ts.map +1 -1
  145. package/lib/typescript/src/contexts/store.d.ts.map +1 -1
  146. package/lib/typescript/src/contexts/theme.d.ts.map +1 -1
  147. package/lib/typescript/src/hooks/chat-messages.d.ts.map +1 -1
  148. package/lib/typescript/src/hooks/connections.d.ts.map +1 -1
  149. package/lib/typescript/src/hooks/credential-card-styles.d.ts +2 -2
  150. package/lib/typescript/src/hooks/credential-card-styles.d.ts.map +1 -1
  151. package/lib/typescript/src/hooks/credentials.d.ts.map +1 -1
  152. package/lib/typescript/src/hooks/developer-mode.d.ts.map +1 -1
  153. package/lib/typescript/src/hooks/notifications.d.ts.map +1 -1
  154. package/lib/typescript/src/hooks/oob.d.ts.map +1 -1
  155. package/lib/typescript/src/hooks/proof-request-templates.d.ts.map +1 -1
  156. package/lib/typescript/src/hooks/proofs.d.ts.map +1 -1
  157. package/lib/typescript/src/hooks/screen-capture.d.ts.map +1 -1
  158. package/lib/typescript/src/hooks/useOnboardingState.d.ts.map +1 -1
  159. package/lib/typescript/src/hooks/usePINValidation.d.ts.map +1 -1
  160. package/lib/typescript/src/index.d.ts +1 -2
  161. package/lib/typescript/src/index.d.ts.map +1 -1
  162. package/lib/typescript/src/localization/index.d.ts.map +1 -1
  163. package/lib/typescript/src/modules/history/ui/HistorySettings.d.ts +2 -3
  164. package/lib/typescript/src/modules/history/ui/HistorySettings.d.ts.map +1 -1
  165. package/lib/typescript/src/modules/openid/hooks/openid.d.ts.map +1 -1
  166. package/lib/typescript/src/modules/openid/offerResolve.d.ts.map +1 -1
  167. package/lib/typescript/src/modules/openid/resolverProof.d.ts.map +1 -1
  168. package/lib/typescript/src/modules/openid/utils/utils.d.ts.map +1 -1
  169. package/lib/typescript/src/navigators/ContactStack.d.ts.map +1 -1
  170. package/lib/typescript/src/navigators/DeliveryStack.d.ts.map +1 -1
  171. package/lib/typescript/src/navigators/MainStack.d.ts.map +1 -1
  172. package/lib/typescript/src/navigators/NotificationStack.d.ts.map +1 -1
  173. package/lib/typescript/src/navigators/OnboardingScreens.d.ts +10 -10
  174. package/lib/typescript/src/navigators/OnboardingScreens.d.ts.map +1 -1
  175. package/lib/typescript/src/navigators/defaultStackOptions.d.ts.map +1 -1
  176. package/lib/typescript/src/onboarding.d.ts.map +1 -1
  177. package/lib/typescript/src/screens/Chat.d.ts.map +1 -1
  178. package/lib/typescript/src/screens/ConfigureMediator.d.ts.map +1 -1
  179. package/lib/typescript/src/screens/CredentialDetails.d.ts +2 -2
  180. package/lib/typescript/src/screens/CredentialDetails.d.ts.map +1 -1
  181. package/lib/typescript/src/screens/JSONDetails.d.ts.map +1 -1
  182. package/lib/typescript/src/screens/OnboardingPages.d.ts.map +1 -1
  183. package/lib/typescript/src/screens/PINChange.d.ts +2 -3
  184. package/lib/typescript/src/screens/PINChange.d.ts.map +1 -1
  185. package/lib/typescript/src/screens/PINEnter.d.ts.map +1 -1
  186. package/lib/typescript/src/screens/PINVerify.d.ts.map +1 -1
  187. package/lib/typescript/src/screens/Terms.d.ts.map +1 -1
  188. package/lib/typescript/src/screens/ToggleBiometry.d.ts.map +1 -1
  189. package/lib/typescript/src/services/keychain.d.ts.map +1 -1
  190. package/lib/typescript/src/services/storage.d.ts.map +1 -1
  191. package/lib/typescript/src/types/navigators.d.ts +1 -0
  192. package/lib/typescript/src/types/navigators.d.ts.map +1 -1
  193. package/lib/typescript/src/types/state.d.ts +2 -1
  194. package/lib/typescript/src/types/state.d.ts.map +1 -1
  195. package/lib/typescript/src/utils/PINValidation.d.ts.map +1 -1
  196. package/lib/typescript/src/utils/agent.d.ts.map +1 -1
  197. package/lib/typescript/src/utils/anonCredsProofRequestMapper.d.ts.map +1 -1
  198. package/lib/typescript/src/utils/contacts.d.ts.map +1 -1
  199. package/lib/typescript/src/utils/credential.d.ts.map +1 -1
  200. package/lib/typescript/src/utils/crypto.d.ts.map +1 -1
  201. package/lib/typescript/src/utils/fileCache.d.ts.map +1 -1
  202. package/lib/typescript/src/utils/helpers.d.ts +1 -3
  203. package/lib/typescript/src/utils/helpers.d.ts.map +1 -1
  204. package/lib/typescript/src/utils/luminance.d.ts.map +1 -1
  205. package/lib/typescript/src/utils/mediatorhelpers.d.ts.map +1 -1
  206. package/lib/typescript/src/utils/migration.d.ts.map +1 -1
  207. package/lib/typescript/src/utils/network.d.ts.map +1 -1
  208. package/lib/typescript/src/utils/oca.d.ts.map +1 -1
  209. package/lib/typescript/src/utils/parsers.d.ts.map +1 -1
  210. package/lib/typescript/src/utils/proofBundle.d.ts.map +1 -1
  211. package/lib/typescript/src/utils/testable.d.ts.map +1 -1
  212. package/package.json +147 -148
  213. package/src/App.tsx +0 -2
  214. package/src/assets/oca-bundles.json +4 -4
  215. package/src/components/buttons/Button.tsx +24 -24
  216. package/src/components/inputs/PINInput.tsx +3 -1
  217. package/src/components/misc/CredentialCard11.tsx +40 -16
  218. package/src/components/modals/DeveloperModal.tsx +1 -2
  219. package/src/components/views/Banner.tsx +174 -0
  220. package/src/components/views/HeaderWithBanner.tsx +17 -0
  221. package/src/components/views/KeyboardView.tsx +23 -9
  222. package/src/container-api.ts +2 -0
  223. package/src/container-impl.ts +2 -0
  224. package/src/contexts/network.tsx +39 -1
  225. package/src/contexts/reducers/store.ts +30 -13
  226. package/src/contexts/store.tsx +1 -1
  227. package/src/index.ts +0 -2
  228. package/src/localization/en/en.json +3 -0
  229. package/src/localization/fr/fr.json +3 -1
  230. package/src/localization/pt-br/pt-br.json +3 -1
  231. package/src/modules/history/ui/HistorySettings.tsx +2 -3
  232. package/src/modules/openid/screens/OpenIDProofChangeCredential.tsx +1 -1
  233. package/src/navigators/ContactStack.tsx +0 -15
  234. package/src/navigators/DeliveryStack.tsx +0 -18
  235. package/src/navigators/MainStack.tsx +6 -3
  236. package/src/navigators/NotificationStack.tsx +0 -18
  237. package/src/navigators/OnboardingScreens.ts +10 -10
  238. package/src/navigators/defaultStackOptions.tsx +2 -0
  239. package/src/screens/Chat.tsx +29 -19
  240. package/src/screens/CredentialDetails.tsx +5 -2
  241. package/src/screens/PINChange.tsx +7 -5
  242. package/src/screens/PINEnter.tsx +6 -7
  243. package/src/screens/PINVerify.tsx +34 -32
  244. package/src/screens/Terms.tsx +3 -13
  245. package/src/screens/ToggleBiometry.tsx +1 -0
  246. package/src/services/logger.ts +8 -8
  247. package/src/types/navigators.ts +1 -0
  248. package/src/types/state.ts +3 -1
  249. package/lib/commonjs/components/network/NetInfo.js +0 -43
  250. package/lib/commonjs/components/network/NetInfo.js.map +0 -1
  251. package/lib/commonjs/hooks/onboarding.js +0 -23
  252. package/lib/commonjs/hooks/onboarding.js.map +0 -1
  253. package/lib/module/components/network/NetInfo.js +0 -36
  254. package/lib/module/components/network/NetInfo.js.map +0 -1
  255. package/lib/module/hooks/onboarding.js +0 -16
  256. package/lib/module/hooks/onboarding.js.map +0 -1
  257. package/lib/typescript/src/components/network/NetInfo.d.ts +0 -3
  258. package/lib/typescript/src/components/network/NetInfo.d.ts.map +0 -1
  259. package/lib/typescript/src/hooks/onboarding.d.ts +0 -2
  260. package/lib/typescript/src/hooks/onboarding.d.ts.map +0 -1
  261. package/src/components/network/NetInfo.tsx +0 -36
  262. package/src/hooks/onboarding.ts +0 -16
@@ -0,0 +1,174 @@
1
+ import React, { useState } from 'react'
2
+ import { useTranslation } from 'react-i18next'
3
+ import { StyleSheet, TouchableOpacity, View } from 'react-native'
4
+ import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
5
+ import { DispatchAction } from '../../contexts/reducers/store'
6
+ import { useStore } from '../../contexts/store'
7
+ import { useTheme } from '../../contexts/theme'
8
+ import { testIdWithKey } from '../../utils/testable'
9
+ import { ThemedText } from '../texts/ThemedText'
10
+
11
+ export interface BannerMessage {
12
+ id: string
13
+ title: string
14
+ type: 'error' | 'warning' | 'info' | 'success'
15
+ variant: 'summary' | 'detail'
16
+ dismissible?: boolean
17
+ }
18
+
19
+ export interface BannerSectionProps extends BannerMessage {
20
+ expanded?: boolean
21
+ onDismiss?: () => void
22
+ onToggle?: () => void
23
+ }
24
+
25
+ export const Banner: React.FC = () => {
26
+ const [store, dispatch] = useStore()
27
+ const [expanded, setExpanded] = useState(false)
28
+ const bannerMessages = store.preferences.bannerMessages
29
+ const { t } = useTranslation()
30
+ const alertMessage: BannerMessage = {
31
+ id: 'alertMessage',
32
+ title: t('Banner.AlertsLength', { alerts: bannerMessages.length }),
33
+ type: 'error',
34
+ variant: 'summary',
35
+ }
36
+
37
+ const dismissBanner = (key: string) => {
38
+ dispatch({
39
+ type: DispatchAction.REMOVE_BANNER_MESSAGE,
40
+ payload: [key],
41
+ })
42
+ }
43
+ if (!bannerMessages || bannerMessages.length == 0) {
44
+ return null
45
+ }
46
+
47
+ if (bannerMessages.length === 1) {
48
+ const message = bannerMessages[0]
49
+ return (
50
+ <BannerSection
51
+ id={message.id}
52
+ key={message.id}
53
+ title={message.title}
54
+ type={message.type}
55
+ variant="detail"
56
+ onDismiss={() => dismissBanner(message.id)}
57
+ dismissible={message.dismissible}
58
+ />
59
+ )
60
+ }
61
+
62
+ return (
63
+ <View>
64
+ <BannerSection
65
+ id={alertMessage.id}
66
+ title={t('Banner.AlertsLength', { alerts: bannerMessages.length })}
67
+ type={alertMessage.type}
68
+ variant={alertMessage.variant}
69
+ expanded={expanded}
70
+ onToggle={() => setExpanded(!expanded)}
71
+ dismissible={alertMessage.dismissible}
72
+ />
73
+ {expanded &&
74
+ bannerMessages.map((message) => (
75
+ <BannerSection
76
+ id={message.id}
77
+ key={message.id}
78
+ title={message.title}
79
+ type={message.type}
80
+ variant="detail"
81
+ onDismiss={() => dismissBanner(message.id)}
82
+ dismissible={message.dismissible}
83
+ />
84
+ ))}
85
+ </View>
86
+ )
87
+ }
88
+
89
+ export const BannerSection: React.FC<BannerSectionProps> = ({
90
+ title,
91
+ type,
92
+ onDismiss,
93
+ dismissible = true,
94
+ variant,
95
+ expanded,
96
+ onToggle,
97
+ }) => {
98
+ const { Spacing, ColorPallet } = useTheme()
99
+ const styles = StyleSheet.create({
100
+ container: {
101
+ backgroundColor: ColorPallet.brand.primary,
102
+ flexDirection: 'row',
103
+ alignItems: 'center',
104
+ padding: Spacing.md,
105
+ },
106
+ icon: {
107
+ marginRight: Spacing.md,
108
+ },
109
+ })
110
+
111
+ const iconName = (type: string): string => {
112
+ switch (type) {
113
+ case 'error':
114
+ return 'alert-circle'
115
+ case 'warning':
116
+ return 'alert'
117
+ case 'info':
118
+ return 'information'
119
+ case 'success':
120
+ return 'check-circle'
121
+ default:
122
+ return 'information'
123
+ }
124
+ }
125
+
126
+ const bannerColor = (type: string): string => {
127
+ switch (type) {
128
+ case 'error':
129
+ return '#CE3E39'
130
+ case 'warning':
131
+ return '#F8BB47'
132
+ case 'info':
133
+ return '#2E5DD7'
134
+ case 'success':
135
+ return '#42814A'
136
+ default:
137
+ return '#2E5DD7'
138
+ }
139
+ }
140
+
141
+ // If more details are needed we might need to push the banner down to accommodate the extra information
142
+ return (
143
+ <TouchableOpacity
144
+ style={{ ...styles.container, backgroundColor: bannerColor(type) }}
145
+ testID={testIdWithKey(`button-${type}`)}
146
+ onPress={() => {
147
+ if (variant === 'summary' && onToggle) {
148
+ onToggle()
149
+ } else if (dismissible && onDismiss) {
150
+ onDismiss()
151
+ }
152
+ }}
153
+ >
154
+ <Icon
155
+ name={iconName(type)}
156
+ size={24}
157
+ color={type === 'warning' ? ColorPallet.brand.secondaryBackground : ColorPallet.grayscale.white}
158
+ style={styles.icon}
159
+ testID={testIdWithKey(`icon-${type}`)}
160
+ />
161
+ <ThemedText
162
+ variant={'bold'}
163
+ style={{
164
+ color: type === 'warning' ? ColorPallet.brand.secondaryBackground : ColorPallet.grayscale.white,
165
+ flex: 1,
166
+ }}
167
+ testID={testIdWithKey(`text-${type}`)}
168
+ >
169
+ {title}
170
+ </ThemedText>
171
+ {variant === 'summary' && <Icon name={expanded ? 'chevron-up' : 'chevron-down'} size={24} color="white" />}
172
+ </TouchableOpacity>
173
+ )
174
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import { View } from 'react-native'
3
+ import { StackHeaderProps, Header } from '@react-navigation/stack'
4
+ import { useServices, TOKENS } from '../../container-api'
5
+
6
+ const HeaderWithBanner: React.FC<StackHeaderProps> = (props) => {
7
+ const [NotificationBanner] = useServices([TOKENS.COMPONENT_NOTIFICATION_BANNER])
8
+
9
+ return (
10
+ <View>
11
+ <Header {...props} />
12
+ <NotificationBanner />
13
+ </View>
14
+ )
15
+ }
16
+
17
+ export default HeaderWithBanner
@@ -1,25 +1,39 @@
1
1
  import React from 'react'
2
- import { KeyboardAvoidingView, Platform, ScrollView } from 'react-native'
2
+ import { KeyboardAvoidingView, ScrollView } from 'react-native'
3
3
  import { SafeAreaView } from 'react-native-safe-area-context'
4
4
  import { useTheme } from '../../contexts/theme'
5
+ import { useHeaderHeight } from '@react-navigation/elements'
5
6
 
6
- const KeyboardView: React.FC<{ children: React.ReactNode }> = ({ children }) => {
7
+ const useSafeHeaderHeight = (): number => {
8
+ try {
9
+ return useHeaderHeight()
10
+ } catch {
11
+ return 100
12
+ }
13
+ }
14
+
15
+ const KeyboardView: React.FC<{ children: React.ReactNode; keyboardAvoiding?: boolean }> = ({
16
+ children,
17
+ keyboardAvoiding = true,
18
+ }) => {
7
19
  const { ColorPallet } = useTheme()
20
+ const headerHeight = useSafeHeaderHeight()
8
21
  return (
9
22
  <SafeAreaView
10
23
  style={{ flex: 1, backgroundColor: ColorPallet.brand.primaryBackground }}
11
24
  edges={['bottom', 'left', 'right']}
12
25
  >
13
- <KeyboardAvoidingView
14
- style={{ flex: 1 }}
15
- // below property is the distance to account for between the top of the screen and the top of the view. It is at most 100 with max zoom + font settings
16
- keyboardVerticalOffset={100}
17
- behavior={Platform.OS === 'ios' ? 'padding' : undefined}
18
- >
26
+ {keyboardAvoiding ? (
27
+ <KeyboardAvoidingView style={{ flex: 1 }} keyboardVerticalOffset={headerHeight} behavior="padding">
28
+ <ScrollView contentContainerStyle={{ flexGrow: 1 }} keyboardShouldPersistTaps={'handled'}>
29
+ {children}
30
+ </ScrollView>
31
+ </KeyboardAvoidingView>
32
+ ) : (
19
33
  <ScrollView contentContainerStyle={{ flexGrow: 1 }} keyboardShouldPersistTaps={'handled'}>
20
34
  {children}
21
35
  </ScrollView>
22
- </KeyboardAvoidingView>
36
+ )}
23
37
  </SafeAreaView>
24
38
  )
25
39
  }
@@ -77,6 +77,7 @@ export const HOOK_TOKENS = {
77
77
 
78
78
  export const COMPONENT_TOKENS = {
79
79
  COMPONENT_HOME_HEADER: 'component.home.header',
80
+ COMPONENT_NOTIFICATION_BANNER: 'component.notification.banner',
80
81
  COMPONENT_HOME_NOTIFICATIONS_EMPTY_LIST: 'component.home.notifications-empty-list',
81
82
  COMPONENT_HOME_FOOTER: 'component.home.footer',
82
83
  COMPONENT_CRED_EMPTY_LIST: 'component.cred.empty-list',
@@ -215,6 +216,7 @@ export type TokenMapping = {
215
216
  [TOKENS.COMPONENT_CRED_LIST_OPTIONS]: React.FC
216
217
  [TOKENS.COMPONENT_CRED_LIST_FOOTER]: React.FC<CredentialListFooterProps>
217
218
  [TOKENS.COMPONENT_HOME_HEADER]: React.FC
219
+ [TOKENS.COMPONENT_NOTIFICATION_BANNER]: React.FC
218
220
  [TOKENS.COMPONENT_HOME_NOTIFICATIONS_EMPTY_LIST]: React.FC
219
221
  [TOKENS.COMPONENT_HOME_FOOTER]: React.FC
220
222
  [TOKENS.COMPONENT_CRED_EMPTY_LIST]: React.FC
@@ -15,6 +15,7 @@ import NoNewUpdates from './components/misc/NoNewUpdates'
15
15
  import PINHeader from './components/misc/PINHeader'
16
16
  import Record from './components/record/Record'
17
17
  import HomeFooterView from './components/views/HomeFooterView'
18
+ import { Banner } from './components/views/Banner'
18
19
  import HomeHeaderView from './components/views/HomeHeaderView'
19
20
  import defaultIndyLedgers from './configs/ledgers/indy'
20
21
  import { LocalStorageKeys, PINRules } from './constants'
@@ -153,6 +154,7 @@ export class MainContainer implements Container {
153
154
  this._container.registerInstance(TOKENS.COMPONENT_CRED_LIST_OPTIONS, () => null)
154
155
  this._container.registerInstance(TOKENS.COMPONENT_CRED_LIST_FOOTER, () => null)
155
156
  this._container.registerInstance(TOKENS.COMPONENT_HOME_HEADER, HomeHeaderView)
157
+ this._container.registerInstance(TOKENS.COMPONENT_NOTIFICATION_BANNER, Banner)
156
158
  this._container.registerInstance(TOKENS.COMPONENT_HOME_NOTIFICATIONS_EMPTY_LIST, NoNewUpdates)
157
159
  this._container.registerInstance(TOKENS.COMPONENT_HOME_FOOTER, HomeFooterView)
158
160
  this._container.registerInstance(TOKENS.COMPONENT_CRED_EMPTY_LIST, EmptyList)
@@ -1,7 +1,10 @@
1
1
  import { NetInfoStateType, useNetInfo } from '@react-native-community/netinfo'
2
- import { createContext, useContext, useState, useCallback, PropsWithChildren } from 'react'
2
+ import { createContext, useContext, useState, useCallback, PropsWithChildren, useEffect } from 'react'
3
3
 
4
4
  import NetInfoModal from '../components/modals/NetInfoModal'
5
+ import { useTranslation } from 'react-i18next'
6
+ import { useStore } from './store'
7
+ import { DispatchAction } from './reducers/store'
5
8
 
6
9
  export interface NetworkContext {
7
10
  silentAssertConnectedNetwork: () => boolean | null
@@ -19,6 +22,9 @@ export const NetworkContext = createContext<NetworkContext>(null as unknown as N
19
22
  export const NetworkProvider = ({ children }: PropsWithChildren) => {
20
23
  const { isConnected, type, isInternetReachable } = useNetInfo()
21
24
  const [isNetInfoModalDisplayed, setIsNetInfoModalDisplayed] = useState<boolean>(false)
25
+ const { t } = useTranslation()
26
+ const [hasShown, setHasShown] = useState(false)
27
+ const [, dispatch] = useStore()
22
28
 
23
29
  const displayNetInfoModal = useCallback(() => {
24
30
  setIsNetInfoModalDisplayed(true)
@@ -62,6 +68,38 @@ export const NetworkProvider = ({ children }: PropsWithChildren) => {
62
68
  return isInternetReachable
63
69
  }, [isInternetReachable])
64
70
 
71
+ const showNetworkWarning = useCallback(() => {
72
+ setHasShown(true)
73
+ dispatch({
74
+ type: DispatchAction.BANNER_MESSAGES,
75
+ payload: [
76
+ {
77
+ id: 'netinfo-no-internet',
78
+ title: t('NetInfo.NoInternetConnectionTitle'),
79
+ type: 'error',
80
+ variant: 'detail',
81
+ dismissible: false,
82
+ },
83
+ ],
84
+ })
85
+ }, [dispatch, t])
86
+
87
+ useEffect(() => {
88
+ const internetReachable = assertInternetReachable()
89
+ if (internetReachable) {
90
+ setHasShown(false)
91
+ dispatch({
92
+ type: DispatchAction.REMOVE_BANNER_MESSAGE,
93
+ payload: ['netinfo-no-internet'],
94
+ })
95
+ }
96
+
97
+ // Strict check for false, null means the network state is not yet known
98
+ if (internetReachable === false && !hasShown) {
99
+ showNetworkWarning()
100
+ }
101
+ }, [showNetworkWarning, assertInternetReachable, hasShown, dispatch])
102
+
65
103
  return (
66
104
  <NetworkContext.Provider
67
105
  value={{
@@ -28,7 +28,6 @@ enum OnboardingDispatchAction {
28
28
  DID_NAME_WALLET = 'onboarding/didNameWallet',
29
29
  DID_COMPLETE_ONBOARDING = 'onboarding/didCompleteOnboarding',
30
30
  ONBOARDING_VERSION = 'onboarding/onboardingVersion',
31
- SET_POST_AUTH_SCREENS = 'onboarding/postAuthScreens',
32
31
  }
33
32
 
34
33
  enum MigrationDispatchAction {
@@ -64,6 +63,8 @@ enum PreferencesDispatchAction {
64
63
  SET_SELECTED_MEDIATOR = 'preferences/setSelectedMediator',
65
64
  ADD_AVAILABLE_MEDIATOR = 'preferences/addAvailableMediator',
66
65
  RESET_MEDIATORS = 'preferences/resetMediators',
66
+ BANNER_MESSAGES = 'preferences/bannerMessages',
67
+ REMOVE_BANNER_MESSAGE = 'REMOVE_BANNER_MESSAGE',
67
68
  }
68
69
 
69
70
  enum ToursDispatchAction {
@@ -561,6 +562,34 @@ export const reducer = <S extends State>(state: S, action: ReducerAction<Dispatc
561
562
  }
562
563
  }
563
564
 
565
+ case PreferencesDispatchAction.BANNER_MESSAGES: {
566
+ const bannerMessageToAdd = action?.payload ?? []
567
+ const newBannerMessages = [...state.preferences.bannerMessages, ...bannerMessageToAdd]
568
+ const preferences: Preferences = {
569
+ ...state.preferences,
570
+ bannerMessages: newBannerMessages,
571
+ }
572
+ PersistentStorage.storeValueForKey(LocalStorageKeys.Preferences, preferences)
573
+ return {
574
+ ...state,
575
+ preferences,
576
+ }
577
+ }
578
+
579
+ case PreferencesDispatchAction.REMOVE_BANNER_MESSAGE: {
580
+ const keysToRemove = action?.payload ?? []
581
+ const newBannerMessages = state.preferences.bannerMessages.filter((msg) => !keysToRemove.includes(msg.id))
582
+ const preferences: Preferences = {
583
+ ...state.preferences,
584
+ bannerMessages: newBannerMessages,
585
+ }
586
+ PersistentStorage.storeValueForKey(LocalStorageKeys.Preferences, preferences)
587
+ return {
588
+ ...state,
589
+ preferences,
590
+ }
591
+ }
592
+
564
593
  case OnboardingDispatchAction.ONBOARDING_VERSION: {
565
594
  const version = (action?.payload || []).pop()
566
595
  const onboarding = {
@@ -678,18 +707,6 @@ export const reducer = <S extends State>(state: S, action: ReducerAction<Dispatc
678
707
 
679
708
  return newState
680
709
  }
681
- case OnboardingDispatchAction.SET_POST_AUTH_SCREENS: {
682
- const value = (action?.payload || []).pop()
683
- const onboarding = {
684
- ...state.onboarding,
685
- postAuthScreens: value,
686
- }
687
- const newState = {
688
- ...state,
689
- onboarding,
690
- }
691
- return newState
692
- }
693
710
  case MigrationDispatchAction.DID_MIGRATE_TO_ASKAR: {
694
711
  const migration: MigrationState = {
695
712
  ...state.migration,
@@ -25,7 +25,6 @@ export const defaultState: State = {
25
25
  didNameWallet: false,
26
26
  onboardingVersion: 0,
27
27
  didCompleteOnboarding: false,
28
- postAuthScreens: [],
29
28
  },
30
29
  authentication: {
31
30
  didAuthenticate: false,
@@ -60,6 +59,7 @@ export const defaultState: State = {
60
59
  autoLockTime: defaultAutoLockTime, // default wallets lockout time to 5 minutes
61
60
  availableMediators: [Config.MEDIATOR_URL ?? ''],
62
61
  selectedMediator: Config.MEDIATOR_URL ?? '',
62
+ bannerMessages: [],
63
63
  },
64
64
  tours: {
65
65
  seenToursPrompt: false,
package/src/index.ts CHANGED
@@ -15,7 +15,6 @@ import CredentialCard from './components/misc/CredentialCard'
15
15
  import InfoBox, { InfoBoxType } from './components/misc/InfoBox'
16
16
  import ErrorModal from './components/modals/ErrorModal'
17
17
  import SafeAreaModal from './components/modals/SafeAreaModal'
18
- import NetInfo from './components/network/NetInfo'
19
18
  import Record from './components/record/Record'
20
19
  import InfoTextBox from './components/texts/InfoTextBox'
21
20
  import Link from './components/texts/Link'
@@ -189,7 +188,6 @@ export {
189
188
  ToastType,
190
189
  toastConfig,
191
190
  NavContainer,
192
- NetInfo,
193
191
  OnboardingPages,
194
192
  OpenIDCredentialRecordProvider,
195
193
  NotificationListItem,
@@ -944,5 +944,8 @@
944
944
  "LearnMore": "Learn what's New",
945
945
  "UpdateNow": "Update the app",
946
946
  "UpdateLater": "Do this later"
947
+ },
948
+ "Banner": {
949
+ "AlertsLength": "You have {{ alerts }} alerts"
947
950
  }
948
951
  }
@@ -50,7 +50,6 @@
50
50
  "Send": "Envoyer",
51
51
  "Reset": "Reset (FR)",
52
52
  "ViewJSON": "View JSON Details (FR)"
53
-
54
53
  },
55
54
  "Date": {
56
55
  "ShortFormat": "D MMM",
@@ -927,5 +926,8 @@
927
926
  "LearnMore": "Learn what's New (FR)",
928
927
  "UpdateNow": "Update the app (FR)",
929
928
  "UpdateLater": "Do this later (FR)"
929
+ },
930
+ "Banner": {
931
+ "AlertsLength": "You have {{ alerts }} alerts (FR)"
930
932
  }
931
933
  }
@@ -49,7 +49,6 @@
49
49
  "Send": "Enviar",
50
50
  "Reset": "Reset (PT-BR)",
51
51
  "ViewJSON": "View JSON Details (PT-BR)"
52
-
53
52
  },
54
53
  "Date": {
55
54
  "ShortFormat": "D MMM",
@@ -905,5 +904,8 @@
905
904
  "LearnMore": "Learn what's New (PT-BR)",
906
905
  "UpdateNow": "Update the app (PT-BR)",
907
906
  "UpdateLater": "Do this later (PT-BR)"
907
+ },
908
+ "Banner": {
909
+ "AlertsLength": "You have {{ alerts }} alerts (PT-BR)"
908
910
  }
909
911
  }
@@ -1,5 +1,4 @@
1
1
  import { useAgent } from '@credo-ts/react-hooks'
2
- import { ParamListBase } from '@react-navigation/core'
3
2
  import { StackScreenProps } from '@react-navigation/stack'
4
3
  import React, { useCallback, useEffect, useState } from 'react'
5
4
  import { useTranslation } from 'react-i18next'
@@ -11,14 +10,14 @@ import KeyboardView from '../../../components/views/KeyboardView'
11
10
  import { TOKENS, useServices } from '../../../container-api'
12
11
  import { useAnimatedComponents } from '../../../contexts/animated-components'
13
12
  import { useTheme } from '../../../contexts/theme'
14
- import { Screens } from '../../../types/navigators'
13
+ import { Screens, SettingStackParams } from '../../../types/navigators'
15
14
  import { testIdWithKey } from '../../../utils/testable'
16
15
  import { HistoryBlockSelection, IHistoryManager } from '../types'
17
16
 
18
17
  import SingleSelectBlock from './components/SingleSelectBlock'
19
18
  import { ThemedText } from '../../../components/texts/ThemedText'
20
19
 
21
- interface HistorySettingsProps extends StackScreenProps<ParamListBase, Screens.HistorySettings> {}
20
+ interface HistorySettingsProps extends StackScreenProps<SettingStackParams, Screens.HistorySettings> {}
22
21
 
23
22
  const HistorySettings: React.FC<HistorySettingsProps> = () => {
24
23
  const [continueEnabled] = useState(true)
@@ -97,7 +97,7 @@ const OpenIDProofCredentialSelect: React.FC<Props> = ({ route, navigation }: Pro
97
97
  <RecordLoading />
98
98
  </View>
99
99
  ) : (
100
- <ThemedText variant='bold'>{t('ProofRequest.AvailableCards')}</ThemedText>
100
+ <ThemedText variant={'bold'}>{t('ProofRequest.AvailableCards')}</ThemedText>
101
101
  )}
102
102
  </View>
103
103
  )
@@ -7,10 +7,8 @@ import { useTheme } from '../contexts/theme'
7
7
  import Chat from '../screens/Chat'
8
8
  import ContactDetails from '../screens/ContactDetails'
9
9
  import CredentialDetails from '../screens/CredentialDetails'
10
- import CredentialOffer from '../screens/CredentialOffer'
11
10
  import ListContacts from '../screens/ListContacts'
12
11
  import ProofDetails from '../screens/ProofDetails'
13
- import ProofRequest from '../screens/ProofRequest'
14
12
  import RenameContact from '../screens/RenameContact'
15
13
  import JSONDetails from '../screens/JSONDetails'
16
14
  import WhatAreContacts from '../screens/WhatAreContacts'
@@ -77,11 +75,6 @@ const ContactStack: React.FC = () => {
77
75
  component={CredentialDetails}
78
76
  options={{ title: t('Screens.CredentialDetails'), ...ScreenOptionsDictionary[Screens.CredentialDetails] }}
79
77
  />
80
- <Stack.Screen
81
- name={Screens.CredentialOffer}
82
- component={CredentialOffer}
83
- options={{ title: t('Screens.CredentialOffer'), ...ScreenOptionsDictionary[Screens.CredentialOffer] }}
84
- />
85
78
  <Stack.Screen
86
79
  name={Screens.ProofDetails}
87
80
  component={ProofDetails}
@@ -91,14 +84,6 @@ const ContactStack: React.FC = () => {
91
84
  ...ScreenOptionsDictionary[Screens.ProofDetails],
92
85
  })}
93
86
  />
94
- <Stack.Screen
95
- name={Screens.ProofRequest}
96
- component={ProofRequest}
97
- options={{
98
- title: t('Screens.ProofRequest'),
99
- ...ScreenOptionsDictionary[Screens.ProofRequest],
100
- }}
101
- />
102
87
  </Stack.Navigator>
103
88
  )
104
89
  }
@@ -6,8 +6,6 @@ import HeaderRightHome from '../components/buttons/HeaderHome'
6
6
  import IconButton, { ButtonLocation } from '../components/buttons/IconButton'
7
7
  import { useTheme } from '../contexts/theme'
8
8
  import Connection from '../screens/Connection'
9
- import CredentialOffer from '../screens/CredentialOffer'
10
- import ProofRequest from '../screens/ProofRequest'
11
9
  import { DeliveryStackParams, Screens } from '../types/navigators'
12
10
  import { testIdWithKey } from '../utils/testable'
13
11
 
@@ -38,22 +36,6 @@ const DeliveryStack: React.FC = () => {
38
36
  }}
39
37
  >
40
38
  <Stack.Screen name={Screens.Connection} component={Connection} options={{ ...defaultStackOptions }} />
41
- <Stack.Screen
42
- name={Screens.ProofRequest}
43
- component={ProofRequest}
44
- options={{
45
- title: t('Screens.ProofRequest'),
46
- ...ScreenOptionsDictionary[Screens.ProofRequest],
47
- }}
48
- />
49
- <Stack.Screen
50
- name={Screens.CredentialOffer}
51
- component={CredentialOffer}
52
- options={{
53
- title: t('Screens.CredentialOffer'),
54
- ...ScreenOptionsDictionary[Screens.CredentialOffer],
55
- }}
56
- />
57
39
  <Stack.Screen
58
40
  name={Screens.OpenIDCredentialOffer}
59
41
  component={OpenIDCredentialOffer}
@@ -11,7 +11,7 @@ import { TOKENS, useServices } from '../container-api'
11
11
  import { useTheme } from '../contexts/theme'
12
12
  import HistoryStack from '../modules/history/navigation/HistoryStack'
13
13
  import Chat from '../screens/Chat'
14
- import { Screens, Stacks, TabStacks } from '../types/navigators'
14
+ import { RootStackParams, Screens, Stacks, TabStacks } from '../types/navigators'
15
15
  import { testIdWithKey } from '../utils/testable'
16
16
  import { useStore } from '../contexts/store'
17
17
  import { useTour } from '../contexts/tour/tour-context'
@@ -53,7 +53,7 @@ const MainStack: React.FC = () => {
53
53
  })
54
54
  }, [declinedProofs, agent, store.preferences.useDataRetention])
55
55
 
56
- const Stack = createStackNavigator()
56
+ const Stack = createStackNavigator<RootStackParams>()
57
57
 
58
58
  // This function is to make the fade in behavior of both iOS and
59
59
  // Android consistent for the settings menu
@@ -68,7 +68,10 @@ const MainStack: React.FC = () => {
68
68
  <View style={{ flex: 1 }} importantForAccessibility={hideElements}>
69
69
  <Stack.Navigator
70
70
  initialRouteName={Stacks.TabStack}
71
- screenOptions={{ ...defaultStackOptions, headerShown: false }}
71
+ screenOptions={{
72
+ ...defaultStackOptions,
73
+ headerShown: false,
74
+ }}
72
75
  >
73
76
  <Stack.Screen name={Stacks.TabStack} component={TabStack} />
74
77
  <Stack.Screen
@@ -5,8 +5,6 @@ import { useTranslation } from 'react-i18next'
5
5
  import { TOKENS, useServices } from '../container-api'
6
6
  import { useTheme } from '../contexts/theme'
7
7
  import CredentialDetails from '../screens/CredentialDetails'
8
- import CredentialOffer from '../screens/CredentialOffer'
9
- import ProofRequest from '../screens/ProofRequest'
10
8
  import { NotificationStackParams, Screens } from '../types/navigators'
11
9
 
12
10
  import { useDefaultStackOptions } from './defaultStackOptions'
@@ -31,22 +29,6 @@ const NotificationStack: React.FC = () => {
31
29
  ...ScreenOptionsDictionary[Screens.CredentialDetails],
32
30
  }}
33
31
  />
34
- <Stack.Screen
35
- name={Screens.CredentialOffer}
36
- component={CredentialOffer}
37
- options={{
38
- title: t('Screens.CredentialOffer'),
39
- ...ScreenOptionsDictionary[Screens.CredentialOffer],
40
- }}
41
- />
42
- <Stack.Screen
43
- name={Screens.ProofRequest}
44
- component={ProofRequest}
45
- options={{
46
- title: t('Screens.ProofRequest'),
47
- ...ScreenOptionsDictionary[Screens.ProofRequest],
48
- }}
49
- />
50
32
  {customNotification && (
51
33
  <Stack.Screen
52
34
  name={Screens.CustomNotification}