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