Skip to content

Commit 98f4ab5

Browse files
Bruno Barbieriestebanmino
Bruno Barbieri
authored andcommitted
Support URLs on QR code scanner (#1145)
* allow scanning urls to open websites * add support for normal websites * version bump * fix * fix bug
1 parent a7e8b9f commit 98f4ab5

File tree

6 files changed

+33
-7
lines changed

6 files changed

+33
-7
lines changed

Diff for: android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ android {
174174
applicationId "io.metamask"
175175
minSdkVersion rootProject.ext.minSdkVersion
176176
targetSdkVersion rootProject.ext.targetSdkVersion
177-
versionCode 20
178-
versionName "0.2.7"
177+
versionCode 21
178+
versionName "0.2.8"
179179
multiDexEnabled true
180180
testBuildType System.getProperty('testBuildType', 'debug')
181181
missingDimensionStrategy "minReactNative", "minReactNative46"

Diff for: app/components/UI/Navbar/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,10 @@ export function getWalletNavbarOptions(title, navigation) {
569569
setTimeout(() => {
570570
DeeplinkManager.parse(data);
571571
}, 500);
572+
} else if ((data && data.indexOf('https://') !== -1) || data.indexOf('http://')) {
573+
setTimeout(() => {
574+
DeeplinkManager.parse(data);
575+
}, 500);
572576
}
573577
};
574578

Diff for: app/components/Views/Browser/index.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,26 @@ class Browser extends PureComponent {
9898
});
9999
}
100100

101-
componentDidUpdate() {
101+
componentDidUpdate(prevProps) {
102102
if (this.props.tabs.length !== Object.keys(this.tabs).length) {
103103
this.createBrowserTabs(this.props.tabs);
104104
}
105+
106+
const prevNavigation = prevProps.navigation;
107+
const { navigation } = this.props;
108+
109+
if (prevNavigation && navigation) {
110+
const prevUrl = prevNavigation.getParam('newTabUrl', null);
111+
const currentUrl = navigation.getParam('newTabUrl', null);
112+
113+
if (currentUrl && prevUrl !== currentUrl) {
114+
this.newTab(currentUrl);
115+
this.props.navigation.setParams({
116+
...this.props.navigation.state.params,
117+
newTabUrl: null
118+
});
119+
}
120+
}
105121
}
106122

107123
showTabs = async () => {

Diff for: app/core/DeeplinkManager.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ class DeeplinkManager {
3131
handleBrowserUrl(url, callback) {
3232
this.navigation.navigate('BrowserTabHome');
3333
InteractionManager.runAfterInteractions(() => {
34-
callback(url);
34+
if (callback) {
35+
callback(url);
36+
} else {
37+
this.navigation.navigate('BrowserView', {
38+
newTabUrl: url
39+
});
40+
}
3541
});
3642
}
3743

Diff for: ios/MetaMask.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2537,7 +2537,7 @@
25372537
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
25382538
"\"$(SRCROOT)/MetaMask\"",
25392539
);
2540-
MARKETING_VERSION = 0.2.7;
2540+
MARKETING_VERSION = 0.2.8;
25412541
OTHER_LDFLAGS = (
25422542
"$(inherited)",
25432543
"-ObjC",
@@ -2605,7 +2605,7 @@
26052605
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
26062606
"\"$(SRCROOT)/MetaMask\"",
26072607
);
2608-
MARKETING_VERSION = 0.2.7;
2608+
MARKETING_VERSION = 0.2.8;
26092609
OTHER_LDFLAGS = (
26102610
"$(inherited)",
26112611
"-ObjC",

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metamask",
3-
"version": "0.2.7",
3+
"version": "0.2.8",
44
"private": true,
55
"scripts": {
66
"restart-packager-clean": "watchman watch-del-all && rm -rf $TMPDIR/react-* && yarn start -- --reset-cache",

0 commit comments

Comments
 (0)