From bf324f273a2f75f3e3509a61225843bc2c79b6af Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Fri, 16 Dec 2022 15:59:36 +0100 Subject: [PATCH] refactor: use service defined signals instead of SignalType --- src/app/modules/main/chat_section/controller.nim | 7 ++----- src/app_service/service/mailservers/service.nim | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/modules/main/chat_section/controller.nim b/src/app/modules/main/chat_section/controller.nim index 616e0dfc01..f7480f2ee6 100644 --- a/src/app/modules/main/chat_section/controller.nim +++ b/src/app/modules/main/chat_section/controller.nim @@ -233,15 +233,12 @@ proc init*(self: Controller) = let args = ContactsStatusUpdatedArgs(e) self.delegate.contactsStatusUpdated(args.statusUpdates) - self.events.on(SignalType.HistoryRequestStarted.event) do(e: Args): + self.events.on(SIGNAL_MAILSERVER_HISTORY_REQUEST_STARTED) do(e: Args): self.delegate.setLoadingHistoryMessagesInProgress(true) - self.events.on(SignalType.HistoryRequestCompleted.event) do(e:Args): + self.events.on(SIGNAL_MAILSERVER_HISTORY_REQUEST_COMPLETED) do(e:Args): self.delegate.setLoadingHistoryMessagesInProgress(false) - self.events.on(SignalType.HistoryRequestFailed.event) do(e:Args): - discard - proc getMySectionId*(self: Controller): string = return self.sectionId diff --git a/src/app_service/service/mailservers/service.nim b/src/app_service/service/mailservers/service.nim index 63ef9f0257..f3c446aee3 100644 --- a/src/app_service/service/mailservers/service.nim +++ b/src/app_service/service/mailservers/service.nim @@ -42,6 +42,8 @@ const SIGNAL_ACTIVE_MAILSERVER_CHANGED* = "activeMailserverChanged" const SIGNAL_MAILSERVER_AVAILABLE* = "mailserverAvailable" const SIGNAL_MAILSERVER_NOT_WORKING* = "mailserverNotWorking" const SIGNAL_MAILSERVER_SYNCED* = "mailserverSynced" +const SIGNAL_MAILSERVER_HISTORY_REQUEST_STARTED* = "historyRequestStarted" +const SIGNAL_MAILSERVER_HISTORY_REQUEST_COMPLETED* = "historyRequestCompleted" const requestMoreMessagesTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} = let arg = decode[RequestMoreMessagesTaskArg](argEncoded) @@ -171,10 +173,12 @@ QtObject: self.events.on(SignalType.HistoryRequestStarted.event) do(e: Args): let h = HistoryRequestStartedSignal(e) info "history request started", numBatches=h.numBatches + self.events.emit(SIGNAL_MAILSERVER_HISTORY_REQUEST_STARTED, Args()) self.events.on(SignalType.HistoryRequestCompleted.event) do(e: Args): let h = HistoryRequestCompletedSignal(e) info "history request completed" + self.events.emit(SIGNAL_MAILSERVER_HISTORY_REQUEST_COMPLETED, Args()) self.events.on(SignalType.HistoryRequestFailed.event) do(e: Args): let h = HistoryRequestFailedSignal(e)