Skip to content

Commit

Permalink
chore: mise à jour du bifold vers la version 381 (#171)
Browse files Browse the repository at this point in the history
chore: mise à jour du bifold vers la version 381

Signed-off-by: fc-santos <[email protected]>
  • Loading branch information
fc-santos authored Dec 5, 2024
1 parent 8c716f8 commit f0744c3
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 143 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ index 1c8a86091e207b58a620be00db905b4ba7d06539..b3b630f911d116a0f6ce441c0aae3abe
const navigation = useNavigation<StackNavigationProp<HomeStackParams>>()
const [store, dispatch] = useStore()
diff --git a/App/screens/Home.tsx b/App/screens/Home.tsx
index ad946ed3ee1af79bbdc90fa70e30eefd6782128c..638c3c8301fe441a8ec07ed74b97cef0235cf8db 100644
index ad946ed3ee1af79bbdc90fa70e30eefd6782128c..ab5500bebf323cf187fc78080b131d154b9eb779 100644
--- a/App/screens/Home.tsx
+++ b/App/screens/Home.tsx
@@ -40,6 +40,8 @@ const Home: React.FC<HomeProps> = () => {
@@ -40,6 +40,9 @@ const Home: React.FC<HomeProps> = () => {
const [showTourPopup, setShowTourPopup] = useState(false)
const screenIsFocused = useIsFocused()

+ const [notificationItemId, setNotificationItemId] = useState<string | null>(null)
+
+
const styles = StyleSheet.create({
flatlist: {
marginBottom: 35,
@@ -49,23 +51,46 @@ const Home: React.FC<HomeProps> = () => {
@@ -49,26 +52,47 @@ const Home: React.FC<HomeProps> = () => {
const DisplayListItemType = useCallback((item: any): React.ReactNode => {
let component: React.ReactNode
if (item.type === 'BasicMessageRecord') {
Expand All @@ -43,8 +44,7 @@ index ad946ed3ee1af79bbdc90fa70e30eefd6782128c..638c3c8301fe441a8ec07ed74b97cef0
+ openSwipeableId={notificationItemId}
+ onOpenSwipeable={setNotificationItemId}
+ notificationType={NotificationType.BasicMessage}
+ notification={item}
+ />
+ notification={item} />
+ )
} else if (item.type === 'CredentialRecord') {
let notificationType = NotificationType.CredentialOffer
Expand All @@ -54,11 +54,10 @@ index ad946ed3ee1af79bbdc90fa70e30eefd6782128c..638c3c8301fe441a8ec07ed74b97cef0
- component = <NotificationListItem notificationType={notificationType} notification={item} />
+ component = (
+ <NotificationListItem
+ openSwipeableId={notificationItemId}
+ onOpenSwipeable={setNotificationItemId}
+ notificationType={notificationType}
+ notification={item}
+ />
+ openSwipeableId={notificationItemId}
+ onOpenSwipeable={setNotificationItemId}
+ notificationType={notificationType}
+ notification={item} />
+ )
} else if (item.type === 'CustomNotification' && customNotification) {
component = (
Expand All @@ -82,4 +81,8 @@ index ad946ed3ee1af79bbdc90fa70e30eefd6782128c..638c3c8301fe441a8ec07ed74b97cef0
+ )
}
return component
}, [customNotification, NotificationListItem])
- }, [customNotification, NotificationListItem])
+ }, [customNotification, NotificationListItem, notificationItemId, setNotificationItemId])

useEffect(() => {
const shouldShowTour = enableToursConfig && store.tours.enableTours && !store.tours.seenHomeTour
1 change: 1 addition & 0 deletions app/container-imp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export class AppContainer implements Container {
this._container.registerInstance(TOKENS.COMPONENT_HOME_NOTIFICATIONS_EMPTY_LIST, HomeEmptyList)
this._container.registerInstance(TOKENS.NOTIFICATIONS_LIST_ITEM, NotificationListItem)
this._container.registerInstance(TOKENS.CONFIG, defaultConfig)
this._container.registerInstance(TOKENS.HISTORY_ENABLED, true)
this._container.registerInstance(TOKENS.COMPONENT_CRED_LIST_FOOTER, AddCredentialButton)
this._container.registerInstance(TOKENS.COMPONENT_CRED_LIST_HEADER_RIGHT, HelpCenterButton)
this._container.registerInstance(TOKENS.COMPONENT_CRED_LIST_OPTIONS, AddCredentialSlider)
Expand Down
4 changes: 2 additions & 2 deletions app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ PODS:
- React-jsinspector (0.72.5)
- React-logger (0.72.5):
- glog
- "react-native-attestation (1.0.0-alpha.374+9bf85b1b)":
- "react-native-attestation (1.0.0-alpha.381+9e81308d)":
- RCT-Folly (= 2021.07.22.00)
- React-Core
- react-native-config (1.5.0):
Expand Down Expand Up @@ -784,7 +784,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: ff70a72027dea5cc7d71cfcc6fad7f599f63987a
React-jsinspector: aef73cbd43b70675f572214d10fa438c89bf11ba
React-logger: 2e4aee3e11b3ec4fa6cfd8004610bbb3b8d6cca4
react-native-attestation: f3a82053ed88e6069f999e951a0658843cf12d49
react-native-attestation: 51aad194ffdf205b9561c3a41b2ca68173ffced4
react-native-config: 5330c8258265c1e5fdb8c009d2cabd6badd96727
react-native-encrypted-storage: db300a3f2f0aba1e818417c1c0a6be549038deb7
react-native-get-random-values: a6ea6a8a65dc93e96e24a11105b1a9c8cfe1d72a
Expand Down
10 changes: 5 additions & 5 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
"@formatjs/intl-relativetimeformat": "9.3.1",
"@hyperledger/anoncreds-react-native": "0.2.4",
"@hyperledger/aries-askar-react-native": "0.2.3",
"@hyperledger/aries-bifold-core": "patch:@hyperledger/aries-bifold-core@npm%3A1.0.0-alpha.374#~/.yarn/patches/@hyperledger-aries-bifold-core-npm-1.0.0-alpha.374-1fd00e0b16.patch",
"@hyperledger/aries-bifold-remote-logs": "1.0.0-alpha.374",
"@hyperledger/aries-bifold-verifier": "1.0.0-alpha.374",
"@hyperledger/aries-oca": "1.0.0-alpha.374",
"@hyperledger/aries-react-native-attestation": "1.0.0-alpha.374",
"@hyperledger/aries-bifold-core": "patch:@hyperledger/aries-bifold-core@npm%3A1.0.0-alpha.381#~/.yarn/patches/@hyperledger-aries-bifold-core-npm-1.0.0-alpha.381-f8d8192b81.patch",
"@hyperledger/aries-bifold-remote-logs": "1.0.0-alpha.381",
"@hyperledger/aries-bifold-verifier": "1.0.0-alpha.381",
"@hyperledger/aries-oca": "1.0.0-alpha.381",
"@hyperledger/aries-react-native-attestation": "1.0.0-alpha.381",
"@hyperledger/indy-vdr-react-native": "0.2.2",
"@hyperledger/indy-vdr-shared": "0.2.2",
"@react-native-async-storage/async-storage": "1.15.11",
Expand Down
11 changes: 10 additions & 1 deletion app/src/components/AddCredentialSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { AnonCredsCredentialMetadataKey } from '@credo-ts/anoncreds/build/utils/metadata'
import { CredentialState } from '@credo-ts/core'
import { useCredentialByState } from '@credo-ts/react-hooks'
import { useTheme, Screens, Stacks, testIdWithKey, testIdForAccessabilityLabel } from '@hyperledger/aries-bifold-core'
import {
useTheme,
Screens,
Stacks,
testIdWithKey,
testIdForAccessabilityLabel,
useNetwork,
} from '@hyperledger/aries-bifold-core'
import { useNavigation } from '@react-navigation/native'
import React, { useEffect, useState, useCallback } from 'react'
import { useTranslation } from 'react-i18next'
Expand All @@ -16,6 +23,7 @@ const AddCredentialSlider: React.FC = () => {
const { ColorPallet, TextTheme } = useTheme()
const navigation = useNavigation()
const { t } = useTranslation()
const { assertNetworkConnected } = useNetwork()

const [addCredentialPressed, setAddCredentialPressed] = useState<boolean>(false)
const [showGetPersonCredential, setShowGetPersonCredential] = useState<boolean>(false)
Expand Down Expand Up @@ -73,6 +81,7 @@ const AddCredentialSlider: React.FC = () => {

const goToScanScreen = useCallback(() => {
deactivateSlider()
if (!assertNetworkConnected()) return
navigation.getParent()?.navigate(Stacks.ConnectStack, { screen: Screens.Scan })
}, [])

Expand Down
10 changes: 5 additions & 5 deletions app/src/components/EventItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GenericFn, testIdWithKey, ToastType, useStore, useTheme } from '@hyperledger/aries-bifold-core'
import { useEffect, useRef, useState } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Pressable, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import { Swipeable } from 'react-native-gesture-handler'
Expand Down Expand Up @@ -107,15 +107,15 @@ const EventItem = ({

const swipeableRef = useRef<Swipeable>(null)

const handleSwipeClose = () => {
const handleSwipeClose = useCallback(() => {
if (openSwipeableId === event.id) {
onOpenSwipeable(null) // Close the current swipeable
}
}
}, [openSwipeableId, onOpenSwipeable, event])

const handleSwipeOpen = () => {
const handleSwipeOpen = useCallback(() => {
onOpenSwipeable(event.id) // Call the parent function to notify which item is opened
}
}, [event, onOpenSwipeable])

const pressAction = () => {
if (activateSelection) {
Expand Down
14 changes: 10 additions & 4 deletions app/src/components/HomeHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Screens, Stacks, useTheme } from '@hyperledger/aries-bifold-core'
import { Screens, Stacks, useNetwork, useTheme } from '@hyperledger/aries-bifold-core'
import { ConnectStackParams } from '@hyperledger/aries-bifold-core/App/types/navigators'
import { useNavigation } from '@react-navigation/native'
import { StackNavigationProp } from '@react-navigation/stack'
Expand All @@ -14,6 +14,14 @@ const HomeHeader = () => {
const { t } = useTranslation()
const { ColorPallet } = useTheme()
const { navigate } = useNavigation<StackNavigationProp<ConnectStackParams>>()
const { assertNetworkConnected } = useNetwork()

const handleNavigation = () => {
if (!assertNetworkConnected()) {
return
}
navigate(Stacks.ConnectStack as never, { screen: Screens.Scan } as never)
}

const styles = StyleSheet.create({
container: {
Expand Down Expand Up @@ -74,9 +82,7 @@ const HomeHeader = () => {
<View style={styles.container}>
<HeaderText title={t('Home.Welcome')} />
<View style={styles.ScanQrCodeContainer}>
<TouchableWithoutFeedback
onPress={() => navigate(Stacks.ConnectStack as never, { screen: Screens.Scan } as never)}
>
<TouchableWithoutFeedback onPress={handleNavigation}>
<View style={styles.ScanQrCodeInnerContainer}>
<View style={styles.imgContainer}>
<HomeImg />
Expand Down
7 changes: 0 additions & 7 deletions app/src/components/NotificationListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({
},
})

const handleSwipeClose = () => {
if (openSwipeableId === notification.id) {
onOpenSwipeable(null) // Close the current swipeable
}
}

const getConnectionImage = (connection: ConnectionRecord | undefined, notificationType: NotificationTypeEnum) => {
if (connection?.imageUrl) return <Image source={{ uri: connection.imageUrl }} style={styles.icon} />
const dimensions = { width: 24, height: 24 }
Expand Down Expand Up @@ -340,7 +334,6 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({

const removeCurrentNotification = async () => {
await removeNotification()
handleSwipeClose()
}

return (
Expand Down
Loading

0 comments on commit f0744c3

Please sign in to comment.