home view changes for bannerService

This commit is contained in:
Sebastiaan Pasma 2018-07-03 11:38:22 +02:00
commit 1d5010de41
2 changed files with 17 additions and 5 deletions

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, servicesService, shapeshiftService, $ionicNavBarDelegate, signVerifyMessageService) {
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $window, gettextCatalog, lodash, popupService, ongoingProcess, bannerService, 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, $ionicNavBarDelegate, signVerifyMessageService) {
var wallet;
var listeners = [];
var notifications = [];
@ -16,9 +16,19 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.isNW = platformInfo.isNW;
$scope.showRateCard = {};
$scope.showServices = false;
$scope.bannerIsLoading = true;
$scope.bannerImageUrl = '';
$scope.bannerUrl = '';
$scope.$on("$ionicView.afterEnter", function() {
startupService.ready();
bannerService.fetchBannerSettings(function(banners) {
var banner = banners[Math.floor(Math.random()*banners.length)];
$scope.bannerImageUrl = bannerService.getBannerImage(banner);
$scope.bannerUrl = banner.url;
$scope.bannerIsLoading = false;
});
});
$scope.$on("$ionicView.beforeEnter", function(event, data) {
@ -155,8 +165,8 @@ angular.module('copayApp.controllers').controller('tabHomeController',
externalLinkService.open(url, optIn, title, message, okText, cancelText);
};
$scope.openStore = function() {
externalLinkService.open('https://store.bitcoin.com/', false);
$scope.openBannerUrl = function() {
externalLinkService.open($scope.bannerUrl, false);
};
$scope.openNotificationModal = function(n) {

View file

@ -92,9 +92,11 @@
<div class="ng-hide list card" ng-show="showServices && (walletsBch[0] || walletsBtc[0])" ng-include="'views/includes/services.html'"></div>
<div class="list card card-banner">
<a ng-click="openStore()">
<img class="card-banner__img" src="img/banner-store.png"/>
<ion-spinner ng-if="bannerIsLoading"></ion-spinner>
<a ng-if="!bannerIsLoading" ng-click="openBannerUrl()">
<img class="card-banner__img" ng-src="{{bannerImageUrl}}"/>
</a>
</div>
<div class="ng-hide list card" ng-show="nextStepsItems.length>0 && !isWindowsPhoneApp" ng-include="'views/includes/community.html'"></div>