diff --git a/package.json b/package.json index 2cbb0cd8..d6d64d89 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "1.3.10", "versionCode": 21, "scripts": { - "start": "expo start --dev-client", + "start": "expo start", "start:native": "expo start --dev-client", "android": "expo run:android", "ios": "expo run:ios", @@ -117,4 +117,4 @@ "prettier --write" ] } -} \ No newline at end of file +} diff --git a/src/Main.tsx b/src/Main.tsx index e1942a2f..d2c7061f 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -55,6 +55,10 @@ export type MainStackParamList = { secretId: string token: string uniqueId: string + packageInfo?: { + name?: string + version?: string + } } Notifications: undefined ExportFileSecret: undefined diff --git a/src/components/NotificationCard.tsx b/src/components/NotificationCard.tsx index ed330667..8a8cacb1 100644 --- a/src/components/NotificationCard.tsx +++ b/src/components/NotificationCard.tsx @@ -16,6 +16,7 @@ import { useSecretSelector } from '../hooks/use-secret-selector' import { useTokenDataSelector } from '../hooks/use-token-data-selector' import { Typography } from './Typography' +import { PackageInfo } from './PackageInfo' const OTP_REQUEST_TIMEOUT = 60001 // See https://github.com/nearform/optic/blob/master/server/lib/routes/otp.js#L5 @@ -37,7 +38,7 @@ const styles = StyleSheet.create({ tokenDescriptionRow: { flexDirection: 'row', justifyContent: 'space-between', - marginBottom: theme.spacing(2), + marginBottom: theme.spacing(1), }, button: { marginTop: theme.spacing(2), @@ -77,8 +78,6 @@ const TokenInfo: React.FC = ({ token, description }) => { {token} - - {description} @@ -140,6 +139,8 @@ export const NotificationCard: React.FC = ({ [data.uniqueId, removeNotification] ) + const packageInfo = notification.request.content.data.packageInfo + return ( <> @@ -151,6 +152,11 @@ export const NotificationCard: React.FC = ({ /> + {packageInfo && ( + + + + )} = ({ + packageInfo: { version, name } = {}, +}) => { + return ( + + {name && ( + + Package + {name} + + )} + {version && ( + + Version + {version} + + )} + + ) +} diff --git a/src/screens/HomeScreen.tsx b/src/screens/HomeScreen.tsx index 56b2ec8c..8ac7ac11 100644 --- a/src/screens/HomeScreen.tsx +++ b/src/screens/HomeScreen.tsx @@ -91,7 +91,7 @@ export const HomeScreen: React.FC = ({ navigation }) => { async (res: NotificationResponse) => { const data = res.notification.request.content.data as NotificationData - const { secretId, uniqueId, token } = data + const { secretId, uniqueId, token, packageInfo } = data const secret = secrets.find(({ _id }) => _id === secretId) @@ -104,6 +104,7 @@ export const HomeScreen: React.FC = ({ navigation }) => { token, secretId, uniqueId, + packageInfo, }) }, [navigation, secrets] diff --git a/src/screens/OtpRequestScreen.tsx b/src/screens/OtpRequestScreen.tsx index 0c053014..76ddf740 100644 --- a/src/screens/OtpRequestScreen.tsx +++ b/src/screens/OtpRequestScreen.tsx @@ -16,6 +16,7 @@ import { useSecretSelector } from '../hooks/use-secret-selector' import { LoadingSpinnerOverlay } from '../components/LoadingSpinnerOverlay' import { usePrefs } from '../context/PrefsContext' import { useCanUseLocalAuth } from '../hooks/use-can-use-local-auth' +import { PackageInfo } from '../components/PackageInfo' const styles = StyleSheet.create({ container: { @@ -52,7 +53,7 @@ export const OtpRequestScreen = ({ route, navigation }: Props) => { const canUseLocalAuth = useCanUseLocalAuth() const api = useMemo(() => apiFactory({ idToken: user.idToken }), [user]) - const { token, secretId, uniqueId } = route.params + const { token, secretId, uniqueId, packageInfo } = route.params const secret = useSecretSelector(secretId) const tokenData = useTokenDataSelector(secretId, token) const description = tokenData ? tokenData.description : '' @@ -134,6 +135,7 @@ export const OtpRequestScreen = ({ route, navigation }: Props) => { {description} + {packageInfo && }