fix: loading indicator
This commit is contained in:
parent
5458dcbb55
commit
fb35f89336
|
@ -39,7 +39,6 @@ proc handleChatEvents(self: ChatController) =
|
|||
# app to be slower
|
||||
self.status.events.on("chatUpdate") do(e: Args):
|
||||
var evArgs = ChatUpdateArgs(e)
|
||||
self.view.hideLoadingIndicator()
|
||||
self.view.updateChats(evArgs.chats)
|
||||
self.view.pushMessages(evArgs.messages)
|
||||
self.view.pushMembers(evArgs.chats)
|
||||
|
|
|
@ -53,13 +53,3 @@ proc handleSignals(self: ChatController) =
|
|||
discard
|
||||
# var data = CommunitySignal(e)
|
||||
# self.view.communities.addCommunityToList(data.community)
|
||||
|
||||
self.status.events.on(SignalType.MailserverRequestCompleted.event) do(e:Args):
|
||||
# TODO: if the signal contains a cursor, request additional messages
|
||||
# else:
|
||||
self.view.hideLoadingIndicator()
|
||||
|
||||
self.status.events.on(SignalType.MailserverRequestExpired.event) do(e:Args):
|
||||
# TODO: retry mailserver request up to N times or change mailserver
|
||||
# If > N, then
|
||||
self.view.hideLoadingIndicator()
|
||||
|
|
|
@ -446,9 +446,6 @@ QtObject:
|
|||
proc pushPinnedMessages*(self: ChatsView, pinnedMessages: var seq[Message]) =
|
||||
self.messageView.pushPinnedMessages(pinnedMessages)
|
||||
|
||||
proc hideLoadingIndicator*(self: ChatsView) {.slot.} =
|
||||
self.messageView.hideLoadingIndicator()
|
||||
|
||||
proc deleteMessage*(self: ChatsView, channelId: string, messageId: string): bool =
|
||||
result = self.messageView.deleteMessage(channelId, messageId)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import ../../../../../../app_service/service/community/service as community_serv
|
|||
import ../../../../../../app_service/service/chat/service as chat_service
|
||||
import ../../../../../../app_service/service/message/service as message_service
|
||||
import ../../../../../../app_service/service/eth/utils as eth_utils
|
||||
|
||||
import ../../../../../core/signals/types
|
||||
import ../../../../../core/eventemitter
|
||||
|
||||
export controller_interface
|
||||
|
@ -121,6 +121,15 @@ method init*(self: Controller) =
|
|||
return
|
||||
self.delegate.onHistoryCleared()
|
||||
|
||||
self.events.on(SignalType.HistoryRequestStarted.event) do(e: Args):
|
||||
self.delegate.setLoadingHistoryMessagesInProgress(true)
|
||||
|
||||
self.events.on(SignalType.HistoryRequestCompleted.event) do(e:Args):
|
||||
self.delegate.setLoadingHistoryMessagesInProgress(false)
|
||||
|
||||
self.events.on(SignalType.HistoryRequestFailed.event) do(e:Args):
|
||||
self.delegate.setLoadingHistoryMessagesInProgress(false)
|
||||
|
||||
method getMySectionId*(self: Controller): string =
|
||||
return self.sectionId
|
||||
|
||||
|
|
|
@ -155,8 +155,6 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
|||
if(not self.view.getInitialMessagesLoaded()):
|
||||
self.view.initialMessagesAreLoaded()
|
||||
|
||||
self.view.setLoadingHistoryMessagesInProgress(false)
|
||||
|
||||
method messageAdded*(self: Module, message: MessageDto) =
|
||||
let sender = self.controller.getContactDetails(message.`from`)
|
||||
|
||||
|
@ -289,3 +287,6 @@ method updateChatIdentifier*(self: Module) =
|
|||
self.view.model().removeItem(CHAT_IDENTIFIER_MESSAGE_ID)
|
||||
# Add new loaded messages
|
||||
self.view.model().appendItem(self.createChatIdentifierItem())
|
||||
|
||||
method setLoadingHistoryMessagesInProgress*(self: Module, isLoading: bool) =
|
||||
self.view.setLoadingHistoryMessagesInProgress(isLoading)
|
||||
|
|
|
@ -33,3 +33,6 @@ method onMessageEdited*(self: AccessInterface, message: MessageDto) {.base.} =
|
|||
|
||||
method updateChatIdentifier*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method setLoadingHistoryMessagesInProgress*(self: AccessInterface, isLoading: bool) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
|
|
@ -100,7 +100,6 @@ QtObject:
|
|||
self.loadingHistoryMessagesInProgressChanged()
|
||||
|
||||
proc loadMoreMessages*(self: View) {.slot.} =
|
||||
self.setLoadingHistoryMessagesInProgress(true)
|
||||
self.delegate.loadMoreMessages()
|
||||
|
||||
proc messageSuccessfullySent*(self: View) {.signal.}
|
||||
|
@ -124,4 +123,3 @@ QtObject:
|
|||
|
||||
proc editMessage*(self: View, messageId: string, updatedMsg: string) {.slot.} =
|
||||
self.delegate.editMessage(messageId, updatedMsg)
|
||||
|
||||
|
|
|
@ -351,16 +351,6 @@ Item {
|
|||
chatSectionModule: root.chatSectionModule
|
||||
}
|
||||
|
||||
// Not Refactored Yet
|
||||
// Connections {
|
||||
// target: root.rootStore.chatsModelInst.channelView
|
||||
// onActiveChannelChanged: {
|
||||
// root.rootStore.chatsModelInst.messageView.hideLoadingIndicator()
|
||||
// SelectedMessage.reset();
|
||||
// chatColumn.isReply = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
Connections {
|
||||
target: systemTray
|
||||
onMessageClicked: function () {
|
||||
|
|
|
@ -379,34 +379,17 @@ ColumnLayout {
|
|||
height: chatInput.height
|
||||
Layout.preferredHeight: height
|
||||
|
||||
// Not Refactored Yet
|
||||
// Connections {
|
||||
// target: chatContentRoot.rootStore.chatsModelInst.messageView
|
||||
// onLoadingMessagesChanged:
|
||||
// if(value){
|
||||
// loadingMessagesIndicator.active = true
|
||||
// } else {
|
||||
// timer.setTimeout(function(){
|
||||
// loadingMessagesIndicator.active = false;
|
||||
// }, 5000);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Not Refactored Yet
|
||||
// Loader {
|
||||
// id: loadingMessagesIndicator
|
||||
// active: chatContentRoot.rootStore.chatsModelInst.messageView.loadingMessages
|
||||
// sourceComponent: loadingIndicator
|
||||
// anchors.right: parent.right
|
||||
// anchors.bottom: chatInput.top
|
||||
// anchors.rightMargin: Style.current.padding
|
||||
// anchors.bottomMargin: Style.current.padding
|
||||
// }
|
||||
|
||||
// Component {
|
||||
// id: loadingIndicator
|
||||
// LoadingAnimation { }
|
||||
// }
|
||||
Loader {
|
||||
id: loadingMessagesIndicator
|
||||
active: messageStore.messageModule.loadingHistoryMessagesInProgress
|
||||
sourceComponent: LoadingAnimation { }
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: chatInput.top
|
||||
rightMargin: Style.current.padding
|
||||
bottomMargin: Style.current.padding
|
||||
}
|
||||
}
|
||||
|
||||
StatusChatInput {
|
||||
id: chatInput
|
||||
|
|
|
@ -257,10 +257,6 @@ Column {
|
|||
FetchMoreMessagesButton {
|
||||
nextMessageIndex: root.nextMessageIndex
|
||||
nextMsgTimestamp: root.nextMsgTimestamp
|
||||
onClicked: {
|
||||
// Not Refactored Yet - Should do it via messageStore
|
||||
// root.chatsModel.messageView.hideLoadingIndicator();
|
||||
}
|
||||
onTimerTriggered: {
|
||||
// Not Refactored Yet - Should do it via messageStore
|
||||
// root.chatsModel.requestMoreMessages(Constants.fetchRangeLast24Hours);
|
||||
|
|
Loading…
Reference in New Issue