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
onApplied: {
console.log("applied!")
ensUsernamesStore.setPrefferedEnsUsername(d.newUsername);
close();
}

View File

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

View File

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