Merge branch 'wallet/sprint/20' into wallet/task/426

This commit is contained in:
Sebastiaan Pasma 2018-07-17 13:41:09 +02:00
commit 6463d5df34
No known key found for this signature in database
GPG key ID: 9A2B0C8B95A1D26F
43 changed files with 789 additions and 999 deletions

View file

@ -1,12 +1,13 @@
'use strict';
angular.module('copayApp.services').factory('bitcoincomService', function($http, $log, lodash, moment, storageService, configService, platformInfo, nextStepsService, homeIntegrationsService) {
angular.module('copayApp.services').factory('bitcoincomService', function(platformInfo, nextStepsService) {
var root = {};
var credentials = {};
/*
* Development: 'testnet'
* Production: 'livenet'
*/
*/
var os = platformInfo.isAndroid ? 'android' : platformInfo.isIOS ? 'ios' : 'desktop';
credentials.NETWORK = 'livenet';
//credentials.NETWORK = 'testnet';
@ -20,28 +21,28 @@ angular.module('copayApp.services').factory('bitcoincomService', function($http,
name: 'games',
title: 'Bitcoin Cash Games',
icon: 'icon-games',
href: 'http://cashgames.bitcoin.com'
href: 'https://cashgames.bitcoin.com'
};
var newsItem = {
name: 'news',
title: 'News',
icon: 'icon-news',
href: 'http://news.bitcoin.com'
href: 'https://news.bitcoin.com/?utm_source=WalletApp&utm_medium=' + os + '&utm_campaign=News'
};
var poolItem = {
name: 'pool',
title: 'Mining Pool',
icon: 'icon-mining',
href: 'http://pool.bitcoin.com'
href: 'https://pool.bitcoin.com/?utm_source=WalletApp&utm_medium=' + os + '&utm_campaign=Pool'
};
var toolsItem = {
name: 'tools',
title: 'Tools',
icon: 'icon-tools',
href: 'http://tools.bitcoin.com'
href: 'https://tools.bitcoin.com/?utm_source=WalletApp&utm_medium=' + os + '&utm_campaign=Tools'
};
var priceChartItem = {
@ -55,7 +56,7 @@ angular.module('copayApp.services').factory('bitcoincomService', function($http,
name: 'faucet',
title: 'Free Bitcoin Cash',
icon: 'icon-faucet',
href: 'https://free.bitcoin.com/'
href: 'https://free.bitcoin.com/?utm_source=WalletApp&utm_medium=' + os + '&utm_campaign=Faucet'
};
var _getBitPay = function(endpoint) {

View file

@ -22,7 +22,27 @@ angular.module('copayApp.services').factory('clipboardService', function ($http,
// Not supported
return;
}
};
root.readFromClipboard = function (cb) {
$log.debug("Read from clipboard");
if (platformInfo.isCordova) {
cordova.plugins.clipboard.paste(function(text) {
cb(text);
})
} else if (platformInfo.isNW) {
cb(nodeWebkitService.readFromClipboard());
} else {
navigator.clipboard.readText()
.then(function (text) {
cb(text);
})
.catch(function (err) {
$log.debug("Clipboard reading is not supported in browser..");
});
return;
}
};
return root;

View file

@ -1,59 +0,0 @@
'use strict';
angular.module('copayApp.services').factory('feedbackService', function($http, $log, $httpParamSerializer, configService) {
var root = {};
// var URL = "https://script.google.com/macros/s/1pWGRxVSUX9CxPqNAKZTppWHtDvyVtZv9HteY_TRQbWc/exec";
var URL = "https://wallet-data.bitcoin.com/feedback.php";
root.send = function(dataSrc, cb) {
$http(_post(dataSrc)).then(function() {
$log.info("SUCCESS: Feedback sent");
return cb();
}, function(err) {
$log.info("ERROR: Feedback sent anyway.");
return cb(err);
});
};
var _post = function(dataSrc) {
return {
method: 'POST',
url: URL,
headers: {
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
},
data: $httpParamSerializer(dataSrc)
};
};
root.isVersionUpdated = function(currentVersion, savedVersion) {
if (!verifyTagFormat(currentVersion))
return 'Cannot verify the format of version tag: ' + currentVersion;
if (!verifyTagFormat(savedVersion))
return 'Cannot verify the format of the saved version tag: ' + savedVersion;
var current = formatTagNumber(currentVersion);
var saved = formatTagNumber(savedVersion);
if (saved.major > current.major || (saved.major == current.major && saved.minor > current.minor))
return false;
return true;
function verifyTagFormat(tag) {
var regex = /^v?\d+\.\d+\.\d+$/i;
return regex.exec(tag);
};
function formatTagNumber(tag) {
var formattedNumber = tag.replace(/^v/i, '').split('.');
return {
major: +formattedNumber[0],
minor: +formattedNumber[1],
patch: +formattedNumber[2]
};
};
};
return root;
});

View file

@ -228,10 +228,12 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
} else if (/^https?:\/\//.test(data)) {
payproService.getPayProDetails(data, coin, function(err, details) {
if (err) {
root.showMenu({
data: data,
type: 'url'
});
if ($state.includes('tabs.scan')) {
root.showMenu({
data: data,
type: 'url'
});
}
return;
}
handlePayPro(details);

View file

@ -217,14 +217,6 @@ angular.module('copayApp.services')
});
};
root.setFeedbackInfo = function(feedbackValues, cb) {
storage.set('feedback', feedbackValues, cb);
};
root.getFeedbackInfo = function(cb) {
storage.get('feedback', cb);
};
root.storeFocusedWalletId = function(id, cb) {
storage.set('focusedWalletId', id || '', cb);
};