Correctly handle referrer from WalletChoice

This commit is contained in:
Zach Fox 2018-02-26 12:44:41 -08:00
parent 4e4aebc7ee
commit 8223ebf393
2 changed files with 16 additions and 10 deletions

View file

@ -179,8 +179,8 @@ Rectangle {
if (isReset) { if (isReset) {
walletResetSetup(); walletResetSetup();
} else { } else {
root.activeView = "initialize"; var msg = { referrer: walletChoice.referrer }
Commerce.getWalletStatus(); followReferrer(msg);
} }
} }
copyFunction: Commerce.copyKeyFileFrom; copyFunction: Commerce.copyKeyFileFrom;
@ -199,14 +199,7 @@ Rectangle {
Connections { Connections {
onSendSignalToWallet: { onSendSignalToWallet: {
if (msg.method === 'walletSetup_finished') { if (msg.method === 'walletSetup_finished') {
if (msg.referrer === '' || msg.referrer === 'marketplace cta') { followReferrer(msg);
root.activeView = "initialize";
Commerce.getWalletStatus();
} else if (msg.referrer === 'purchases') {
sendToScript({method: 'goToPurchases'});
} else {
sendToScript({method: 'goToMarketplaceItemPage', itemId: msg.referrer});
}
} else if (msg.method === 'walletSetup_raiseKeyboard') { } else if (msg.method === 'walletSetup_raiseKeyboard') {
root.keyboardRaised = true; root.keyboardRaised = true;
root.isPassword = msg.isPasswordField; root.isPassword = msg.isPasswordField;
@ -759,6 +752,7 @@ Rectangle {
switch (message.method) { switch (message.method) {
case 'updateWalletReferrer': case 'updateWalletReferrer':
walletSetup.referrer = message.referrer; walletSetup.referrer = message.referrer;
walletChoice.referrer = message.referrer;
break; break;
case 'inspectionCertificate_resetCert': case 'inspectionCertificate_resetCert':
// NOP // NOP
@ -798,6 +792,17 @@ Rectangle {
UserActivityLogger.commerceWalletSetupStarted(timestamp, walletSetup.setupAttemptID, walletSetup.setupFlowVersion, walletSetup.referrer ? walletSetup.referrer : "wallet app", UserActivityLogger.commerceWalletSetupStarted(timestamp, walletSetup.setupAttemptID, walletSetup.setupFlowVersion, walletSetup.referrer ? walletSetup.referrer : "wallet app",
(AddressManager.placename || AddressManager.hostname || '') + (AddressManager.pathname ? AddressManager.pathname.match(/\/[^\/]+/)[0] : '')); (AddressManager.placename || AddressManager.hostname || '') + (AddressManager.pathname ? AddressManager.pathname.match(/\/[^\/]+/)[0] : ''));
} }
function followReferrer(msg) {
if (msg.referrer === '' || msg.referrer === 'marketplace cta') {
root.activeView = "initialize";
Commerce.getWalletStatus();
} else if (msg.referrer === 'purchases') {
sendToScript({method: 'goToPurchases'});
} else {
sendToScript({method: 'goToMarketplaceItemPage', itemId: msg.referrer});
}
}
// //
// FUNCTION DEFINITIONS END // FUNCTION DEFINITIONS END
// //

View file

@ -25,6 +25,7 @@ Item {
property string activeView: "conflict"; property string activeView: "conflict";
property var proceedFunction: nil; property var proceedFunction: nil;
property var copyFunction: nil; property var copyFunction: nil;
property string referrer: "";
Image { Image {
anchors.fill: parent; anchors.fill: parent;