Skip to content

Commit

Permalink
Merge branch 'main' into fix/8714-ledger-instruction-change
Browse files Browse the repository at this point in the history
  • Loading branch information
dawnseeker8 authored Mar 6, 2024
2 parents b421e98 + 0c45fbf commit c6ccdcf
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .js.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export MM_BLOCKAID_UI_ENABLED=""
export WATCHER_PORT=8081

# Environment: "production", "pre-release" or "local"
export METAMASK_ENVIRONMENT=""
export METAMASK_ENVIRONMENT="local"

# Build type: "main" or "flask"
export METAMASK_BUILD_TYPE=""
export METAMASK_BUILD_TYPE="main"

# Segment SDK proxy endpoint and write key
export SEGMENT_WRITE_KEY=""
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To learn how to develop MetaMask-compatible applications, visit our [Developer D

### Environment setup

Before running the app, make sure your development environment has all the required tools.
Before running the app, make sure your development environment has all the required tools. Several of these tools (ie Node and Ruby) may require specific versions in order to successfully build the app.

[Setup your development environment](./docs/readme/environment.md)

Expand Down Expand Up @@ -65,4 +65,4 @@ yarn start:ios
**Run on an Android device**
```bash
yarn start:android
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ describe('SendTransaction View', () => {
"fiat_out": 0,
"order_id": "test-id-1",
"payment_method_id": "/payments/instant-bank-transfer",
"provider_offramp": "Test (Staging)",
},
]
`);
Expand Down Expand Up @@ -432,6 +433,7 @@ describe('SendTransaction View', () => {
"fiat_out": 0,
"order_id": "test-id-1",
"payment_method_id": "/payments/instant-bank-transfer",
"provider_offramp": "Test (Staging)",
},
]
`);
Expand Down Expand Up @@ -479,6 +481,7 @@ describe('SendTransaction View', () => {
"fiat_out": 0,
"order_id": "test-id-1",
"payment_method_id": "/payments/instant-bank-transfer",
"provider_offramp": "Test (Staging)",
},
]
`);
Expand Down Expand Up @@ -529,6 +532,7 @@ describe('SendTransaction View', () => {
"fiat_out": 0,
"order_id": "test-id-1",
"payment_method_id": "/payments/instant-bank-transfer",
"provider_offramp": "Test (Staging)",
},
]
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ function SendTransaction() {

const transactionAnalyticsPayload = useMemo(
() => ({
crypto_amount: orderData?.cryptoAmount,
crypto_amount: orderData?.cryptoAmount as string,
chain_id_source: orderData?.cryptoCurrency.network.chainId,
fiat_out: orderData?.fiatAmount,
payment_method_id: orderData?.paymentMethod.id,
currency_source: orderData?.cryptoCurrency.symbol,
currency_destination: orderData?.fiatCurrency.symbol,
order_id: order?.id,
provider_offramp: orderData?.provider.name,
}),
[order?.id, orderData],
);
Expand Down
1 change: 1 addition & 0 deletions app/components/UI/Ramp/types/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ interface RampTransaction {
currency_source: string;
currency_destination: string;
order_id?: string;
provider_offramp: string;
}

interface RampQuotesExpanded {
Expand Down
6 changes: 5 additions & 1 deletion app/components/Views/Settings/NetworksSettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ class NetworksSettings extends PureComponent {
this.updateNavBar();
};

componentDidUpdate = () => {
componentDidUpdate = (prevProps) => {
if (this.props.networkConfigurations !== prevProps.networkConfigurations) {
this.handleSearchTextChange(this.state.searchString);
}

this.updateNavBar();
};

Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@
"@metamask/contract-metadata": "^2.1.0",
"@metamask/approval-controller": "3.4.0",
"@exodus/react-native-payments/validator": "^13.7.0",
"**/plist": "3.0.5",
"**/minimist": "1.2.6",
"@metamask/**/cross-fetch": "2.2.6",
"react-native-svg-asset-plugin/sharp": "^0.30.5",
"d3-color": "3.1.0",
"tough-cookie": "4.1.3",
Expand Down
56 changes: 40 additions & 16 deletions patches/react-native-webview+11.13.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ index 0000000..f4a6af9
+ }
+}
diff --git a/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java b/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
index f743bbc..06d172f 100644
index f743bbc..b520532 100644
--- a/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
+++ b/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
@@ -5,6 +5,7 @@ import android.annotation.TargetApi;
Expand Down Expand Up @@ -1022,7 +1022,31 @@ index f743bbc..06d172f 100644

@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
@@ -1402,6 +1756,15 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
@@ -1266,7 +1620,22 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
requestPermissions(Collections.singletonList(Manifest.permission.ACCESS_FINE_LOCATION));

} else {
- callback.invoke(origin, true, false);
+ String alertMessage = String.format("Allow this app to use your location?");
+ AlertDialog.Builder builder = new AlertDialog.Builder(this.mWebView.getContext());
+ builder.setMessage(alertMessage);
+ builder.setCancelable(false);
+ builder.setPositiveButton("Allow", (dialog, which) -> {
+ callback.invoke(origin, true, false);
+ });
+ builder.setNegativeButton("Don't allow", (dialog, which) -> {
+ callback.invoke(origin, false, false);
+ });
+ AlertDialog alertDialog = builder.create();
+ alertDialog.show();
+ //Delay making `allow` clickable for 500ms to avoid unwanted presses.
+ Button posButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
+ posButton.setEnabled(false);
+ this.runDelayed(() -> posButton.setEnabled(true), 500);
}
}

@@ -1402,6 +1771,15 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
}
}

Expand All @@ -1038,7 +1062,7 @@ index f743bbc..06d172f 100644
@Override
public void onHostPause() { }

@@ -1447,6 +1810,13 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
@@ -1447,6 +1825,13 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
protected boolean nestedScrollEnabled = false;
protected ProgressChangedFilter progressChangedFilter;

Expand All @@ -1052,7 +1076,7 @@ index f743bbc..06d172f 100644
/**
* WebView must be created with an context of the current activity
* <p>
@@ -1475,6 +1845,42 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
@@ -1475,6 +1860,42 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
this.nestedScrollEnabled = nestedScrollEnabled;
}

Expand Down Expand Up @@ -1095,7 +1119,7 @@ index f743bbc..06d172f 100644
@Override
public void onHostResume() {
// do nothing
@@ -1533,6 +1939,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
@@ -1533,6 +1954,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
}
}

Expand All @@ -1104,7 +1128,7 @@ index f743bbc..06d172f 100644
public @Nullable
RNCWebViewClient getRNCWebViewClient() {
return mRNCWebViewClient;
@@ -1609,8 +2017,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
@@ -1609,8 +2032,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {

public void callInjectedJavaScriptBeforeContentLoaded() {
if (getSettings().getJavaScriptEnabled() &&
Expand All @@ -1115,7 +1139,7 @@ index f743bbc..06d172f 100644
evaluateJavascriptWithFallback("(function() {\n" + injectedJSBeforeContentLoaded + ";\n})();");
}
}
@@ -1672,16 +2080,16 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
@@ -1672,16 +2095,16 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {

if (mOnScrollDispatchHelper.onScrollChanged(x, y)) {
ScrollEvent event = ScrollEvent.obtain(
Expand Down Expand Up @@ -1174,39 +1198,39 @@ diff --git a/node_modules/react-native-webview/apple/RNCWebView.m b/node_modules
index 28c078a..9bb5368 100644
--- a/node_modules/react-native-webview/apple/RNCWebView.m
+++ b/node_modules/react-native-webview/apple/RNCWebView.m
@@ -105,6 +105,7 @@ @implementation RNCWebView
@@ -105,6 +105,7 @@ static NSDictionary* customCertificatesForHost;
UIStatusBarStyle _savedStatusBarStyle;
#endif // !TARGET_OS_OSX
BOOL _savedStatusBarHidden;
+ BOOL _disablePromptDuringLoading; //Disables the display of prompts during site navigation/loading

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
UIScrollViewContentInsetAdjustmentBehavior _savedContentInsetAdjustmentBehavior;
@@ -139,6 +140,7 @@ - (instancetype)initWithFrame:(CGRect)frame
@@ -139,6 +140,7 @@ static NSDictionary* customCertificatesForHost;
_injectedJavaScriptForMainFrameOnly = YES;
_injectedJavaScriptBeforeContentLoaded = nil;
_injectedJavaScriptBeforeContentLoadedForMainFrameOnly = YES;
+ _disablePromptDuringLoading = YES;

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
_savedContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
@@ -417,6 +419,7 @@ -(void)keyboardDisplacementFix
@@ -417,6 +419,7 @@ static NSDictionary* customCertificatesForHost;
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
if ([keyPath isEqual:@"estimatedProgress"] && object == self.webView) {
if(_onLoadingProgress){
+ _disablePromptDuringLoading = YES;
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
[event addEntriesFromDictionary:@{@"progress":[NSNumber numberWithDouble:self.webView.estimatedProgress]}];
_onLoadingProgress(event);
@@ -492,6 +495,7 @@ - (void)userContentController:(WKUserContentController *)userContentController
@@ -492,6 +495,7 @@ static NSDictionary* customCertificatesForHost;
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
[event addEntriesFromDictionary: @{@"navigationType": message.body}];
_onLoadingFinish(event);
+ _disablePromptDuringLoading = NO;
}
} else if ([message.name isEqualToString:MessageHandlerName]) {
if (_onMessage) {
@@ -851,11 +855,13 @@ - (void) webView:(WKWebView *)webView
@@ -851,11 +855,13 @@ static NSDictionary* customCertificatesForHost;
- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
{
#if !TARGET_OS_OSX
Expand All @@ -1225,7 +1249,7 @@ index 28c078a..9bb5368 100644
#else
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:message];
@@ -868,6 +874,51 @@ - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSStrin
@@ -868,6 +874,51 @@ static NSDictionary* customCertificatesForHost;
/**
* confirm
*/
Expand Down Expand Up @@ -1277,7 +1301,7 @@ index 28c078a..9bb5368 100644
- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL))completionHandler{
#if !TARGET_OS_OSX
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert];
@@ -894,44 +945,49 @@ - (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSStr
@@ -894,44 +945,49 @@ static NSDictionary* customCertificatesForHost;
* prompt
*/
- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString *))completionHandler{
Expand Down Expand Up @@ -1362,15 +1386,15 @@ index 28c078a..9bb5368 100644
}

#if !TARGET_OS_OSX
@@ -1157,6 +1213,7 @@ - (void)webView:(WKWebView *)webView
@@ -1157,6 +1213,7 @@ static NSDictionary* customCertificatesForHost;
}

if (_onLoadingFinish) {
+ _disablePromptDuringLoading = NO;
_onLoadingFinish([self baseEvent]);
}
}
@@ -1446,3 +1503,4 @@ - (void)userContentController:(WKUserContentController *)userContentController d
@@ -1446,3 +1503,4 @@ static NSDictionary* customCertificatesForHost;
}

@end
Expand Down
37 changes: 16 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9941,7 +9941,7 @@
resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e"
integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==

"@xmldom/xmldom@^0.8.10", "@xmldom/xmldom@^0.x":
"@xmldom/xmldom@^0.8.10", "@xmldom/xmldom@^0.8.8", "@xmldom/xmldom@^0.x":
version "0.8.10"
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.8.10.tgz#a1337ca426aa61cef9fe15b5b28e340a72f6fa99"
integrity sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==
Expand Down Expand Up @@ -13362,15 +13362,7 @@ cron-parser@^4.5.0:
dependencies:
luxon "^3.2.1"

cross-fetch@2.2.6, cross-fetch@^3.1.5:
version "2.2.6"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-2.2.6.tgz#2ef0bb39a24ac034787965c457368a28730e220a"
integrity sha512-9JZz+vXCmfKUZ68zAptS7k4Nu8e2qcibe7WVZYps7sAgk5R8GYTc+T1WR0v1rlP9HxgARmOX1UTIJZFytajpNA==
dependencies:
node-fetch "^2.6.7"
whatwg-fetch "^2.0.4"

cross-fetch@3.1.5, cross-fetch@^3.0.4:
cross-fetch@3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
Expand All @@ -13384,6 +13376,13 @@ cross-fetch@4.0.0:
dependencies:
node-fetch "^2.6.12"

cross-fetch@^3.0.4, cross-fetch@^3.1.5:
version "3.1.8"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82"
integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==
dependencies:
node-fetch "^2.6.12"

cross-spawn@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
Expand Down Expand Up @@ -22619,13 +22618,14 @@ please-upgrade-node@^3.1.1, please-upgrade-node@^3.2.0:
dependencies:
semver-compare "^1.0.0"

plist@3.0.5, plist@3.1.0, plist@^3.0.1, plist@^3.0.5:
version "3.0.5"
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.5.tgz#2cbeb52d10e3cdccccf0c11a63a85d830970a987"
integrity sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==
plist@3.1.0, plist@^3.0.1, plist@^3.0.5:
version "3.1.0"
resolved "https://registry.yarnpkg.com/plist/-/plist-3.1.0.tgz#797a516a93e62f5bde55e0b9cc9c967f860893c9"
integrity sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==
dependencies:
"@xmldom/xmldom" "^0.8.8"
base64-js "^1.5.1"
xmlbuilder "^9.0.7"
xmlbuilder "^15.1.1"

plugin-error@^0.1.2:
version "0.1.2"
Expand Down Expand Up @@ -27901,11 +27901,6 @@ webpack@5, webpack@^5.88.2:
watchpack "^2.4.0"
webpack-sources "^3.2.3"

whatwg-fetch@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"
integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==

whatwg-fetch@^3.0.0, whatwg-fetch@^3.4.1:
version "3.6.2"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c"
Expand Down Expand Up @@ -28249,7 +28244,7 @@ xmlbuilder@^15.1.1:
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-15.1.1.tgz#9dcdce49eea66d8d10b42cae94a79c3c8d0c2ec5"
integrity sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==

xmlbuilder@^9.0.1, xmlbuilder@^9.0.7:
xmlbuilder@^9.0.1:
version "9.0.7"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"
integrity sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==
Expand Down

0 comments on commit c6ccdcf

Please sign in to comment.