Skip to content

Commit

Permalink
chore: move SnapsExecutionWebView out of Main navigation stack (#10268)
Browse files Browse the repository at this point in the history
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR Fix a bug happening while app is locked. A state mismatch
between the ExecutionService state and the actual WebView would cause
snap calls to fail.

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to Settings
2. Enable Notifications if its disabled
3. Lock the app.
4. Try to enable/disable notifications again. 

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**


https://github.com/MetaMask/metamask-mobile/assets/44679989/1060c4a7-fdbd-4b5b-ab6b-fdf2def14655

### **After**


https://github.com/MetaMask/metamask-mobile/assets/44679989/3a6f0052-db86-4f91-9a88-1c4369427d6a

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
Jonathansoufer authored Jul 10, 2024
1 parent 4fa9dc3 commit b87c1f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 13 additions & 1 deletion app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, {
useState,
} from 'react';
import { CommonActions, NavigationContainer } from '@react-navigation/native';
import { Animated, Linking } from 'react-native';
import { Animated, Linking, View } from 'react-native';
import { createStackNavigator } from '@react-navigation/stack';
import Login from '../../Views/Login';
import QRScanner from '../../Views/QRScanner';
Expand Down Expand Up @@ -111,6 +111,9 @@ import DefaultSettings from '../../Views/OnboardingSuccess/DefaultSettings';
import BasicFunctionalityModal from '../../UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal';
import SmartTransactionsOptInModal from '../../Views/SmartTransactionsOptInModal/SmartTranactionsOptInModal';
import NFTAutoDetectionModal from '../../../../app/components/Views/NFTAutoDetectionModal/NFTAutoDetectionModal';
///: BEGIN:ONLY_INCLUDE_IF(preinstalled-snaps,external-snaps)
import { SnapsExecutionWebView } from '../../../lib/snaps';
///: END:ONLY_INCLUDE_IF

const clearStackNavigatorOptions = {
headerShown: false,
Expand Down Expand Up @@ -771,6 +774,15 @@ const App = ({ userLoggedIn }) => {
// do not render unless a route is defined
(route && (
<>
{
///: BEGIN:ONLY_INCLUDE_IF(preinstalled-snaps,external-snaps)
}
<View>
<SnapsExecutionWebView />
</View>
{
///: END:ONLY_INCLUDE_IF
}
{isBlockaidFeatureEnabled() && <PPOMView />}
<NavigationContainer
// Prevents artifacts when navigating between screens
Expand Down
12 changes: 0 additions & 12 deletions app/components/Nav/Main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ import {
startIncomingTransactionPolling,
stopIncomingTransactionPolling,
} from '../../../util/transaction-controller';
///: BEGIN:ONLY_INCLUDE_IF(preinstalled-snaps,external-snaps)
import { SnapsExecutionWebView } from '../../../lib/snaps';
///: END:ONLY_INCLUDE_IF

const Stack = createStackNavigator();

Expand Down Expand Up @@ -365,15 +362,6 @@ const Main = (props) => {
) : (
renderLoader()
)}
{
///: BEGIN:ONLY_INCLUDE_IF(preinstalled-snaps,external-snaps)
}
<View>
<SnapsExecutionWebView />
</View>
{
///: END:ONLY_INCLUDE_IF
}
<GlobalAlert />
<FadeOutOverlay />
<Notification navigation={props.navigation} />
Expand Down

0 comments on commit b87c1f8

Please sign in to comment.