Application State
Launch Sequence
When an application launches, it firstly runs the standard OS launch sequence:
After the OS launch sequence has completed, control is delegated to the RootViewController.
RootViewController is an iOS class. RootActivity is the equivalent Android class.
RootViewController
The RootViewController will attach or detach different view controllers (activities) depending on the application's state and the user's session:
- Logged In State
- Data Preloading State
- Data Preloaded State
- Logged Out State
Application State Flow
Scene Transitions
The following code example demonstrates the mechanism for changing scenes in CC6.
Scene Transition Example (Router)
import CCComponent
import CCSchema
import UIKit
class ApproveRejectOrderRouter: NSObject, AttachmentRouter, CCComponent.ApproveRejectOrderRouter {
weak var viewController: UIViewController!
var dataStore: ApproveRejectOrderInOut?
func routeToHome() {
viewController.navigationController?.popToRootViewController(animated: true)
}
func routeToViewOrdersForApprovalRoute() {
viewController.navigationController?.popViewController(animated: true)
}
func routeToApproveRejectOrderDetail(purchaseOrderLineUUID: UUIDString) {
let destinationViewController: ApproveRejectOrderDetailViewController = viewController.instantiateViewController()
destinationViewController.router?.dataStore?.purchaseOrderLineUUID = purchaseOrderLineUUID
viewController.show(destinationViewController, sender: self)
}
}
Scene Transition Example (Segue)
func openInventoryInquiry() {
performSegue(withIdentifier: InventoryInquiryViewController.segueIdentifier, sender: self)
}
func prepareForSegue(to inventoryInquiryViewController: InventoryInquiryViewController?, mode: InventoryInquiryMode? = nil) {
inventoryInquiryViewController?.requestingViewController = self
inventoryInquiryViewController?.mode = mode ?? InventoryInquiryMode(callingViewController: self)
}
Standard Scenes
Login Scene
The login scene is responsible for obtaining a session with Cantara for the provided login credentials. It also handles the preloading of media upload queues as these can be attached to the user's sessions.
Login Scene
Settings Scene
The settings scene displays the runtime configurable app settings. For more information about app settings, refer to App Configuration Data Definitions. This scene can display both general and application-specific settings.
Loading Scene
The loading scene is responsible for handling any data preloading that needs to be done before the user can use the application.
Information about the different types of application data is described in Application Data below.
Application Data
Foundation Data
Foundation data persists between user sessions. We should aim to only reload this data if it does not exist, the user has requested it be reloaded, or it is considered to be out of date.
- Foundation data does not change often
- Foundation data is not tied to a user's session (i.e not affected by JDE row security)
For example, UserDefinedCodes can be considered as foundation data, as they are very rarely updated.
Dynamic Data
Dynamic data is data that should be reloaded after a user logs in.
Note
A login is different from a user reestablishing their session due to a timeout.
- Dynamic data is tied to a user's session general because of JDE row security
- Dynamic data changes often
Within the dynamic data set we can also have branch related data.
Branch Related Data
Branch related data is tied to a specific branch within JDE. The branch data ties back to a user's default branch, along with toggling what branches one should load data for.
Default Branch:
A user's default branch is configured in User Preferences. It determines the default branch we should use in picker views or any other text input fields that are related to a branch and need auto filling. For example, in inventory transfer the from branch will always default to the user's default branch.