Skip to content

Commit

Permalink
[chore] Show pools while syncing utxos
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed Apr 19, 2022
1 parent fc70f92 commit d5dd4fa
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 27 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ android {
applicationId "com.emurgo"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 333
versionCode 334
versionName "4.7.1"
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
Expand Down
24 changes: 12 additions & 12 deletions ios/emurgo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@
BUNDLE_ID_SUFFIX = "";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -1395,7 +1395,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
Expand Down Expand Up @@ -1441,7 +1441,7 @@
BUNDLE_DISPLAY_NAME = Yoroi;
BUNDLE_ID_SUFFIX = "";
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -1492,7 +1492,7 @@
BUNDLE_DISPLAY_NAME = "Yoroi Staging";
BUNDLE_ID_SUFFIX = .staging;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -1545,7 +1545,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
Expand Down Expand Up @@ -1595,7 +1595,7 @@
BUNDLE_DISPLAY_NAME = "Yoroi Staging";
BUNDLE_ID_SUFFIX = .staging;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
Expand Down Expand Up @@ -1831,7 +1831,7 @@
BUNDLE_ID_SUFFIX = .staging;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -1979,7 +1979,7 @@
BUNDLE_ID_SUFFIX = .staging;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
Expand Down Expand Up @@ -2064,7 +2064,7 @@
BUNDLE_ID_SUFFIX = "";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -2113,7 +2113,7 @@
BUNDLE_ID_SUFFIX = .staging;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -2163,7 +2163,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
Expand Down Expand Up @@ -2210,7 +2210,7 @@
BUNDLE_ID_SUFFIX = .staging;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 379;
CURRENT_PROJECT_VERSION = 380;
DEVELOPMENT_TEAM = F8NVT2G2L4;
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
Expand Down
2 changes: 1 addition & 1 deletion legacy/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const CONFIG = {
},
BUILD_VARIANT,
IS_TESTNET_BUILD: BUILD_VARIANT === 'STAGING',
MAX_CONCURRENT_REQUESTS: 5,
MAX_CONCURRENT_REQUESTS: 8,
SENTRY,
MNEMONIC_STRENGTH: 160,
ASSURANCE_LEVELS: _ASSURANCE_STRICT ? ASSURANCE_LEVELS.STRICT : ASSURANCE_LEVELS.NORMAL,
Expand Down
1 change: 1 addition & 0 deletions legacy/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@
"global.actions.dialogs.walletKeysInvalidated.title": "Biometrics changed",
"global.actions.dialogs.walletStateInvalid.message": "Your wallet is in an inconsistent state. You may solve this by restoring your wallet with your recovery phrase. Please contact EMURGO support to report this issue as this may help us fix the problem in a future release.",
"global.actions.dialogs.walletStateInvalid.title": "Invalid wallet state",
"global.actions.dialogs.walletSynchronizing": "Wallet is synchronizing",
"global.actions.dialogs.wrongPinError.message": "PIN is incorrect.",
"global.actions.dialogs.wrongPinError.title": "Invalid PIN",
"global.assets.assetsLabel": "Assets",
Expand Down
38 changes: 25 additions & 13 deletions src/Staking/StakingCenter/StakingCenter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {ApiError, NetworkError} from '../../../legacy/api/errors'
import type {RawUtxo} from '../../../legacy/api/types'
import AccountAutoRefresher from '../../../legacy/components/Delegation/AccountAutoRefresher'
import PoolWarningModal from '../../../legacy/components/Delegation/PoolWarningModal'
import styles from '../../../legacy/components/Delegation/styles/DelegationCenter.style'
import UtxoAutoRefresher from '../../../legacy/components/Send/UtxoAutoRefresher'
import {PleaseWaitModal} from '../../../legacy/components/UiKit'
import {CONFIG, getTestStakingPool, isNightly, SHOW_PROD_POOLS_IN_DEV} from '../../../legacy/config/config'
Expand All @@ -34,6 +33,7 @@ import type {DefaultAsset} from '../../../legacy/types/HistoryTransaction'
import {ObjectValues} from '../../../legacy/utils/flow'
import {normalizeTokenAmount} from '../../../legacy/utils/format'
import {Logger} from '../../../legacy/utils/logging'
import {Spacer} from '../../components'
import {StakingCenterRouteNavigation} from '../../navigation'
import {useSelectedWallet} from '../../SelectedWallet'
import {PoolDetailScreen} from '../PoolDetails'
Expand Down Expand Up @@ -70,6 +70,9 @@ export const StakingCenter = () => {
}

const handleOnMessage = async (event) => {
if (isFetchingUtxos) {
return showErrorDialog(waitSyncDialog, intl)
}
if (event) {
const selectedPoolHashes: Array<string> = JSON.parse(decodeURI(event.nativeEvent.data))
Logger.debug('selected pools from explorer:', selectedPoolHashes)
Expand Down Expand Up @@ -123,7 +126,7 @@ export const StakingCenter = () => {
return (
<>
{(__DEV__ || (isNightly() && !isMainnet)) && (
<View style={styles.container}>
<View style={{flex: 1}}>
<PoolDetailScreen
onPressDelegate={(poolHash) => handleOnPress(poolHash)}
disabled={!nightlyAndDevPoolHashes.length || isFetchingUtxos || !utxos}
Expand All @@ -132,19 +135,17 @@ export const StakingCenter = () => {
)}
{(isMainnet || SHOW_PROD_POOLS_IN_DEV) && (
<>
<View style={styles.container}>
<View style={{flex: 1, backgroundColor: '#fff'}}>
<Spacer height={8} />
<UtxoAutoRefresher />
<AccountAutoRefresher />
{isFetchingUtxos ? (
<ActivityIndicator size="large" color="black" />
) : (
<WebView
source={{
uri: prepareStakingURL(poolList, amountToDelegate, languageCode),
}}
onMessage={(event) => handleOnMessage(event)}
/>
)}
{isFetchingUtxos && <ActivityIndicator color="black" />}
<WebView
source={{
uri: prepareStakingURL(poolList, amountToDelegate, languageCode),
}}
onMessage={(event) => handleOnMessage(event)}
/>
</View>
<PoolWarningModal
visible={showPoolWarning}
Expand Down Expand Up @@ -181,6 +182,17 @@ const noPoolDataDialog = defineMessages({
},
})

const waitSyncDialog = defineMessages({
title: {
id: 'global.tryAgain',
defaultMessage: '!!!Try again',
},
message: {
id: 'global.actions.dialogs.walletSynchronizing',
defaultMessage: '!!!Wallet is syncronizing',
},
})

type SelectedPool = {
poolName?: string
poolHash: string
Expand Down

0 comments on commit d5dd4fa

Please sign in to comment.