From 458e82e9d1f195f1d67edc38b213c0b972139da7 Mon Sep 17 00:00:00 2001 From: Jon Tzeng Date: Wed, 29 May 2024 19:09:51 -0700 Subject: [PATCH] Comment out new ScamWarning Pending further refinement --- CHANGELOG.md | 1 - src/actions/ScamWarningActions.tsx | 79 ++++++++++++++---------------- 2 files changed, 37 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83b64ed13e8..396339ff10b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,6 @@ - added: Add Visa/MC buy support with Paybis - added: Support for `promoId`-based filtering for Promo Cards -- added: Scam warning to the first login after app install, first view of private keys, and first use of WalletConnect - added: New Asset Setting to manually enable tokens with detected balances across all wallets - added: MUTE_CONSOLE_OUTPUT environment variable to disable specific console output functions - added: Performance logging with app start-up time and login time as initial performance metrics diff --git a/src/actions/ScamWarningActions.tsx b/src/actions/ScamWarningActions.tsx index be877e9d1e5..e41f955c5a5 100644 --- a/src/actions/ScamWarningActions.tsx +++ b/src/actions/ScamWarningActions.tsx @@ -1,17 +1,14 @@ import { asBoolean, asObject, asOptional } from 'cleaners' -import { Disklet, makeReactNativeDisklet } from 'disklet' +import { Disklet } from 'disklet' import * as React from 'react' -import { AirshipBridge } from 'react-native-airship' import { sprintf } from 'sprintf-js' import { ConfirmContinueModal } from '../components/modals/ConfirmContinueModal' -import { ScamWarningModal } from '../components/modals/ScamWarningModal' import { Airship } from '../components/services/AirshipInstance' import { Paragraph, WarningText } from '../components/themed/EdgeText' -import { SCAM_WARNING, SCAM_WARNING_2 } from '../constants/constantSettings' +import { SCAM_WARNING } from '../constants/constantSettings' import { lstrings } from '../locales/strings' import { config } from '../theme/appConfig' -import { getFirstOpenInfo } from './FirstOpenActions' let isSendScamWarningChecked = false @@ -42,37 +39,37 @@ export const showSendScamWarningModal = async (disklet: Disklet) => { } } -const scamWarningDisklet = makeReactNativeDisklet() +// const scamWarningDisklet = makeReactNativeDisklet() const asScamWarningInfo = asObject({ firstPrivateKeyView: asOptional(asBoolean, true), firstWalletConnect: asOptional(asBoolean, true), firstLogin: asOptional(asBoolean, true) }) type ScamWarningInfo = ReturnType -let scamWarningInfo: ScamWarningInfo +// let scamWarningInfo: ScamWarningInfo -const getScamWarningInfo = async (): Promise => { - if (scamWarningInfo == null) { - try { - const scamWarningText = await scamWarningDisklet.getText(SCAM_WARNING_2) - scamWarningInfo = asScamWarningInfo(JSON.parse(scamWarningText)) - } catch (error: any) { - if ((await getFirstOpenInfo()).isFirstOpen === 'false') { - // If this isn't the first open, don't pester the user with new scam - // warnings. Assume this isn't their first rodeo across the board. - scamWarningInfo = { - firstPrivateKeyView: false, - firstWalletConnect: false, - firstLogin: false - } - } else { - scamWarningInfo = asScamWarningInfo({}) - } - await scamWarningDisklet.setText(SCAM_WARNING_2, JSON.stringify(scamWarningInfo)) - } - } - return scamWarningInfo -} +// const getScamWarningInfo = async (): Promise => { +// if (scamWarningInfo == null) { +// try { +// const scamWarningText = await scamWarningDisklet.getText(SCAM_WARNING_2) +// scamWarningInfo = asScamWarningInfo(JSON.parse(scamWarningText)) +// } catch (error: any) { +// if ((await getFirstOpenInfo()).isFirstOpen === 'false') { +// // If this isn't the first open, don't pester the user with new scam +// // warnings. Assume this isn't their first rodeo across the board. +// scamWarningInfo = { +// firstPrivateKeyView: false, +// firstWalletConnect: false, +// firstLogin: false +// } +// } else { +// scamWarningInfo = asScamWarningInfo({}) +// } +// await scamWarningDisklet.setText(SCAM_WARNING_2, JSON.stringify(scamWarningInfo)) +// } +// } +// return scamWarningInfo +// } /** * Warning the user about bad actors that are walking the user through @@ -83,17 +80,15 @@ const getScamWarningInfo = async (): Promise => { * dangerous action. **/ export const showScamWarningModal = async (scamWarningInfoKey: keyof ScamWarningInfo) => { - const scamWarningInfo = await getScamWarningInfo() - - // Ignore if we've already triggered a particular warning - if (scamWarningInfo[scamWarningInfoKey]) { - // Make sure we don't show this warning again for this particular scenario - scamWarningInfo[scamWarningInfoKey] = false - await scamWarningDisklet.setText(SCAM_WARNING_2, JSON.stringify(scamWarningInfo)) - - // Show the scam warning modal - await Airship.show((bridge: AirshipBridge<'yes' | 'no' | undefined>) => { - return - }) - } + // const scamWarningInfo = await getScamWarningInfo() + // // Ignore if we've already triggered a particular warning + // if (scamWarningInfo[scamWarningInfoKey]) { + // // Make sure we don't show this warning again for this particular scenario + // scamWarningInfo[scamWarningInfoKey] = false + // await scamWarningDisklet.setText(SCAM_WARNING_2, JSON.stringify(scamWarningInfo)) + // // Show the scam warning modal + // await Airship.show((bridge: AirshipBridge<'yes' | 'no' | undefined>) => { + // return + // }) + // } }