diff --git a/src/context/FocusClaim.tsx b/src/context/FocusClaim.tsx index 2d5ef3e8..6dbc853a 100644 --- a/src/context/FocusClaim.tsx +++ b/src/context/FocusClaim.tsx @@ -3,6 +3,8 @@ import { getMintsUrls } from '@db' import { l } from '@log' import type { ITokenInfo } from '@model' import { NS } from '@src/i18n' +import { store } from '@store' +import { STORE_KEYS } from '@store/consts' import { addToHistory } from '@store/latestHistoryEntries' import { formatInt, formatMintUrl, getStrFromClipboard, hasTrustedMint, isCashuToken, isErr, sleep } from '@util' import { claimToken, isTokenSpendable } from '@wallet' @@ -29,8 +31,10 @@ const useFocusClaim = () => { // in an empty string returned. Find a better way than the following function to handle it. let isSpent = false const fn = async () => { + const selfCreated = await store.get(STORE_KEYS.createdToken) const clipboard = await getStrFromClipboard() if (!clipboard?.length || !isCashuToken(clipboard)) { return false } + if (selfCreated === clipboard) { return false } const info = getTokenInfo(clipboard) if (!info) { return false } // check if mint is a trusted one diff --git a/src/screens/Payment/Send/EncodedToken.tsx b/src/screens/Payment/Send/EncodedToken.tsx index 46c70f8f..c2ed25b3 100644 --- a/src/screens/Payment/Send/EncodedToken.tsx +++ b/src/screens/Payment/Send/EncodedToken.tsx @@ -8,6 +8,8 @@ import TopNav from '@nav/TopNav' import { isIOS } from '@src/consts' import { useThemeContext } from '@src/context/Theme' import { NS } from '@src/i18n' +import { store } from '@store' +import { STORE_KEYS } from '@store/consts' import { globals, highlight as hi, mainColors } from '@styles' import { share, vib } from '@util' import { useEffect, useState } from 'react' @@ -23,7 +25,11 @@ export default function EncodedTokenPage({ navigation, route }: TEncodedTokenPag const { copied, copy } = useCopy() const [error, setError] = useState({ msg: '', open: false }) - useEffect(() => vib(400), []) + useEffect(() => { + // we can save the created token here to avoid foreground prompts of self-created tokens + void store.set(STORE_KEYS.createdToken, route.params.token) + vib(400) + }, [route.params.token]) return ( diff --git a/src/storage/store/consts.ts b/src/storage/store/consts.ts index 15d976f0..26e356fa 100644 --- a/src/storage/store/consts.ts +++ b/src/storage/store/consts.ts @@ -18,7 +18,8 @@ export const STORE_KEYS = { defaultMint: 'MINT_STORE=|:|=default_mint', hiddenBal: 'privacy_balance', hiddenTxs: 'privacy_txs', - latestHistory: 'history_latest' + latestHistory: 'history_latest', + createdToken: 'createdToken', } export const SECURESTORE_KEY = 'auth_pin'