()
| 509 | } |
| 510 | |
| 511 | async componentDidUpdate() { |
| 512 | const route = findRouteNameFromNavigatorState( |
| 513 | this.props.navigation.dangerouslyGetState().routes, |
| 514 | ); |
| 515 | if (!this.props.passwordSet || !this.props.seedphraseBackedUp) { |
| 516 | if ( |
| 517 | [ |
| 518 | 'SetPasswordFlow', |
| 519 | 'ChoosePassword', |
| 520 | 'AccountBackupStep1', |
| 521 | 'AccountBackupStep1B', |
| 522 | 'ManualBackupStep1', |
| 523 | 'ManualBackupStep2', |
| 524 | 'ManualBackupStep3', |
| 525 | 'Webview', |
| 526 | Routes.LOCK_SCREEN, |
| 527 | ].includes(route) |
| 528 | ) { |
| 529 | this.state.showProtectWalletModal && |
| 530 | // eslint-disable-next-line react/no-did-update-set-state |
| 531 | this.setState({ showProtectWalletModal: false }); |
| 532 | return; |
| 533 | } |
| 534 | let tokenFound = false; |
| 535 | |
| 536 | this.props.tokens.forEach((token) => { |
| 537 | if ( |
| 538 | this.props.tokenBalances[token.address] && |
| 539 | !isZero(this.props.tokenBalances[token.address]) |
| 540 | ) { |
| 541 | tokenFound = true; |
| 542 | } |
| 543 | }); |
| 544 | if ( |
| 545 | !this.props.passwordSet || |
| 546 | this.currentBalance > 0 || |
| 547 | tokenFound || |
| 548 | this.props.collectibles.length > 0 |
| 549 | ) { |
| 550 | // eslint-disable-next-line react/no-did-update-set-state |
| 551 | this.setState({ showProtectWalletModal: true }); |
| 552 | |
| 553 | this.props.metrics.trackEvent( |
| 554 | MetaMetricsEvents.WALLET_SECURITY_PROTECT_VIEWED, |
| 555 | { |
| 556 | wallet_protection_required: false, |
| 557 | source: 'Backup Alert', |
| 558 | }, |
| 559 | ); |
| 560 | } else { |
| 561 | // eslint-disable-next-line react/no-did-update-set-state |
| 562 | this.setState({ showProtectWalletModal: false }); |
| 563 | } |
| 564 | } else { |
| 565 | // eslint-disable-next-line react/no-did-update-set-state |
| 566 | this.setState({ showProtectWalletModal: false }); |
| 567 | } |
| 568 | const pendingDeeplink = DeeplinkManager.getPendingDeeplink(); |
nothing calls this directly
no test coverage detected