Skip to content

Commit

Permalink
add factory reset, update contacts onboarding text
Browse files Browse the repository at this point in the history
  • Loading branch information
KKA11010 committed Aug 19, 2023
1 parent b7d504b commit 9c0ba7f
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 7 deletions.
5 changes: 4 additions & 1 deletion assets/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@
"default": "Standard",
"delete": "Löschen",
"delHistory": "Transaktionsverlauf löschen",
"factoryReset": "Wallet zurücksetzen",
"delHistoryErr": "Verlauf konnte nicht gelöscht werden",
"delHistoryQ": "Sind Sie sicher, dass Sie den Verlauf löschen möchten?",
"resetQ": "Sind Sie sicher, dass Sie Ihre Wallet zurücksetzen möchten?",
"delHistoryTxt": "Die Daten können nachträglich nicht wiederhergestellt werden.",
"plsRestart": "Bitte starten Sie die App neu",
"disclaimer": "Haftungsausschluss",
"ecashPayment": "Ecash Zahlung",
"edit": "Bearbeiten",
Expand Down Expand Up @@ -179,7 +182,7 @@
"explainer3": "Fügen Sie einfach eine Mint über die URL hinzu, zahlen Sie eine Lightning-Rechnung, um Ecash zu erhalten. eNuts führt Sie, ermöglicht Ihnen sofortiges Empfangen von jedem und fügt automatisch verbundene Mints hinzu – mit Ihrer Zustimmung. Tauschen Sie Guthaben zwischen Mints aus und senden Sie Ecash, sobald Sie ein Guthaben haben.",
"send&receive": "Senden & Empfangen",
"contactsNostr": "Kontakte & NOSTR",
"nostrExplainer": "eNuts ermöglicht Ecash-Überweisungen über NOSTR-DMs und nahtlose Kontaktsynchronisierung mit NPUB. Keine Notwendigkeit, Ihren privaten Schlüssel einzugeben, da eNuts einen neuen für Sie generiert. Ihr NOSTR-Profil und Ihre Daten werden mit Ihrem öffentlichen Schlüssel angezeigt, während der neu generierte private Schlüssel eine reibungslose Interaktion mit NOSTR-DMs ermöglicht.",
"nostrExplainer": "Die NOSTR-Implementierung ermöglicht eine reibungslose Synchronisierung Ihrer Kontakte, ohne dass Sie Ihren privaten Schlüssel eingeben müssen, da wir einen neuen für Sie generieren. Ihre Daten werden mithilfe des öffentlichen Schlüssels angezeigt, während der neue private Schlüssel Ihre Nachrichten verschlüsselt/entschlüsselt.",
"send": "Senden",
"FoundNoLnurl": "Keine LNURL gefunden",
"invalidNpub": "invalider NPUB!",
Expand Down
5 changes: 4 additions & 1 deletion assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@
"default": "Default",
"delete": "Delete",
"delHistory": "Delete transaction history",
"factoryReset": "Factory reset",
"delHistoryErr": "Could not delete the history.",
"delHistoryQ": "Are you sure that you want to delete the history?",
"resetQ": "Are you sure that you want to reset your wallet?",
"delHistoryTxt": "The data can not be retrieved afterwards.",
"plsRestart": "Please restart the app now",
"disclaimer": "Disclaimer",
"ecashPayment": "Ecash payment",
"edit": "Edit",
Expand Down Expand Up @@ -179,7 +182,7 @@
"explainer3": "Simply add a mint via URL, pay a Lightning invoice to get Ecash. eNuts guides you, lets you receive from anyone instantly and with your permission, automatically adds related mints. Swap funds between mints and send Ecash once you have a balance.",
"send&receive": "Send & receive",
"contactsNostr": "Contacts & NOSTR",
"nostrExplainer": "eNuts allows Ecash transfers via NOSTR DMs and seamless contact syncing using your NPUB. No need to enter your private key, as eNuts generates a new one for you. Your NOSTR profile and data are displayed using your public key, while the new generated private key enables smooth interaction with NOSTR DMs.",
"nostrExplainer": "The NOSTR implementation enables seamless synchronization of your contacts without the need for you to enter your private key, as we generate a new one for you. Your data is displayed using the public key, while the new private key encrypts/decrypts your messages.",
"send": "Send",
"FoundNoLnurl": "Found no LNURL",
"invalidNpub": "NPUB invalid!",
Expand Down
5 changes: 4 additions & 1 deletion assets/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@
"default": "Par défaut",
"delete": "Supprimer",
"delHistory": "Supprimer l'historique transactions",
"factoryReset": "Réinitialisation",
"delHistoryErr": "Impossible de supprimer l'historique.",
"resetQ": "Êtes-vous sûr de vouloir réinitialiser?",
"delHistoryQ": "Êtes-vous sûr de vouloir supprimer l'historique?",
"delHistoryTxt": "Les données ne pourront pas être récupérées ultérieurement.",
"plsRestart": "Veuillez redémarrer l'application maintenant",
"disclaimer": "Clause de non-responsabilité",
"ecashPayment": "Paiement Ecash",
"edit": "Modifier",
Expand Down Expand Up @@ -179,7 +182,7 @@
"explainer3": "Pour ajouter simplement une mint via une URL, payez une facture Lightning pour obtenir de l'Ecash. eNuts vous guide, vous permet de recevoir instantanément de n'importe qui et ajoute automatiquement les mints liés avec votre permission. Échangez des fonds entre les mints et envoyez de l'Ecash une fois que vous avez un solde.",
"send&receive": "Envoyer et recevoir",
"contactsNostr": "Contacts & NOSTR",
"nostrExplainer": "eNuts permet des transferts Ecash via NOSTR DMs et une synchronisation transparente des contacts avec NPUB. Pas besoin d'entrer votre clé privée, car eNuts en génère une nouvelle pour vous. Votre profil et vos données NOSTR sont affichés à l'aide de votre clé publique, tandis que la nouvelle clé privée générée facilite une interaction fluide avec les DMs NOSTR.",
"nostrExplainer": "L'implémentation NOSTR permet une synchronisation transparente de vos contacts sans que vous ayez besoin d'entrer votre clé privée, car nous en générons une nouvelle pour vous. Vos données sont affichées à l'aide de la clé publique, tandis que la nouvelle clé privée chiffre/déchiffre vos messages.",
"send": "Envoyer",
"FoundNoLnurl": "Pas trouver votre LNURL",
"invalidNpub": "NPUB invalid!",
Expand Down
2 changes: 0 additions & 2 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import * as Sentry from 'sentry-expo'
import Blank from './Blank'
import ClipboardModal from './ClipboardModal'
import Toaster from './Toaster'
// import { dropAllData } from '@src/storage/dev'

interface ILockData {
mismatch: boolean
Expand Down Expand Up @@ -121,7 +120,6 @@ function _App() {
}
const mintBalsTotal = (balances).reduce((acc, cur) => acc + cur.amount, 0)
if (mintBalsTotal !== balance) { await addAllMintIds() }
// await dropAllData() // DEV-ONLY DEBUG
} catch (e) {
l(isErr(e) ? e.message : 'Error while initiating the user app configuration.')
} finally {
Expand Down
3 changes: 2 additions & 1 deletion src/screens/Addressbook/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default function AddressbookPage({ navigation, route }: TAddressBookPageP
const { openPromptAutoClose } = usePromptContext()
const { color } = useThemeContext()
const {
nutPub,
setNutPub,
pubKey,
setPubKey,
Expand Down Expand Up @@ -349,7 +350,7 @@ export default function AddressbookPage({ navigation, route }: TAddressBookPageP
<MyModal
type='bottom'
animation='slide'
visible={newNpubModal}
visible={!nutPub || newNpubModal}
close={() => setNewNpubModal(false)}
>
<Text style={globals(color).modalHeader}>
Expand Down
29 changes: 28 additions & 1 deletion src/screens/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import BottomNav from '@nav/BottomNav'
import { usePromptContext } from '@src/context/Prompt'
import { useThemeContext } from '@src/context/Theme'
import { NS } from '@src/i18n'
import { dropAllData } from '@src/storage/dev'
import { historyStore } from '@store'
import { globals, mainColors } from '@styles'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { StyleSheet, View } from 'react-native'
import { StyleSheet, Text, View } from 'react-native'

import { version } from '../../../package.json'
import SettingsMenuItem from './MenuItem'
Expand All @@ -20,6 +21,7 @@ export default function Settings({ navigation, route }: TSettingsPageProps) {
const { t } = useTranslation([NS.common])
const { color } = useThemeContext()
const [confirm, setConfirm] = useState(false)
const [confirmReset, setConfirmReset] = useState(false)
const { openPromptAutoClose } = usePromptContext()
const handleDeleteHistory = async () => {
const success = await historyStore.clear()
Expand All @@ -29,6 +31,11 @@ export default function Settings({ navigation, route }: TSettingsPageProps) {
})
setConfirm(false)
}
const handleReset = async () => {
await dropAllData()
setConfirmReset(false)
openPromptAutoClose({success: true, msg: t('plsRestart')})
}
return (
<Screen
screenName={t('settings', { ns: NS.topNav })}
Expand Down Expand Up @@ -80,10 +87,20 @@ export default function Settings({ navigation, route }: TSettingsPageProps) {
txtColor={mainColors.ERROR}
icon={<TrashbinIcon color={mainColors.ERROR} />}
onPress={() => setConfirm(true)}
hasSeparator={__DEV__}
/>
{__DEV__ &&
<SettingsMenuItem
txt={t('factoryReset')}
txtColor={mainColors.ERROR}
icon={<Text>💥💥💥</Text>}
onPress={() => setConfirmReset(true)}
/>
}
</View>
<Txt txt={`eNuts v${version}`} styles={[styles.version]} />
<BottomNav navigation={navigation} route={route} />
{/* confirm history deletion */}
<QuestionModal
header={t('delHistoryQ')}
txt={t('delHistoryTxt')}
Expand All @@ -93,6 +110,16 @@ export default function Settings({ navigation, route }: TSettingsPageProps) {
cancelTxt={t('no')}
cancelFn={() => setConfirm(false)}
/>
{/* confirm factory reset */}
<QuestionModal
header={t('resetQ')}
txt={t('delHistoryTxt')}
visible={confirmReset}
confirmTxt={t('yes')}
confirmFn={() => void handleReset()}
cancelTxt={t('no')}
cancelFn={() => setConfirmReset(false)}
/>
</Screen>
)
}
Expand Down

0 comments on commit 9c0ba7f

Please sign in to comment.