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

@ -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);
}
});