Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1226 from blockchain/ab
Browse files Browse the repository at this point in the history
AB
  • Loading branch information
plondon authored Jul 31, 2017
2 parents 873db93 + e451ddf commit 9285dc2
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/partials/request.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
17 changes: 16 additions & 1 deletion assets/js/controllers/request.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 4 additions & 1 deletion assets/js/controllers/top.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
};
Expand Down
6 changes: 4 additions & 2 deletions assets/js/controllers/wallet.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down
4 changes: 4 additions & 0 deletions assets/js/services/wallet.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
3 changes: 3 additions & 0 deletions tests/mocks/my_wallet/my_blockchain_api_mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ angular
},
getFiatAtTime (time, amount, currency) {
return $q.resolve(amount.toFixed(2));
},
createExperiment () {
return { recordA: () => {}, recordB: () => {} };
}
}));

0 comments on commit 9285dc2

Please sign in to comment.