Nonstop Kotlin SDK

Users

Login

login should be called whenever a user Registers or Signs In via OneID, after the call to create or update the user in ShowMS.

Thus the flow is:

OneID Success -> ShowMS Success -> Nonstop Success -> Control Returned to Client

In order to call login, create a UserInput model:

    val signUpRequest = UserInput(
                            "showms-user-id",
                            "Dave",
                            "dave@stormideas.com",
                            "1988-01-19"
                        )
  • firstName - Should be the users first name as returned by OneID
  • externalId - Should be the ShowMS User ID
  • email - Email address from OneID, this will be securely hashed and it used to find the user in the admin for customer service scenarios
  • birthday - The user's birthday as returned from OneID in the format 'YYYY-MM-DD'

And pass this into the login function:

    Nonstop.login(signUpRequest)
            .doOnSubscribe {
                // Track disposable
                disposables.add(it)
            }.subscribe({
                // Nonstop user successfully logged in
            }, {
                // Error logging in Nonstop user
            })

If the user should gain a reward by logging in then the SDK will play the appropriate animation before handing control back to the calling app.

Note: You can optionally pass an additional parameter:

    Nonstop.login(signUpRequest, true)

To suppress any Reward Animation as a result of login. The main use case for this is when already logged in existing users need to be logged into Nonstop in the background as part of the upgrade path.

On error the client should message the user and offer to retry.

The createdUser object returned with Success will have details of logged in user's:

  • id
  • name
  • points

But there should be no need to store this on the client app. While logged in the current user can be accessed via the SDK at all times via:

Is Connected

You can ask whether there is a currently logged in user via:

    Nonstop.isConnected()

This should be used for Session Management scenarios.

Current User

You can access the currently logged in User via:

    Nonstop.getCurrentUser()

Logout

logout should be called whenever a user logs out of OneID.

    Nonstop.logout()
        .doOnSubscribe {
            // Track disposable
            disposables.add(it)
        }.subscribe({
            // Nonstop user successfully logged out
        }, {
            // Error logging out
        })

No action is required for either Success or Error, other than logging if required.

In this document