TUIContact
The following will guide you through how to hide the contact setting options.
Hide contact setting options
API Function: Hide Contact Settings Options. This setting is effective for all contacts.
API prototype:
// TUIContactConfig.swiftpublic struct TUIContactConfigItem: OptionSet {public let rawValue: Intpublic init(rawValue: Int) {self.rawValue = rawValue}public static let none = TUIContactConfigItem([])public static let alias = TUIContactConfigItem(rawValue: 1 << 0)public static let muteAndPin = TUIContactConfigItem(rawValue: 1 << 1)public static let background = TUIContactConfigItem(rawValue: 1 << 2)public static let block = TUIContactConfigItem(rawValue: 1 << 3)public static let clearChatHistory = TUIContactConfigItem(rawValue: 1 << 4)public static let delete = TUIContactConfigItem(rawValue: 1 << 5)public static let addFriend = TUIContactConfigItem(rawValue: 1 << 6)}/*** Hide items in contact config interface.*/public func hideItemsInContactConfig(_ items: TUIContactConfigItem) {hideContactAlias = items.contains(.alias)hideContactMuteAndPinItems = items.contains(.muteAndPin)hideContactBackgroundItem = items.contains(.background)hideContactBlock = items.contains(.block)hideContactClearChatHistory = items.contains(.clearChatHistory)hideContactDelete = items.contains(.delete)hideContactAddFriend = items.contains(.addFriend)}
// TUIContactConfig.htypedef NS_OPTIONS(NSInteger, TUIContactConfigItem) {TUIContactConfigItem_None = 0,TUIContactConfigItem_Alias = 1 << 0,TUIContactConfigItem_MuteAndPin = 1 << 1,TUIContactConfigItem_Background = 1 << 2,TUIContactConfigItem_Block = 1 << 3,TUIContactConfigItem_ClearChatHistory = 1 << 4,TUIContactConfigItem_Delete = 1 << 5,TUIContactConfigItem_AddFriend = 1 << 6,};/*** Hide items in contact config interface.*/- (void)hideItemsInContactConfig:(TUIContactConfigItem)items;
Sample code:
// When to call: Before initializing contact setting interface.// Valid for contacts.TUIContactConfig.shared.hideItemsInContactConfig([.block, .clearChatHistory, .delete])// Valid for strange users who have not been added to the contact.TUIContactConfig.shared.hideItemsInContactConfig([.addFriend])
// When to call: Before initializing contact setting interface.// Valid for contacts.[[TUIContactConfig sharedConfig] hideItemsInContactConfig:TUIContactConfigItem_Block|TUIContactConfigItem_ClearChatHistory|TUIContactConfigItem_Delete];// Valid for strange users who have not been added to the contact.[[TUIContactConfig sharedConfig] hideItemsInContactConfig:TUIContactConfigItem_AddFriend];
Result of Contact Settings:
Hide Partial Options | Hide All Options | Default |
![]() | ![]() | ![]() |
Result of Users Not Yet Added to Contacts:
Hide Adding Friends | Default |
![]() | ![]() |