diff --git a/bitanalytics/bitanalytics.js b/bitanalytics/bitanalytics.js index c8c0d8870..d04b2a0bd 100644 --- a/bitanalytics/bitanalytics.js +++ b/bitanalytics/bitanalytics.js @@ -6256,7 +6256,6 @@ var ClickAction = /** @class */ (function (_super) { // Add event listener to all the elements found for (var i = 0; i < elements.length; i++) { var element = elements[i]; - console.log('init ' + this.name); element.addEventListener('click', this.listener); } }; @@ -6413,7 +6412,6 @@ var AdjustChannel = /** @class */ (function (_super) { _this.eventTypes = config.eventTypes; var os = _this.adjustedOs(config.os); _this.advertisingId = _this.getAdvertisingId(os); - console.log('Advertising ID for adjust: ' + _this.advertisingId); // TODO: Different initialisation for Cordova. var sessionParams = { app_version: config.appVersion, @@ -6656,7 +6654,7 @@ var MixpanelChannel = /** @class */ (function (_super) { function MixpanelChannel(name, config) { var _this = _super.call(this, name) || this; if (!config.token) { - throw new DOMException('[BitAnalytics] Config incorrect.'); + throw new Error('[BitAnalytics] Config incorrect.'); } _this.mixpanelInstance = mixpanel; mixpanel.init(config.token, config.config); @@ -7037,7 +7035,7 @@ var LogEventHandlers = /** @class */ (function () { _this.channels.push(channel); } catch (error) { - console.log('[BitAnalytics] ' + error.name + ': ' + error.message); + console.log(error.message); } }); }; diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index b945be92c..73ebfd150 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -467,7 +467,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, } sendFlowService.pushState(confirmData); - if (!confirmData.fromWalletId) { $state.transitionTo('tabs.paymentRequest.confirm', confirmData); } else { diff --git a/src/js/controllers/backup.js b/src/js/controllers/backup.js index 0eec71f12..6ec7089c6 100644 --- a/src/js/controllers/backup.js +++ b/src/js/controllers/backup.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('backupController', - function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, lodash, profileService, bwcService, walletService, ongoingProcess, popupService, gettextCatalog, $ionicModal, firebaseEventsService) { + function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, lodash, profileService, bwcService, walletService, ongoingProcess, popupService, gettextCatalog, $ionicModal) { if ($state.current.name == 'onboarding.backup') { $scope.onboarding = true; @@ -89,7 +89,8 @@ angular.module('copayApp.controllers').controller('backupController', $scope.setFlow(2); }) } else { - firebaseEventsService.logEvent('backed_up_wallet'); + + //firebaseEventsService.logEvent('backed_up_wallet'); openConfirmBackupModal(); } }; diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index c98064fcc..76950df73 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, $ionicLoading, ionicToast, addressbookService, gettextCatalog, walletService, platformInfo, lodash, configService, $stateParams, $window, $state, $log, profileService, bitcore, bitcoreCash, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService, feeService, bitcoinCashJsService, bwcError, txConfirmNotification, externalLinkService, firebaseEventsService, soundService, clipboardService) { +angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $timeout, $ionicScrollDelegate, $ionicLoading, ionicToast, addressbookService, gettextCatalog, walletService, platformInfo, lodash, configService, $state, $log, profileService, bitcore, bitcoreCash, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, feeService, bitcoinCashJsService, bwcError, txConfirmNotification, soundService, clipboardService) { var countDown = null; var FEE_TOO_HIGH_LIMIT_PER = 15; @@ -708,8 +708,6 @@ angular.module('copayApp.controllers').controller('confirmController', function( }], [channel, "adjust"]); window.BitAnalytics.LogEventHandlers.postEvent(log); - // Should be removed - firebaseEventsService.logEvent('sent_bitcoin', { coin: $scope.wallet.coin }); $timeout(function() { $scope.$digest(); }, 100); diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index a25300a4a..a21053e2d 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('createController', - function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService, pushNotificationsService, firebaseEventsService, $ionicNavBarDelegate) { + function($scope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, popupService, appConfigService, pushNotificationsService, $ionicNavBarDelegate) { /* For compressed keys, m*73 + n*34 <= 496 */ var COPAYER_PAIR_LIMITS = { @@ -268,7 +268,7 @@ angular.module('copayApp.controllers').controller('createController', }, 100); } else { - firebaseEventsService.logEvent('wallet_created', { coin: opts.coin }); + //firebaseEventsService.logEvent('wallet_created', { coin: opts.coin }); $state.go('tabs.home'); } } diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 3d63ae41f..51d500de7 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, sendFlowService, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $window, gettextCatalog, lodash, popupService, ongoingProcess, bannerService, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, appConfigService, startupService, addressbookService, bwcError, nextStepsService, buyAndSellService, homeIntegrationsService, bitpayCardService, pushNotificationsService, timeService, bitcoincomService, pricechartService, firebaseEventsService, servicesService, shapeshiftService, $ionicNavBarDelegate, signVerifyMessageService) { + function($rootScope, sendFlowService, $timeout, $scope, $state, $stateParams, $ionicScrollDelegate, $window, gettextCatalog, lodash, popupService, ongoingProcess, bannerService, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, appConfigService, startupService, addressbookService, bwcError, nextStepsService, buyAndSellService, homeIntegrationsService, bitpayCardService, pushNotificationsService, timeService, $ionicNavBarDelegate) { var wallet; var listeners = []; var notifications = []; @@ -20,7 +20,12 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.bannerUrl = ''; - $scope.$on("$ionicView.afterEnter", function() { + $scope.$on("$ionicView.beforeEnter", onBeforeEnter); + $scope.$on("$ionicView.enter", onEnter); + $scope.$on("$ionicView.afterEnter", onAfterEnter); + $scope.$on("$ionicView.leave", onLeave); + + function onAfterEnter () { startupService.ready(); bannerService.getBanner(function (banner) { @@ -28,9 +33,9 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.bannerUrl = banner.url; $scope.bannerIsLoading = false; }); - }); + }; - $scope.$on("$ionicView.beforeEnter", function(event, data) { + function onBeforeEnter (event, data) { if (!$scope.homeTip) { storageService.getHomeTipAccepted(function(error, value) { @@ -52,9 +57,9 @@ angular.module('copayApp.controllers').controller('tabHomeController', } }); } - }); - - $scope.$on("$ionicView.enter", function(event, data) { + }; + + function onEnter(event, data) { $ionicNavBarDelegate.showBar(true); updateAllWallets(); @@ -98,21 +103,19 @@ angular.module('copayApp.controllers').controller('tabHomeController', } $scope.showServices = true; - pushNotificationsService.init(); - firebaseEventsService.init(); $timeout(function() { $ionicScrollDelegate.resize(); $scope.$apply(); }, 10); }); - }); + }; - $scope.$on("$ionicView.leave", function(event, data) { + function onLeave (event, data) { lodash.each(listeners, function(x) { x(); }); - }); + }; $scope.createdWithinPastDay = function(time) { return timeService.withinPastDay(time); diff --git a/src/js/controllers/walletDetails.js b/src/js/controllers/walletDetails.js index b159f7bc4..e6a8e2351 100644 --- a/src/js/controllers/walletDetails.js +++ b/src/js/controllers/walletDetails.js @@ -484,7 +484,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun }); }; - $scope.goToReceive = function() { $state.go('tabs.home', { walletId: $scope.wallet.id @@ -495,7 +494,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun }); }); }; - + $scope.goToBuy = function() { $state.go('tabs.home', { walletId: $scope.wallet.id diff --git a/src/js/routes.js b/src/js/routes.js index 5dbcbe6a3..b5a9c91fe 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1207,7 +1207,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }); }) - .run(function($rootScope, $state, $location, $log, $timeout, startupService, ionicToast, fingerprintService, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, emailService, /* plugins START HERE => */ buydotbitcoindotcomService, glideraService, amazonService, bitpayCardService, applicationService, mercadoLibreService, rateService) { + .run(function($rootScope, $state, $location, $log, $timeout, startupService, ionicToast, fingerprintService, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, emailService, /* plugins START HERE => */ buydotbitcoindotcomService, pushNotificationsService, glideraService, amazonService, bitpayCardService, applicationService, mercadoLibreService, rateService) { $ionicPlatform.ready(function() { @@ -1231,6 +1231,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }); + configService.whenAvailable(function(config) { + pushNotificationsService.init(); + }); + //firebaseEventsService.init(); + var channel = "ga"; if (platformInfo.isCordova) { channel = "firebase"; diff --git a/src/js/services/firebaseEventsService.js b/src/js/services/firebaseEventsService.js index d81e682d7..d6ce6f1cc 100644 --- a/src/js/services/firebaseEventsService.js +++ b/src/js/services/firebaseEventsService.js @@ -1,5 +1,5 @@ 'use strict'; -angular.module('copayApp.services').factory('firebaseEventsService', function firebaseEventsService($log, $state, $ionicHistory, sjcl, platformInfo, lodash, appConfigService, profileService, configService) { +angular.module('copayApp.services').factory('firebaseEventsService', function firebaseEventsService($log, platformInfo) { var root = {}; var useEvents = platformInfo.isCordova && !platformInfo.isWP;