mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-11 06:47:01 +00:00
fix: fix binding loop on the fetch button
This commit is contained in:
parent
fbf592bf52
commit
eeb1628337
@ -140,7 +140,16 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
active: true
|
active: {
|
||||||
|
if (contentType === Constants.fetchMoreMessagesButton) {
|
||||||
|
const gapNowAndOldestTimestamp = Date.now() / 1000 - chatsModel.oldestMsgTimestamp
|
||||||
|
return gapNowAndOldestTimestamp < Constants.maxNbDaysToFetch * Constants.fetchRangeLast24Hours &&
|
||||||
|
(chatsModel.activeChannel.chatType !== Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.isMember)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
switch(contentType) {
|
switch(contentType) {
|
||||||
@ -167,15 +176,8 @@ Item {
|
|||||||
Component {
|
Component {
|
||||||
id: fetchMoreMessagesButtonComponent
|
id: fetchMoreMessagesButtonComponent
|
||||||
Item {
|
Item {
|
||||||
property int gapNowAndOldestTimestamp: Date.now() / 1000 - chatsModel.oldestMsgTimestamp
|
id: wrapper
|
||||||
|
height: childrenRect.height + Style.current.smallPadding * 2
|
||||||
visible: {
|
|
||||||
|
|
||||||
return gapNowAndOldestTimestamp < Constants.maxNbDaysToFetch * Constants.fetchRangeLast24Hours &&
|
|
||||||
(chatsModel.activeChannel.chatType !== Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.isMember)
|
|
||||||
}
|
|
||||||
id: wrapper
|
|
||||||
height: wrapper.visible ? childrenRect.height + Style.current.smallPadding*2 : 0
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
Separator {
|
Separator {
|
||||||
@ -193,14 +195,14 @@ Item {
|
|||||||
anchors.top: sep1.bottom
|
anchors.top: sep1.bottom
|
||||||
anchors.topMargin: Style.current.smallPadding
|
anchors.topMargin: Style.current.smallPadding
|
||||||
MouseArea {
|
MouseArea {
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
chatsModel.requestMoreMessages(Constants.fetchRangeLast24Hours);
|
chatsModel.requestMoreMessages(Constants.fetchRangeLast24Hours);
|
||||||
timer.setTimeout(function(){
|
timer.setTimeout(function(){
|
||||||
chatsModel.hideLoadingIndicator()
|
chatsModel.hideLoadingIndicator()
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user