Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new proof request loading screen #1243

Merged
merged 35 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
af7582d
feat: work on loading animation
jleach Aug 16, 2024
73ae808
refactor: create loading placeholder
jleach Aug 22, 2024
88718a2
feat: work on loading placeholder
jleach Aug 22, 2024
855704e
feat: work on loading placeholder
jleach Aug 22, 2024
0614b72
feat: add progress bar
jleach Aug 22, 2024
cb11b2e
feat: style
jleach Aug 22, 2024
7cf4c99
refactor: proof request to component
jleach Aug 23, 2024
a3fe3eb
feat: state for percent complete
jleach Aug 23, 2024
1b0f9a1
refactor: cred offer to component
jleach Aug 23, 2024
e52f7a0
refactor: code cleanup
jleach Aug 23, 2024
3118b6c
refactor: better props
jleach Aug 27, 2024
a1b835a
chore: code cleanup
jleach Aug 27, 2024
6d8f6d5
refactor: notif to use connection
jleach Aug 29, 2024
aea2962
refactor: fix connection tests
jleach Sep 5, 2024
4c6e638
refactor: fix contacts tests
jleach Sep 5, 2024
74103f0
refactor: work on fixing home tests
jleach Sep 6, 2024
b742554
chore: work on tests
jleach Sep 19, 2024
a61bd56
chore: work on tests
jleach Sep 19, 2024
aebfa77
chore: work on tests
jleach Sep 19, 2024
61707ef
chore: work on tests
jleach Sep 19, 2024
8373003
chore: work on tests
jleach Sep 19, 2024
ba9aad6
fix: lint issues
jleach Sep 19, 2024
b4d21a6
fix: type check and lint
jleach Sep 20, 2024
a31941a
fix: issue after rebase
jleach Sep 23, 2024
cb06f46
fix: lint issues
jleach Sep 23, 2024
97eb9bd
feat: audo redirect
jleach Sep 23, 2024
c0bb421
fix: snapshots
jleach Sep 23, 2024
bf02b80
fix: lint and type errors
jleach Sep 24, 2024
74dcb05
fix: no changes to file
jleach Sep 24, 2024
9fdfc80
fix: issues with rebase
jleach Sep 25, 2024
0bb6292
fix: update snapshots
jleach Sep 25, 2024
867fa24
fix: language support
jleach Sep 25, 2024
df5f39f
fix: lint issues
jleach Oct 1, 2024
f6fb2c1
chore: cleanup style
jleach Oct 2, 2024
6d784a5
chore: cleanup style
jleach Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 44 additions & 25 deletions packages/legacy/core/App/components/animated/RecordLoading.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,74 @@
import React, { useEffect, useRef } from 'react'
import { View, StyleSheet, Animated } from 'react-native'
import { StyleProp, ViewStyle, View, StyleSheet, Animated, useWindowDimensions } from 'react-native'

import { useTheme } from '../../contexts/theme'
import { testIdWithKey } from '../../utils/testable'

type RecordLoadingProps = {
style?: StyleProp<ViewStyle>
}

const fadeTiming: Animated.TimingAnimationConfig = {
toValue: 0.2,
toValue: 0.4,
duration: 1100,
useNativeDriver: true,
}

const RecordLoading: React.FC = () => {
const borderRadius = 10

const RecordLoading: React.FC<RecordLoadingProps> = ({ style }) => {
const { width } = useWindowDimensions()
const padding = width * 0.05
const logoHeight = width * 0.12
const { ColorPallet } = useTheme()
const rowFadeAnim = useRef(new Animated.Value(1))
const style = StyleSheet.create({
const myStyle = StyleSheet.create({
container: {
flexDirection: 'column',
},
rectangle: {
backgroundColor: ColorPallet.grayscale.veryLightGrey,
backgroundColor: ColorPallet.grayscale.lightGrey,
height: 30,
marginVertical: 10,
marginVertical: 5,
borderRadius,
},
line: {
margin: {
backgroundColor: ColorPallet.grayscale.lightGrey,
height: 1,
marginVertical: 5,
width: 40,
borderTopLeftRadius: borderRadius,
borderBottomLeftRadius: borderRadius,
},
logo: {
marginLeft: -1 * logoHeight + padding,
marginTop: padding,
backgroundColor: ColorPallet.grayscale.lightGrey,
height: logoHeight,
width: logoHeight,
borderRadius,
},
})

useEffect(() => {
Animated.loop(Animated.timing(rowFadeAnim.current, fadeTiming)).start()
}, [])

const makeARow = () => {
return (
<View style={{ flexDirection: 'column' }}>
<View style={[style.rectangle, { width: '35%' }]}></View>
<View style={[style.rectangle, { width: '85%' }]}></View>
<View style={style.line} />
</View>
)
}

return (
<View style={style.container} testID={testIdWithKey('RecordLoading')}>
<Animated.View style={{ opacity: rowFadeAnim.current }}>
{makeARow()}
{makeARow()}
</Animated.View>
</View>
<Animated.View
style={[{ opacity: rowFadeAnim.current, backgroundColor: ColorPallet.grayscale.white, borderRadius: 15 }, style]}
>
<View style={myStyle.container} testID={testIdWithKey('RecordLoading')}>
<View style={{ flexDirection: 'row' }}>
<View style={myStyle.margin} />
<View style={myStyle.logo} />
<View style={{ flexGrow: 1, marginLeft: 15, marginTop: 15, marginBottom: 15 }}>
<View style={[myStyle.rectangle, { width: '100%', height: 20 }]} />
<View style={[myStyle.rectangle, { width: '75%', height: 25 }]} />
<View style={[myStyle.rectangle, { width: '35%', height: 20, marginTop: 20 }]} />
<View style={[myStyle.rectangle, { width: '90%', height: 25 }]} />
</View>
</View>
</View>
</Animated.View>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({
})

const isReceivedProof = useMemo(() => {
return notificationType === NotificationType.ProofRequest &&
((notification as ProofExchangeRecord).state === ProofState.Done ||
(notification as ProofExchangeRecord).state === ProofState.PresentationSent)
return (
notificationType === NotificationType.ProofRequest &&
((notification as ProofExchangeRecord).state === ProofState.Done ||
(notification as ProofExchangeRecord).state === ProofState.PresentationSent)
)
}, [notificationType, notification])

const toggleDeclineModalVisible = useCallback(() => setDeclineModalVisible(prev => !prev), [])
const toggleDeclineModalVisible = useCallback(() => setDeclineModalVisible((prev) => !prev), [])

const declineProofRequest = useCallback(async () => {
try {
Expand Down Expand Up @@ -236,57 +238,57 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({
let details
switch (notificationType) {
case NotificationType.BasicMessage:
details = ({
details = {
type: InfoBoxType.Info,
title: t('Home.NewMessage'),
body: theirLabel ? `${theirLabel} ${t('Home.SentMessage')}` : t('Home.ReceivedMessage'),
buttonTitle: t('Home.ViewMessage'),
})
}
break
case NotificationType.CredentialOffer:
details = ({
details = {
type: InfoBoxType.Info,
title: t('CredentialOffer.NewCredentialOffer'),
body: `${name + (version ? ` v${version}` : '')}`,
buttonTitle: undefined,
})
}
break
case NotificationType.ProofRequest: {
const proofId = (notification as ProofExchangeRecord).id
agent?.proofs.findRequestMessage(proofId).then((message) => {
if (message instanceof V1RequestPresentationMessage && message.indyProofRequest) {
details = ({
details = {
type: InfoBoxType.Info,
title: t('ProofRequest.NewProofRequest'),
body: message.indyProofRequest.name ?? message.comment ?? '',
buttonTitle: undefined,
})
}
} else {
details = ({
details = {
type: InfoBoxType.Info,
title: t('ProofRequest.NewProofRequest'),
body: '',
buttonTitle: undefined,
})
}
}
})
break
}
case NotificationType.Revocation:
details = ({
details = {
type: InfoBoxType.Error,
title: t('CredentialDetails.NewRevoked'),
body: `${name + (version ? ` v${version}` : '')}`,
buttonTitle: undefined,
})
}
break
case NotificationType.Custom:
details = ({
details = {
type: InfoBoxType.Info,
title: t(customNotification?.title as any),
body: t(customNotification?.description as any),
buttonTitle: t(customNotification?.buttonTitle as any),
})
}
break
default:
throw new Error('NotificationType was not set correctly.')
Expand All @@ -296,7 +298,15 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({
}

getDetails()
}, [notification, notificationType, connection, store.preferences.alternateContactNames, t, agent, customNotification])
}, [
notification,
notificationType,
connection,
store.preferences.alternateContactNames,
t,
agent,
customNotification,
])

useEffect(() => {
let onPress: () => void
Expand All @@ -313,8 +323,8 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({
break
case NotificationType.CredentialOffer:
onPress = () => {
navigation.getParent()?.navigate(Stacks.NotificationStack, {
screen: Screens.CredentialOffer,
navigation.getParent()?.navigate(Stacks.ConnectionStack, {
screen: Screens.Connection,
params: { credentialId: notification.id },
})
}
Expand All @@ -333,8 +343,8 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({
}
} else {
onPress = () => {
navigation.getParent()?.navigate(Stacks.NotificationStack, {
screen: Screens.ProofRequest,
navigation.getParent()?.navigate(Stacks.ConnectionStack, {
screen: Screens.Connection,
params: { proofId: (notification as ProofExchangeRecord).id },
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const CredentialCard11: React.FC<CredentialCard11Props> = ({
height: 150,
aspectRatio: 1,
resizeMode: 'contain',
borderRadius: 10,
borderRadius: borderRadius,
},
statusContainer: {
backgroundColor: 'rgba(0, 0, 0, 0)',
Expand Down
Loading
Loading