Merge pull request #214 from Bitcoin-com/wallet/task/458

Wallet/task/458
This commit is contained in:
Brendon Duncan 2018-07-16 13:53:20 +12:00 committed by GitHub
commit 7dea47eb42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 7041 additions and 21 deletions

View file

@ -35,6 +35,16 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu
var translated = bitcoinCashJsService.readAddress(addressbook.address);
addressbook.address = translated.legacy;
}
var channel = "firebase";
if (platformInfo.isNW) {
channel = "ga";
}
var log = new window.BitAnalytics.LogEvent("contact_created", [{
"coin": $scope.addressbookEntry.coin
}], [channel]);
window.BitAnalytics.LogEventHandlers.postEvent(log);
$timeout(function() {
addressbookService.add(addressbook, function(err, ab) {
if (err) {

View file

@ -643,6 +643,19 @@ angular.module('copayApp.controllers').controller('confirmController', function(
soundService.play('misc/payment_sent.mp3');
}
var channel = "firebase";
if (platformInfo.isNW) {
channel = "ga";
}
var log = new window.BitAnalytics.LogEvent("transfer_success", [{
"coin": $scope.wallet.coin,
"type": "outgoing",
"amount": $scope.amount,
"fees": $scope.fee
}], [channel, "adjust"]);
window.BitAnalytics.LogEventHandlers.postEvent(log);
// Should be removed
firebaseEventsService.logEvent('sent_bitcoin', { coin: $scope.wallet.coin });
$timeout(function() {
$scope.$digest();

View file

@ -75,6 +75,15 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr
};
emailService.updateEmail(opts);
var channel = "firebase";
if (platformInfo.isNW) {
channel = "ga";
}
var log = new window.BitAnalytics.LogEvent("settings_email_notification_toggle", [{
"toggle": $scope.emailNotifications.value
}], [channel]);
window.BitAnalytics.LogEventHandlers.postEvent(log);
};
$scope.soundNotificationsChange = function() {

View file

@ -145,6 +145,16 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
}
$scope.paymentReceivedCoin = $scope.wallet.coin;
var channel = "firebase";
if (platformInfo.isNW) {
channel = "ga";
}
var log = new window.BitAnalytics.LogEvent("transfer_success", [{
"coin": $scope.wallet.coin,
"type": "incoming"
}], [channel, "adjust"]);
window.BitAnalytics.LogEventHandlers.postEvent(log);
if ($state.current.name === "tabs.receive") {
soundService.play('misc/payment_received.mp3');
}

View file

@ -12,6 +12,13 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.isAndroid = platformInfo.isAndroid;
$scope.isIOS = platformInfo.isIOS;
var channel = "firebase";
if (platformInfo.isNW) {
channel = "ga";
}
var log = new window.BitAnalytics.LogEvent("wallet_details_open", [], [channel]);
window.BitAnalytics.LogEventHandlers.postEvent(log);
$scope.amountIsCollapsible = !$scope.isAndroid;
$scope.openExternalLink = function(url, target) {

View file

@ -1211,7 +1211,68 @@ 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) {
$ionicPlatform.ready(function() {
// Init BitAnalytics
var os = platformInfo.isAndroid ? 'android' : platformInfo.isIOS ? 'ios' : 'desktop';
window.BitAnalytics.initialize(os, $window.fullVersion, {"firebase": {},
"ga": {
"trackingId": "UA-59964190-23",
"eventLabels": ["id", "icon-off"]
},
"adjust": {
"token": "au1onbhgg5q8",
"environment" : "production",
"eventTypes": {
"banner_click": "sc5i8u",
"buy_bitcoin_click": "t1vcdz",
"transfer_success": "f68evo",
"wallet_created": "nd3dg5",
"wallet_opened": "4n39l7"
}
}
});
var channel = "firebase";
if (platformInfo.isNW) {
channel = "ga";
}
// Send a log to test
var log = new window.BitAnalytics.LogEvent("wallet_opened", [], [channel, "adjust"]);
window.BitAnalytics.LogEventHandlers.postEvent(log);
var actionBanner = new window.BitAnalytics.ActionFactory.createAction('click', {
name: 'banner_click',
class: 'track_banner_click',
params: ['href-banner', 'id'],
channels: [channel, 'adjust']
});
window.BitAnalytics.ActionHandlers.trackAction(actionBanner);
var actionBuyBitcoin = new window.BitAnalytics.ActionFactory.createAction('click', {
name: 'buy_bitcoin_click',
class: 'track_buy_bitcoin_click',
params: ['href', 'id'],
channels: [channel, 'adjust']
});
window.BitAnalytics.ActionHandlers.trackAction(actionBuyBitcoin);
var actionLinkClickOut = new window.BitAnalytics.ActionFactory.createAction('click', {
name: 'link_click_out',
class: 'track_link_click_out',
params: ['href', 'id'],
channels: [channel]
});
window.BitAnalytics.ActionHandlers.trackAction(actionLinkClickOut);
var actionTabOpen = new window.BitAnalytics.ActionFactory.createAction('click', {
name: 'tab_open',
class: 'track_tab_open',
params: ['href', 'title', 'icon-off'],
channels: [channel]
});
window.BitAnalytics.ActionHandlers.trackAction(actionTabOpen);
// Init language
uxLanguage.init(function (lang) {
@ -1381,7 +1442,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
win.menu = nativeMenuBar;
}
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
if (document.body.classList.contains('keyboard-open')) {
document.body.classList.remove('keyboard-open');

View file

@ -427,6 +427,15 @@ angular.module('copayApp.services')
}, function(err, secret) {
if (err) return bwcError.cb(err, gettextCatalog.getString('Error creating wallet'), cb);
var channel = "firebase";
if (platformInfo.isNW) {
channel = "ga";
}
var log = new window.BitAnalytics.LogEvent("wallet_created", [{
"coin": opts.coin
}], [channel]);
window.BitAnalytics.LogEventHandlers.postEvent(log);
return cb(null, walletClient, secret);
});
});