diff --git a/.js.env.example b/.js.env.example index ff60d5739df..a9c923b361b 100644 --- a/.js.env.example +++ b/.js.env.example @@ -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="" diff --git a/README.md b/README.md index 89cb782993f..9794cab8c73 100644 --- a/README.md +++ b/README.md @@ -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) @@ -65,4 +65,4 @@ yarn start:ios **Run on an Android device** ```bash yarn start:android -``` \ No newline at end of file +``` diff --git a/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.test.tsx b/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.test.tsx index 7f8d13ca8cf..e32fbe12f3d 100644 --- a/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.test.tsx +++ b/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.test.tsx @@ -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)", }, ] `); @@ -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)", }, ] `); @@ -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)", }, ] `); @@ -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)", }, ] `); diff --git a/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.tsx b/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.tsx index 7db84663a0e..4bf46677aba 100644 --- a/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.tsx +++ b/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.tsx @@ -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], ); diff --git a/app/components/UI/Ramp/types/analytics.ts b/app/components/UI/Ramp/types/analytics.ts index 951e79afbb5..f7eb4bba4f2 100644 --- a/app/components/UI/Ramp/types/analytics.ts +++ b/app/components/UI/Ramp/types/analytics.ts @@ -278,6 +278,7 @@ interface RampTransaction { currency_source: string; currency_destination: string; order_id?: string; + provider_offramp: string; } interface RampQuotesExpanded { diff --git a/app/components/Views/Settings/NetworksSettings/index.js b/app/components/Views/Settings/NetworksSettings/index.js index e3d0fc7f0d8..6419bcac3cc 100644 --- a/app/components/Views/Settings/NetworksSettings/index.js +++ b/app/components/Views/Settings/NetworksSettings/index.js @@ -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(); }; diff --git a/package.json b/package.json index 897d3e0891e..05463042058 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/patches/react-native-webview+11.13.0.patch b/patches/react-native-webview+11.13.0.patch index 81140f13f02..d613485d404 100644 --- a/patches/react-native-webview+11.13.0.patch +++ b/patches/react-native-webview+11.13.0.patch @@ -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; @@ -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 { +@@ -1266,7 +1620,22 @@ public class RNCWebViewManager extends SimpleViewManager { + 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 { } } @@ -1038,7 +1062,7 @@ index f743bbc..06d172f 100644 @Override public void onHostPause() { } -@@ -1447,6 +1810,13 @@ public class RNCWebViewManager extends SimpleViewManager { +@@ -1447,6 +1825,13 @@ public class RNCWebViewManager extends SimpleViewManager { protected boolean nestedScrollEnabled = false; protected ProgressChangedFilter progressChangedFilter; @@ -1052,7 +1076,7 @@ index f743bbc..06d172f 100644 /** * WebView must be created with an context of the current activity *

-@@ -1475,6 +1845,42 @@ public class RNCWebViewManager extends SimpleViewManager { +@@ -1475,6 +1860,42 @@ public class RNCWebViewManager extends SimpleViewManager { this.nestedScrollEnabled = nestedScrollEnabled; } @@ -1095,7 +1119,7 @@ index f743bbc..06d172f 100644 @Override public void onHostResume() { // do nothing -@@ -1533,6 +1939,8 @@ public class RNCWebViewManager extends SimpleViewManager { +@@ -1533,6 +1954,8 @@ public class RNCWebViewManager extends SimpleViewManager { } } @@ -1104,7 +1128,7 @@ index f743bbc..06d172f 100644 public @Nullable RNCWebViewClient getRNCWebViewClient() { return mRNCWebViewClient; -@@ -1609,8 +2017,8 @@ public class RNCWebViewManager extends SimpleViewManager { +@@ -1609,8 +2032,8 @@ public class RNCWebViewManager extends SimpleViewManager { public void callInjectedJavaScriptBeforeContentLoaded() { if (getSettings().getJavaScriptEnabled() && @@ -1115,7 +1139,7 @@ index f743bbc..06d172f 100644 evaluateJavascriptWithFallback("(function() {\n" + injectedJSBeforeContentLoaded + ";\n})();"); } } -@@ -1672,16 +2080,16 @@ public class RNCWebViewManager extends SimpleViewManager { +@@ -1672,16 +2095,16 @@ public class RNCWebViewManager extends SimpleViewManager { if (mOnScrollDispatchHelper.onScrollChanged(x, y)) { ScrollEvent event = ScrollEvent.obtain( @@ -1174,7 +1198,7 @@ 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; @@ -1182,7 +1206,7 @@ index 28c078a..9bb5368 100644 #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; @@ -1190,7 +1214,7 @@ index 28c078a..9bb5368 100644 #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 *)change context:(void *)context{ if ([keyPath isEqual:@"estimatedProgress"] && object == self.webView) { if(_onLoadingProgress){ @@ -1198,7 +1222,7 @@ index 28c078a..9bb5368 100644 NSMutableDictionary *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 *event = [self baseEvent]; [event addEntriesFromDictionary: @{@"navigationType": message.body}]; _onLoadingFinish(event); @@ -1206,7 +1230,7 @@ index 28c078a..9bb5368 100644 } } 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 @@ -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 */ @@ -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{ @@ -1362,7 +1386,7 @@ 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) { @@ -1370,7 +1394,7 @@ index 28c078a..9bb5368 100644 _onLoadingFinish([self baseEvent]); } } -@@ -1446,3 +1503,4 @@ - (void)userContentController:(WKUserContentController *)userContentController d +@@ -1446,3 +1503,4 @@ static NSDictionary* customCertificatesForHost; } @end diff --git a/yarn.lock b/yarn.lock index ed8168e74b9..8f308ccb4d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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== @@ -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== @@ -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" @@ -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" @@ -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" @@ -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==