Removes unnecessary files

This commit is contained in:
Gustavo Maximiliano Cortez 2015-04-20 18:44:34 -03:00
commit cc8521d51e
16 changed files with 0 additions and 914 deletions

View file

@ -1,6 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('EmailConfirmationController', function($scope, $rootScope, $location) {
$rootScope.fromEmailConfirmation = true;
$location.path('/');
});

View file

@ -1,81 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('importProfileController',
function($scope, $rootScope, $timeout, notification, isMobile, isCordova, identityService) {
this.importStatus = 'Importing profile - Reading backup...';
this.hideAdv = true;
this.isSafari = isMobile.Safari();
this.isCordova = isCordova;
window.ignoreMobilePause = true;
$scope.$on('$destroy', function() {
$timeout(function(){
window.ignoreMobilePause = false;
}, 100);
});
var reader = new FileReader();
var updateStatus = function(status) {
this.importStatus = status;
}
var _importBackup = function(str) {
var password = this.password;
updateStatus('Importing profile - Setting things up...');
identityService.importProfile(str,password, function(err, iden) {
if (err) {
$rootScope.starting = false;
copay.logger.warn(err);
if ((err.toString() || '').match('BADSTR')) {
this.error = 'Bad password or corrupt profile file';
} else if ((err.toString() || '').match('EEXISTS')) {
this.error = 'Profile already exists';
} else {
this.error = 'Unknown error';
}
$timeout(function() {
$rootScope.$digest();
}, 1);
}
});
};
this.getFile = function() {
// If we use onloadend, we need to check the readyState.
reader.onloadend = function(evt) {
if (evt.target.readyState == FileReader.DONE) { // DONE == 2
var encryptedObj = evt.target.result;
_importBackup(encryptedObj);
}
};
};
this.import = function(form) {
if (form.$invalid) {
this.error = 'Please enter the required fields';
return;
}
var backupFile = this.file;
var backupText = form.backupText.$modelValue;
var password = form.password.$modelValue;
if (!backupFile && !backupText) {
this.error = 'Please, select your backup file';
return;
}
$rootScope.starting = true;
$timeout(function() {
if (backupFile) {
reader.readAsBinaryString(backupFile);
} else {
_importBackup(backupText);
}
}, 100);
};
});

View file

@ -1,68 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, $filter, $timeout, backupService, identityService, isMobile, isCordova, notification) {
$scope.username = $rootScope.iden.getName();
$scope.isSafari = isMobile.Safari();
$scope.isCordova = isCordova;
$rootScope.title = 'Profile';
$scope.hideAdv = true;
$scope.downloadProfileBackup = function() {
backupService.profileDownload($rootScope.iden);
};
$scope.viewProfileBackup = function() {
$scope.loading = true;
$timeout(function() {
$scope.backupProfilePlainText = backupService.profileEncrypted($rootScope.iden);
}, 100);
};
$scope.copyProfileBackup = function() {
var ep = backupService.profileEncrypted($rootScope.iden);
window.cordova.plugins.clipboard.copy(ep);
window.plugins.toast.showShortCenter('Copied to clipboard');
};
$scope.sendProfileBackup = function() {
if (isMobile.Android() || isMobile.Windows()) {
window.ignoreMobilePause = true;
}
window.plugins.toast.showShortCenter('Preparing backup...');
var name = $rootScope.iden.fullName;
var ep = backupService.profileEncrypted($rootScope.iden);
var properties = {
subject: 'Copay Profile Backup: ' + name,
body: 'Here is the encrypted backup of the profile ' + name + ': \n\n' + ep + '\n\n To import this backup, copy all text between {...}, including the symbols {}',
isHtml: false
};
window.plugin.email.open(properties);
};
$scope.init = function() {
if ($rootScope.quotaPerItem) {
$scope.perItem = $filter('noFractionNumber')($rootScope.quotaPerItem / 1000, 1);
$scope.nrWallets = parseInt($rootScope.quotaItems) - 1;
}
// no need to add event handlers here. Wallet deletion is handle by callback.
};
$scope.deleteProfile = function() {
$scope.loading = true;
identityService.deleteProfile(function(err, res) {
$scope.loading = false;
if (err) {
log.warn(err);
notification.error('Error', 'Could not delete profile');
$timeout(function() {
$scope.$digest();
});
} else {
$location.path('/');
$timeout(function() {
notification.success('Success', 'Profile successfully deleted');
});
}
});
};
});

View file

@ -1,26 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('settingsController', function(configService, applicationService) {
var config;
this.init = function() {
config = configService.get();
this.bws = config.bws.url;
};
this.save = function() {
if (!this.bws) return;
config.bws.url = this.bws;
var res = configService.set(config);
if (res) {
applicationService.restart();
}
};
this.reset = function() {
if (configService.reset()) {
applicationService.restart();
}
};
});

View file

@ -1,5 +0,0 @@
angular.module('copayApp.controllers').controller('signOutController', function(identityService) {
identityService.signout();
});

View file

@ -1,174 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('signinController',
function($rootScope, $timeout, $window, go, notification, profileService, pinService, applicationService, isMobile, isCordova, localStorageService) {
var KEY = 'CopayDisclaimer';
var _credentials;
this.init = function() {
this.isMobile = isMobile.any();
this.isWindowsPhoneApp = isMobile.Windows() && isCordova;
this.hideForWP = 0;
this.attempt = 0;
this.digits = [];
this.defined = [];
this.askForPin = 0;
// This is only for backwards compat, insight api should link to #!/confirmed directly
if (getParam('confirmed')) {
var hashIndex = window.location.href.indexOf('/?');
window.location = window.location.href.substr(0, hashIndex) + '#!/confirmed';
return;
}
if ($rootScope.fromEmailConfirmation) {
this.confirmedEmail = true;
$rootScope.fromEmailConfirmation = false;
}
if ($rootScope.wallet) {
go.walletHome();
}
};
this.clear = function() {
pinService.clearPin(this);
};
this.press = function(digit) {
pinService.pressPin(this, digit);
};
this.skip = function() {
pinService.skipPin(this);
};
this.agreeDisclaimer = function() {
if (localStorageService.set(KEY, true)) {
this.showDisclaimer = null;
}
};
this.formFocus = function() {
if (this.isWindowsPhoneApp) {
this.hideForWP = true;
$timeout(function() {
this.$digest();
}, 1);
}
};
this.openWithPin = function(pin) {
if (!pin) {
this.error = 'Please enter the required fields';
return;
}
$rootScope.starting = true;
$timeout(function() {
var credentials = pinService.get(pin, function(err, credentials) {
if (err || !credentials) {
$rootScope.starting = null;
this.error = 'Wrong PIN';
this.clear();
$timeout(function() {
this.error = null;
}, 2000);
return;
}
this.open(credentials.email, credentials.password);
});
}, 100);
};
this.openWallets = function() {
var iden = $rootScope.iden;
$rootScope.hideNavigation = false;
$rootScope.starting = true;
iden.openWallets();
};
this.createPin = function(pin) {
preconditions.checkArgument(pin);
preconditions.checkState($rootScope.iden);
preconditions.checkState(_credentials && _credentials.email);
$rootScope.starting = true;
$timeout(function() {
pinService.save(pin, _credentials.email, _credentials.password, function(err) {
_credentials.password = '';
_credentials = null;
this.askForPin = 0;
$rootScope.hasPin = true;
$rootScope.starting = null;
this.openWallets();
});
}, 100);
};
this.openWithCredentials = function(form) {
if (form && form.$invalid) {
this.error = 'Please enter the required fields';
return;
}
this.open(form.email.$modelValue, form.password.$modelValue);
};
this.pinLogout = function() {
pinService.clear(function() {
copay.logger.debug('PIN erased');
delete $rootScope['hasPin'];
applicationService.restart();
});
};
this.open = function(username, password) {
$rootScope.starting = true;
profileService.open(username, password, function(err) {
if (err) {
$rootScope.starting = false;
$rootScope.hasPin = false;
pinService.clear(function() {});
this.error = 'Unknown error';
return;
}
// mobile
if (this.isMobile && !$rootScope.hasPin) {
_credentials = {
email: email,
password: password,
};
this.askForPin = 1;
$rootScope.starting = false;
$rootScope.hideNavigation = true;
$timeout(function() {
$rootScope.$digest();
}, 1);
}
// no mobile
else {
// this.openWallets();
}
});
};
function getParam(sname) {
var params = location.search.substr(location.search.indexOf("?") + 1);
var sval = "";
params = params.split("&");
// split param and value into individual pieces
for (var i = 0; i < params.length; i++) {
var temp = params[i].split("=");
if ([temp[0]] == sname) {
sval = temp[1];
}
}
return sval;
}
});

View file

@ -1,7 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('unsupportedController', function($state) {
if (localStorage && localStorage.length > 0) {
$state.go('signin');
}
});

View file

@ -1,47 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('walletForPaymentController', function($rootScope, $scope, $modal, identityService, go) {
// INIT: (not it a function, since there is no associated html)
var ModalInstanceCtrl = function($scope, $modalInstance, identityService) {
$scope.loading = true;
preconditions.checkState($rootScope.iden);
var iden = $rootScope.iden;
iden.on('newWallet', function() {
$scope.setWallets();
});
$scope.setWallets = function() {
$scope.wallets = $rootScope.iden.getWallets();
};
$scope.ok = function(w) {
$modalInstance.close(w);
};
$scope.cancel = function() {
$rootScope.pendingPayment = null;
$modalInstance.close();
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/walletSelection.html',
windowClass: 'full',
controller: ModalInstanceCtrl,
});
modalInstance.result.then(function(w) {
if (w) {
identityService.setFocusedWallet(w);
$rootScope.walletForPaymentSet = true;
} else {
$rootScope.pendingPayment = null;
}
go.walletHome();
}, function() {
$rootScope.pendingPayment = null;
go.walletHome();
});
});

View file

@ -1,27 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('WarningController', function($scope, $rootScope, $location, identityService) {
$scope.checkLock = function() {
if (!$rootScope.tmp || !$rootScope.tmp.getLock()) {
console.log('[warning.js.7] TODO LOCK'); //TODO
}
};
$scope.signout = function() {
identityService.signout();
};
$scope.ignoreLock = function() {
var w = $rootScope.tmp;
delete $rootScope['tmp'];
if (!w) {
$location.path('/');
} else {
w.ignoreLock = 1;
$scope.loading = true;
//controllerUtils.startNetwork(w, $scope);
// TODO
}
};
});