added servicesService and moved shapeshift into there
This commit is contained in:
parent
38e6a87cef
commit
43556b84c4
6 changed files with 72 additions and 8 deletions
|
|
@ -1,8 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('servicesController', function($scope, $ionicScrollDelegate, $timeout) {
|
angular.module('copayApp.controllers').controller('servicesController', function($scope, $ionicScrollDelegate, $timeout, servicesService) {
|
||||||
|
|
||||||
$scope.hide = false;
|
$scope.hide = false;
|
||||||
|
$scope.services = servicesService.get();
|
||||||
|
|
||||||
$scope.toggle = function() {
|
$scope.toggle = function() {
|
||||||
$scope.hide = !$scope.hide;
|
$scope.hide = !$scope.hide;
|
||||||
|
|
|
||||||
|
|
@ -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, bitcoincomService, pricechartService, firebaseEventsService) {
|
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, pricechartService, firebaseEventsService, servicesService, shapeshiftService) {
|
||||||
var wallet;
|
var wallet;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var notifications = [];
|
var notifications = [];
|
||||||
|
|
|
||||||
39
src/js/services/servicesService.js
Normal file
39
src/js/services/servicesService.js
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
'use strict'
|
||||||
|
angular.module('copayApp.services').factory('servicesService', function(configService, $log, lodash) {
|
||||||
|
var root = {};
|
||||||
|
var services = [];
|
||||||
|
|
||||||
|
root.register = function(serviceInfo) {
|
||||||
|
$log.info('Adding Services entry:' + serviceInfo.name);
|
||||||
|
|
||||||
|
if (!lodash.find(services, function(x) {
|
||||||
|
return x.name == serviceInfo.name;
|
||||||
|
})) {
|
||||||
|
services.push(serviceInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
root.unregister = function(serviceName) {
|
||||||
|
|
||||||
|
var newS = lodash.filter(services, function(x) {
|
||||||
|
return x.name != serviceName;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Found?
|
||||||
|
if (newS.length == services.length) return;
|
||||||
|
|
||||||
|
$log.info('Removing Services entry:' + serviceName);
|
||||||
|
// This is to preserve services pointer
|
||||||
|
while (services.length)
|
||||||
|
services.pop();
|
||||||
|
|
||||||
|
while (newS.length)
|
||||||
|
services.push(newS.pop());
|
||||||
|
};
|
||||||
|
|
||||||
|
root.get = function() {
|
||||||
|
return services;
|
||||||
|
};
|
||||||
|
|
||||||
|
return root;
|
||||||
|
});
|
||||||
19
src/js/services/shapeshiftService.js
Normal file
19
src/js/services/shapeshiftService.js
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
'use strict';
|
||||||
|
angular.module('copayApp.services').factory('shapeshiftService', function($http, $log, lodash, moment, storageService, configService, platformInfo, servicesService) {
|
||||||
|
var root = {};
|
||||||
|
var credentials = {};
|
||||||
|
|
||||||
|
var servicesItem = {
|
||||||
|
name: 'shapeshift',
|
||||||
|
title: 'Shapeshift',
|
||||||
|
icon: 'icon-shapeshift',
|
||||||
|
sref: 'tabs.shapeshift',
|
||||||
|
};
|
||||||
|
|
||||||
|
var register = function() {
|
||||||
|
servicesService.register(servicesItem);
|
||||||
|
};
|
||||||
|
|
||||||
|
register();
|
||||||
|
return root;
|
||||||
|
});
|
||||||
|
|
@ -249,6 +249,11 @@ div.slide-success__background.fill-screen {
|
||||||
background-image: url('../img/chart.svg');
|
background-image: url('../img/chart.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-shapeshift {
|
||||||
|
background-color: #494949;
|
||||||
|
background-image: url('../img/shapeshifticon.png');
|
||||||
|
}
|
||||||
|
|
||||||
.tabs .tab-item .icon {
|
.tabs .tab-item .icon {
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
<div ng-controller="servicesController">
|
<div ng-controller="servicesController">
|
||||||
<div class="item item-icon-right item-heading" ng-click="toggle()">
|
<div class="item item-icon-right item-heading" ng-click="toggle()" >
|
||||||
<span translate>Services</span>
|
<span translate>Next steps</span>
|
||||||
<i class="icon bp-arrow-up" ng-show="!hide"></i>
|
<i class="icon bp-arrow-up" ng-show="!hide"></i>
|
||||||
<i class="icon bp-arrow-down" ng-show="hide"></i>
|
<i class="icon bp-arrow-down" ng-show="hide"></i>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="!hide">
|
<div ng-show="!hide">
|
||||||
<div>
|
<div ng-repeat="service in services track by $index">
|
||||||
<a ui-sref="tabs.shapeshift" class="item item-sub item-icon-left item-big-icon-left item-icon-right service">
|
<a ui-sref="{{service.sref}}" class="item item-sub item-icon-left item-big-icon-left item-icon-right next-step">
|
||||||
<i class="icon big-icon-svg">
|
<i class="icon big-icon-svg">
|
||||||
<img src="img/shapeshifticon.png" class="bg"/>
|
<div class="bg {{service.icon}}"></div>
|
||||||
</i>
|
</i>
|
||||||
<span>Shapeshift</span>
|
<span>{{service.title || service.name}}</span>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue