Digital PCT265 story DE307-731: Earlier behavior application. Sumanth catch.
This commit is contained in:
parent
7a4984f2d8
commit
2ce7a7dbc6
@ -146,6 +146,11 @@ import MVMCore
|
||||
do {
|
||||
let template = try parsePageJSON(loadObject: loadObject)
|
||||
pageModel = template // TODO: Eventually this page parsing should be done outside of this class and then set by the caller. For now, double duty.
|
||||
// Needed for PageMoleculeTransformationBehavior + PageLocalDataShareBehavior behaviors.
|
||||
if let behaviorContainer = template as? (PageBehaviorContainerModelProtocol & TemplateModelProtocol) {
|
||||
var behaviorHandler = self
|
||||
behaviorHandler.applyBehaviors(pageBehaviorModel: behaviorContainer)
|
||||
}
|
||||
isFirstRender = true // Assuming this is only on the first page load from the handler. Might need to revist later.
|
||||
if let backgroundRequest = loadObject.requestParameters?.backgroundRequest, !backgroundRequest, let pageType, let identifier = loadObject.identifier {
|
||||
MVMCoreLoggingHandler.shared()?.logCoreEvent(.pageProcessingComplete(pageType: pageType, requestUUID: identifier, webUrl: nil))
|
||||
@ -230,11 +235,11 @@ import MVMCore
|
||||
open func handleNewData(_ pageModel: PageModelProtocol? = nil, shouldTriggerRender: Bool = true) {
|
||||
|
||||
guard var newPageModel = pageModel ?? self.pageModel else { return }
|
||||
let originalModel = isFirstRender ? nil : self.pageModel as? MVMControllerModelProtocol
|
||||
let originalModel = self.pageModel as? MVMControllerModelProtocol
|
||||
|
||||
// Refresh our behaviors if there is a page change.
|
||||
// Refresh our behaviors if there is a page change. Originally set up in shouldFinishProcessingLoad.
|
||||
if let behaviorContainer = newPageModel as? (PageBehaviorContainerModelProtocol & TemplateModelProtocol),
|
||||
(originalModel == nil || originalModel!.id != behaviorContainer.id) {
|
||||
(originalModel == nil || originalModel!.id != behaviorContainer.id) {
|
||||
var behaviorHandler = self
|
||||
behaviorHandler.applyBehaviors(pageBehaviorModel: behaviorContainer)
|
||||
}
|
||||
@ -277,7 +282,6 @@ import MVMCore
|
||||
let allUpdatedMolecules = behaviorUpdatedModels //+ pageUpdatedModels
|
||||
|
||||
// Notify the manager of new data.
|
||||
// Warning: Some flows cause table reloads. Until the UI update is decoupled, should be after the updateUI.
|
||||
manager?.newDataReceived?(in: self)
|
||||
|
||||
guard shouldTriggerRender else { return }
|
||||
|
||||
@ -41,7 +41,7 @@ public extension PageBehaviorHandlerProtocol {
|
||||
// Apply them to the page.
|
||||
self.behaviors = behaviors.count > 0 ? behaviors : nil
|
||||
|
||||
// Ask the session to apply any more. (Curently inverted contol due to Swift <--> Obj-C conflict.
|
||||
// Ask the session to apply any more. (Currently inverted contol due to Swift <--> Obj-C conflict.)
|
||||
if let viewController = self as? UIViewController {
|
||||
MVMCoreUISession.sharedGlobal()?.applyGlobalBehaviors(to: viewController)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user