Merge pull request #35 from gabrielbazan7/feat/QrOnboarding

Qr - remove main tabs from import view (onboarding)
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-01 17:50:31 -03:00 committed by GitHub
commit d856ef99b8
7 changed files with 124 additions and 97 deletions

View file

@ -1,17 +1,33 @@
<ion-view >
<ion-view ng-controller="tabsController" ng-init="importInit()">
<ion-tabs class="tabs-striped tabs-color-positive tabs-color-active-positive tabs-top">
<ion-tab title="Recovery Phrare" ui-sref="tabs.import.phrase">
<ion-nav-view name="tab-import-phrase"></ion-nav-view>
</ion-tab>
<div ng-if="!fromOnboarding">
<ion-tab title="Recovery Phrase" ui-sref="tabs.import.phrase">
<ion-nav-view name="tab-import-phrase"></ion-nav-view>
</ion-tab>
<ion-tab title="File/Text" ui-sref="tabs.import.file">
<ion-nav-view name="tab-import-file"></ion-nav-view>
</ion-tab>
<ion-tab title="File/Text" ui-sref="tabs.import.file">
<ion-nav-view name="tab-import-file"></ion-nav-view>
</ion-tab>
<ion-tab title="Hardware Wallet" ui-sref="tabs.import.hardware">
<ion-nav-view name="tab-import-hardware"></ion-nav-view>
</ion-tab>
<ion-tab title="Hardware Wallet" ui-sref="tabs.import.hardware">
<ion-nav-view name="tab-import-hardware"></ion-nav-view>
</ion-tab>
</div>
<div ng-if="fromOnboarding">
<ion-tab title="Recovery Phrase" ui-sref="onboarding.import.phrase">
<ion-nav-view name="tab-import-phrase"></ion-nav-view>
</ion-tab>
<ion-tab title="File/Text" ui-sref="onboarding.import.file">
<ion-nav-view name="tab-import-file"></ion-nav-view>
</ion-tab>
<ion-tab title="Hardware Wallet" ui-sref="onboarding.import.hardware">
<ion-nav-view name="tab-import-hardware"></ion-nav-view>
</ion-tab>
</div>
</ion-tabs>
</ion-view>

View file

@ -1,6 +1,6 @@
<ion-view id="onboard-welcome" class="onboarding">
<ion-content ng-controller="welcomeController" ng-init="createProfile()">
<img src="../img/onboarding-welcome-shopping24.png" id="shopping-24" />
<qr-scanner id="shopping-24" on-scan="goImport(data)"></qr-scanner>
<div class="text-center">
<div class="row">
<img src='../../img/bitpay-logo.svg' class="logo col col-50" />
@ -14,7 +14,7 @@
<button class="button button-block get-started col col-75" href ui-sref="onboarding.tour" translate>Get started</button>
</div>
<div class="row">
<button class="button button-block restore col col-75" translate href ui-sref="tabs.import({'fromOnboarding':true})">Restore</button>
<button class="button button-block restore col col-75" translate href ui-sref="onboarding.import.phrase({'fromOnboarding':true})">Restore</button>
</div>
</ion-content>
</ion-view>

View file

@ -36,7 +36,6 @@ angular.module('copayApp.controllers').controller('importController',
$scope.processWalletInfo = function(code) {
if (!code) return;
$scope.importErr = false;
var parsedCode = code.split('|');
@ -102,18 +101,7 @@ angular.module('copayApp.controllers').controller('importController',
return;
}
walletService.updateRemotePreferences(client, {}, function() {
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
});
profileService.setBackupFlag(client.credentials.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(client);
});
}, 100);
};
@ -133,19 +121,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.$apply();
});
}
walletService.updateRemotePreferences(client, {}, function() {
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
});
profileService.setBackupFlag(client.credentials.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(client);
});
}, 100);
};
@ -166,11 +142,12 @@ angular.module('copayApp.controllers').controller('importController',
}
profileService.setBackupFlag(walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
});
}, 100);
@ -194,18 +171,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.$apply();
});
}
walletService.updateRemotePreferences(client, {}, function() {
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
});
profileService.setBackupFlag(client.credentials.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(client);
});
}, 100);
};
@ -313,19 +279,7 @@ angular.module('copayApp.controllers').controller('importController',
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
walletService.updateRemotePreferences(wallet, {}, function() {
$log.debug('Remote preferences saved for:' + wallet.walletId)
});
profileService.setBackupFlag(wallet.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(wallet);
});
}, 100);
};
@ -389,23 +343,27 @@ angular.module('copayApp.controllers').controller('importController',
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
walletService.updateRemotePreferences(wallet, {}, function() {
$log.debug('Remote preferences saved for:' + wallet.walletId)
});
profileService.setBackupFlag(wallet.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(wallet);
});
}, 100);
};
var finish = function(wallet) {
walletService.updateRemotePreferences(wallet, {}, function() {
$log.debug('Remote preferences saved for:' + wallet.credentials.walletId)
});
profileService.setBackupFlag(wallet.credentials.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
};
updateSeedSourceSelect();
$scope.setSeedSource('new');
$scope.setSeedSource();
if ($stateParams.code) $scope.processWalletInfo($stateParams.code);
});

View file

@ -2,6 +2,13 @@
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $log, $ionicPopup, profileService) {
$scope.goImport = function(code) {
$state.go('onboarding.import.phrase', {
fromOnboarding: true,
code: code
});
};
$scope.createProfile = function() {
$log.debug('Creating profile');
profileService.createProfile(function(err) {

View file

@ -1,21 +1,27 @@
'use strict';
angular.module('copayApp.controllers').controller('tabsController', function($log, $scope, $ionicModal, incomingData) {
angular.module('copayApp.controllers').controller('tabsController', function($log, $scope, $stateParams, $ionicModal, $timeout, incomingData) {
$scope.onScan = function(data) {
console.log('[tabsController.js.6:data:]',data); //TODO
if (!incomingData.redir(data)) {
$ionicPopup.alert({
title: 'Invalid data',
});
}
$scope.onScan = function(data) {
if (!incomingData.redir(data)) {
$ionicPopup.alert({
title: 'Invalid data',
});
}
}
$scope.setScanFn = function(scanFn) {
$scope.scan = function() {
$log.debug('Scanning...');
scanFn();
};
$scope.setScanFn = function(scanFn) {
$scope.scan = function() {
$log.debug('Scanning...');
scanFn();
};
});
};
$scope.importInit = function() {
$scope.fromOnboarding = $stateParams.fromOnboarding;
$timeout(function() {
$scope.$apply();
}, 1);
}
});

View file

@ -270,12 +270,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
})
.state('tabs.import', {
url: '/import/:fromOnboarding',
// abstract: true,
// abstract: true,
views: {
'tab-home': {
templateUrl: 'views/import.html'
},
}
},
params: {
code: null
},
})
.state('tabs.import.phrase', {
url: '/tab-import-phrase',
@ -628,6 +631,42 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
}
})
.state('onboarding.import', {
url: '/import/:fromOnboarding',
abstract: true,
views: {
'onboarding': {
templateUrl: 'views/import.html'
},
},
params: {
code: null
},
})
.state('onboarding.import.phrase', {
url: '/tab-import-phrase',
views: {
'tab-import-phrase': {
templateUrl: 'views/tab-import-phrase.html',
},
}
})
.state('onboarding.import.file', {
url: '/tab-import-file',
views: {
'tab-import-file': {
templateUrl: 'views/tab-import-file.html',
},
}
})
.state('onboarding.import.hardware', {
url: '/tab-import-hardware',
views: {
'tab-import-hardware': {
templateUrl: 'views/tab-import-hardware.html',
},
}
})
/*
*

View file

@ -5,6 +5,7 @@
background-size: contain;
background-repeat-y: no-repeat;
#shopping-24 {
content: url("../img/onboarding-welcome-shopping24.png");
position: absolute;
top: 2%;
right: 5%;