提交
This commit is contained in:
42
TUIKit/TUIGroup/CommonModel/TUIGroupConfig.h
Normal file
42
TUIKit/TUIGroup/CommonModel/TUIGroupConfig.h
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// TUIGroupConfig.h
|
||||
// TUIGroup
|
||||
//
|
||||
// Created by Tencent on 2024/9/6.
|
||||
// Copyright © 2024 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_OPTIONS(NSInteger, TUIGroupConfigItem) {
|
||||
TUIGroupConfigItem_None = 0,
|
||||
TUIGroupConfigItem_Members = 1 << 0,
|
||||
TUIGroupConfigItem_Notice = 1 << 1,
|
||||
TUIGroupConfigItem_Manage = 1 << 2,
|
||||
TUIGroupConfigItem_Alias = 1 << 3,
|
||||
TUIGroupConfigItem_MuteAndPin = 1 << 4,
|
||||
TUIGroupConfigItem_Background = 1 << 5,
|
||||
TUIGroupConfigItem_ClearChatHistory = 1 << 6,
|
||||
TUIGroupConfigItem_DeleteAndLeave = 1 << 7,
|
||||
TUIGroupConfigItem_Transfer = 1 << 8,
|
||||
TUIGroupConfigItem_Dismiss = 1 << 9,
|
||||
TUIGroupConfigItem_Report = 1 << 10,
|
||||
};
|
||||
|
||||
@interface TUIGroupConfig : NSObject
|
||||
|
||||
+ (TUIGroupConfig *)sharedConfig;
|
||||
/**
|
||||
* Hide items in group config interface.
|
||||
*/
|
||||
- (void)hideItemsInGroupConfig:(TUIGroupConfigItem)items;
|
||||
/**
|
||||
* Get the hidden status of specified item.
|
||||
*/
|
||||
- (BOOL)isItemHiddenInGroupConfig:(TUIGroupConfigItem)item;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
75
TUIKit/TUIGroup/CommonModel/TUIGroupConfig.m
Normal file
75
TUIKit/TUIGroup/CommonModel/TUIGroupConfig.m
Normal file
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// TUIGroupConfig.m
|
||||
// TUIGroup
|
||||
//
|
||||
// Created by Tencent on 2024/9/6.
|
||||
// Copyright © 2024 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUIGroupConfig.h"
|
||||
|
||||
@interface TUIGroupConfig()
|
||||
@property (nonatomic, assign) BOOL hideGroupMembersItems;
|
||||
@property (nonatomic, assign) BOOL hideGroupNoticeItem;
|
||||
@property (nonatomic, assign) BOOL hideGroupManageItems;
|
||||
@property (nonatomic, assign) BOOL hideGroupAliasItem;
|
||||
@property (nonatomic, assign) BOOL hideGroupMuteAndPinItems;
|
||||
@property (nonatomic, assign) BOOL hideGroupBackgroundItem;
|
||||
@property (nonatomic, assign) BOOL hideGroupClearChatHistory;
|
||||
@property (nonatomic, assign) BOOL hideGroupDeleteAndLeave;
|
||||
@property (nonatomic, assign) BOOL hideGroupTransfer;
|
||||
@property (nonatomic, assign) BOOL hideGroupDismiss;
|
||||
@property (nonatomic, assign) BOOL hideGroupReport;
|
||||
@end
|
||||
|
||||
@implementation TUIGroupConfig
|
||||
|
||||
+ (TUIGroupConfig *)sharedConfig {
|
||||
static dispatch_once_t onceToken;
|
||||
static TUIGroupConfig *config;
|
||||
dispatch_once(&onceToken, ^{
|
||||
config = [[TUIGroupConfig alloc] init];
|
||||
});
|
||||
return config;
|
||||
}
|
||||
|
||||
- (void)hideItemsInGroupConfig:(TUIGroupConfigItem)items {
|
||||
self.hideGroupMuteAndPinItems = items & TUIGroupConfigItem_MuteAndPin;
|
||||
self.hideGroupManageItems = items & TUIGroupConfigItem_Manage;
|
||||
self.hideGroupAliasItem = items & TUIGroupConfigItem_Alias;
|
||||
self.hideGroupBackgroundItem = items & TUIGroupConfigItem_Background;
|
||||
self.hideGroupMembersItems = items & TUIGroupConfigItem_Members;
|
||||
self.hideGroupClearChatHistory = items & TUIGroupConfigItem_ClearChatHistory;
|
||||
self.hideGroupDeleteAndLeave = items & TUIGroupConfigItem_DeleteAndLeave;
|
||||
self.hideGroupTransfer = items & TUIGroupConfigItem_Transfer;
|
||||
self.hideGroupDismiss = items & TUIGroupConfigItem_Dismiss;
|
||||
self.hideGroupReport = items & TUIGroupConfigItem_Report;
|
||||
}
|
||||
|
||||
- (BOOL)isItemHiddenInGroupConfig:(TUIGroupConfigItem)item {
|
||||
if (item & TUIGroupConfigItem_MuteAndPin) {
|
||||
return self.hideGroupMuteAndPinItems;
|
||||
} else if (item & TUIGroupConfigItem_Manage) {
|
||||
return self.hideGroupManageItems;
|
||||
} else if (item & TUIGroupConfigItem_Alias) {
|
||||
return self.hideGroupAliasItem;
|
||||
} else if (item & TUIGroupConfigItem_Background) {
|
||||
return self.hideGroupBackgroundItem;
|
||||
} else if (item & TUIGroupConfigItem_Members) {
|
||||
return self.hideGroupMembersItems;
|
||||
} else if (item & TUIGroupConfigItem_ClearChatHistory) {
|
||||
return self.hideGroupClearChatHistory;
|
||||
} else if (item & TUIGroupConfigItem_DeleteAndLeave) {
|
||||
return self.hideGroupDeleteAndLeave;
|
||||
} else if (item & TUIGroupConfigItem_Transfer) {
|
||||
return self.hideGroupTransfer;
|
||||
} else if (item & TUIGroupConfigItem_Dismiss) {
|
||||
return self.hideGroupDismiss;
|
||||
} else if (item & TUIGroupConfigItem_Report) {
|
||||
return self.hideGroupReport;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
23
TUIKit/TUIGroup/CommonModel/TUIGroupDefine.h
Normal file
23
TUIKit/TUIGroup/CommonModel/TUIGroupDefine.h
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// TUIChatDefine.h
|
||||
// Pods
|
||||
//
|
||||
// Created by xiangzhang on 2022/10/14.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <TIMCommon/TIMCommonModel.h>
|
||||
|
||||
#ifndef TUIGroupDefine_h
|
||||
#define TUIGroupDefine_h
|
||||
|
||||
typedef NS_ENUM(NSInteger, TUISelectMemberOptionalStyle) {
|
||||
TUISelectMemberOptionalStyleNone = 0,
|
||||
TUISelectMemberOptionalStyleAtAll = 1 << 0,
|
||||
TUISelectMemberOptionalStyleTransferOwner = 1 << 1,
|
||||
TUISelectMemberOptionalStylePublicMan = 1 << 2
|
||||
};
|
||||
|
||||
typedef void (^SelectedFinished)(NSMutableArray<TUIUserModel *> *modelList);
|
||||
|
||||
#endif /* TUIGroupDefine_h */
|
||||
Reference in New Issue
Block a user