added servicesService and moved shapeshift into there

This commit is contained in:
Kadir Sekha 2018-02-14 16:35:57 +00:00
commit 43556b84c4
6 changed files with 72 additions and 8 deletions

View file

@ -1,8 +1,9 @@
'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.services = servicesService.get();
$scope.toggle = function() {
$scope.hide = !$scope.hide;

View file

@ -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, 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 listeners = [];
var notifications = [];

View 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;
});

View 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;
});

View file

@ -249,6 +249,11 @@ div.slide-success__background.fill-screen {
background-image: url('../img/chart.svg');
}
.icon-shapeshift {
background-color: #494949;
background-image: url('../img/shapeshifticon.png');
}
.tabs .tab-item .icon {
background-size: contain;
}

View file

@ -1,16 +1,16 @@
<div ng-controller="servicesController">
<div class="item item-icon-right item-heading" ng-click="toggle()">
<span translate>Services</span>
<div class="item item-icon-right item-heading" ng-click="toggle()" >
<span translate>Next steps</span>
<i class="icon bp-arrow-up" ng-show="!hide"></i>
<i class="icon bp-arrow-down" ng-show="hide"></i>
</div>
<div ng-show="!hide">
<div>
<a ui-sref="tabs.shapeshift" class="item item-sub item-icon-left item-big-icon-left item-icon-right service">
<div ng-repeat="service in services track by $index">
<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">
<img src="img/shapeshifticon.png" class="bg"/>
<div class="bg {{service.icon}}"></div>
</i>
<span>Shapeshift</span>
<span>{{service.title || service.name}}</span>
<i class="icon bp-arrow-right"></i>
</a>
</div>