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
open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate {
public var pageType: String?
public var loadObject: MVMCoreLoadObject?
@objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate {
@objc public var pageType: String?
@objc public var loadObject: MVMCoreLoadObject?
public var pageModel: MVMControllerModelProtocol?
/// 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 {
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
return false
@ -215,6 +216,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
return MVMCoreUISession.sharedGlobal()?.launchAppLoadedSuccessfully ?? false
}
// Eventually will be moved to server
open func isSupportInitiallyAccessible() -> Bool {
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
return false
@ -226,6 +228,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
return loadObject?.pageJSON?.lenientBoolForKey("showRightPanel") ?? false
}
// Eventually will be moved to separate button in navigation item model
open func isOverridingRightButton() -> Bool {
guard let rightPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("rightPanelButtonLink") else {
return false
@ -234,6 +237,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
return true
}
// Eventually will be moved to separate button in navigation item model
open func isOverridingLeftButton() -> Bool {
guard let leftPanelLink = loadObject?.pageJSON?.optionalDictionaryForKey("leftPanelButtonLink") else {
return false
@ -242,6 +246,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
return true
}
// Eventually will be moved to Model
open func showBottomProgressBar() {
if MVMCoreUISplitViewController.main()?.getCurrentVisibleController() == self,
let progressString = loadObject?.pageJSON?.optionalStringForKey(KeyProgressPercent),
@ -265,6 +270,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
// Do any additional setup after loading the view.
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "View Controller Loaded : \(self)")
// We use our own margins.
viewRespectsSystemMinimumLayoutMargins = false
// Presents from the bottom.
@ -278,7 +284,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
// Handle data on load
handleNewData()
view.setNeedsLayout()
}
@ -312,7 +318,7 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
if manager == nil {
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 {
set(navigationController: manager.navigationController)
}
// Janky way to track current page.
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
//MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
}
// MARK: - MVMCoreActionDelegateProtocol
@ -351,6 +358,10 @@ open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMC
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
open func getModuleWithName(_ name: String?) -> [AnyHashable : Any]? {
guard let name = name else { return nil }

View File

@ -29,9 +29,7 @@ import UIKit
guard newValue != oldValue,
let self = self,
let index = self.dropDown.pickerData.firstIndex(of: newValue),
let dropListItemJSON = (self.listItemModel as? DropDownListItemModel).toJSON(),
let json2d = dropListItemJSON.optionalArrayForKey("molecules") as? [[[AnyHashable: Any]]],
!json2d.isEmpty && !(json2d.first?.isEmpty ?? false)
let model = self.listItemModel as? DropDownListItemModel
else { return }
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.updateViewConstraints()
self.view.layoutIfNeeded()
@ -200,6 +201,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
}
}
guard indexPaths.count > 0 else { return }
tableView?.deleteRows(at: indexPaths, with: animation)
updateViewConstraints()
view.layoutIfNeeded()