User and profile
setUser, updateUser, and logout on MotiSig.shared for the iOS SDK.
All APIs below are on MotiSig.shared after MotiSig.initialize(...).
setUser(id:)
Registers the user with the MotiSig API (POST /users) with timezone and locale from TimeZone.current and Locale.current.
- If the server returns 409 Conflict, the SDK treats the user as already registered and continues.
- On success (including the 409 path), the user id is persisted locally.
- After the user id is set, the SDK will upsert a push subscription (APNs token plus permission and customer-enabled flag) when a device token is available (see Push notifications).
setUser runs on the SDK mutation queue relative to other mutations; see Getting started.
updateUser(firstName:lastName:email:)
Sends PATCH /users/{id} with only the fields allowed by the client API (name, email, timezone, locale). Only non-nil parameters are included; timezone and locale are refreshed from the current device values.
If no user is set, the method returns immediately without a network call.
logout()
- If both a persisted user id and APNs token exist, the SDK enqueues remove push subscription (
DELETE …/push-subscriptions) for that pair (captured before clearing storage). - Removes all notification listeners and clears the notification event buffer.
- Clears local SDK storage (user id, token, etc.).
Important: Other mutations already queued may still run afterward using user ids captured at enqueue time. The design intentionally avoids dropping in-flight work when logging out.