This commit is contained in:
Matias Alejo Garcia 2015-01-03 18:34:07 -03:00
commit 237a707719
3 changed files with 236 additions and 225 deletions

View file

@ -23,4 +23,9 @@ android: cordova-base
release-android: cordova-base release-android: cordova-base
make -C cordova release-android make -C cordova release-android
wp8:
cordova/build.sh WP8
cordova/wp/fix-svg.sh
echo -e "\a"

View file

@ -1,10 +1,10 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('CreateProfileController', function($scope, $rootScope, $location, $timeout, $window, notification, pluginManager, identityService, pinService, isMobile, isCordova, configService, go) { angular.module('copayApp.controllers').controller('CreateProfileController', function ($scope, $rootScope, $location, $timeout, $window, notification, pluginManager, identityService, pinService, isMobile, isCordova, configService, go) {
var _credentials, _firstpin; var _credentials, _firstpin;
$scope.init = function() { $scope.init = function () {
if ($rootScope.wallet) if ($rootScope.wallet)
go.walletHome(); go.walletHome();
@ -19,20 +19,25 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
$scope.minPasswordStrength = _.isUndefined(config.minPasswordStrength) ? $scope.minPasswordStrength = _.isUndefined(config.minPasswordStrength) ?
4 : config.minPasswordStrength; 4 : config.minPasswordStrength;
pinService.makePinInput($scope, 'newpin', function(newValue) { pinService.makePinInput($scope, 'newpin', function (newValue) {
_firstpin = newValue; _firstpin = newValue;
$scope.askForPin = 2;
$scope.hideForWP = 0; $scope.hideForWP = 0;
$scope.askForPin = 2;
$timeout(function () {
$scope.$digest();
}, 1);
}); });
pinService.makePinInput($scope, 'repeatpin', function(newValue) { pinService.makePinInput($scope, 'repeatpin', function (newValue) {
if (newValue === _firstpin) { if (newValue === _firstpin) {
_firstpin = null; _firstpin = null;
$scope.createPin(newValue); $scope.createPin(newValue);
} else { } else {
$scope.askForPin = 1; $scope.askForPin = 1;
$scope.hideForWP = 0; $scope.hideForWP = 0;
$scope.passwordStrength = null;
_firstpin = null; _firstpin = null;
@ -43,20 +48,23 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
$scope.setPinForm.$setPristine(); $scope.setPinForm.$setPristine();
$scope.error = 'Entered PINs were not equal. Try again'; $scope.error = 'Entered PINs were not equal. Try again';
$timeout(function () {
$scope.$digest();
}, 1);
} }
}); });
}; };
$scope.formFocus = function() { $scope.formFocus = function () {
if ($scope.isWindowsPhoneApp) { if ($scope.isWindowsPhoneApp) {
$scope.hideForWP = true; $scope.hideForWP = true;
$timeout(function() { $timeout(function () {
$scope.$digest(); $scope.$digest();
}, 1); }, 1);
} }
}; };
$scope.createPin = function(pin) { $scope.createPin = function (pin) {
preconditions.checkArgument(pin); preconditions.checkArgument(pin);
preconditions.checkState($rootScope.iden); preconditions.checkState($rootScope.iden);
preconditions.checkState(_credentials && _credentials.email); preconditions.checkState(_credentials && _credentials.email);
@ -65,8 +73,8 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
// hide Keyboard after submit form // hide Keyboard after submit form
$window.document.querySelector('#repeatpin').blur(); $window.document.querySelector('#repeatpin').blur();
$timeout(function() { $timeout(function () {
pinService.save(pin, _credentials.email, _credentials.password, function(err) { pinService.save(pin, _credentials.email, _credentials.password, function (err) {
_credentials.password = ''; _credentials.password = '';
_credentials = null; _credentials = null;
$scope.askForPin = 0; $scope.askForPin = 0;
@ -78,44 +86,44 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
}; };
$scope.setStep = function(step) { $scope.setStep = function (step) {
$scope.error = null; $scope.error = null;
$scope.createStep = step; $scope.createStep = step;
$scope.hideForWP = false; $scope.hideForWP = false;
$timeout(function() { $timeout(function () {
$scope.$digest(); $scope.$digest();
}, 1); }, 1);
}; };
$scope.selectStorage = function(storage) { $scope.selectStorage = function (storage) {
$scope.useLocalstorage = storage == 'local'; $scope.useLocalstorage = storage == 'local';
$scope.hideForWP = false; $scope.hideForWP = false;
$timeout(function() { $timeout(function () {
$scope.$digest(); $scope.$digest();
}, 1); }, 1);
}; };
$scope.goToEmail = function() { $scope.goToEmail = function () {
$scope.createStep = 'email'; $scope.createStep = 'email';
$scope.useEmail = !$scope.useLocalstorage; $scope.useEmail = !$scope.useLocalstorage;
}; };
$scope.setEmailOrUsername = function(form) { $scope.setEmailOrUsername = function (form) {
$scope.userOrEmail = $scope.useLocalstorage ? form.username.$modelValue : form.email.$modelValue; $scope.userOrEmail = $scope.useLocalstorage ? form.username.$modelValue : form.email.$modelValue;
preconditions.checkState($scope.userOrEmail); preconditions.checkState($scope.userOrEmail);
$scope.error = null; $scope.error = null;
$scope.hideForWP = false; $scope.hideForWP = false;
$scope.createStep = 'pass'; $scope.createStep = 'pass';
$timeout(function() { $timeout(function () {
$scope.$digest(); $scope.$digest();
}, 1); }, 1);
}; };
/* Last step. Will emit after creation so the UX gets updated */ /* Last step. Will emit after creation so the UX gets updated */
$scope.createDefaultWallet = function() { $scope.createDefaultWallet = function () {
$rootScope.hideNavigation = false; $rootScope.hideNavigation = false;
identityService.createDefaultWallet(function(err) { identityService.createDefaultWallet(function (err) {
$scope.askForPin = 0; $scope.askForPin = 0;
if (err) { if (err) {
@ -130,14 +138,14 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
}); });
}; };
$scope._doCreateProfile = function(emailOrUsername, password, cb) { $scope._doCreateProfile = function (emailOrUsername, password, cb) {
preconditions.checkArgument(_.isString(emailOrUsername)); preconditions.checkArgument(_.isString(emailOrUsername));
preconditions.checkArgument(_.isString(password)); preconditions.checkArgument(_.isString(password));
$rootScope.hideNavigation = false; $rootScope.hideNavigation = false;
$rootScope.starting = true; $rootScope.starting = true;
identityService.create(emailOrUsername, password, function(err) { identityService.create(emailOrUsername, password, function (err) {
$rootScope.starting = null; $rootScope.starting = null;
$scope.error = null; $scope.error = null;
if (err) { if (err) {
@ -163,7 +171,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
$scope.hideForWP = 0; $scope.hideForWP = 0;
$rootScope.hideNavigation = true; $rootScope.hideNavigation = true;
$timeout(function() { $timeout(function () {
$rootScope.$digest(); $rootScope.$digest();
}, 1); }, 1);
return; return;
@ -176,7 +184,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
}; };
$scope.saveSettings = function(cb) { $scope.saveSettings = function (cb) {
var plugins = config.plugins; var plugins = config.plugins;
plugins.EncryptedLocalStorage = false; plugins.EncryptedLocalStorage = false;
@ -191,17 +199,17 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
}; };
$scope.createProfile = function(form) { $scope.createProfile = function (form) {
if (form && form.$invalid) { if (form && form.$invalid) {
$scope.error = 'Please enter the required fields'; $scope.error = 'Please enter the required fields';
return; return;
} }
$scope.saveSettings(function(err) { $scope.saveSettings(function (err) {
preconditions.checkState(!err, err); preconditions.checkState(!err, err);
$scope._doCreateProfile($scope.userOrEmail, form.password.$modelValue, function(err) { $scope._doCreateProfile($scope.userOrEmail, form.password.$modelValue, function (err) {
$timeout(function() { $timeout(function () {
form.password.$setViewValue(''); form.password.$setViewValue('');
form.password.$render(); form.password.$render();
form.repeatpassword.$setViewValue(''); form.repeatpassword.$setViewValue('');

View file

@ -214,15 +214,14 @@
</div> </div>
<form name="setPinForm" novalidate> <form name="setPinForm" novalidate>
<div class="input" ng-show="askForPin == 1"> <div class="input" ng-if="askForPin == 1">
<input id="newpin" type="tel" ng-model="newpin" class="form-control" ng-maxlength="4" ng-minlength="4" maxlength="4" ng-pattern="/^[0-9]{1,4}$/" placeholder="PIN" name="newpin" required show-focus="askForPin == 1 && !isWindowsPhoneApp" ng-focus="formFocus()"> <input id="newpin" type="tel" ng-model="newpin" class="form-control" ng-maxlength="4" ng-minlength="4" maxlength="4" ng-pattern="/^[0-9]{1,4}$/" placeholder="PIN" name="newpin" required show-focus="askForPin == 1 && !isWindowsPhoneApp" ng-focus="formFocus()">
<i class="icon-locked"></i> <i class="icon-locked" ng-hide="isWindowsPhoneApp"></i>
</div> </div>
<div class="input" ng-show="askForPin == 2"> <div class="input" ng-if="askForPin == 2">
<input id="repeatpin" type="tel" ng-model="repeatpin" class="form-control" ng-maxlength="4" ng-minlength="4" maxlength="4" ng-pattern="/^[0-9]{1,4}$/" placeholder="Confirm your PIN" name="repeatpin" required show-focus="askForPin == 2 && !isWindowsPhoneApp" ng-focus="formFocus()"> <input id="repeatpin" type="tel" ng-model="repeatpin" class="form-control" ng-maxlength="4" ng-minlength="4" maxlength="4" ng-pattern="/^[0-9]{1,4}$/" placeholder="Confirm your PIN" name="repeatpin" required show-focus="askForPin == 2 && !isWindowsPhoneApp" ng-focus="formFocus()">
<i class="icon-locked"></i> <i class="icon-locked" ng-hide="isWindowsPhoneApp"></i>
</div> </div>
<div class="box-setup-footer row collapse"> <div class="box-setup-footer row collapse">
<div class="large-6 medium-6 small-6 columns"> <div class="large-6 medium-6 small-6 columns">
<a class="button secondary radius m0" ng-click="createDefaultWallet()"> <a class="button secondary radius m0" ng-click="createDefaultWallet()">
@ -237,8 +236,7 @@
</div> </div>
</div> </div>
</form>
</form>
</div> </div>
</div> </div>