Digital PCT265 defect CXTDT-546577 - Track UI updates from module changes.
This commit is contained in:
parent
70bc766c41
commit
c48eab03ec
@ -22,7 +22,8 @@ public protocol MoleculeDelegateProtocol: AnyObject {
|
|||||||
/// Notifies the delegate that the molecule layout update. Should be called when the layout may change due to an async method. Mainly used for list or collections.
|
/// Notifies the delegate that the molecule layout update. Should be called when the layout may change due to an async method. Mainly used for list or collections.
|
||||||
func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) //optional
|
func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) //optional
|
||||||
|
|
||||||
func replaceMoleculeData(_ moleculeModels: [MoleculeModelProtocol])
|
/// Attempts to replace the molecules provided. Returns the ones that replaced successfully.
|
||||||
|
func replaceMoleculeData(_ moleculeModels: [MoleculeModelProtocol], completionHandler: (([MoleculeModelProtocol])->Void)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension MoleculeDelegateProtocol {
|
extension MoleculeDelegateProtocol {
|
||||||
|
|||||||
@ -511,7 +511,7 @@ import MVMCore
|
|||||||
// Needed otherwise when subclassed, the extension gets called.
|
// Needed otherwise when subclassed, the extension gets called.
|
||||||
open func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) { }
|
open func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) { }
|
||||||
|
|
||||||
public func replaceMoleculeData(_ moleculeModels: [MoleculeModelProtocol]) {
|
public func replaceMoleculeData(_ moleculeModels: [MoleculeModelProtocol], completionHandler: (([MoleculeModelProtocol])->Void)? = nil) {
|
||||||
pageUpdateQueue.addOperation {
|
pageUpdateQueue.addOperation {
|
||||||
let replacedModels:[MoleculeModelProtocol] = moleculeModels.compactMap { model in
|
let replacedModels:[MoleculeModelProtocol] = moleculeModels.compactMap { model in
|
||||||
guard self.attemptToReplace(with: model) else {
|
guard self.attemptToReplace(with: model) else {
|
||||||
@ -524,6 +524,7 @@ import MVMCore
|
|||||||
self.updateUI(for: replacedModels)
|
self.updateUI(for: replacedModels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
completionHandler?(replacedModels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public class ReplaceableMoleculeBehavior: PageMoleculeTransformationBehavior {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if moleculeModels.count > 0 {
|
if moleculeModels.count > 0 {
|
||||||
delegateObject?.moleculeDelegate?.replaceMoleculeData(moleculeModels)
|
delegateObject?.moleculeDelegate?.replaceMoleculeData(moleculeModels, completionHandler: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,8 +95,11 @@ public class ReplaceableMoleculeBehavior: PageMoleculeTransformationBehavior {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if modules.count > 0 {
|
guard modules.count > 0 else { return }
|
||||||
delegateObject?.moleculeDelegate?.replaceMoleculeData(modules)
|
delegateObject?.moleculeDelegate?.replaceMoleculeData(modules) { replacedModels in
|
||||||
|
let modules = replacedModels.compactMap { modulesLoaded.dictionaryForKey($0.id) }
|
||||||
|
guard let viewController = self.delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return }
|
||||||
|
modules.forEach { MVMCoreUILoggingHandler.shared()?.defaultLogPageUpdate(forController: viewController, from: $0) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,4 +13,7 @@
|
|||||||
|
|
||||||
// Action Logging
|
// Action Logging
|
||||||
@objc open func defaultLogAction(forController controller: MVMCoreViewControllerProtocol?, actionInformation: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?) { }
|
@objc open func defaultLogAction(forController controller: MVMCoreViewControllerProtocol?, actionInformation: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?) { }
|
||||||
|
|
||||||
|
// Module Update Logging
|
||||||
|
@objc open func defaultLogPageUpdate(forController controller: MVMCoreViewControllerProtocol, from module: [AnyHashable: Any]) { }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user