mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-22 04:21:44 +00:00
Registering context property moved from constructor to the load method for each module.
This commit is contained in:
parent
cc20c234e0
commit
a945275d3f
@ -2,6 +2,7 @@ import NimQml
|
||||
import io_interface
|
||||
import ../io_interface as delegate_interface
|
||||
import view, controller
|
||||
import ../../../../app/boot/global_singleton
|
||||
|
||||
import ../../../../app_service/service/chat/service as chat_service
|
||||
import ../../../../app_service/service/community/service as community_service
|
||||
@ -34,6 +35,14 @@ method delete*(self: Module) =
|
||||
self.controller.delete
|
||||
|
||||
method load*(self: Module) =
|
||||
if(self.controller.isCommunity()):
|
||||
singletonInstance.engine.setRootContextProperty("communitySectionModule",
|
||||
self.viewVariant)
|
||||
else:
|
||||
singletonInstance.engine.setRootContextProperty("chatSectionModule",
|
||||
self.viewVariant)
|
||||
|
||||
self.controller.init()
|
||||
self.view.load()
|
||||
|
||||
method isLoaded*(self: Module): bool =
|
||||
|
@ -39,8 +39,6 @@ proc newModule*[T](delegate: T,
|
||||
result.viewVariant = newQVariant(result.view)
|
||||
result.controller = controller.newController(result, communityService)
|
||||
|
||||
singletonInstance.engine.setRootContextProperty("mainModule", result.viewVariant)
|
||||
|
||||
# Submodules
|
||||
result.chatSectionModule = chat_section_module.newModule(result, "chat",
|
||||
false, chatService, communityService)
|
||||
@ -60,6 +58,8 @@ method delete*[T](self: Module[T]) =
|
||||
self.controller.delete
|
||||
|
||||
method load*[T](self: Module[T]) =
|
||||
singletonInstance.engine.setRootContextProperty("mainModule", self.viewVariant)
|
||||
self.controller.init()
|
||||
self.view.load()
|
||||
|
||||
let chatSectionItem = initItem("chat", ChatSectionType.Chat.int, "Chat", "",
|
||||
|
@ -1,7 +1,6 @@
|
||||
import NimQml
|
||||
import io_interface, view, controller
|
||||
|
||||
#import ../../../../app_service/service/community/service as community_service
|
||||
import ../../../../app/boot/global_singleton
|
||||
|
||||
export io_interface
|
||||
|
||||
@ -28,6 +27,10 @@ method delete*[T](self: Module[T]) =
|
||||
self.controller.delete
|
||||
|
||||
method load*[T](self: Module[T]) =
|
||||
singletonInstance.engine.setRootContextProperty("loginModule", self.viewVariant)
|
||||
self.controller.init()
|
||||
self.view.load()
|
||||
|
||||
self.moduleLoaded = true
|
||||
self.delegate.loginDidLoad()
|
||||
|
||||
|
@ -41,8 +41,6 @@ proc newModule*[T](delegate: T):
|
||||
result.viewVariant = newQVariant(result.view)
|
||||
result.controller = controller.newController[Module[T]](result)
|
||||
|
||||
singletonInstance.engine.setRootContextProperty("startupModule", result.viewVariant)
|
||||
|
||||
# Submodules
|
||||
result.onboardingModule = onboarding_module.newModule[Module[T]](result)
|
||||
result.loginModule = login_module.newModule[Module[T]](result)
|
||||
@ -55,6 +53,8 @@ method delete*[T](self: Module[T]) =
|
||||
self.controller.delete
|
||||
|
||||
method load*[T](self: Module[T]) =
|
||||
singletonInstance.engine.setRootContextProperty("startupModule", self.viewVariant)
|
||||
self.controller.init()
|
||||
self.view.load()
|
||||
|
||||
method viewDidLoad*[T](self: Module[T]) =
|
||||
|
@ -1,7 +1,6 @@
|
||||
import NimQml
|
||||
import io_interface, view, controller
|
||||
|
||||
#import ../../../../app_service/service/community/service as community_service
|
||||
import ../../../../app/boot/global_singleton
|
||||
|
||||
export io_interface
|
||||
|
||||
@ -28,6 +27,10 @@ method delete*[T](self: Module[T]) =
|
||||
self.controller.delete
|
||||
|
||||
method load*[T](self: Module[T]) =
|
||||
singletonInstance.engine.setRootContextProperty("onboardingModule", self.viewVariant)
|
||||
self.controller.init()
|
||||
self.view.load()
|
||||
|
||||
self.moduleLoaded = true
|
||||
self.delegate.onboardingDidLoad()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user