Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update TOTP countdown to adhere to custom settings in mobile app (#2556)
Leendert de Borst9f7c4ec169cc
diff --git a/apps/mobile-app/components/items/details/TotpSection.tsx b/apps/mobile-app/components/items/details/TotpSection.tsxindex bee3c3699..1d8940a2b 100644--- a/apps/mobile-app/components/items/details/TotpSection.tsx+++ b/apps/mobile-app/components/items/details/TotpSection.tsx@@ -5,7 +5,7 @@ import { View, StyleSheet, TouchableOpacity, Platform } from 'react-native';import Toast from 'react-native-toast-message';import { copyToClipboardWithExpiration } from '@/utils/ClipboardUtility';-import { generateTotpCode } from '@aliasvault/client/items/TotpUtility';+import { generateTotpCode, getTotpElapsedPercentage, getTotpRemainingSeconds } from '@aliasvault/client/items/TotpUtility';import type { Item, TotpCode } from '@aliasvault/models/vault';import { useColors } from '@/hooks/useColorScheme';@@ -43,21 +43,6 @@ export const TotpSection: React.FC<TotpSectionProps> = ({ item }) : React.ReactNconst { t } = useTranslation();const recordItemCopy = useRecordItemCopy();- /**- * Get the remaining seconds in the current TOTP window.- */- const getRemainingSeconds = (step = 30): number => {- return step - (Math.floor(Date.now() / 1000) % step);- };-- /**- * Get the remaining percentage.- */- const getRemainingPercentage = (): number => {- const remaining = getRemainingSeconds();- return Math.floor(((30.0 - remaining) / 30.0) * 100);- };-/*** Copy the totp code to the clipboard.*/@@ -209,13 +194,13 @@ export const TotpSection: React.FC<TotpSectionProps> = ({ item }) : React.ReactN</View><View style={styles.timerContainer}><ThemedText style={styles.timer}>- {getRemainingSeconds()}s+ {getTotpRemainingSeconds(totpCode)}s</ThemedText><View style={styles.progressBar}><Viewstyle={[styles.progressFill,- { width: `${getRemainingPercentage()}%` }+ { width: `${getTotpElapsedPercentage(totpCode)}%` }]}/></View>