diff --git a/app-template/bitcoincom/appConfig.json b/app-template/bitcoincom/appConfig.json index ae3f0d22f..65331365d 100644 --- a/app-template/bitcoincom/appConfig.json +++ b/app-template/bitcoincom/appConfig.json @@ -28,6 +28,7 @@ "_enabledExtensions": { "coinbase": false, "glidera": false, - "amazon": false + "amazon": false, + "bitcoincom": true, } } diff --git a/src/js/controllers/bitcoincom.js b/src/js/controllers/bitcoincom.js new file mode 100644 index 000000000..f94bf57a3 --- /dev/null +++ b/src/js/controllers/bitcoincom.js @@ -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; + }); + }); diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index b2667b2b7..9a32b3ee0 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -1,7 +1,7 @@ 'use strict'; 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 listeners = []; var notifications = []; diff --git a/src/js/routes.js b/src/js/routes.js index 52a9ade41..6e88e4a4e 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1014,6 +1014,18 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr 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 diff --git a/src/js/services/amazonService.js b/src/js/services/amazonService.js index c0dee597e..ec70c7a00 100644 --- a/src/js/services/amazonService.js +++ b/src/js/services/amazonService.js @@ -159,9 +159,9 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo var register = function() { storageService.getAmazonGiftCards(root.getNetwork(), function(err, giftCards) { if (giftCards) { - homeIntegrationsService.register(homeItem); + // homeIntegrationsService.register(homeItem); } else { - nextStepsService.register(nextStepItem); + // nextStepsService.register(nextStepItem); } }); }; diff --git a/src/js/services/bitcoincomService.js b/src/js/services/bitcoincomService.js new file mode 100644 index 000000000..e47b5fcfb --- /dev/null +++ b/src/js/services/bitcoincomService.js @@ -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; +}); diff --git a/src/js/services/buyAndSellService.js b/src/js/services/buyAndSellService.js index bffbb7252..d5003024c 100644 --- a/src/js/services/buyAndSellService.js +++ b/src/js/services/buyAndSellService.js @@ -23,9 +23,9 @@ angular.module('copayApp.services').factory('buyAndSellService', function($log, if (linkedServices.length == 0) { nextStepsService.register({ - title: 'Buy or Sell Bitcoin', + title: 'Buy Bitcoin', name: 'buyandsell', - icon: 'icon-buy-bitcoin', + icon: 'icon-buy-bitcoin2', sref: 'tabs.buyandsell', }); } else {