Skip to content

Commit

Permalink
Support URLs on QR code scanner (#1145)
Browse files Browse the repository at this point in the history
* allow scanning urls to open websites

* add support for normal websites

* version bump

* fix

* fix bug
  • Loading branch information
Bruno Barbieri authored and estebanmino committed Oct 9, 2019
1 parent 7d7b2be commit 73fbcb3
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Expand Up @@ -174,8 +174,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 20
versionName "0.2.7"
versionCode 21
versionName "0.2.8"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
Expand Down
4 changes: 4 additions & 0 deletions app/components/UI/Navbar/index.js
Expand Up @@ -569,6 +569,10 @@ export function getWalletNavbarOptions(title, navigation) {
setTimeout(() => {
DeeplinkManager.parse(data);
}, 500);
} else if ((data && data.indexOf('https://') !== -1) || data.indexOf('http://')) {
setTimeout(() => {
DeeplinkManager.parse(data);
}, 500);
}
};

Expand Down
18 changes: 17 additions & 1 deletion app/components/Views/Browser/index.js
Expand Up @@ -98,10 +98,26 @@ class Browser extends PureComponent {
});
}

componentDidUpdate() {
componentDidUpdate(prevProps) {
if (this.props.tabs.length !== Object.keys(this.tabs).length) {
this.createBrowserTabs(this.props.tabs);
}

const prevNavigation = prevProps.navigation;
const { navigation } = this.props;

if (prevNavigation && navigation) {
const prevUrl = prevNavigation.getParam('newTabUrl', null);
const currentUrl = navigation.getParam('newTabUrl', null);

if (currentUrl && prevUrl !== currentUrl) {
this.newTab(currentUrl);
this.props.navigation.setParams({
...this.props.navigation.state.params,
newTabUrl: null
});
}
}
}

showTabs = async () => {
Expand Down
8 changes: 7 additions & 1 deletion app/core/DeeplinkManager.js
Expand Up @@ -31,7 +31,13 @@ class DeeplinkManager {
handleBrowserUrl(url, callback) {
this.navigation.navigate('BrowserTabHome');
InteractionManager.runAfterInteractions(() => {
callback(url);
if (callback) {
callback(url);
} else {
this.navigation.navigate('BrowserView', {
newTabUrl: url
});
}
});
}

Expand Down
4 changes: 2 additions & 2 deletions ios/MetaMask.xcodeproj/project.pbxproj
Expand Up @@ -2537,7 +2537,7 @@
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
"\"$(SRCROOT)/MetaMask\"",
);
MARKETING_VERSION = 0.2.7;
MARKETING_VERSION = 0.2.8;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -2605,7 +2605,7 @@
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
"\"$(SRCROOT)/MetaMask\"",
);
MARKETING_VERSION = 0.2.7;
MARKETING_VERSION = 0.2.8;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "metamask",
"version": "0.2.7",
"version": "0.2.8",
"private": true,
"scripts": {
"restart-packager-clean": "watchman watch-del-all && rm -rf $TMPDIR/react-* && yarn start -- --reset-cache",
Expand Down

0 comments on commit 73fbcb3

Please sign in to comment.