Skip to content

Account Types

mcecunda edited this page Nov 3, 2023 · 6 revisions

Account type

CM SDK can contain multiple activated Accounts in same application. By running activation multiple times, several accounts will be created. Every account has some type. Activated accounts can be organized in groups, which are called AccountTypes.

AccountType contains unique identification - type, backend endpoints and tenant identification. Accounts with the same AccountType share their configuration.

Application can use AccountTypeManager to get instances of existing types, or store modified configuration for existing account type.

val server = "test.case.server.com"
val networkConfigJSON = """
    {
        "endpoints": {
            "casemsNoAuth":"https://$server/casems/v4/",
            "casemsAuth":"https://$server/casems/v4/"
        }
    }
"""
val network = CMNetworkConfig(JSONObject(networkConfigJSON))
val type = CMAccountType("com.case.mobile", network)

val manager = CMAccountTypeManager(context)
manager.put(type)

iOS:

let server = "test.case.server.com"
let endpoint = "https://\(server)/casems/v4"
let casemsNoAuthUrl = URL(string: endpoint)!
let casemsAuthUrl = URL(string: endpoint)!
let networkConfig = NetworkConfig(endpointURLAuth: casemsAuthUrl, endpointURLNoAuth: casemsNoAuthUrl)
let accountType = AccountType(type: "com.case.mobile", tenant: nil, networkConfig: networkConfig!)

AccountTypeManager().put(accountType)

Next up: User authentication

Clone this wiki locally