Skip to content

Commit

Permalink
Fixes #207 (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
KKA11010 committed Sep 13, 2023
1 parent 588046a commit 07116bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/components/modal/TrustMint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export default function TrustMintModal({ loading, tokenInfo, handleTrustModal, c
{t('trustMint')}?
</Text>
{/* token amount */}
<Text style={[styles.mintPrompt, { color: color.TEXT_SECONDARY, }]}>
<Text style={[styles.mintPrompt, { color: color.TEXT }]}>
{formatInt(tokenInfo?.value || 0)} Satoshi {t('from')}:
</Text>
{/* Show in which mint(s) the tokens are */}
<View style={styles.tokenMintsView}>
{tokenInfo?.mints.map(m => <Text style={[styles.mintPrompt, { color: color.TEXT_SECONDARY, }]} key={m}>{formatMintUrl(m)}</Text>)}
{tokenInfo?.mints.map(m => <Text style={[styles.mintPrompt, { color: color.TEXT }]} key={m}>{formatMintUrl(m)}</Text>)}
</View>
<Text style={globals(color, highlight).modalTxt}>
{t('notClaim')}.
Expand All @@ -48,7 +48,7 @@ export default function TrustMintModal({ loading, tokenInfo, handleTrustModal, c

const styles = StyleSheet.create({
mintPrompt: {
fontSize: 12,
fontSize: 14,
marginBottom: 5,
},
tokenMintsView: {
Expand Down
12 changes: 9 additions & 3 deletions src/screens/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ export default function Dashboard({ navigation, route }: TDashboardPageProps) {
// check if user wants to trust the token mint
const userMints = await getMintsUrls()
if (!hasTrustedMint(userMints, tokenInfo.mints)) {
closeOptsModal()
// ask user for permission if token mint is not in his mint list
setTrustModal(true)
stopLoading()
const t = setTimeout(() => {
setTrustModal(true)
stopLoading()
clearTimeout(t)
}, 250)
return
}
await receiveToken(url)
Expand All @@ -124,16 +128,17 @@ export default function Dashboard({ navigation, route }: TDashboardPageProps) {
// helper function that gets called either right after pasting token or in the trust modal depending on user permission
const receiveToken = async (encodedToken: string) => {
const success = await claimToken(encodedToken).catch(l)
setTrustModal(false)
closeOptsModal()
setToken('')
stopLoading()
if (!success) {
setTrustModal(false)
openPromptAutoClose({ msg: t('invalidOrSpent') })
return
}
const info = getTokenInfo(encodedToken)
if (!info) {
setTrustModal(false)
openPromptAutoClose({ msg: t('tokenInfoErr') })
return
}
Expand All @@ -144,6 +149,7 @@ export default function Dashboard({ navigation, route }: TDashboardPageProps) {
value: encodedToken,
mints: info.mints,
})
setTrustModal(false)
navigation.navigate('success', {
amount: info?.value,
memo: info?.decoded.memo,
Expand Down

0 comments on commit 07116bc

Please sign in to comment.