fix(EnsListView): Fixed message preview visibility

This commit is contained in:
Igor Sirotin 2022-12-06 23:42:18 +03:00 committed by Igor Sirotin
parent 4da18c8de7
commit 16be01495a
3 changed files with 15 additions and 18 deletions

View File

@ -23,7 +23,6 @@ StatusDialog {
implicitWidth: 400 implicitWidth: 400
onApplied: { onApplied: {
console.log("applied!")
ensUsernamesStore.setPrefferedEnsUsername(d.newUsername); ensUsernamesStore.setPrefferedEnsUsername(d.newUsername);
close(); close();
} }

View File

@ -31,7 +31,7 @@ QtObject {
function numOfPendingEnsUsernames() { function numOfPendingEnsUsernames() {
if(!root.ensUsernamesModule) if(!root.ensUsernamesModule)
return 0 return 0
ensUsernamesModule.numOfPendingEnsUsernames() return ensUsernamesModule.numOfPendingEnsUsernames()
} }
function ensDetails(ensUsername) { function ensDetails(ensUsername) {

View File

@ -26,21 +26,26 @@ Item {
signal addBtnClicked() signal addBtnClicked()
signal selectEns(string username) signal selectEns(string username)
Component.onCompleted: {
d.updateNumberOfPendingEnsUsernames()
}
QtObject { QtObject {
id: d id: d
function shouldDisplayExampleMessage(){ property int numOfPendingEnsUsernames: 0
return root.ensUsernamesStore.ensUsernamesModel.count > 0 && readonly property bool hasConfirmedEnsUsernames: root.ensUsernamesStore.ensUsernamesModel.count > 0
root.ensUsernamesStore.numOfPendingEnsUsernames() !== root.ensUsernamesStore.ensUsernamesModel && && numOfPendingEnsUsernames !== root.ensUsernamesStore.ensUsernamesModel.count
store.ensUsernamesStore.preferredUsername !== ""
function updateNumberOfPendingEnsUsernames() {
numOfPendingEnsUsernames = root.ensUsernamesStore.numOfPendingEnsUsernames()
} }
} }
Connections { Connections {
target: root.ensUsernamesStore.ensUsernamesModule target: root.ensUsernamesStore.ensUsernamesModule
onUsernameConfirmed: { onUsernameConfirmed: {
messagesShownAs.updateVisibility() d.updateNumberOfPendingEnsUsernames()
chatSettingsLabel.visible = true chatSettingsLabel.visible = true
} }
} }
@ -210,8 +215,7 @@ Item {
StatusBaseText { StatusBaseText {
id: chatSettingsLabel id: chatSettingsLabel
visible: root.ensUsernamesStore.ensUsernamesModel.count > 0 && visible: d.hasConfirmedEnsUsernames
root.ensUsernamesStore.numOfPendingEnsUsernames() != root.ensUsernamesStore.ensUsernamesModel.count
text: qsTr("Chat settings") text: qsTr("Chat settings")
anchors.left: parent.left anchors.left: parent.left
anchors.top: ensList.bottom anchors.top: ensList.bottom
@ -260,17 +264,12 @@ Item {
StatusMessage { StatusMessage {
id: messagesShownAs id: messagesShownAs
function updateVisibility() {
// visible = d.shouldDisplayExampleMessage()
}
Component.onCompleted: {
updateVisibility()
}
anchors.top: !visible ? separator.bottom : primaryUsernameItem.bottom anchors.top: !visible ? separator.bottom : primaryUsernameItem.bottom
anchors.topMargin: Style.current.padding * 2 anchors.topMargin: Style.current.padding * 2
visible: d.hasConfirmedEnsUsernames
&& root.ensUsernamesStore.preferredUsername !== ""
timestamp: new Date().getTime() timestamp: new Date().getTime()
disableHover: true disableHover: true
hideQuickActions: true hideQuickActions: true
@ -281,7 +280,6 @@ Item {
messageText: qsTr("Hey!") messageText: qsTr("Hey!")
amISender: false amISender: false
sender.displayName: root.ensUsernamesStore.preferredUsername sender.displayName: root.ensUsernamesStore.preferredUsername
// displayName: "@" + (root.ensUsernamesStore.preferredUsername.replace(".stateofus.eth", ""))
sender.profileImage.assetSettings.isImage: true sender.profileImage.assetSettings.isImage: true
sender.profileImage.name: root.ensUsernamesStore.icon sender.profileImage.name: root.ensUsernamesStore.icon
} }