commit
e513059d3e
33 changed files with 526 additions and 202 deletions
|
|
@ -1,15 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('CreateController',
|
||||
function($scope, $rootScope, $location, $timeout, identityService, backupService, notification, defaults) {
|
||||
function($scope, $rootScope, $location, $timeout, identityService, backupService, notification, defaults, isMobile, isCordova) {
|
||||
|
||||
$rootScope.fromSetup = true;
|
||||
$scope.loading = false;
|
||||
$scope.walletPassword = $rootScope.walletPassword;
|
||||
$scope.isMobile = !!window.cordova;
|
||||
$scope.isMobile = isMobile.any();
|
||||
$scope.hideAdv = true;
|
||||
$scope.networkName = config.networkName;
|
||||
$rootScope.title = 'Create new wallet';
|
||||
$rootScope.hideWalletNavigation = true;
|
||||
$scope.isWindowsPhoneApp = isMobile.Windows() && isCordova;
|
||||
|
||||
// ng-repeat defined number of times instead of repeating over array?
|
||||
$scope.getNumber = function(num) {
|
||||
|
|
@ -39,6 +41,7 @@ angular.module('copayApp.controllers').controller('CreateController',
|
|||
return $scope.networkUrl != defaults.network.livenet.url && $scope.networkUrl != defaults.network.testnet.url;
|
||||
};
|
||||
|
||||
|
||||
$scope.create = function(form) {
|
||||
if (form && form.$invalid) {
|
||||
$scope.error = 'Please enter the required fields';
|
||||
|
|
@ -68,4 +71,8 @@ angular.module('copayApp.controllers').controller('CreateController',
|
|||
},1);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$destroy", function () {
|
||||
$rootScope.hideWalletNavigation = false;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('CreateProfileController', function($scope, $rootScope, $location, $timeout, $window, notification, pluginManager, identityService, pinService, isMobile, 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;
|
||||
|
||||
|
|
@ -10,15 +10,25 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
|||
go.walletHome();
|
||||
|
||||
$scope.isMobile = isMobile.any();
|
||||
$scope.isWindowsPhoneApp = isMobile.Windows() && isCordova;
|
||||
$scope.hideForWP = 0;
|
||||
|
||||
|
||||
$scope.createStep = 'storage';
|
||||
$scope.useLocalstorage = false;
|
||||
$scope.minPasswordStrength = _.isUndefined(config.minPasswordStrength) ?
|
||||
4 : config.minPasswordStrength;
|
||||
|
||||
|
||||
pinService.makePinInput($scope, 'newpin', function(newValue) {
|
||||
_firstpin = newValue;
|
||||
$scope.hideForWP = 0;
|
||||
$scope.askForPin = 2;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
|
||||
|
||||
});
|
||||
|
||||
pinService.makePinInput($scope, 'repeatpin', function(newValue) {
|
||||
|
|
@ -27,6 +37,9 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
|||
$scope.createPin(newValue);
|
||||
} else {
|
||||
$scope.askForPin = 1;
|
||||
$scope.hideForWP = 0;
|
||||
$scope.passwordStrength = null;
|
||||
|
||||
_firstpin = null;
|
||||
|
||||
$scope.setPinForm.newpin.$setViewValue('');
|
||||
|
|
@ -36,10 +49,20 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
|||
$scope.setPinForm.$setPristine();
|
||||
|
||||
$scope.error = 'Entered PINs were not equal. Try again';
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.formFocus = function() {
|
||||
if (!$scope.isWindowsPhoneApp) return
|
||||
$scope.hideForWP = true;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
};
|
||||
|
||||
$scope.createPin = function(pin) {
|
||||
preconditions.checkArgument(pin);
|
||||
|
|
@ -66,6 +89,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
|||
$scope.setStep = function(step) {
|
||||
$scope.error = null;
|
||||
$scope.createStep = step;
|
||||
$scope.hideForWP = false;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
|
|
@ -73,6 +97,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
|||
|
||||
$scope.selectStorage = function(storage) {
|
||||
$scope.useLocalstorage = storage == 'local';
|
||||
$scope.hideForWP = false;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
|
|
@ -88,6 +113,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
|||
preconditions.checkState($scope.userOrEmail);
|
||||
|
||||
$scope.error = null;
|
||||
$scope.hideForWP = false;
|
||||
$scope.createStep = 'pass';
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
|
|
@ -142,6 +168,8 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
|||
password: password,
|
||||
};
|
||||
$scope.askForPin = 1;
|
||||
$scope.hideForWP = 0;
|
||||
|
||||
$rootScope.hideNavigation = true;
|
||||
$timeout(function() {
|
||||
$rootScope.$digest();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $timeout, $window, go, notification, identityService, Compatibility, pinService, applicationService, isMobile) {
|
||||
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $timeout, $window, go, notification, identityService, Compatibility, pinService, applicationService, isMobile, isCordova) {
|
||||
|
||||
var _credentials, _firstpin;
|
||||
$scope.init = function() {
|
||||
$scope.isMobile = isMobile.any();
|
||||
$scope.isWindowsPhoneApp = isMobile.Windows() && isCordova;
|
||||
$scope.hideForWP = 0;
|
||||
$scope.attempt = 0;
|
||||
|
||||
// This is only for backwards compat, insight api should link to #!/confirmed directly
|
||||
|
|
@ -30,6 +32,16 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
|||
$scope.usingLocalStorage = config.plugins.EncryptedLocalStorage;
|
||||
};
|
||||
|
||||
|
||||
$scope.formFocus = function() {
|
||||
if ($scope.isWindowsPhoneApp) {
|
||||
$scope.hideForWP = true;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
}
|
||||
};
|
||||
|
||||
pinService.makePinInput($scope, 'pin', function(newValue) {
|
||||
$scope.openWithPin(newValue);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ angular.module('copayApp.controllers').controller('ImportController',
|
|||
$scope.isSafari = isMobile.Safari();
|
||||
$scope.isCordova = isCordova;
|
||||
$scope.importOpts = {};
|
||||
$rootScope.hideWalletNavigation = true;
|
||||
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
$scope.$on('$destroy', function() {
|
||||
|
|
@ -96,4 +98,10 @@ angular.module('copayApp.controllers').controller('ImportController',
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$scope.$on("$destroy", function () {
|
||||
$rootScope.hideWalletNavigation = false;
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ angular.module('copayApp.controllers').controller('JoinController',
|
|||
$scope.loading = false;
|
||||
$scope.isMobile = isMobile.any();
|
||||
$rootScope.title = 'Join shared wallet';
|
||||
$rootScope.hideWalletNavigation = true;
|
||||
|
||||
|
||||
// QR code Scanner
|
||||
var cameraInput;
|
||||
|
|
@ -150,4 +152,9 @@ angular.module('copayApp.controllers').controller('JoinController',
|
|||
$timeout(function () { $scope.$digest(); }, 1);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$scope.$on("$destroy", function () {
|
||||
$rootScope.hideWalletNavigation = false;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ var bitcore = require('bitcore');
|
|||
var preconditions = require('preconditions').singleton();
|
||||
|
||||
angular.module('copayApp.controllers').controller('SendController',
|
||||
function($scope, $rootScope, $window, $timeout, $modal, $filter, notification, isMobile, rateService, txStatus) {
|
||||
function($scope, $rootScope, $window, $timeout, $modal, $filter, notification, isMobile, rateService, txStatus, isCordova) {
|
||||
|
||||
var satToUnit;
|
||||
|
||||
|
|
@ -13,9 +13,13 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
|
||||
preconditions.checkState(w.settings.unitToSatoshi);
|
||||
|
||||
$scope.isMobile = isMobile.any();
|
||||
$scope.isWindowsPhoneApp = isMobile.Windows() && isCordova;
|
||||
$rootScope.wpInputFocused = false;
|
||||
|
||||
$scope.isShared = w.isShared();
|
||||
$scope.requiresMultipleSignatures = w.requiresMultipleSignatures();
|
||||
$rootScope.title =$scope.requiresMultipleSignatures ? 'Send Proposal' : 'Send';
|
||||
$rootScope.title = $scope.requiresMultipleSignatures ? 'Send Proposal' : 'Send';
|
||||
$scope.loading = false;
|
||||
$scope.error = $scope.success = null;
|
||||
|
||||
|
|
@ -44,7 +48,30 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
$scope.isRateAvailable = true;
|
||||
$scope.$digest();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.formFocus = function(what) {
|
||||
if (!$scope.isWindowsPhoneApp) return
|
||||
|
||||
if (!what) {
|
||||
$rootScope.wpInputFocused = false;
|
||||
$scope.hideAddress = false;
|
||||
$scope.hideAmount = false;
|
||||
|
||||
} else {
|
||||
$rootScope.wpInputFocused = true;
|
||||
if (what == 'amount') {
|
||||
$scope.hideAddress = true;
|
||||
} else if (what == 'msg') {
|
||||
$scope.hideAddress = true;
|
||||
$scope.hideAmount = true;
|
||||
}
|
||||
|
||||
}
|
||||
$timeout(function() {
|
||||
$rootScope.$digest();
|
||||
}, 1);
|
||||
};
|
||||
|
||||
$scope.setInputs = function() {
|
||||
var w = $rootScope.wallet;
|
||||
|
|
@ -148,26 +175,36 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
}
|
||||
|
||||
$scope.loading = true;
|
||||
var comment = form.comment.$modelValue;
|
||||
var merchantData = $scope._merchantData;
|
||||
var address, amount;
|
||||
if (!merchantData) {
|
||||
address = form.address.$modelValue;
|
||||
amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0));
|
||||
}
|
||||
$scope.creatingTX = true;
|
||||
if ($scope.isWindowsPhoneApp)
|
||||
$rootScope.wpInputFocused = true;
|
||||
|
||||
w.spend({
|
||||
merchantData: merchantData,
|
||||
toAddress: address,
|
||||
amountSat: amount,
|
||||
comment: comment,
|
||||
}, function(err, txid, status) {
|
||||
$scope.loading = false;
|
||||
if (err)
|
||||
return $scope.setError(err);
|
||||
txStatus.notify(status);
|
||||
$scope.resetForm();
|
||||
});
|
||||
$timeout(function () {
|
||||
var comment = form.comment.$modelValue;
|
||||
var merchantData = $scope._merchantData;
|
||||
var address, amount;
|
||||
if (!merchantData) {
|
||||
address = form.address.$modelValue;
|
||||
amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0));
|
||||
}
|
||||
|
||||
w.spend({
|
||||
merchantData: merchantData,
|
||||
toAddress: address,
|
||||
amountSat: amount,
|
||||
comment: comment,
|
||||
}, function (err, txid, status) {
|
||||
$scope.loading = false;
|
||||
$scope.creatingTX = false;
|
||||
if ($scope.isWindowsPhoneApp)
|
||||
$rootScope.wpInputFocused = false;
|
||||
|
||||
if (err)
|
||||
return $scope.setError(err);
|
||||
txStatus.notify(status);
|
||||
$scope.resetForm();
|
||||
});
|
||||
}, 1);
|
||||
};
|
||||
|
||||
// QR code Scanner
|
||||
|
|
@ -291,7 +328,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
window.ignoreMobilePause = true;
|
||||
cordova.plugins.barcodeScanner.scan(
|
||||
function onSuccess(result) {
|
||||
$timeout(function(){
|
||||
$timeout(function() {
|
||||
window.ignoreMobilePause = false;
|
||||
}, 100);
|
||||
if (result.cancelled) return;
|
||||
|
|
@ -305,7 +342,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
}, 1000);
|
||||
},
|
||||
function onError(error) {
|
||||
$timeout(function(){
|
||||
$timeout(function() {
|
||||
window.ignoreMobilePause = false;
|
||||
}, 100);
|
||||
alert('Scanning error');
|
||||
|
|
|
|||
12
js/init.js
12
js/init.js
|
|
@ -1,9 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.element(document).ready(function() {
|
||||
var startAngular = function() {
|
||||
angular.bootstrap(document, ['copayApp']);
|
||||
};
|
||||
|
||||
// this is now in HTML tab, witch is compatible with Windows Phone
|
||||
// var startAngular = function() {
|
||||
// angular.bootstrap(document, ['copayApp']);
|
||||
// };
|
||||
/* Cordova specific Init */
|
||||
if (window.cordova !== undefined) {
|
||||
|
||||
|
|
@ -28,10 +30,10 @@ angular.element(document).ready(function() {
|
|||
window.plugins.webintent.onNewIntent(handleBitcoinURI);
|
||||
window.handleOpenURL = handleBitcoinURI;
|
||||
|
||||
startAngular();
|
||||
// startAngular();
|
||||
}, false);
|
||||
} else {
|
||||
startAngular();
|
||||
// startAngular();
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue