@interface Teak

TODO!

Methods

- identifyUser:

Tell Teak how to identify the current user.

- (void)identifyUser:(NSString *)userId;

This will also begin tracking and reporting of a session, and track a daily active user. This functionality is also accessable from the C API:

extern void TeakIdentifyUser(const char* userId,
                             const char* userConfigurationJson);

This should be how you identify the user in your back-end.

Parameters

Name Description

userId

The string Teak should use to identify the current user.

- identifyUser:withEmail:

Use identifyUser:withConfiguration: instead

Tell Teak how to identify the current user.

- (void)identifyUser:(NSString *)userId
           withEmail:(NSString *)email;

This will also begin tracking and reporting of a session, and track a daily active user. This functionality is also accessable from the C API:

extern void TeakIdentifyUser(const char* userId,
                             const char* userConfigurationJson);

This should be how you identify the user in your back-end.

Parameters

Name Description

userId

The string Teak should use to identify the current user.

email

The email address for the current user.

- identifyUser:withOptOutList:

Use identifyUser:withConfiguration: instead

Tell Teak how to identify the current user, with data collection opt-out.

- (void)identifyUser:(NSString *)userId
      withOptOutList:(NSArray *)optOut;

This will also begin tracking and reporting of a session, and track a daily active user. This functionality is also accessable from the C API:

extern void TeakIdentifyUser(const char* userId,
                             const char* userConfigurationJson);

This should be how you identify the user in your back-end.

Parameters

Name Description

userId

The string Teak should use to identify the current user.

optOut

A list containing zero or more of: TeakOptOutIdfa, TeakOptOutPushKey, TeakOptOutFacebook

- identifyUser:withOptOutList:andEmail:

Use identifyUser:withConfiguration: instead

Tell Teak how to identify the current user, with data collection opt-out.

- (void)identifyUser:(NSString *)userId
      withOptOutList:(NSArray *)optOut
            andEmail:(NSString *)email;

This will also begin tracking and reporting of a session, and track a daily active user. This functionality is also accessable from the C API:

extern void TeakIdentifyUser(const char* userId,
                             const char* userConfigurationJson);

This should be how you identify the user in your back-end.

Parameters

Name Description

userId

The string Teak should use to identify the current user.

optOut

A list containing zero or more of: TeakOptOutIdfa, TeakOptOutPushKey, TeakOptOutFacebook

email

The email address for the current user.

- identifyUser:withConfiguration:

Tell Teak how to identify the current user, with data collection opt-out.

- (void)identifyUser:(NSString *)userIdentifier
   withConfiguration:(TeakUserConfiguration *)userConfiguration;

This will also begin tracking and reporting of a session, and track a daily active user. This functionality is also accessable from the C API:

extern void TeakIdentifyUser(const char* userId,
                             const char* userConfigurationJson);

This should be how you identify the user in your back-end.

Parameters

Name Description

userIdentifier

The string Teak should use to identify the current user.

userConfiguration

Additional configuration for the current user.

- logout

Logout the current user.

- (void)logout;

- refreshPushTokenIfAuthorized

If the user has authorized push notifications, manually refresh the push token.

- (void)refreshPushTokenIfAuthorized;

This is used in conjunction with the TeakDoNotRefreshPushToken Plist configuration flag. If TeakDoNotRefreshPushToken is false, or not present, you do not need to call this method.

- deleteEmail

Delete any email address associated with the current user.

- (void)deleteEmail;

- trackEventWithActionId:forObjectTypeId:andObjectInstanceId:

Track an arbitrary event in Teak.

- (void)trackEventWithActionId:(NSString *)actionId
               forObjectTypeId:(NSString *)objectTypeId
           andObjectInstanceId:(NSString *)objectInstanceId;

Parameters

Name Description

actionId

The identifier for the action, e.g. 'complete'.

objectTypeId

The type of object that is being posted, e.g. 'quest'.

objectInstanceId

The specific instance of the object, e.g. 'gather-quest-1'

- incrementEventWithActionId:forObjectTypeId:andObjectInstanceId:count:

Increment an arbitrary event in Teak.

- (void)incrementEventWithActionId:(NSString *)actionId
                   forObjectTypeId:(NSString *)objectTypeId
               andObjectInstanceId:(NSString *)objectInstanceId
                             count:(int64_t)count;

Parameters

Name Description

actionId

The identifier for the action, e.g. 'complete'.

objectTypeId

The type of object that is being posted, e.g. 'quest'.

objectInstanceId

The specific instance of the object, e.g. 'gather-quest-1'

count

The amount by which to increment.

- notificationState

Push notification authorization state.

- (TeakNotificationState)notificationState;

Return

Notification state, see: TeakNotificationState

If they have disabled push notifications, you can prompt them to re-enable and use openSettingsAppToThisAppsSettings to open the Settings app.

- canOpenSettingsAppToThisAppsSettings

Can Settings.app be opened to the settings for this application.

- (BOOL)canOpenSettingsAppToThisAppsSettings;

Return

YES if Settings.app can be opened to the settings for this application.

This is YES for all versions of iOS.

- openSettingsAppToThisAppsSettings

Open Settings.app to the settings for this application.

- (BOOL)openSettingsAppToThisAppsSettings;

Return

YES if Settings.app was opened.

- canOpenNotificationSettings

Open can Settings.app be opened to the notification settings for this application.

- (BOOL)canOpenNotificationSettings;

Return

YES if Settings.app can be opened to the notification settings for this application.

- openNotificationSettings

Open Settings.app to the notification settings for this application.

- (BOOL)openNotificationSettings;

Return

YES if Settings.app was opened.

This is only available on iOS 15.4 and greater, it will return NO on incompatible versions of iOS.

- setApplicationBadgeNumber:

Set the badge number on the icon of the application.

- (void)setApplicationBadgeNumber:(int)count;

Parameters

Name Description

count

The number that should be displayed on the icon.

- setNumericAttribute:forKey:

Track a numeric player profile attribute.

- (void)setNumericAttribute:(double)value
                     forKey:(NSString *)key;

This functionality is also accessable from the C API:

extern void TeakSetNumericAttribute(const char* cstr_key,
                                    double value);

Parameters

Name Description

value

The numeric value to assign.

key

The name of the numeric attribute.

- setStringAttribute:forKey:

Track a string player profile attribute.

- (void)setStringAttribute:(NSString *)value
                    forKey:(NSString *)key;

This functionality is also accessable from the C API:

extern void TeakSetStringAttribute(const char* cstr_key,
                                   const char* cstr_value);

Parameters

Name Description

value

The string value to assign.

key

The name of the string attribute.

- getDeviceConfiguration

Get Teak’s configuration data about the current device.

- (NSString *)getDeviceConfiguration;

Return

JSON string containing device info, or null if it’s not ready

- getAppConfiguration

Get Teak’s configuration data about the current app.

- (NSString *)getAppConfiguration;

Return

JSON string containing device info, or null if it’s not ready

- channelCategories

Get the current set of channel opt out categories.

- (NSArray *)channelCategories;

Return

NSArray<TeakChannelCategory*> if TeakConfigurationData has posted, otherwise nil.

This will be null if TeakConfigurationData has not yet posted.This functionality is also accessible from the C API: extern NSArray* TeakGetChannelCategories();

- processDeepLinks

Process deep links.

- (void)processDeepLinks;

Deep links will be processed the sooner of:

  • The user has been identified

  • This method is called

- handleDeepLinkPath:

Manually pass Teak a deep link path to handle.

- (BOOL)handleDeepLinkPath:(NSString *)path;

Return

true if the deep link was found and handled.

This path should be prefixed with a forward slash, and can contain query parameters, e.g.

/foo/bar?fizz=buzz

It should not contain a host, or a scheme.

This function will only execute deep links that have been defined through Teak. It has no visibility into any other SDKs or custom code.

Parameters

Name Description

path

The deep link path to process.

- setState:forChannel:

Assign the opt-out state to a Teak Marketing Channel.

- (TeakOperation *)setState:(NSString *)state
                 forChannel:(NSString *)channel;

Return

A TeakOperation which contains the status and result of the call.

You may only assign the values TeakChannelStateOptOut or TeakChannelStateAvailable to channels.

Parameters

Name Description

state

The state to assign to the channel.

channel

The channel for which the opt-out state is being assigned.

- setState:forChannel:andCategory:

Assign the opt-out state to a Teak Marketing Category pair.

- (TeakOperation *)setState:(NSString *)state
                 forChannel:(NSString *)channel
                andCategory:(NSString *)category;

Return

A TeakOperation which contains the status and result of the call.

You may only assign the values TeakChannelStateOptOut or TeakChannelStateAvailable to categories.

Parameters

Name Description

state

The state to assign to the channel.

channel

The channel for which the opt-out state is being assigned.

category

The category

Static Methods

+ initForApplicationId:withClass:andApiKey:

Set up Teak in a single function call.

+ (void)initForApplicationId:(NSString *)appId
                   withClass:(Class)appDelegateClass
                   andApiKey:(NSString *)apiKey;

This function must be called from no other place than main() in your application’s 'main.m' or 'main.mm' file before UIApplicationMain() is called. Ex:

int main(int argc, char *argv[])
{
  @autoreleasepool {
    // Add this line here.
    [Teak initForApplicationId:@"your_app_id"
                     withClass:[YourAppDelegate class]
                     andApiKey:@"your_api_key"];

    return UIApplicationMain(argc, argv, nil,
        NSStringFromClass([YourAppDelegate class]));
  }
}

This functionality is also accessable from the C API:

extern void Teak_Plant(Class appDelegateClass,
                       NSString* appId,
                       NSString* appSecret);

Parameters

Name Description

appId

Teak Application Id

appDelegateClass

Class of your application delegate, ex: [YourAppDelegate class].

apiKey

Your Teak API key.

+ sharedInstance

Teak singleton.

+ (Teak *)sharedInstance;

+ isTeakNotification:

Returns true if the notification was sent by Teak.

+ (BOOL)isTeakNotification:(UNNotification *)notification;

Parameters

Name Description

notification

+ didReceiveNotificationResponse:withCompletionHandler:

If you are setting your own UNNotificationCenter delegate, then you need to call this method from your handler.

+ (BOOL)didReceiveNotificationResponse:(UNNotificationResponse *)response
                 withCompletionHandler:(void(^)(void))completionHandler;

If this method returns true, do not call the completion handler yourself.

Parameters

Name Description

response

completionHandler

+ willPresentNotification:withCompletionHandler:

If you are setting your own UNNotificationCenter delegate, then you need to call this method from your handler.

+ (BOOL)willPresentNotification:(UNNotification *)notification
          withCompletionHandler:(void(^)(UNNotificationPresentationOptions))completionHandler;

If this method returns true, do not call the completion handler yourself.

Parameters

Name Description

notification

completionHandler

Properties

Name Type Description Access

sdkVersion

NSString *

Teak SDK Version.

Get

enableDebugOutput

BOOL

Is debug logging enabled.

Get

enableRemoteLogging

BOOL

Is remote logging enabled.

Get

logListener

TeakLogListener

The active log listener.

Get