diff --git a/app/partials/request.pug b/app/partials/request.pug index 4df592a577..c3f13fe819 100644 --- a/app/partials/request.pug +++ b/app/partials/request.pug @@ -7,7 +7,7 @@ span(translate="PAYMENT_ADDRESS" ng-show="state.viewQR") span(translate="REQUEST_CREATED" ng-show="state.requestCreated") #receive.modal-body - form.bc-form(role="form" name="requestForm" ng-hide="state.requestCreated || state.viewQR" ng-submit="isToImportedAddress() ? state.requestCreated = true : createPaymentRequest();" novalidate) + form.bc-form(role="form" name="requestForm" ng-hide="state.requestCreated || state.viewQR" ng-submit="nextStep()" novalidate) fieldset .group.mb-20 .item @@ -17,7 +17,7 @@ helper-button(content="COPY_AND_SHARE_ADDRESS.HELPER" ng-hide="isToImportedAddress()") helper-button(content="COPY_AND_SHARE_IMPORTED_ADDRESS.HELPER" ng-show="isToImportedAddress()") a.f-12.em-300(translate="VIEW_QR" ng-click="state.viewQR = true") - .flex-row.flex-column-mobile + .flex-row.flex-column-mobile(ng-click="manuallyCopiedAddress()") span.f-16.bg-grey.ph-25.pv-10.width-100.font-1-mobile.ph-10-mobile(translate="no") {{ state.address }} span.f-14.ph-25.pv-10.upper.pointer.white.bg-primary.pos-rel.center-mobile(single-click-select translate="COPY" ng-hide="state.isAddressCopied || !browser.canExecCommand" copy-content="{{ address() }}" ng-click="state.isAddressCopied = true") span.f-14.ph-25.pv-10.upper.white.bg-success.center-mobile(translate="COPIED" ng-show="state.isAddressCopied" ng-mouseleave="state.isAddressCopied = false") diff --git a/assets/js/controllers/request.controller.js b/assets/js/controllers/request.controller.js index 9b6d547a5e..e558de5fdf 100644 --- a/assets/js/controllers/request.controller.js +++ b/assets/js/controllers/request.controller.js @@ -2,12 +2,14 @@ angular .module('walletApp') .controller('RequestCtrl', RequestCtrl); -function RequestCtrl ($scope, AngularHelper, Wallet, Alerts, currency, $uibModalInstance, $log, destination, $translate, $stateParams, filterFilter, $filter, $q, format, smartAccount, Labels, $timeout, browser, Env) { +function RequestCtrl ($scope, AngularHelper, Wallet, Alerts, currency, $uibModalInstance, $log, destination, $translate, $stateParams, filterFilter, $filter, $q, format, smartAccount, Labels, $timeout, browser, Env, MyBlockchainApi) { Env.then(env => { $scope.rootURL = env.rootURL; $scope.isProduction = env.isProduction; }); + let isUsingPaymentRequestsExperiment = MyBlockchainApi.createExperiment(2); + $scope.status = Wallet.status; $scope.settings = Wallet.settings; $scope.accounts = Wallet.accounts; @@ -36,6 +38,19 @@ function RequestCtrl ($scope, AngularHelper, Wallet, Alerts, currency, $uibModal $scope.state.to = destination || Wallet.my.wallet.hdwallet.defaultAccount; $scope.isToImportedAddress = () => $scope.state.to.type === 'Imported Addresses'; + $scope.didCopyManually = false; + $scope.manuallyCopiedAddress = () => { + if ($scope.didCopyManually) return; + $scope.didCopyManually = true; + isUsingPaymentRequestsExperiment.recordA(); + }; + + $scope.nextStep = () => { + if ($scope.isToImportedAddress()) $scope.state.requestCreated = true; + else $scope.createPaymentRequest(); + isUsingPaymentRequestsExperiment.recordB(); + }; + $scope.createPaymentRequest = () => { $scope.lock(); Alerts.clear(); diff --git a/assets/js/controllers/top.controller.js b/assets/js/controllers/top.controller.js index b35ed04e94..1576aa195a 100644 --- a/assets/js/controllers/top.controller.js +++ b/assets/js/controllers/top.controller.js @@ -2,7 +2,9 @@ angular .module('walletApp') .controller('TopCtrl', TopCtrl); -function TopCtrl ($scope, Wallet, currency, browser) { +function TopCtrl ($scope, Wallet, currency, browser, MyBlockchainApi) { + let isUsingRequestQuickCopyExperiment = MyBlockchainApi.createExperiment(1); + $scope.copied = false; $scope.status = Wallet.status; $scope.settings = Wallet.settings; @@ -18,6 +20,7 @@ function TopCtrl ($scope, Wallet, currency, browser) { $scope.nextAddress = () => { if ($scope.copied) return; $scope.copied = true; + isUsingRequestQuickCopyExperiment.recordB(); let defaultIdx = Wallet.my.wallet.hdwallet.defaultAccountIndex; return Wallet.getReceivingAddressForAccount(defaultIdx); }; diff --git a/assets/js/controllers/wallet.controller.js b/assets/js/controllers/wallet.controller.js index 636f3025b0..4f181dfd69 100644 --- a/assets/js/controllers/wallet.controller.js +++ b/assets/js/controllers/wallet.controller.js @@ -2,9 +2,10 @@ angular .module('walletApp') .controller('WalletCtrl', WalletCtrl); -function WalletCtrl ($scope, $rootScope, Wallet, $uibModal, $timeout, Alerts, $interval, $ocLazyLoad, $state, $uibModalStack, $q, localStorageService, MyWallet, currency, $translate, $window, buyStatus, modals) { - $scope.goal = Wallet.goal; +function WalletCtrl ($scope, $rootScope, Wallet, $uibModal, $timeout, Alerts, $interval, $ocLazyLoad, $state, $uibModalStack, $q, localStorageService, MyWallet, currency, $translate, $window, buyStatus, modals, MyBlockchainApi) { + let isUsingRequestQuickCopyExperiment = MyBlockchainApi.createExperiment(1); + $scope.goal = Wallet.goal; $scope.status = Wallet.status; $scope.settings = Wallet.settings; $rootScope.isMock = Wallet.isMock; @@ -45,6 +46,7 @@ function WalletCtrl ($scope, $rootScope, Wallet, $uibModal, $timeout, Alerts, $i $scope.request = modals.openOnce(() => { Alerts.clear(); + isUsingRequestQuickCopyExperiment.recordA(); return $uibModal.open({ templateUrl: 'partials/request.pug', windowClass: 'bc-modal initial', diff --git a/assets/js/services/wallet.service.js b/assets/js/services/wallet.service.js index c6493b393a..37d0f4280f 100644 --- a/assets/js/services/wallet.service.js +++ b/assets/js/services/wallet.service.js @@ -245,6 +245,10 @@ function Wallet ($http, $window, $timeout, $location, $injector, Alerts, MyWalle wallet.settings.blockTOR = !!result.block_tor_ips; wallet.status.didLoadSettings = true; + let isUsingThemesExperiment = MyBlockchainApi.createExperiment(0); + if (wallet.settings.theme === theme.themes[0]) isUsingThemesExperiment.recordA(); + else isUsingThemesExperiment.recordB(); + if (wallet.my.wallet.isUpgradedToHD) { let didFetchTransactions = () => { if (browserDetection().browser === 'ie') { diff --git a/tests/mocks/my_wallet/my_blockchain_api_mock.js b/tests/mocks/my_wallet/my_blockchain_api_mock.js index f2882519a9..8b861204bb 100644 --- a/tests/mocks/my_wallet/my_blockchain_api_mock.js +++ b/tests/mocks/my_wallet/my_blockchain_api_mock.js @@ -10,5 +10,8 @@ angular }, getFiatAtTime (time, amount, currency) { return $q.resolve(amount.toFixed(2)); + }, + createExperiment () { + return { recordA: () => {}, recordB: () => {} }; } }));