PredixMobilityManager
@objc public class PredixMobilityManager: NSObject
Predix Mobile SDK main manager class
Controls the interface between the container application and the SDK.
-
Shared instance - invalid until init is called.
Important
init must be called before sharedInstance.Declaration
Swift
public static var sharedInstance: PredixMobilityManager
-
The PredixAppWindowProtocol object responsible for webapp UI display
Declaration
Swift
public internal(set) var packageWindow: PredixAppWindowProtocol
-
True if the authentication UI is currently being displayed
Declaration
Swift
public var isShowingAuthentication: Bool
-
Application Delegates for App lifecycle events and notifications
Declaration
Swift
public var applicationDelegates: ApplicationDelegateHandlers
-
The
AuthenticationManager
used for authenticationDeclaration
Swift
public private(set) var authenticationManager: AuthenticationManager!
-
Initializes the Predix Mobile SDK
Declaration
Swift
public init(authenticationManager: AuthenticationManager, packageWindow: PredixAppWindowProtocol)
Parameters
authenticationManager
AuthenticationManager
object responsible for authentication.packageWindow
The PredixAppWindowProtocol object responsible for webapp UI display
-
Initializes the Predix Mobile SDK
Declaration
Swift
public init(packageWindow: PredixAppWindowProtocol, presentAuthentication: @escaping (_ packageWindow: PredixAppWindowProtocol) -> PredixAppWindowProtocol, dismissAuthentication: @escaping (_ authenticationWindow: PredixAppWindowProtocol) -> Void)
Parameters
packageWindow
The PredixAppWindowProtocol object responsible for webapp UI display
presentAuthentication
Closure that will be called when the SDK needs the container to present the authentication UI to the user. The packageWindow object is provided to this closure. The consuming container app should return a PredixAppWindowProtocol object that controls the authentication UI.
dismissAuthentication
Closure that will be called when the SDK needs the container to dismiss the authentication UI. The PredixAppWindowProtocol object passed to the SDK during presentAuthentication will be provided.
authenticationWindow
Parameter to dismissAuthentication closure, the PredixAppWindowProtocol object passed to the SDK during presentAuthentication
-
Starts the Predix Mobile SDK application, loading configuration and calling the boot service when the UI is ready.
Declaration
Swift
public func startApp()
-
Starts the boot service, with appropriate handling using the Serious Error Page for boot service errors.
Declaration
Swift
public func callBootService(withPath: String = "start")
-
Helper to show the Serious Error Page with the provided message string.
Declaration
Swift
public func ShowUserError(_ msg: String)
Parameters
msg
String message to show in the error UI.
-
Adds a translation for native notifications for easier consuming by JavaScript.
Listens for notifications, and re-posts notifications after running a closure that can translate a notification object into a more JSON consumable format.
Declaration
Swift
public func addTranslation(forNotification: Notification.Name, asNotification: Notification.Name, translation: @escaping (Notification) -> ([String : Any]?))
Parameters
forNotification
Name of the notification to translate
asNotification
Name to re-post the notification after translation
translation
Closure to call to transform the notification data from the original Notification into a JSON consumable format.
-
Removes a notification translation.
Declaration
Swift
public func removeTranslation(forNotification: Notification.Name)
Parameters
forNotification
Name of the notification translation to remove.
-
Indicates authentication has completed, and the running authentication service should complete processing.
Generally authentication completion is automatically detected, but in some instances, like authentication failure, it may be necessary for the UI to explicity inform the SDK that the authentication process has completed.
Declaration
Swift
public func authenticationComplete()