2016-05-13 11:48:48 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2016-07-21 11:18:48 -03:00
|
|
|
angular.module('copayApp.controllers').controller('amazonController',
|
2017-01-24 01:23:57 -03:00
|
|
|
function($scope, $timeout, $ionicModal, $log, $state, $ionicHistory, lodash, amazonService, externalLinkService, popupService) {
|
2016-09-23 13:05:50 -03:00
|
|
|
|
2016-12-12 17:29:11 -03:00
|
|
|
$scope.openExternalLink = function(url) {
|
|
|
|
|
externalLinkService.open(url);
|
2016-08-24 19:00:50 -03:00
|
|
|
};
|
|
|
|
|
|
2016-09-22 01:47:39 -03:00
|
|
|
var initAmazon = function() {
|
2016-07-21 11:18:48 -03:00
|
|
|
amazonService.getPendingGiftCards(function(err, gcds) {
|
2017-01-24 01:23:57 -03:00
|
|
|
if (err) $log.error(err);
|
|
|
|
|
$scope.giftCards = gcds;
|
2016-11-28 17:01:07 -03:00
|
|
|
$timeout(function() {
|
|
|
|
|
$scope.$digest();
|
|
|
|
|
});
|
2016-06-14 00:36:41 -03:00
|
|
|
});
|
2016-05-13 11:48:48 -03:00
|
|
|
};
|
2016-09-22 01:47:39 -03:00
|
|
|
|
2016-10-12 15:29:06 -04:00
|
|
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
2017-01-24 01:23:57 -03:00
|
|
|
$scope.network = amazonService.getNetwork();
|
2016-09-22 01:47:39 -03:00
|
|
|
initAmazon();
|
|
|
|
|
});
|
2016-05-13 11:48:48 -03:00
|
|
|
});
|