commit
774aaec8ca
41 changed files with 314 additions and 299 deletions
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);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
@ -31,6 +31,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
|
|||
'sweepingWallet': gettext('Sweeping Wallet...'),
|
||||
'deletingWallet': gettext('Deleting Wallet...'),
|
||||
'extractingWalletInfo': gettext('Extracting Wallet Information...'),
|
||||
'gettingFeeLevels': gettext('Getting fee levels...'),
|
||||
};
|
||||
|
||||
root.clear = function() {
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ angular.module('copayApp.services')
|
|||
root.updateWalletSettings = function(wallet) {
|
||||
var defaults = configService.getDefaults();
|
||||
configService.whenAvailable(function(config){
|
||||
wallet.usingCustomBWS = config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url);
|
||||
wallet.name = config.aliasFor[wallet.id] || wallet.credentials.walletName;
|
||||
wallet.color = config.colorFor[wallet.id] || '#4A90E2';
|
||||
wallet.usingCustomBWS = config.bwsFor && config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url);
|
||||
wallet.name = (config.aliasFor && config.aliasFor[wallet.id]) || wallet.credentials.walletName;
|
||||
wallet.color = (config.colorFor && config.colorFor[wallet.id]) || '#4A90E2';
|
||||
wallet.email = config.emailFor && config.emailFor[wallet.id];
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue