Theymes class.
ImportantBefore you can use any other functions of the SDK, you must initialize it. See Installing the SDK for more information.
Initialization
initialize
Initializes the SDK with the given token and domain. You can optionally pass anoptions dictionary to override the SDK API domain.
- Swift
- Objective-C
Opening and closing
openSupport
Opens the help center. Optionally pass a config dictionary to customize it. See Configuring the SDK for more information.- Swift
- Objective-C
openResource
Opens a specific resource from Theymes (e.g. an article or collector). You can get the resource identifier from the Theymes application.- Swift
- Objective-C
close
Closes the help center or resource that was opened withopenSupport or openResource. Normally the user sees a close button; use this to close programmatically.
- Swift
- Objective-C
Notifications
Notifications can be shown when there’s a new message in the user’s open tickets. Typically you would call
enableNotifications() when transitioning to menus or other screens, and disableNotifications() when transitioning to gameplay. Notifications are disabled by default.requestNotificationPermission
Requests permission to show notifications. Call as part of your app initialization flow.- Swift
- Objective-C
enableNotifications
Enables in-game notifications to be shown to the player.- Swift
- Objective-C
disableNotifications
Disables in-game notifications.- Swift
- Objective-C
getUnreadMessageCount
Returns the number of unread messages. You can use this to show a badge or indicator in your UI.- Swift
- Objective-C
getUnansweredMessageCount
Returns the number of unanswered messages. You can use this to show a badge or indicator in your UI.- Swift
- Objective-C
registerPushToken
Registers a device push token with Theymes. UsePushTokenType.apns for Apple Push Notification service or PushTokenType.fcm for Firebase Cloud Messaging. See Push notifications for more information.
You can pass either a string (e.g. FCM token) or the raw device token data from didRegisterForRemoteNotificationsWithDeviceToken (APNs); the SDK converts the latter to the expected string format internally.
- Swift
- Objective-C
handlePendingNotificationAction
Handles a pending notification action when the user tapped a push notification while the app was in the background. Call this when your app becomes active (e.g. inapplicationDidBecomeActive). See Push notifications for more information.
- Swift
- Objective-C
hasPendingNotificationAction
Returns whether there is a pending notification action to handle.- Swift
- Objective-C
Config
getLanguage / setLanguage
Get or set the language in which the help center will be displayed.- Swift
- Objective-C
getPlayer / setPlayer
Get or set the player information. See Configuring the SDK for more information.- Swift
- Objective-C
getSignedMetadataToken / setSignedMetadataToken
Get or set the signed metadata token for Player Verification.- Swift
- Objective-C
Tags
Tags can be used to send additional information to Theymes. The tag must be configured in the Theymes application first or it will be ignored.getTags / setTags
- Swift
- Objective-C
addTag / addTags
- Swift
- Objective-C
removeTag / removeTags / removeAllTags
- Swift
- Objective-C
Breadcrumbs
Breadcrumbs are short diagnostic messages that are timestamped automatically and sent when opening support or a resource. They are kept in memory only and are cleared byclearBreadcrumbs() and reset().
addBreadcrumb / addBreadcrumbs
- Swift
- Objective-C
clearBreadcrumbs
- Swift
- Objective-C
Fields
Fields are key-value pairs that can be used to send additional information to Theymes. Values can be booleans, strings, numbers, or arrays of strings. The field must be configured in the Theymes application first or it will be ignored.getFields / setFields
- Swift
- Objective-C
addField / addFields
- Swift
- Objective-C
removeField / removeFields / removeAllFields
- Swift
- Objective-C
Privacy
isYoungPlayer / setYoungPlayer
Setting the player as a young player also enables privacy mode and lets support agents know they are talking to a young player.- Swift
- Objective-C
isPrivacyMode / setPrivacyMode
- Swift
- Objective-C
Other
isSupported
Returns whether the help center is supported on the current device (iOS 14+).- Swift
- Objective-C
getSdkVersion
Returns the version of the SDK.- Swift
- Objective-C
reset
Resets the SDK to its initial state (clears player, fields, tags and breadcrumbs). Useful for logout flows.- Swift
- Objective-C
enableLogging / disableLogging
- Swift
- Objective-C
Events (Delegate)
iOS uses a delegate instead of events. SetTheymes.delegate to an object that conforms to TheymesDelegate. All delegate methods are optional. Callbacks are invoked on the main thread.
- Swift
- Objective-C
didUpdateSignedMetadataTokenExpiration(_:) is called only when a signed metadata token is set. It is called immediately when the app comes to the foreground and then once a minute while the app stays in the foreground. The delegate method receives the remaining expiration time in seconds. If the token is already expired, the value is 0 or negative. Your game decides when to refresh the token based on this value. The value is calculated from the client’s clock, so if the clock is not in sync, the reported expiration time is skewed too.