Merge branch 'master' of https://github.com/highfidelity/hifi into reset-wallet

This commit is contained in:
David Kelly 2017-08-30 15:30:29 -07:00
commit 962d1fc81d
9 changed files with 97 additions and 70 deletions

View file

@ -28,14 +28,14 @@ Rectangle {
property string activeView: "initialize"; property string activeView: "initialize";
property bool purchasesReceived: false; property bool purchasesReceived: false;
property bool balanceReceived: false; property bool balanceReceived: false;
property bool securityImageResultReceived: false;
property bool keyFilePathIfExistsResultReceived: false;
property string itemId: ""; property string itemId: "";
property string itemHref: ""; property string itemHref: "";
property double balanceAfterPurchase: 0; property double balanceAfterPurchase: 0;
property bool alreadyOwned: false; property bool alreadyOwned: false;
property int itemPriceFull: 0; property int itemPriceFull: 0;
property bool itemIsJson: true; property bool itemIsJson: true;
property bool securityImageResultReceived: false;
property bool keyFilePathIfExistsResultReceived: false;
// Style // Style
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
Hifi.QmlCommerce { Hifi.QmlCommerce {
@ -48,6 +48,8 @@ Rectangle {
root.activeView = "initialize"; root.activeView = "initialize";
commerce.getSecurityImage(); commerce.getSecurityImage();
commerce.getKeyFilePathIfExists(); commerce.getKeyFilePathIfExists();
commerce.balance();
commerce.inventory();
} }
} }
@ -190,6 +192,10 @@ Rectangle {
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
Component.onCompleted: { Component.onCompleted: {
securityImageResultReceived = false;
purchasesReceived = false;
balanceReceived = false;
keyFilePathIfExistsResultReceived = false;
commerce.getLoginStatus(); commerce.getLoginStatus();
} }
} }
@ -311,13 +317,6 @@ Rectangle {
anchors.left: parent.left; anchors.left: parent.left;
anchors.right: parent.right; anchors.right: parent.right;
onVisibleChanged: {
if (visible) {
commerce.balance();
commerce.inventory();
}
}
// //
// ITEM DESCRIPTION START // ITEM DESCRIPTION START
// //

View file

@ -29,7 +29,7 @@ Rectangle {
property string referrerURL: ""; property string referrerURL: "";
property bool securityImageResultReceived: false; property bool securityImageResultReceived: false;
property bool keyFilePathIfExistsResultReceived: false; property bool keyFilePathIfExistsResultReceived: false;
property bool inventoryReceived: false; property bool purchasesReceived: false;
property bool punctuationMode: false; property bool punctuationMode: false;
// Style // Style
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
@ -43,6 +43,7 @@ Rectangle {
root.activeView = "initialize"; root.activeView = "initialize";
commerce.getSecurityImage(); commerce.getSecurityImage();
commerce.getKeyFilePathIfExists(); commerce.getKeyFilePathIfExists();
commerce.inventory();
} }
} }
@ -69,11 +70,13 @@ Rectangle {
} }
onInventoryResult: { onInventoryResult: {
inventoryReceived = true; purchasesReceived = true;
if (result.status !== 'success') { if (result.status !== 'success') {
console.log("Failed to get purchases", result.message); console.log("Failed to get purchases", result.message);
} else { } else {
purchasesModel.clear();
purchasesModel.append(result.data.assets); purchasesModel.append(result.data.assets);
filteredPurchasesModel.clear();
filteredPurchasesModel.append(result.data.assets); filteredPurchasesModel.append(result.data.assets);
} }
} }
@ -161,6 +164,9 @@ Rectangle {
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
Component.onCompleted: { Component.onCompleted: {
securityImageResultReceived = false;
purchasesReceived = false;
keyFilePathIfExistsResultReceived = false;
commerce.getLoginStatus(); commerce.getLoginStatus();
} }
} }
@ -283,14 +289,7 @@ Rectangle {
anchors.top: titleBarContainer.bottom; anchors.top: titleBarContainer.bottom;
anchors.topMargin: 8; anchors.topMargin: 8;
anchors.bottom: actionButtonsContainer.top; anchors.bottom: actionButtonsContainer.top;
anchors.bottomMargin: 8; anchors.bottomMargin: 8;
onVisibleChanged: {
if (visible) {
commerce.balance();
commerce.inventory();
}
}
// //
// FILTER BAR START // FILTER BAR START
@ -378,7 +377,7 @@ Rectangle {
Item { Item {
id: noPurchasesAlertContainer; id: noPurchasesAlertContainer;
visible: !purchasesContentsList.visible && root.inventoryReceived; visible: !purchasesContentsList.visible && root.purchasesReceived;
anchors.top: filterBarContainer.bottom; anchors.top: filterBarContainer.bottom;
anchors.topMargin: 12; anchors.topMargin: 12;
anchors.left: parent.left; anchors.left: parent.left;

View file

@ -45,6 +45,10 @@ Item {
} }
} }
// This will cause a bug -- if you bring up passphrase selection in HUD mode while
// in HMD while having HMD preview enabled, then move, then finish passphrase selection,
// HMD preview will stay off.
// TODO: Fix this unlikely bug
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
passphraseField.focus = true; passphraseField.focus = true;
@ -69,12 +73,6 @@ Item {
echoMode: TextInput.Password; echoMode: TextInput.Password;
placeholderText: "passphrase"; placeholderText: "passphrase";
onVisibleChanged: {
if (visible) {
text = "";
}
}
onFocusChanged: { onFocusChanged: {
if (focus) { if (focus) {
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'}); sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
@ -105,12 +103,6 @@ Item {
echoMode: TextInput.Password; echoMode: TextInput.Password;
placeholderText: "re-enter passphrase"; placeholderText: "re-enter passphrase";
onVisibleChanged: {
if (visible) {
text = "";
}
}
onFocusChanged: { onFocusChanged: {
if (focus) { if (focus) {
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'}); sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
@ -281,5 +273,11 @@ Item {
errorText.text = text; errorText.text = text;
} }
function clearPassphraseFields() {
passphraseField.text = "";
passphraseFieldAgain.text = "";
setErrorText("");
}
signal sendMessageToLightbox(var msg); signal sendMessageToLightbox(var msg);
} }

View file

@ -27,12 +27,6 @@ Rectangle {
// Style // Style
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
onVisibleChanged: {
if (visible) {
root.resetSubmitButton();
}
}
// //
// SECURE PASSPHRASE SELECTION START // SECURE PASSPHRASE SELECTION START
// //
@ -175,4 +169,8 @@ Rectangle {
passphraseSubmitButton.enabled = true; passphraseSubmitButton.enabled = true;
passphraseSubmitButton.text = "Submit"; passphraseSubmitButton.text = "Submit";
} }
function clearPassphraseFields() {
passphraseSelection.clearPassphraseFields();
}
} }

View file

@ -24,14 +24,13 @@ Item {
HifiConstants { id: hifi; } HifiConstants { id: hifi; }
id: root; id: root;
Hifi.QmlCommerce { // This will cause a bug -- if you bring up security image selection in HUD mode while
id: commerce; // in HMD while having HMD preview enabled, then move, then finish passphrase selection,
} // HMD preview will stay off.
// TODO: Fix this unlikely bug
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
commerce.getSecurityImage();
sendSignalToWallet({method: 'disableHmdPreview'}); sendSignalToWallet({method: 'disableHmdPreview'});
} else { } else {
sendSignalToWallet({method: 'maybeEnableHmdPreview'}); sendSignalToWallet({method: 'maybeEnableHmdPreview'});

View file

@ -28,12 +28,6 @@ Rectangle {
// Style // Style
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
onVisibleChanged: {
if (visible) {
root.resetSubmitButton();
}
}
Hifi.QmlCommerce { Hifi.QmlCommerce {
id: commerce; id: commerce;

View file

@ -277,6 +277,7 @@ Rectangle {
onSendSignalToWallet: { onSendSignalToWallet: {
if (msg.method === 'walletSecurity_changePassphrase') { if (msg.method === 'walletSecurity_changePassphrase') {
passphraseSelectionLightbox.visible = true; passphraseSelectionLightbox.visible = true;
passphraseSelectionLightbox.clearPassphraseFields();
} else if (msg.method === 'walletSecurity_changeSecurityImage') { } else if (msg.method === 'walletSecurity_changeSecurityImage') {
securityImageSelectionLightbox.visible = true; securityImageSelectionLightbox.visible = true;
} }

View file

@ -24,6 +24,7 @@ Item {
HifiConstants { id: hifi; } HifiConstants { id: hifi; }
id: root; id: root;
property bool historyReceived: false;
Hifi.QmlCommerce { Hifi.QmlCommerce {
id: commerce; id: commerce;
@ -41,9 +42,10 @@ Item {
} }
onHistoryResult : { onHistoryResult : {
historyReceived = true;
if (result.status === 'success') { if (result.status === 'success') {
var txt = result.data.history.map(function (h) { return h.text; }).join("<hr>"); transactionHistoryModel.clear();
transactionHistoryText.text = txt; transactionHistoryModel.append(result.data.history);
} }
} }
} }
@ -111,6 +113,7 @@ Item {
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
historyReceived = false;
commerce.balance(); commerce.balance();
commerce.history(); commerce.history();
} }
@ -233,24 +236,66 @@ Item {
// Style // Style
color: hifi.colors.faintGray; color: hifi.colors.faintGray;
} }
ListModel {
id: transactionHistoryModel;
}
Rectangle { Rectangle {
id: transactionHistory;
anchors.top: recentActivityText.bottom; anchors.top: recentActivityText.bottom;
anchors.topMargin: 4; anchors.topMargin: 4;
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
anchors.left: parent.left; anchors.left: parent.left;
anchors.right: parent.right; anchors.right: parent.right;
color: "white";
// some placeholder stuff ListView {
TextArea { id: transactionHistory;
id: transactionHistoryText; anchors.centerIn: parent;
text: "<hr>history unavailable<hr>"; width: parent.width - 12;
textFormat: TextEdit.AutoText; height: parent.height - 12;
font.pointSize: 10; visible: transactionHistoryModel.count !== 0;
clip: true;
model: transactionHistoryModel;
delegate: Item {
width: parent.width;
height: transactionText.height + 30;
RalewayRegular {
id: transactionText;
text: model.text;
// Style
size: 18;
width: parent.width;
height: paintedHeight;
anchors.verticalCenter: parent.verticalCenter;
color: "black";
wrapMode: Text.WordWrap;
// Alignment
horizontalAlignment: Text.AlignLeft;
verticalAlignment: Text.AlignVCenter;
}
HifiControlsUit.Separator {
anchors.left: parent.left;
anchors.right: parent.right;
anchors.bottom: parent.bottom;
}
}
onAtYEndChanged: {
if (transactionHistory.atYEnd) {
console.log("User scrolled to the bottom of 'Recent Activity'.");
// Grab next page of results and append to model
}
}
}
// This should never be visible (since you immediately get 100 HFC)
RalewayRegular {
id: emptyTransationHistory;
size: 24;
visible: !transactionHistory.visible && root.historyReceived;
text: "Recent Activity Unavailable";
anchors.fill: parent; anchors.fill: parent;
horizontalAlignment: Text.AlignLeft; horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignTop; verticalAlignment: Text.AlignVCenter;
} }
} }
} }

View file

@ -24,7 +24,7 @@ Rectangle {
HifiConstants { id: hifi; } HifiConstants { id: hifi; }
id: root; id: root;
property string lastPage: "securityImage"; property string lastPage: "initialize";
// Style // Style
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
@ -58,16 +58,9 @@ Rectangle {
// //
Item { Item {
id: securityImageContainer; id: securityImageContainer;
visible: false;
// Anchors // Anchors
anchors.fill: parent; anchors.fill: parent;
onVisibleChanged: {
if (visible) {
commerce.getSecurityImage();
}
}
Item { Item {
id: securityImageTitle; id: securityImageTitle;
// Size // Size
@ -197,6 +190,7 @@ Rectangle {
commerce.chooseSecurityImage(securityImagePath); commerce.chooseSecurityImage(securityImagePath);
securityImageContainer.visible = false; securityImageContainer.visible = false;
choosePassphraseContainer.visible = true; choosePassphraseContainer.visible = true;
passphraseSelection.clearPassphraseFields();
} }
} }
} }