Skip to main content

TSMessage

The TSMessage module provides a comprehensive interface for managing message notifications on connected devices. It enables applications to query supported notification types, retrieve current notification settings, configure which notifications should be enabled or disabled, and monitor real-time changes to notification preferences.

Prerequisites

  • TopStepComKit iOS SDK must be properly integrated into your project
  • The connected device must support message notification functionality
  • You must have the appropriate permissions to access and modify device notification settings
  • A valid connection to the device must be established before calling any message notification methods

Data Models

TSMessageModel

Message notification configuration model used to manage device message notification settings.

PropertyTypeDescription
typeTSMessageTypeThe message notification type, see TSMessageType enumeration for available types
enableBOOLWhether this notification type is enabled; YES to enable, NO to disable

Enumerations

TSMessageType

Message notification types supported by the device. Each type represents a specific notification category.

ValueRaw ValueDescription
TSMessage_Total0Total number of message types
TSMessage_Phone1Phone call notifications
TSMessage_Messages2SMS notifications
TSMessage_WeChat3WeChat notifications
TSMessage_QQ4QQ notifications
TSMessage_Facebook5Facebook notifications
TSMessage_Twitter6Twitter notifications
TSMessage_Instagram7Instagram notifications
TSMessage_Skype8Skype notifications
TSMessage_WhatsApp9WhatsApp notifications
TSMessage_Line10Line notifications
TSMessage_KakaoTalk11KakaoTalk notifications
TSMessage_Email12Email notifications
TSMessage_Messenger13Facebook Messenger notifications
TSMessage_Zalo14Zalo notifications
TSMessage_Telegram15Telegram notifications
TSMessage_Viber16Viber notifications
TSMessage_NateOn17NateOn notifications
TSMessage_Gmail18Gmail notifications
TSMessage_Calendar19Calendar notifications
TSMessage_DailyHunt20DailyHunt notifications
TSMessage_Outlook21Outlook notifications
TSMessage_Yahoo22Yahoo notifications
TSMessage_Inshorts23Inshorts notifications
TSMessage_Phonepe24Phonepe notifications
TSMessage_Gpay25Google Pay notifications
TSMessage_Paytm26Paytm notifications
TSMessage_Swiggy27Swiggy notifications
TSMessage_Zomato28Zomato notifications
TSMessage_Uber29Uber notifications
TSMessage_Ola30Ola notifications
TSMessage_ReflexApp31ReflexApp notifications
TSMessage_Snapchat32Snapchat notifications
TSMessage_YtMusic33YouTube Music notifications
TSMessage_YouTube34YouTube notifications
TSMessage_LinkEdin35LinkedIn notifications
TSMessage_Amazon36Amazon notifications
TSMessage_Flipkart37Flipkart notifications
TSMessage_NetFlix38Netflix notifications
TSMessage_Hotstar39Hotstar notifications
TSMessage_AmazonPrime40Amazon Prime notifications
TSMessage_GoogleChat41Google Chat notifications
TSMessage_Wynk42Wynk notifications
TSMessage_GoogleDrive43Google Drive notifications
TSMessage_Dunzo44Dunzo notifications
TSMessage_Gaana45Gaana notifications
TSMessage_MissCall46Missed call notifications
TSMessage_WhatsAppBusiness47WhatsApp Business notifications
TSMessage_Dingtalk48Dingtalk notifications
TSMessage_Tiktok49TikTok notifications
TSMessage_Lyft50Lyft notifications
TSMessage_GoogleMaps51Google Maps notifications
TSMessage_Slack52Slack notifications
TSMessage_MicrosoftTeams53Microsoft Teams notifications
TSMessage_MormaiiSmartwatches54Mormaii Smartwatches notifications
TSMessage_Reddit55Reddit notifications
TSMessage_Discord56Discord notifications
TSMessage_Gojek57Gojek notifications
TSMessage_Lark58Lark notifications
TSMessage_Garb59Garb notifications
TSMessage_Shopee60Shopee notifications
TSMessage_Tokopedia61Tokopedia notifications
TSMessage_Hinge62Hinge notifications
TSMessage_Myntra63Myntra notifications
TSMessage_Meesho64Meesho notifications
TSMessage_Zivame65Zivame notifications
TSMessage_Ajio66Ajio notifications
TSMessage_Urbanic67Urbanic notifications
TSMessage_Nykaa68Nykaa notifications
TSMessage_Healthifyme69Healthifyme notifications
TSMessage_Cultfit70Cultfit notifications
TSMessage_Flo71Flo notifications
TSMessage_Bumble72Bumble notifications
TSMessage_Tira73Tira notifications
TSMessage_Hike74Hike notifications
TSMessage_AppleMusic75Apple Music notifications
TSMessage_Zoom76Zoom notifications
TSMessage_Fastrack77Fastrack notifications
TSMessage_TitanSmartWorld78Titan Smart World notifications
TSMessage_Pinterest79Pinterest notifications
TSMessage_Alipay80Alipay notifications
TSMessage_FaceTime81FaceTime notifications
TSMessage_Hangouts82Hangouts notifications
TSMessage_VK83VK notifications
TSMessage_Weibo84Weibo notifications
TSMessage_Other85Other app notifications

Callback Types

TSMessageListBlock

Callback block invoked when retrieving or modifying message notification lists.

typedef void(^TSMessageListBlock)(NSArray<TSMessageModel *> * _Nullable notifications, NSError * _Nullable error);
ParameterTypeDescription
notificationsNSArray<TSMessageModel *> *Array of message models; nil if operation fails
errorNSError *Error information if operation fails; nil on success

API Reference

Create a message model with specified type

+ (instancetype)modelWithType:(TSMessageType)type;
ParameterTypeDescription
typeTSMessageTypeThe message type to create model for

Return Value: instancetype — A new TSMessageModel instance with the specified type (enable property defaults to NO)

Code Example:

TSMessageModel *model = [TSMessageModel modelWithType:TSMessage_WeChat];
TSLog(@"Created model with type: %ld, enable: %d", (long)model.type, model.isEnable);

Create a message model with specified type and enable status

+ (instancetype)modelWithType:(TSMessageType)type enable:(BOOL)enable;
ParameterTypeDescription
typeTSMessageTypeThe message type to create model for
enableBOOLWhether the message type is enabled

Return Value: instancetype — A new TSMessageModel instance with the specified type and enable status

Code Example:

TSMessageModel *model = [TSMessageModel modelWithType:TSMessage_WeChat enable:YES];
TSLog(@"Created model: type=%ld, enable=%d", (long)model.type, model.isEnable);

Get the list of enabled messages

- (void)getMessageEnableList:(nullable TSMessageListBlock)completion;
ParameterTypeDescription
completionTSMessageListBlockCompletion callback returning array of message models and error information

Code Example:

id<TSMessageInterface> messageInterface = (id<TSMessageInterface>)device;
[messageInterface getMessageEnableList:^(NSArray<TSMessageModel *> * _Nullable notifications, NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to get message enable list: %@", error.localizedDescription);
return;
}

TSLog(@"Retrieved %lu message notification settings:", (unsigned long)notifications.count);
for (TSMessageModel *model in notifications) {
TSLog(@"Type: %ld, Enabled: %d", (long)model.type, model.isEnable);
}
}];

Set the list of enabled messages

- (void)setMessageEnableList:(NSArray<TSMessageModel *> *)messages
completion:(TSCompletionBlock)completion;
ParameterTypeDescription
messagesNSArray<TSMessageModel *> *Array of message models with desired enable status
completionTSCompletionBlockCompletion callback returning operation success status and error information

Code Example:

id<TSMessageInterface> messageInterface = (id<TSMessageInterface>)device;

NSMutableArray<TSMessageModel *> *messagesToSet = [NSMutableArray array];
[messagesToSet addObject:[TSMessageModel modelWithType:TSMessage_WeChat enable:YES]];
[messagesToSet addObject:[TSMessageModel modelWithType:TSMessage_Phone enable:NO]];
[messagesToSet addObject:[TSMessageModel modelWithType:TSMessage_Messages enable:YES]];

[messageInterface setMessageEnableList:messagesToSet completion:^(NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to set message enable list: %@", error.localizedDescription);
return;
}
TSLog(@"Message enable list updated successfully");
}];

Get the list of supported messages

- (void)getSupportMessageList:(nullable TSMessageListBlock)completion;
ParameterTypeDescription
completionTSMessageListBlockCompletion callback returning array of supported message models and error information

Code Example:

id<TSMessageInterface> messageInterface = (id<TSMessageInterface>)device;
[messageInterface getSupportMessageList:^(NSArray<TSMessageModel *> * _Nullable notifications, NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to get supported message list: %@", error.localizedDescription);
return;
}

TSLog(@"Device supports %lu message types:", (unsigned long)notifications.count);
for (TSMessageModel *model in notifications) {
TSLog(@"Supported type: %ld", (long)model.type);
}
}];

Register for message notification changes

- (void)registerMessageDidChanged:(nullable TSMessageListBlock)messageDidChangedBlock;
ParameterTypeDescription
messageDidChangedBlockTSMessageListBlockCallback invoked when notification settings change on device or app side

Code Example:

id<TSMessageInterface> messageInterface = (id<TSMessageInterface>)device;
[messageInterface registerMessageDidChanged:^(NSArray<TSMessageModel *> * _Nullable notifications, NSError * _Nullable error) {
if (error) {
TSLog(@"Error observing message changes: %@", error.localizedDescription);
return;
}

TSLog(@"Message notification settings changed:");
for (TSMessageModel *model in notifications) {
TSLog(@"Type: %ld, Enable: %d", (long)model.type, model.isEnable);
}
}];

Important Notes

  1. Always check the error parameter in completion blocks before processing the returned data; a nil error indicates successful operation while a non-nil error indicates failure.

  2. When calling setMessageEnableList:completion:, ensure the messages array is not empty; passing an empty array will result in a parameter error.

  3. The enable property of TSMessageModel uses a getter method isEnable to retrieve its value; use model.isEnable or model.enable to access this property.

  4. Message notification changes can be triggered either by the device itself or by the connected application; register the change callback early to capture all modifications.

  5. The getSupportMessageList: method is not yet fully supported and will be implemented in a future SDK version.

  6. Use modelWithType: for creating models with default disabled status or modelWithType:enable: when you need to specify both type and enable status during model creation.

  7. The TSMessage_Total type with value 0 represents the total count of message types and is not a valid notification type to enable or disable.