PredixMobilityConfiguration

@objc public class PredixMobilityConfiguration: NSObject

Static class of elements Predix Mobile SDK consumers can use to adjust to configure aspects of the SDK.

  • Indicates the SDK will automatically listen for Application state events. Defaults to true. If false, the container application is expected to call PredixMobilityManager’s application state methods such as applicationWillTerminate, applicationDidBecomeActive, etc.

    Declaration

    Swift

    public static var automaticallyListenForApplicationStateEvents = true
  • Specifies the default logging level to be used if no logging level configuration is found.

    Declaration

    Swift

    public static var defaultLoggingLevel: LoggerLevel = .info
  • Specifies the default database name to use. This value is overridden by the user’s information upon login, if a database name key is found within the user’s information.

    Default: pm

    Declaration

    Swift

    public static var defaultDatabaseName = "pm"
  • Specifies the authentication scheme to watch for during login. During authentication the user will login via a web page, this web page is then expected to redirect to a URL, in the format of ://

    Declaration

    Swift

    public static var authenticationScheme = "gepredixgo"
  • Specifies the authentication grant indicator hostname to watch for during login. During authentication the user will login via a web page, this web page is then expected to redirect to a URL, in the format of ://

    Declaration

    Swift

    public static var authenticationGrantIndicator = "authorization_grant"
  • Specifies the configuration key (as in a key/value pair) used to determine the logging level in either the info.plist or the settings bundle root.plist

    Default: logging_level

    Declaration

    Swift

    public static var loggingLevelConfigKey = "logging_level"
  • Specifies where the logging level configuration key/value should be found.

    Declaration

    Swift

    public static var loggingLevelConfigLocation = ConfigurationLocation.settings
  • Specifies the configuration key (as in a key/value pair) used to determine the Trace logging level logs all requests value is in either the info.plist or the settings bundle root.plist

    Default: traceLogsReqeuests

    Declaration

    Swift

    public static var traceLogsRequestsConfigKey = "traceLogsReqeuests"
  • Specifies where the Trace logging level logs all requests configuration key/value should be found.

    Declaration

    Swift

    public static var traceLogsRequestsConfigLocation = ConfigurationLocation.settings
  • Specifies the configuration key (as in a key/value pair) used to determine the server endpoint hostname in either the info.plist or the settings bundle root.plist.

    Default: server_url

    Declaration

    Swift

    public static var serverEndpointConfigKey = "server_url"
  • Specifies where the server endpoint hostname configuration key/value should be found.

    Declaration

    Swift

    public static var serverEndpointConfigLocation = ConfigurationLocation.settings
  • Base server endpoint URL, or nil if LoadConfiguration has not yet been called.

    Declaration

    Swift

    public static var serverEndpointURL: URL?
  • The server endpoint path used to retrieve user session information during the login process.

    Declaration

    Swift

    public static var userSessionURLPath = "/pg/session/active"
  • The server endpoint path used to initialize the login process and display the login page.

    Declaration

    Swift

    public static var loginURLPath = "/pg/session/create"
  • The server endpoint path used to log the user out and remove the current user session.

    Declaration

    Swift

    public static var logoutURLPath = "/pg/session/logout"
  • The server endpoint path used to syncronize the local database.

    Declaration

    Swift

    public static var dataReplicationURLPath = "/pg/data"
  • The server endpoinr path used to upload monitor logs and alerts

    Declaration

    Swift

    public static var clientMonitorURLPath = "/pg/monitor/v1/log"
  • The server endpoint path used to validate the user has a valid authenticated session.

    Declaration

    Swift

    public static var authorizationCheckURLPath = userSessionURLPath
  • The Http.StatusCode expected to be returned when calling the authorizationCheckURLPath, when the user has a valid authenticated session.

    Declaration

    Swift

    public static var authorizationCheckAuthorizedStatusCode = Http.StatusCode.ok
  • An array of Http.StatusCodes expected to be returned when calling the authorizationCheckURLPath, whether the user has an authenticated session or not. Any values returned from the authorizationCheckURLPath call other than these codes are interpreted as an error condition where the endpoint server is unavailable.

    Declaration

    Swift

    public static var authorizationCheckValidStatusCodes = [Http.StatusCode.ok, Http.StatusCode.found]
  • The key in the response JSON from the userSessionURLPath call that specifies the user name value. The value this key is associated with is expected to be a string.

    Default: name

    Declaration

    Swift

    public static var userSessionUsernameKey = "name"
  • The key in the response JSON from the userSessionURLPath call that specifies the database name value. The value this key is associated with is expected to be a string. If this property is nil, or not found in the user session information then defaultDatabaseName value is used for the database name.

    Default:db

    Declaration

    Swift

    public static var userSessionDatabaseNameKey: String? = "db"
  • Specifies the configuration key used to determine the PM app name to load in either the info.plist or the settings bundle root.plist This value is the name field in the app.json document loaded into the database with the PM cli define command.

    Default: pmapp_name

    Declaration

    Swift

    public static var pmappDocumentNameKey = "pmapp_name"
  • Specifies where the PM app name configuration key/value should be found.

    Declaration

    Swift

    public static var pmappDocumentNameConfigLocation = ConfigurationLocation.infoplist
  • Specifies the configuration key used to determine the PM app version to load in either the info.plist or the settings bundle root.plist This value is the version field in the app.json document loaded into the database with the PM cli define command.

    Default: pmapp_version

    Declaration

    Swift

    public static var pmappDocumentVersionKey = "pmapp_version"
  • Specifies where the PM app version configuration key/value should be found.

    Default: ConfigurationLocation.infoplist

    Declaration

    Swift

    public static var pmappDocumentVersionConfigLocation = ConfigurationLocation.infoplist
  • The key in the PM app document that determines the initial webapp to load into the container at startup.

    Default: starter

    Declaration

    Swift

    public static var pmAppDocumentWebAppNameKey = "starter"
  • The key in the PM app document that determines the offline authentication webapp to use during offline login.

    Default: offline

    Declaration

    Swift

    public static var pmAppDocumentOfflineAppNameKey = "offline"
  • The key in the PM app document that determines the available webapps array.

    Default: dependencies

    Declaration

    Swift

    public static var pmAppDocumentDependenciesKey = "dependencies"
  • The hostname to be used for Predix Mobile SDK service calls.

    Default: pmapi

    Declaration

    Swift

    public static var apiHostname = "pmapi"
  • The default error message used in the catastrophic error display that is shown to the user when no webapp can be loaded or the application cannot otherwise continue.

    Declaration

    Swift

    public static var seriousErrorDefaultMessage = "A serious error was encountered"
  • The Bundled HTML filename used for the catastrophic error display that is shown to the user when no webapp can be loaded or the application cannot otherwise continue. If this file is not found a native UI alert message will be used.

    Default: SeriousError.html

    Declaration

    Swift

    public static var seriousErrorPage = "SeriousError.html"
  • A closure that, if supplied, is run during the boot/restart service call. This can be used to perform additional container work that should be performed when the system is restarting.

    Declaration

    Swift

    public static var additionalBootRestartWorkflow : ((_ onComplete: ()->Void)->Void)?
  • An array of services that should be registered during the boot process.

    Declaration

    Swift

    public static var additionalBootServicesToRegister: [ServiceProtocol.Type] = []
  • Specifies the SDK will trap and log unhandled errors before the container crashes.

    Declaration

    Swift

    public static var shouldLogUnhandledErrors = true
  • Specifies the SDK will automatically import default values from the Settings bundle into standard UserDefaults

    Default: true

    Declaration

    Swift

    public static var shouldInitializeDefaultsFromSettings = true
  • Specifies the SDK will attempt to detect URL requests for placeholder images from http://placehold.it and issue a warning log entry when detected

    Default: true

    Declaration

    Swift

    public static var shouldIssueWarningsForPlaceholderURLs = true
  • Specifies the SDK will require the device to have a passcode set to proceed during the Boot service startup process.

    Default:* true

    Declaration

    Swift

    public static var requireDevicePasscodeSet = true
  • Specifies the key to use in NSUserDefaults to determine if the server endpoint has changed. When the server endpoint changes, as detected via this key, all user data is wiped from the device.

    Declaration

    Swift

    public static var defaultInitializationDetectionKey = PredixMobilityConfiguration.previousServerEndpointKey
  • Specifies the default to indicate a watcher will log all networks requests for the app.

    Default:* false

    Declaration

    Swift

    public static var traceLogsAllRequestsDefault = false
  • Optionally specifies maximum depth of a document’s revision tree (or, max length of its revision history.) Revisions older than this limit will be deleted when the database is compacted during when DB service close operation is called. Smaller values save space, at the expense of making document conflicts somewhat more likely. If unspecified it currently defaults to 20.

    Declaration

    Swift

    public static var documentRevisionMaxDepth: UInt?
  • Specifies an app-specific data that should be included when the device registers for push notificiations.

    Declaration

    Swift

    public static var remoteNotificationRegistrationAdditionalInfo: [String: Any] = [:]
  • the format of the document id to use when registering for push notifications.

    Declaration

    Swift

    public static var remoteNotificationRegistrationDocumentId = "doc_RNR_\(PredixMobilityConfiguration.identifierForVendor)"
  • the document type used for the push notification registratino document.

    Declaration

    Swift

    public static var remoteNotificationRegistrationDocumentType = "RemoteNotificationRegistration"
  • Optional settings used to tweak the behavior of push (client to server) data replication

    Declaration

    Swift

    public static var replicationAdditionalPushSettings: [String: Any] = [:]
  • Optional settings used to tweak the behavior of pull (server to client) data replication

    Declaration

    Swift

    public static var replicationAdditionalPullSettings: [String: Any] = [:]
  • While Online and Authenticated, if replication is encountering continuous errors, after this number of consecutive errors replication will be paused for a period of time as specified by PredixMobilityConfiguration.replicationFailureRetryRecoveryTime.

    Changes to connectivity state will reset the error count.

    Declaration

    Swift

    public static var replicationFailureMaxRetryAttempts = 10
  • After PredixMobilityConfiguration.replicationFailureRetryAttempts have been surpased, replication will pause for this time interval before resuming.

    Changes to connectivity state will invalidate the timer.

    Declaration

    Swift

    public static var replicationFailureRetryRecoveryTime: TimeInterval = 300.0
  • An array of view definitions, consisting of a view name, version, and closure that maps the view. The methods appendDataViewDefinition(…) are a helper method to append new definitions to this array.

    Declaration

    Swift

    public static var dataViewDefinitions: [ViewDefinition] = []
  • A dictionary of replication push filter definitions, whose key is the name of the filter, and value is a PushReplicationFilter closure that determines if the document should be pushed to the server during replication.

    Declaration

    Swift

    public static var pushReplicationFilterDefinitions: [String :PushReplicationFilter] = [:]
  • The name of a PushReplicationFilter, as setup in pushReplicationFilterDefinitions, to use when replication is initially setup

    Declaration

    Swift

    public static var defaultPushReplicationFilterName: String?
  • Dictionary of filter parameters to use when replication is initially setup

    Declaration

    Swift

    public static var defaultPushReplicationFilterParameters: [String: Any] = [:]
  • List of channels used to restrict data coming from the server when replication is initially setup

    Declaration

    Swift

    public static var defaultPullReplicationChannels: [String]?
  • Optional keychain access group. If provided this group will be used for all keychain access.

    Declaration

    Swift

    public static var keychainAccessGroup: String?
  • Specifies the prefix to use for keychain storage keys.

    Declaration

    Swift

    public static var keychainKeyPrefix: String = { return PredixMobilityConfiguration.getKeychainPrefix() }()
  • Provides a short string of version information of the running app, the Predix Mobile SDK, and some of its dependent components.

    Declaration

    Swift

    public static var versionInfo: String
  • Specifies that when the SDK detects the ApplicationDidBecomeActive application state, the SDK can start interacting with the UI immediately. If the consuming app wants finer control over when the UI is ready for SDK interaction, it can set this flag to false, and manually post the UIReadyNotification to inform the SDK when the UI is ready for interaction.

    Declaration

    Swift

    public static var considerUIReadyWhenApplicationDidBecomeActive = true
  • This closure allows the implementation of the non-web based serious error pages to be overridden.

    In iOS the default implementation shows a UIAlertController with the error details.

    In the macOS version of the SDK there is no default implementation.

    Important

    macOS containers must include a web-based serious error page, or should implement this closure.

    Declaration

    Swift

    public static var displaySeriousErrorPopup : (_ errorMessage: String, _ onRetry: @escaping () -> Void) -> Void = ShowSeriousErrorHelper.displaySeriousErrorPopupiOS
  • File system URL under which the SDK uses for all application storage.

    Declaration

    Swift

    public static var localStorageURL: URL
  • File system URL under which the SDK uses for all application storage for the current logged in user. Nil until after authentication completes.

    Declaration

    Swift

    public static var userLocalStorageURL: URL?
  • Secondary database to use for hybrid UI data: webapp documents and pm app documents.

    If nil the system will use a single database for all data.

    If a directory named hybridUIDatabaseName.cblite2 containing a sql lite database exists in the application bundle, then this database will be used as an inital data source.

    When a hybrid UI database is used, application loading will not wait for the main data database to sync before launching the hybrid ui webapp.

    Example:

    PredixMobilityManager.hybridUIDatabaseName = "hybridui"
    

    Declaration

    Swift

    public static var hybridUIDatabaseName: String?
  • Specifies the configuration key (as in a key/value pair) used to determine the name of the hybrid UI database in either the info.plist or the settings bundle root.plist

    Declaration

    Swift

    public static var hybridUIDatabaseNameConfigKey = "HybridDatabaseName"
  • Specifies where the hybrid UI database name configuration key/value should be found.

    Default: Info.plist

    Declaration

    Swift

    public static var hybridUIDatabaseNameConfigLocation = ConfigurationLocation.infoplist
  • Works with hybridUIDatabaseName to allow the hybrid UI web elements to be updated dynamically.

    Allowing replication of hybrid UI data allows for easy updates during development, or for creating an Enterprise app that supports dynamic updates.

    Behaviors:

    true: On application start, the database named in PredixMobilityConfiguration.hybridUIDatabaseName will be refreshed from the backend sync gateway. Application loading will wait until this database has synced, but will not wait for the main data database to sync.

    false: No replication will be performed to update the hybridUIDatabaseName database. This database is expected to be included in the application bundle. Application loading will not wait for the main data database to sync.

    Attention

    Must be false for any App Store production system.

    Default: true

    Declaration

    Swift

    public static var hybridUIAllowUpdates: Bool = true
  • Specifies the configuration key (as in a key/value pair) used to determine state of the hybridUIAllowUpdates configuration in either the info.plist or the settings bundle root.plist

    Declaration

    Swift

    public static var hybridUIAllowUpdatesConfigKey = "HybridUIAllowUpdates"
  • Specifies where the hybridUIAllowUpdates configuration key/value should be found.

    Default: Info.plist

    Declaration

    Swift

    public static var hybridUIAllowUpdatesConfigLocation = ConfigurationLocation.infoplist
  • When enabled the client will monitor and trace conditions in database and on other features in the SDK. These monitor logs will be reported to the backend client monitor. Alert conditions detected by the client will be reported to the Predix NOC as an alert. Clients can also choose to send logs for their applications. Please visit the Mobile MonitorMonitor class for more inforamtion.

    Default: false

    Declaration

    Swift

    public static var clientMonitoringEnabled: Bool = false
  • By default monitor logs are only sent when a user logs in for the first time when enabled. Setting this flag to true will send monitor logs when the monitor is quite for a period of time.

    Default: false

    Declaration

    Swift

    public static var clientMonitorSendsLogsContinuously: Bool = false
  • The time in seconds the monitor should wait to see if more monitor data comes in before sending the monitor logs to the server

    NOTE: This configuration is only valid if clientMonitoringEnabled and clientMonitorSendsLogsContinuously is enabled

    Default: 10 seconds

    Declaration

    Swift

    public static var clientMonitorLogBatchWriteToDiskDelay: TimeInterval = 10
  • TODO temporary var, remove me please!!!!!!

    Declaration

    Swift

    public static var clientMonitorHostAndEnpointOverride: String?
  • If the default AuthenticationManager setup is used, this flag allows the Offline webapp to use TouchId for authentication, in place of the offline password.

    Declaration

    Swift

    public static var offlineWebAppLoginUseTouchId = false
  • The time in seconds the monitor should wait to see if more alerts happen before sending the alert to the server

    NOTE: This configuration is only valid if clientMonitoringEnabled is enabled

    Default: 30 seconds

    Declaration

    Swift

    public static var clientMonitorTransmitDelay: TimeInterval = 30
  • Tells the SDK to initialize, load configuration from settings, prepare the logging system, and prepare the SDK for startup. If not called by the time PredixMobilityManager.startApp is called, it will be called at that time.

    Declaration

    Swift

    public static func loadConfiguration()
  • Helper method takes a view name and version, and map function closure, creates a ViewDefinition and adds it to the dataViewDefinitions property.

    Declaration

    Swift

    public static func appendDataViewDefinition(_ viewName: String, version: String, mapFunction:@escaping (_ properties: [String : Any], _ emit: (Any, Any?)->Void)->Void)
  • Helper method takes a view name and version, and map function closure, and reduce function closure, creates a ViewDefinition and adds it to the dataViewDefinitions property.

    Declaration

    Swift

    public static func appendDataViewDefinition(_ viewName: String, version: String, mapFunction:@escaping (_ properties: [String : Any], _ emit: (Any, Any?)->Void)->Void, reduceFunction: ((_ keys: [Any], _ values: [Any], _ re: Bool) -> (Any))?)
  • Adds a ViewDefinition to the dataViewDefinitions property

    Declaration

    Swift

    public static func appendDataViewDefinition(_ viewDefinition: ViewDefinition)
  • Adds a filter for Push replication, consisting of a filter name, and a closure called to determine if a given document should be sent to the server.

    Declaration

    Swift

    public static func addPushReplicationFilter(name: String, filter: @escaping PushReplicationFilter)
  • Returns a dictionary containing version information of the app, the SDK, and dependent components, as well as some basic environmental information for the current device.

    Declaration

    Swift

    public static func getVersionInfo() -> [String: String]
  • Removes all data associated with the app, including the local database and keychain entries.

    Declaration

    Swift

    public static func wipeApplicationData()