Update translation. Removed old files

This commit is contained in:
Gustavo Maximiliano Cortez 2015-04-22 15:19:08 -03:00
commit 93e61b66df
29 changed files with 358 additions and 703 deletions

View file

@ -6,24 +6,21 @@ angular.module('copayApp.controllers').controller('createProfileController', fun
if (profileService.profile)
go.walletHome();
var pin='';
// $rootScope.$on('pin', function(event, pin) {
self.creatingProfile = true;
self.creatingProfile = true;
$timeout(function() {
profileService.create(pin, function(err) {
if (err) {
self.creatingProfile = false;
$log.warn(err);
self.error = err;
$scope.$apply();
$timeout(function() {
go.reload();
}, 3000);
} else {
go.walletHome();
}
});
}, 100);
// });
$timeout(function() {
profileService.create(function(err) {
if (err) {
self.creatingProfile = false;
$log.warn(err);
self.error = err;
$scope.$apply();
$timeout(function() {
go.reload();
}, 3000);
} else {
go.walletHome();
}
});
}, 100);
});

View file

@ -28,6 +28,23 @@ angular.module('copayApp.controllers').controller('indexController', function($r
'link': 'history'
}];
self.availableLanguages = [{
name: 'English',
isoCode: 'en',
}, {
name: 'Spanish',
isoCode: 'es',
}, {
name: 'Français',
isoCode: 'fr',
}, {
name: '日本人',
isoCode: 'ja',
}];
self.defaultLanguage = configService.getSync().wallet.settings.defaultLanguage || 'en';
self.defaultLanguageName = lodash.result(lodash.find(this.availableLanguages, { 'isoCode': self.defaultLanguage }), 'name');
self.setOngoingProcess = function(processName, isOn) {
$log.debug('onGoingProcess', processName, isOn);
self[processName] = isOn;
@ -419,7 +436,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
};
// UX event handlers
$rootScope.$on('Local/ColorUpdated', function(event) {
self.updateColor();

View file

@ -1,73 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('pinController', function($scope, $timeout) {
this.init = function(confirmPin, testPin) {
this._firstpin = null;
this.askForPin = 1;
this.confirmPin = confirmPin;
this.clear();
if (testPin) {
console.log('WARN: using test pin:', testPin);
$timeout(function() {
$scope.$emit('pin', testPin);
}, 100);
}
};
this.clear = function() {
this.digits = [];
this.defined = [];
};
this.press = function(digit) {
var self = this;
$timeout(function() {
self._press(digit);
}, 1);
};
this._press = function(digit) {
var self = this;
this.error = null;
this.digits.push(digit);
this.defined.push(true);
if (this.digits.length == 4) {
var pin = this.digits.join('');
if (this.confirmPin) {
if (!this._firstpin) {
this._firstpin = pin;
this.askForPin = 2;
$timeout(function() {
self.clear();
}, 100);
return;
} else {
if (pin === this._firstpin) {
$scope.$emit('pin', pin);
return;
} else {
this._firstpin = null;
this.askForPin = 1;
$timeout(function() {
self.clear();
self.error = 'Entered PINs were not equal. Try again';
var _self = self;
$timeout(function() {
_self.error = null;
}, 2000);
}, 100);
return;
}
}
} else {
$scope.$emit('pin', pin);
}
}
};
this.skip = function() {
$scope.$emit('pin', null);
};
});

View file

@ -0,0 +1,23 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesLanguageController',
function($scope, $timeout, configService, applicationService) {
this.save = function(newLang) {
var opts = {
wallet: {
settings: {
defaultLanguage: newLang
}
}
};
this.loading = true;
$timeout(function() {
configService.set(opts, function(err) {
if (err) console.log(err);
applicationService.restart();
});
}, 100);
};
});

View file

@ -59,31 +59,5 @@ angular.module('copayApp.controllers').controller('receiveController',
}
};
this.openAddressModal = function(address) {
var self = this;
var ModalInstanceCtrl = function($scope, $modalInstance, address) {
$scope.address = address;
$scope.isCordova = self.isCordova;
$scope.copyAddress = function(addr) {
self.copyAddress(addr);
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
};
$modal.open({
templateUrl: 'views/modals/qr-address.html',
windowClass: 'full',
controller: ModalInstanceCtrl,
resolve: {
address: function() {
return address;
}
}
});
};
}
);

View file

@ -430,90 +430,4 @@ angular.module('copayApp.controllers').controller('sendController',
return value;
}
};
this.openAddressBook = function() {
var w = $rootScope.wallet;
var modalInstance = $modal.open({
templateUrl: 'views/modals/address-book.html',
windowClass: 'full',
controller: function($scope, $modalInstance) {
$scope.showForm = null;
$scope.addressBook = w.addressBook;
$scope.hasEntry = function() {
return _.keys($scope.addressBook).length > 0 ? true : false;
};
$scope.toggleAddressBookEntry = function(key) {
w.toggleAddressBookEntry(key);
};
$scope.copyToSend = function(addr) {
$modalInstance.close(addr);
};
$scope.cancel = function(form) {
$scope.error = $scope.success = $scope.newaddress = $scope.newlabel = null;
clearForm(form);
$scope.toggleForm();
};
$scope.toggleForm = function() {
$scope.showForm = !$scope.showForm;
};
var clearForm = function(form) {
form.newaddress.$pristine = true;
form.newaddress.$setViewValue('');
form.newaddress.$render();
form.newlabel.$pristine = true;
form.newlabel.$setViewValue('');
form.newlabel.$render();
form.$setPristine();
};
// TODO change to modal
$scope.submitAddressBook = function(form) {
if (form.$invalid) {
return;
}
$scope.blockUx = true;
$timeout(function() {
var errorMsg;
var entry = {
"address": form.newaddress.$modelValue,
"label": form.newlabel.$modelValue
};
try {
w.setAddressBook(entry.address, entry.label);
} catch (e) {
$log.warn(e);
errorMsg = e.message;
}
if (errorMsg) {
$scope.error = errorMsg;
} else {
clearForm(form);
$scope.toggleForm();
notification.success('Entry created', 'New addressbook entry created')
}
$scope.blockUx = false;
$rootScope.$digest();
}, 100);
return;
};
$scope.close = function() {
$modalInstance.dismiss('cancel');
};
},
});
modalInstance.result.then(function(addr) {
$scope.setForm(addr);
});
};
});

View file

@ -254,6 +254,23 @@ angular
}
}
})
.state('preferencesLanguage', {
url: '/preferencesLanguage',
walletShouldBeComplete: true,
needProfile: true,
views: {
'main': {
templateUrl: 'views/preferencesLanguage.html'
},
'topbar': {
templateUrl: 'views/includes/topbar.html',
controller: function($scope) {
$scope.titleSection = 'Language';
$scope.goBackToState = 'preferences';
}
}
}
})
.state('preferencesUnit', {
url: '/preferencesUnit',
templateUrl: 'views/preferencesUnit.html',
@ -415,22 +432,32 @@ angular
needProfile: false
});
})
.run(function($rootScope, $state, $log, gettextCatalog, uriHandler, isCordova, amMoment, profileService) {
.run(function($rootScope, $state, $log, gettextCatalog, uriHandler, isCordova, amMoment, profileService, configService) {
// Auto-detect browser language
// (default: English)
var userLang, androidLang;
if (navigator && navigator.userAgent && (androidLang = navigator.userAgent.match(/android.*\W(\w\w)-(\w\w)\W/i))) {
userLang = androidLang[1];
} else {
// works for iOS and Android 4.x
userLang = navigator.userLanguage || navigator.language;
var userLang = configService.getSync().wallet.settings.defaultLanguage;
if (!userLang) {
// Auto-detect browser language
var androidLang;
if (navigator && navigator.userAgent && (androidLang = navigator.userAgent.match(/android.*\W(\w\w)-(\w\w)\W/i))) {
userLang = androidLang[1];
} else {
// works for iOS and Android 4.x
userLang = navigator.userLanguage || navigator.language;
}
userLang = userLang ? (userLang.split('-', 1)[0] || 'en') : 'en';
}
userLang = userLang ? (userLang.split('-', 1)[0] || 'en') : 'en';
gettextCatalog.setCurrentLanguage(userLang);
amMoment.changeLocale(userLang);
configService.set({
wallet: {
settings: {
defaultLanguage: userLang
}
}
}, function() {
gettextCatalog.setCurrentLanguage(userLang);
amMoment.changeLocale(userLang);
});
// Register URI handler, not for mobileApp
if (!isCordova) {
@ -446,6 +473,7 @@ angular
preferencesColor: 12,
backup: 12,
delete: 12,
preferencesLanguage: 12,
preferencesUnit: 12,
preferencesAltCurrency: 12,
preferencesBwsUrl: 12,

View file

@ -58,8 +58,6 @@ angular.module('copayApp.services').factory('configService', function(localStora
var configCache = null;
root.getSync = function() {
if (!configCache)
throw new Error('configService#getSync called when cache is not initialized');

View file

@ -136,7 +136,7 @@ angular.module('copayApp.services')
});
};
root._createNewProfile = function(pin, cb) {
root._createNewProfile = function(cb) {
var walletClient = bwcService.getClient();
walletClient.createWallet('Personal Wallet', 'me', 1, 1, {
@ -260,8 +260,8 @@ angular.module('copayApp.services')
root.create = function(pin, cb) {
root._createNewProfile(pin, function(err, p) {
root.create = function(cb) {
root._createNewProfile(function(err, p) {
if (err) return cb(err);
root.bindProfile(p, function(err) {
storageService.storeNewProfile(p, function(err) {