Ref About
This commit is contained in:
parent
9908046766
commit
a200d42bcd
25 changed files with 208 additions and 171 deletions
|
|
@ -1,15 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amazonController',
|
||||
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, nodeWebkit, popupService) {
|
||||
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, externalLinkService, popupService) {
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
if (platformInfo.isNW) {
|
||||
nodeWebkit.openExternalLink(url);
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
}
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
this.init = function() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||
function($scope, $log, $timeout, $state, lodash, profileService, bwcError, gettextCatalog, configService, walletService, amazonService, ongoingProcess, platformInfo, nodeWebkit, popupService) {
|
||||
function($scope, $log, $timeout, $state, lodash, profileService, bwcError, gettextCatalog, configService, walletService, amazonService, ongoingProcess, platformInfo, externalLinkService, popupService) {
|
||||
|
||||
var self = this;
|
||||
var wallet;
|
||||
|
|
@ -16,12 +16,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
});
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
if (platformInfo.isNW) {
|
||||
nodeWebkit.openExternalLink(url);
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
}
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
this.init = function() {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('glideraController',
|
||||
function($scope, $timeout, $ionicModal, $log, storageService, glideraService, ongoingProcess, platformInfo, nodeWebkit, popupService, gettextCatalog) {
|
||||
function($scope, $timeout, $ionicModal, $log, storageService, glideraService, ongoingProcess, platformInfo, externalLinkService, popupService, gettextCatalog) {
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
if (platformInfo.isNW) {
|
||||
nodeWebkit.openExternalLink(url);
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
}
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
$scope.init = function(accessToken) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService, platformInfo) {
|
||||
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService, platformInfo, externalLinkService) {
|
||||
|
||||
var self = $scope.self;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
|
|
@ -81,12 +81,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
};
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
if (platformInfo.isNW) {
|
||||
nodeWebkit.openExternalLink(url);
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
}
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
$scope.getShortNetworkName = function() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, uxLanguage, profileService) {
|
||||
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, uxLanguage, profileService, externalLinkService) {
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
|
||||
$scope.confirm = function() {
|
||||
|
|
@ -12,4 +12,8 @@ angular.module('copayApp.controllers').controller('termsController', function($s
|
|||
});
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesAbout',
|
||||
function($scope, $window, $ionicNavBarDelegate, gettextCatalog) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('About Copay'));
|
||||
function($scope, $window, $ionicNavBarDelegate, gettextCatalog, externalLinkService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('About') + ' ' + $window.appConfig.nameCase);
|
||||
|
||||
$scope.version = $window.version;
|
||||
$scope.commitHash = $window.commitHash;
|
||||
$scope.name = $window.appConfig.gitHubRepoName;
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesLanguageController',
|
||||
function($scope, $log, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService) {
|
||||
function($scope, $log, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService, externalLinkService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Language'));
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.availableLanguages = uxLanguage.getLanguages();
|
||||
$scope.currentLanguage = uxLanguage.getCurrentLanguage();
|
||||
|
|
|
|||
|
|
@ -8,13 +8,19 @@ angular.module('copayApp.controllers').controller('preferencesLogs',
|
|||
$scope.logs = historicLog.get();
|
||||
}
|
||||
|
||||
$scope.sendLogs = function() {
|
||||
var body = 'Copay Session Logs\n Be careful, this could contain sensitive private data\n\n';
|
||||
body += '\n\n';
|
||||
body += $scope.logs.map(function(v) {
|
||||
$scope.prepare = function() {
|
||||
var log = 'Copay Session Logs\n Be careful, this could contain sensitive private data\n\n';
|
||||
log += '\n\n';
|
||||
log += $scope.logs.map(function(v) {
|
||||
return v.msg;
|
||||
}).join('\n');
|
||||
|
||||
return log;
|
||||
};
|
||||
|
||||
$scope.sendLogs = function() {
|
||||
var body = $scope.prepare();
|
||||
|
||||
window.plugins.socialsharing.shareViaEmail(
|
||||
body,
|
||||
'Copay Logs',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
|
||||
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $ionicModal, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
|
||||
|
||||
$scope.init = function() {
|
||||
|
||||
|
|
@ -9,6 +9,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
var isWP = platformInfo.isWP;
|
||||
var isIOS = platformInfo.isIOS;
|
||||
|
||||
$scope.appName = $window.appConfig.nameCase;
|
||||
|
||||
$scope.unitName = config.wallet.settings.unitName;
|
||||
$scope.currentLanguageName = uxLanguage.getCurrentLanguageName();
|
||||
$scope.selectedAlternative = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('termOfUseController',
|
||||
function($scope, uxLanguage, $ionicNavBarDelegate, gettextCatalog) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('About Copay'));
|
||||
function($scope, $window, uxLanguage, $ionicNavBarDelegate, gettextCatalog, externalLinkService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Terms Of Use'));
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
$scope.disclaimerUrl = $window.appConfig.disclaimerUrl;
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
8
src/js/controllers/translators.js
Normal file
8
src/js/controllers/translators.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('translatorsController',
|
||||
function($scope, externalLinkService) {
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup, txpModalService) {
|
||||
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup, txpModalService, externalLinkService) {
|
||||
|
||||
var isCordova = platformInfo.isCordova;
|
||||
var isWP = platformInfo.isWP;
|
||||
|
|
@ -12,6 +12,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
var HISTORY_SHOW_LIMIT = 10;
|
||||
$scope.txps = [];
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
var setPendingTxps = function(txps) {
|
||||
if (!txps) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.directives')
|
||||
.directive('copyToClipboard', function(platformInfo, nodeWebkit, gettextCatalog, ionicToast, clipboard) {
|
||||
.directive('copyToClipboard', function(platformInfo, nodeWebkitService, gettextCatalog, ionicToast, clipboard) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
|
|
@ -22,7 +22,7 @@ angular.module('copayApp.directives')
|
|||
window.cordova.plugins.clipboard.copy(data);
|
||||
window.plugins.toast.showShortCenter(msg);
|
||||
} else if (isNW) {
|
||||
nodeWebkit.writeToClipboard(data);
|
||||
nodeWebkitService.writeToClipboard(data);
|
||||
scope.$apply(function() {
|
||||
ionicToast.show(msg, 'bottom', false, 1000);
|
||||
});
|
||||
|
|
|
|||
14
src/js/services/externalLinkService.js
Normal file
14
src/js/services/externalLinkService.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService) {
|
||||
|
||||
this.open = function(url, target) {
|
||||
if (platformInfo.isNW) {
|
||||
nodeWebkitService.openExternalLink(url);
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('nodeWebkit', function nodeWebkitFactory() {
|
||||
var root = {};
|
||||
|
||||
var isNodeWebkit = function() {
|
||||
var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
|
||||
if(isNode) {
|
||||
try {
|
||||
return (typeof require('nw.gui') !== "undefined");
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
root.readFromClipboard = function() {
|
||||
if (!isNodeWebkit()) return;
|
||||
var gui = require('nw.gui');
|
||||
var clipboard = gui.Clipboard.get();
|
||||
return clipboard.get();
|
||||
};
|
||||
|
||||
root.writeToClipboard = function(text) {
|
||||
if (!isNodeWebkit()) return;
|
||||
var gui = require('nw.gui');
|
||||
var clipboard = gui.Clipboard.get();
|
||||
return clipboard.set(text);
|
||||
};
|
||||
|
||||
root.openExternalLink = function(url) {
|
||||
if (!isNodeWebkit()) return;
|
||||
var gui = require('nw.gui');
|
||||
return gui.Shell.openExternal(url);
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
22
src/js/services/nodeWebkitService.js
Normal file
22
src/js/services/nodeWebkitService.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').service('nodeWebkitService', function() {
|
||||
|
||||
this.readFromClipboard = function() {
|
||||
var gui = require('nw.gui');
|
||||
var clipboard = gui.Clipboard.get();
|
||||
return clipboard.get();
|
||||
};
|
||||
|
||||
this.writeToClipboard = function(text) {
|
||||
var gui = require('nw.gui');
|
||||
var clipboard = gui.Clipboard.get();
|
||||
return clipboard.set(text);
|
||||
};
|
||||
|
||||
this.openExternalLink = function(url) {
|
||||
var gui = require('nw.gui');
|
||||
return gui.Shell.openExternal(url);
|
||||
};
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue