track action fixes

This commit is contained in:
Pfeil, Scott Robert 2020-03-17 13:48:34 -04:00
parent ddfeb9cd35
commit 8243820f85
3 changed files with 20 additions and 9 deletions

View File

@ -8,9 +8,9 @@
import UIKit import UIKit
open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate { @objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate {
public var pageType: String? @objc public var pageType: String?
public var loadObject: MVMCoreLoadObject? @objc public var loadObject: MVMCoreLoadObject?
public var pageModel: MVMControllerModelProtocol? public var pageModel: MVMControllerModelProtocol?
/// Set if this page is containted in a manager. /// Set if this page is containted in a manager.
@ -208,6 +208,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
} }
} }
// Eventually will be moved to server
open func isMasterInitiallyAccessible() -> Bool { open func isMasterInitiallyAccessible() -> Bool {
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false { if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
return false return false
@ -215,6 +216,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
return MVMCoreUISession.sharedGlobal()?.launchAppLoadedSuccessfully ?? false return MVMCoreUISession.sharedGlobal()?.launchAppLoadedSuccessfully ?? false
} }
// Eventually will be moved to server
open func isSupportInitiallyAccessible() -> Bool { open func isSupportInitiallyAccessible() -> Bool {
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false { if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
return false return false
@ -226,6 +228,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
return loadObject?.pageJSON?.lenientBoolForKey("showRightPanel") ?? false return loadObject?.pageJSON?.lenientBoolForKey("showRightPanel") ?? false
} }
// Eventually will be moved to separate button in navigation item model
open func isOverridingRightButton() -> Bool { open func isOverridingRightButton() -> Bool {
guard let rightPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("rightPanelButtonLink") else { guard let rightPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("rightPanelButtonLink") else {
return false return false
@ -234,6 +237,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
return true return true
} }
// Eventually will be moved to separate button in navigation item model
open func isOverridingLeftButton() -> Bool { open func isOverridingLeftButton() -> Bool {
guard let leftPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("leftPanelButtonLink") else { guard let leftPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("leftPanelButtonLink") else {
return false return false
@ -242,6 +246,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
return true return true
} }
// Eventually will be moved to Model
open func showBottomProgressBar() { open func showBottomProgressBar() {
if MVMCoreUISplitViewController.main()?.getCurrentVisibleController() == self, if MVMCoreUISplitViewController.main()?.getCurrentVisibleController() == self,
let progressString = loadObject?.pageJSON?.optionalStringForKey(KeyProgressPercent), let progressString = loadObject?.pageJSON?.optionalStringForKey(KeyProgressPercent),
@ -265,6 +270,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "View Controller Loaded : \(self)") MVMCoreLoggingHandler.logDebugMessage(withDelegate: "View Controller Loaded : \(self)")
// We use our own margins.
viewRespectsSystemMinimumLayoutMargins = false viewRespectsSystemMinimumLayoutMargins = false
// Presents from the bottom. // Presents from the bottom.
@ -312,7 +318,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
if manager == nil { if manager == nil {
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
//MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self) MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
} }
} }
@ -340,8 +346,9 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
if initialLoadFinished { if initialLoadFinished {
set(navigationController: manager.navigationController) set(navigationController: manager.navigationController)
} }
// Janky way to track current page.
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
//MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self) MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
} }
// MARK: - MVMCoreActionDelegateProtocol // MARK: - MVMCoreActionDelegateProtocol
@ -351,6 +358,10 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
MVMCoreActionHandler.defaultHandleOpenPage(for: requestParameters, additionalData: additionalData, delegateObject: selfDelegateObject) MVMCoreActionHandler.defaultHandleOpenPage(for: requestParameters, additionalData: additionalData, delegateObject: selfDelegateObject)
} }
open func logAction(withActionInformation actionInformation: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?) {
MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: self, actionInformation: actionInformation, additionalData: additionalData)
}
// MARK: - MoleculeDelegateProtocol // MARK: - MoleculeDelegateProtocol
open func getModuleWithName(_ name: String?) -> [AnyHashable : Any]? { open func getModuleWithName(_ name: String?) -> [AnyHashable : Any]? {
guard let name = name else { return nil } guard let name = name else { return nil }

View File

@ -29,9 +29,7 @@ import UIKit
guard newValue != oldValue, guard newValue != oldValue,
let self = self, let self = self,
let index = self.dropDown.pickerData.firstIndex(of: newValue), let index = self.dropDown.pickerData.firstIndex(of: newValue),
let dropListItemJSON = (self.listItemModel as? DropDownListItemModel).toJSON(), let model = self.listItemModel as? DropDownListItemModel
let json2d = dropListItemJSON.optionalArrayForKey("molecules") as? [[[AnyHashable: Any]]],
!json2d.isEmpty && !(json2d.first?.isEmpty ?? false)
else { return } else { return }
if self.previousIndex != NSNotFound { if self.previousIndex != NSNotFound {

View File

@ -183,6 +183,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
} }
} }
guard indexPaths.count > 0 else { return }
self.tableView?.insertRows(at: indexPaths, with: animation) self.tableView?.insertRows(at: indexPaths, with: animation)
self.updateViewConstraints() self.updateViewConstraints()
self.view.layoutIfNeeded() self.view.layoutIfNeeded()
@ -200,6 +201,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
} }
} }
guard indexPaths.count > 0 else { return }
tableView?.deleteRows(at: indexPaths, with: animation) tableView?.deleteRows(at: indexPaths, with: animation)
updateViewConstraints() updateViewConstraints()
view.layoutIfNeeded() view.layoutIfNeeded()