Added proper services for the Bitcoin.com stuff
This commit is contained in:
parent
4d628fd450
commit
c7bbaf7cce
7 changed files with 100 additions and 6 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
"_enabledExtensions": {
|
"_enabledExtensions": {
|
||||||
"coinbase": false,
|
"coinbase": false,
|
||||||
"glidera": false,
|
"glidera": false,
|
||||||
"amazon": false
|
"amazon": false,
|
||||||
|
"bitcoincom": true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
17
src/js/controllers/bitcoincom.js
Normal file
17
src/js/controllers/bitcoincom.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('bitcoincomController',
|
||||||
|
function($scope, $timeout, $ionicModal, $log, $state, $ionicHistory, lodash, bitcoincomService, externalLinkService, popupService) {
|
||||||
|
|
||||||
|
$scope.openExternalLink = function(url) {
|
||||||
|
externalLinkService.open(url);
|
||||||
|
};
|
||||||
|
|
||||||
|
var initBitcoincom = function() {
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
|
$scope.network = bitcoincomController.getNetwork();
|
||||||
|
initBitcoincom;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('tabHomeController',
|
angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $window, gettextCatalog, lodash, popupService, ongoingProcess, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, appConfigService, startupService, addressbookService, feedbackService, bwcError, nextStepsService, buyAndSellService, homeIntegrationsService, bitpayCardService, pushNotificationsService, timeService) {
|
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $window, gettextCatalog, lodash, popupService, ongoingProcess, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, appConfigService, startupService, addressbookService, feedbackService, bwcError, nextStepsService, buyAndSellService, homeIntegrationsService, bitpayCardService, pushNotificationsService, timeService, bitcoincomService) {
|
||||||
var wallet;
|
var wallet;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var notifications = [];
|
var notifications = [];
|
||||||
|
|
|
||||||
|
|
@ -1014,6 +1014,18 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
abstract: true
|
abstract: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
/* Explore Bitcoin.com */
|
||||||
|
.state('tabs.bitcoin-com', {
|
||||||
|
url: '/bitcoincom',
|
||||||
|
views: {
|
||||||
|
'tab-home@tabs': {
|
||||||
|
controller: 'bitcoincomController',
|
||||||
|
templateUrl: 'views/bitcoincom.html'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Amazon.com Gift Card
|
* Amazon.com Gift Card
|
||||||
|
|
|
||||||
|
|
@ -159,9 +159,9 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
|
||||||
var register = function() {
|
var register = function() {
|
||||||
storageService.getAmazonGiftCards(root.getNetwork(), function(err, giftCards) {
|
storageService.getAmazonGiftCards(root.getNetwork(), function(err, giftCards) {
|
||||||
if (giftCards) {
|
if (giftCards) {
|
||||||
homeIntegrationsService.register(homeItem);
|
// homeIntegrationsService.register(homeItem);
|
||||||
} else {
|
} else {
|
||||||
nextStepsService.register(nextStepItem);
|
// nextStepsService.register(nextStepItem);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
64
src/js/services/bitcoincomService.js
Normal file
64
src/js/services/bitcoincomService.js
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
'use strict';
|
||||||
|
angular.module('copayApp.services').factory('bitcoincomService', function($http, $log, lodash, moment, storageService, configService, platformInfo, nextStepsService, homeIntegrationsService) {
|
||||||
|
var root = {};
|
||||||
|
var credentials = {};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Development: 'testnet'
|
||||||
|
* Production: 'livenet'
|
||||||
|
*/
|
||||||
|
credentials.NETWORK = 'livenet';
|
||||||
|
//credentials.NETWORK = 'testnet';
|
||||||
|
|
||||||
|
if (credentials.NETWORK == 'testnet') {
|
||||||
|
credentials.BITPAY_API_URL = "https://test.bitpay.com";
|
||||||
|
} else {
|
||||||
|
credentials.BITPAY_API_URL = "https://bitpay.com";
|
||||||
|
};
|
||||||
|
|
||||||
|
var homeItem = {
|
||||||
|
name: 'bitcoincom',
|
||||||
|
title: 'Explore Bitcoin.com',
|
||||||
|
icon: 'icon-bitcoincom',
|
||||||
|
sref: 'tabs.bitcoin-com',
|
||||||
|
};
|
||||||
|
|
||||||
|
var nextStepItem = {
|
||||||
|
name: 'bitcoincom',
|
||||||
|
title: 'Explore Bitcoin.com',
|
||||||
|
icon: 'icon-bitcoincom',
|
||||||
|
sref: 'tabs.bitcoin-com',
|
||||||
|
};
|
||||||
|
|
||||||
|
var _getBitPay = function(endpoint) {
|
||||||
|
return {
|
||||||
|
method: 'GET',
|
||||||
|
url: credentials.BITPAY_API_URL + endpoint,
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var _postBitPay = function(endpoint, data) {
|
||||||
|
return {
|
||||||
|
method: 'POST',
|
||||||
|
url: credentials.BITPAY_API_URL + endpoint,
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json'
|
||||||
|
},
|
||||||
|
data: data
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
root.getNetwork = function() {
|
||||||
|
return credentials.NETWORK;
|
||||||
|
};
|
||||||
|
|
||||||
|
var register = function() {
|
||||||
|
nextStepsService.register(nextStepItem);
|
||||||
|
};
|
||||||
|
|
||||||
|
register();
|
||||||
|
return root;
|
||||||
|
});
|
||||||
|
|
@ -23,9 +23,9 @@ angular.module('copayApp.services').factory('buyAndSellService', function($log,
|
||||||
|
|
||||||
if (linkedServices.length == 0) {
|
if (linkedServices.length == 0) {
|
||||||
nextStepsService.register({
|
nextStepsService.register({
|
||||||
title: 'Buy or Sell Bitcoin',
|
title: 'Buy Bitcoin',
|
||||||
name: 'buyandsell',
|
name: 'buyandsell',
|
||||||
icon: 'icon-buy-bitcoin',
|
icon: 'icon-buy-bitcoin2',
|
||||||
sref: 'tabs.buyandsell',
|
sref: 'tabs.buyandsell',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue