From ab4dbf549e69fec54a079ecea03ccb097fcf93ab Mon Sep 17 00:00:00 2001 From: Matthew Abraham Date: Wed, 17 Aug 2022 17:46:22 -0400 Subject: [PATCH] chore: (demo-tt) Wallet should use TTD as the default currency code (#41) * chore: add ttd currency * feat: ensure account initialization * chore: set currency default on store init * chore: pin skips phone number * fix: remove rewards for test event * chore: remove unnecessary notifications * chore: bump to 1.34.2 --- android/app/build.gradle | 2 +- android/gradle.properties | 2 +- ios/celo.xcodeproj/project.pbxproj | 16 +-- package.json | 2 +- src/account/NuxInterests.tsx | 32 +++--- src/home/NotificationBox.tsx | 151 +---------------------------- src/localCurrency/consts.ts | 2 + src/localCurrency/reducer.ts | 1 + src/navigator/DrawerNavigator.tsx | 2 - src/pincode/PincodeSet.tsx | 2 +- 10 files changed, 28 insertions(+), 184 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index e11809c9d2e..8f5632a9ee6 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -167,7 +167,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode appVersionCode - versionName "1.34.1" + versionName "1.34.2" multiDexEnabled true testBuildType System.getProperty('testBuildType', 'debug') testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/android/gradle.properties b/android/gradle.properties index b851561a7ad..a4a236557de 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -23,7 +23,7 @@ CELO_RELEASE_KEY_ALIAS=celo-key-alias # Setting this manually based on version number until we have this deploying via Cloud Build # Example: v1.5.1 deployment number 1 = 1005001001 (1 005 001 001) -VERSION_CODE=1021071630 +VERSION_CODE=1021071631 # AndroidX package structure to make it clearer which packages are bundled with the # Android operating system, and which are packaged with your app's APK # https://developer.android.com/topic/libraries/support-library/androidx-rn diff --git a/ios/celo.xcodeproj/project.pbxproj b/ios/celo.xcodeproj/project.pbxproj index 42e1fd1609e..bb6a314be23 100644 --- a/ios/celo.xcodeproj/project.pbxproj +++ b/ios/celo.xcodeproj/project.pbxproj @@ -1179,7 +1179,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = celo/celo.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 22; + CURRENT_PROJECT_VERSION = 23; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = 48TPT4QN6K; HEADER_SEARCH_PATHS = "$(inherited)"; @@ -1189,7 +1189,7 @@ "$(inherited)", "$(PROJECT_DIR)", ); - MARKETING_VERSION = 1.34.1; + MARKETING_VERSION = 1.34.2; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1212,7 +1212,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = celo/celo.entitlements; - CURRENT_PROJECT_VERSION = 22; + CURRENT_PROJECT_VERSION = 23; DEVELOPMENT_TEAM = 48TPT4QN6K; HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = celo/Info.plist; @@ -1221,7 +1221,7 @@ "$(inherited)", "$(PROJECT_DIR)", ); - MARKETING_VERSION = 1.34.1; + MARKETING_VERSION = 1.34.2; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1423,7 +1423,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 22; + CURRENT_PROJECT_VERSION = 23; ENABLE_BITCODE = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; @@ -1442,7 +1442,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.4; - MARKETING_VERSION = 1.34.1; + MARKETING_VERSION = 1.34.2; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -1469,7 +1469,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 22; + CURRENT_PROJECT_VERSION = 23; ENABLE_BITCODE = NO; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -1482,7 +1482,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.4; - MARKETING_VERSION = 1.34.1; + MARKETING_VERSION = 1.34.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/package.json b/package.json index cce582ea0f8..e73fc5aa9ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@valora/wallet", - "version": "1.34.1", + "version": "1.34.2", "author": "Celo", "license": "Apache-2.0", "private": true, diff --git a/src/account/NuxInterests.tsx b/src/account/NuxInterests.tsx index 1939745fe94..8fdb011d19e 100644 --- a/src/account/NuxInterests.tsx +++ b/src/account/NuxInterests.tsx @@ -2,6 +2,7 @@ import { useFocusEffect } from '@react-navigation/native' import { StackScreenProps, useHeaderHeight } from '@react-navigation/stack' import { includes } from 'lodash' import React, { useCallback, useEffect, useLayoutEffect, useState } from 'react' +import { useAsync } from 'react-async-hook' import { useTranslation } from 'react-i18next' import { Image, ScrollView, StyleSheet, Text, View } from 'react-native' import { TouchableOpacity } from 'react-native-gesture-handler' @@ -9,17 +10,13 @@ import Modal from 'react-native-modal' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { FlatGrid } from 'react-native-super-grid' import { useDispatch, useSelector } from 'react-redux' -import { addUserInterest, removeUserInterest } from 'src/account/actions' +import { addUserInterest, initializeAccount, removeUserInterest } from 'src/account/actions' import InterestsLearnMoreDialog from 'src/account/InterestsLearnMoreDialog' import { NuxInterestChoice } from 'src/account/reducer' -import { choseToRestoreAccountSelector, currentInterestsSelector } from 'src/account/selectors' +import { currentInterestsSelector } from 'src/account/selectors' import { VerificationEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' -import { - hideVerificationSelector, - numberVerifiedSelector, - registrationStepsSelector, -} from 'src/app/selectors' +import { registrationStepsSelector } from 'src/app/selectors' import BackButton from 'src/components/BackButton' import Button, { BtnSizes, BtnTypes } from 'src/components/Button' import TextButton from 'src/components/TextButton' @@ -38,13 +35,13 @@ import { navigate, navigateHome } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { TopBarTextButton } from 'src/navigator/TopBarButton' import { StackParamList } from 'src/navigator/types' -import useTypedSelector from 'src/redux/useSelector' +import { waitUntilSagasFinishLoading } from 'src/redux/sagas' import colors, { Colors } from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' import Logger from 'src/utils/Logger' -import { useAsyncKomenciReadiness } from 'src/verify/hooks' import { + checkIfKomenciAvailable, currentStateSelector, reset, setKomenciContext, @@ -55,7 +52,6 @@ import { verificationStatusSelector, } from 'src/verify/reducer' import VerificationSkipDialog from 'src/verify/VerificationSkipDialog' -import { currentAccountSelector } from 'src/web3/selectors' type ScreenProps = StackScreenProps @@ -63,18 +59,15 @@ type Props = ScreenProps function NuxInterestsScreen({ route, navigation }: Props) { const showSkipDialog = route.params?.showSkipDialog || false - const account = useTypedSelector(currentAccountSelector) const [showLearnMoreDialog, setShowLearnMoreDialog] = useState(false) const { t } = useTranslation() const dispatch = useDispatch() const headerHeight = useHeaderHeight() const insets = useSafeAreaInsets() - const numberVerified = useSelector(numberVerifiedSelector) const partOfOnboarding = !route.params?.hideOnboardingStep const currentState = useSelector(currentStateSelector) const shouldUseKomenci = useSelector(shouldUseKomenciSelector) const verificationStatus = useSelector(verificationStatusSelector) - const choseToRestoreAccount = useSelector(choseToRestoreAccountSelector) const { step, totalSteps } = useSelector(registrationStepsSelector) const currentInterests = useSelector(currentInterestsSelector) const [allowContinue, showContinue] = useState(false) @@ -101,11 +94,6 @@ function NuxInterestsScreen({ route, navigation }: Props) { } } - const onPressContinueWhenVerificationUnavailable = () => { - dispatch(setHasSeenVerificationNux(true)) - navigateHome() - } - const onPressLearnMore = () => { setShowLearnMoreDialog(true) } @@ -148,9 +136,11 @@ function NuxInterestsScreen({ route, navigation }: Props) { showContinue(currentInterests.length > 0) }, [currentInterests]) - // CB TEMPORARY HOTFIX: Pinging Komenci endpoint to ensure availability - const hideVerification = useSelector(hideVerificationSelector) - const asyncKomenciReadiness = useAsyncKomenciReadiness() + useAsync(async () => { + await waitUntilSagasFinishLoading() + dispatch(initializeAccount()) + dispatch(checkIfKomenciAvailable()) + }, []) useFocusEffect( // useCallback is needed here: https://bit.ly/2G0WKTJ diff --git a/src/home/NotificationBox.tsx b/src/home/NotificationBox.tsx index af874a0d549..c7a3254a03c 100644 --- a/src/home/NotificationBox.tsx +++ b/src/home/NotificationBox.tsx @@ -3,12 +3,6 @@ import { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { NativeScrollEvent, ScrollView, StyleSheet, View } from 'react-native' import { useDispatch } from 'react-redux' -import { - dismissGetVerified, - dismissGoldEducation, - dismissKeepSupercharging, - dismissStartSupercharging, -} from 'src/account/actions' import { HomeEvents, RewardsEvents } from 'src/analytics/Events' import { ScrollDirection } from 'src/analytics/types' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -26,7 +20,7 @@ import { getReclaimableEscrowPayments } from 'src/escrow/reducer' import { dismissNotification } from 'src/home/actions' import { DEFAULT_PRIORITY } from 'src/home/reducers' import { getExtraNotifications } from 'src/home/selectors' -import { backupKey, boostRewards, getVerified, learnCelo } from 'src/images/Images' +import { backupKey, boostRewards } from 'src/images/Images' import { ensurePincode, navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import IncomingPaymentRequestSummaryNotification from 'src/paymentRequest/IncomingPaymentRequestSummaryNotification' @@ -83,13 +77,7 @@ interface Notification { } function useSimpleActions() { - const { - backupCompleted, - dismissedGetVerified, - dismissedGoldEducation, - dismissedKeepSupercharging, - dismissedStartSupercharging, - } = useSelector((state) => state.account) + const { backupCompleted } = useSelector((state) => state.account) const numberVerified = useSelector((state) => state.app.numberVerified) const goldEducationCompleted = useSelector((state) => state.goldToken.educationCompleted) @@ -167,113 +155,9 @@ function useSimpleActions() { }, ], }) - } else { - if (isSupercharging && !dismissedKeepSupercharging) { - actions.push({ - id: 'keepSupercharging', - text: t('superchargingNotificationBodyV1_33', { apy: superchargeApy }), - icon: boostRewards, - priority: SUPERCHARGE_INFO_PRIORITY, - callToActions: [ - { - text: t('superchargingNotificationStart'), - onPress: () => { - ValoraAnalytics.track(HomeEvents.notification_select, { - notificationType: NotificationBannerTypes.supercharging, - selectedAction: NotificationBannerCTATypes.accept, - }) - navigate(Screens.ConsumerIncentivesHomeScreen) - ValoraAnalytics.track(RewardsEvents.rewards_screen_opened, { - origin: RewardsScreenOrigin.SuperchargingNotification, - }) - }, - }, - { - text: t('dismiss'), - isSecondary: true, - onPress: () => { - ValoraAnalytics.track(HomeEvents.notification_select, { - notificationType: NotificationBannerTypes.supercharging, - selectedAction: NotificationBannerCTATypes.decline, - }) - dispatch(dismissKeepSupercharging()) - }, - }, - ], - }) - } - - if (!isSupercharging && !dismissedStartSupercharging) { - actions.push({ - id: 'startSupercharging', - text: t('startSuperchargingNotificationBody'), - icon: boostRewards, - priority: SUPERCHARGE_INFO_PRIORITY, - callToActions: [ - { - text: t('startSuperchargingNotificationStart'), - onPress: () => { - ValoraAnalytics.track(HomeEvents.notification_select, { - notificationType: NotificationBannerTypes.start_supercharging, - selectedAction: NotificationBannerCTATypes.accept, - }) - navigate(Screens.ConsumerIncentivesHomeScreen) - ValoraAnalytics.track(RewardsEvents.rewards_screen_opened, { - origin: RewardsScreenOrigin.StartSuperchargingNotification, - }) - }, - }, - { - text: t('dismiss'), - isSecondary: true, - onPress: () => { - ValoraAnalytics.track(HomeEvents.notification_select, { - notificationType: NotificationBannerTypes.supercharging, - selectedAction: NotificationBannerCTATypes.decline, - }) - dispatch(dismissStartSupercharging()) - }, - }, - ], - }) - } } } - if (!dismissedGetVerified && !numberVerified && verificationPossible) { - actions.push({ - id: 'getVerified', - text: t('notification.body'), - icon: getVerified, - priority: VERIFICATION_PRIORITY, - callToActions: [ - { - text: t('notification.cta'), - onPress: () => { - ValoraAnalytics.track(HomeEvents.notification_select, { - notificationType: NotificationBannerTypes.verification_prompt, - selectedAction: NotificationBannerCTATypes.accept, - }) - navigate(Screens.VerificationEducationScreen, { - hideOnboardingStep: true, - }) - }, - }, - { - text: t('dismiss'), - isSecondary: true, - onPress: () => { - ValoraAnalytics.track(HomeEvents.notification_select, { - notificationType: NotificationBannerTypes.verification_prompt, - selectedAction: NotificationBannerCTATypes.decline, - }) - dispatch(dismissGetVerified()) - }, - }, - ], - }) - } - for (const [id, notification] of Object.entries(extraNotifications)) { if (!notification) { continue @@ -316,37 +200,6 @@ function useSimpleActions() { }) } - if (!dismissedGoldEducation && !goldEducationCompleted) { - actions.push({ - id: 'celoEducation', - text: t('whatIsGold'), - icon: learnCelo, - priority: CELO_EDUCATION_PRIORITY, - callToActions: [ - { - text: t('learnMore'), - onPress: () => { - ValoraAnalytics.track(HomeEvents.notification_select, { - notificationType: NotificationBannerTypes.celo_asset_education, - selectedAction: NotificationBannerCTATypes.accept, - }) - navigate(Screens.GoldEducation) - }, - }, - { - text: t('dismiss'), - isSecondary: true, - onPress: () => { - ValoraAnalytics.track(HomeEvents.notification_select, { - notificationType: NotificationBannerTypes.celo_asset_education, - selectedAction: NotificationBannerCTATypes.decline, - }) - dispatch(dismissGoldEducation()) - }, - }, - ], - }) - } return actions } diff --git a/src/localCurrency/consts.ts b/src/localCurrency/consts.ts index cc37a30b4fb..9e59874d60a 100644 --- a/src/localCurrency/consts.ts +++ b/src/localCurrency/consts.ts @@ -22,6 +22,7 @@ export enum LocalCurrencyCode { RWF = 'RWF', SLL = 'SLL', TRY = 'TRY', + TTD = 'TTD', UAH = 'UAH', UGX = 'UGX', USD = 'USD', @@ -52,6 +53,7 @@ export enum LocalCurrencySymbol { RWF = 'FRw', SLL = 'Le', TRY = '₺', + TTD = '$', UAH = '₴', UGX = 'USh', USD = '$', diff --git a/src/localCurrency/reducer.ts b/src/localCurrency/reducer.ts index da05d626724..2af1d8d9cea 100644 --- a/src/localCurrency/reducer.ts +++ b/src/localCurrency/reducer.ts @@ -15,6 +15,7 @@ export interface State { const initialState = { isLoading: false, error: false, + preferredCurrencyCode: LocalCurrencyCode.TTD, exchangeRates: { [Currency.Celo]: null, [Currency.Dollar]: null, diff --git a/src/navigator/DrawerNavigator.tsx b/src/navigator/DrawerNavigator.tsx index 32c14df2cfb..2056ab8ac63 100644 --- a/src/navigator/DrawerNavigator.tsx +++ b/src/navigator/DrawerNavigator.tsx @@ -53,7 +53,6 @@ import InviteFriendModal from 'src/invite/InviteFriendModal' import DrawerItem from 'src/navigator/DrawerItem' import { ensurePincode } from 'src/navigator/NavigationService' import { getActiveRouteName } from 'src/navigator/NavigatorWrapper' -import RewardsPill from 'src/navigator/RewardsPill' import { Screens } from 'src/navigator/Screens' import TabNavigator from 'src/navigator/TabNavigator' import { default as useSelector } from 'src/redux/useSelector' @@ -162,7 +161,6 @@ function CustomDrawerContent(props: DrawerContentComponentProps - {displayName} {e164PhoneNumber && ( diff --git a/src/pincode/PincodeSet.tsx b/src/pincode/PincodeSet.tsx index a42f2449254..cadebd7a7f4 100644 --- a/src/pincode/PincodeSet.tsx +++ b/src/pincode/PincodeSet.tsx @@ -163,7 +163,7 @@ export class PincodeSet extends React.Component { this.props.skipVerification && this.props.setHasSeenVerificationNux(true) navigateHome() } else { - navigateClearingStack(Screens.VerificationEducationScreen) + navigateClearingStack(Screens.NuxInterests) } }