TIMConfig.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // TIMConfig.m
  3. // Pods
  4. //
  5. // Created by cologne on 2023/3/14.
  6. // Copyright © 2023 Tencent. All rights reserved.
  7. //
  8. #import "TIMConfig.h"
  9. #import "TIMCommonMediator.h"
  10. #import "TUIEmojiMeditorProtocol.h"
  11. #define kTUIKitFirstInitAppStyleID @"Classic"; // Classic / Minimalist
  12. typedef NS_OPTIONS(NSInteger, emojiFaceType) {
  13. emojiFaceTypeKeyBoard = 1 << 0,
  14. emojiFaceTypePopDetail = 1 << 1,
  15. };
  16. @interface TIMConfig ()
  17. @end
  18. @implementation TIMConfig
  19. + (void)load {
  20. TUIRegisterThemeResourcePath(TIMCommonThemePath, TUIThemeModuleTIMCommon);
  21. }
  22. - (id)init {
  23. self = [super init];
  24. if (self) {
  25. self.enableMessageBubble = YES;
  26. }
  27. return self;
  28. }
  29. + (id)defaultConfig {
  30. static dispatch_once_t onceToken;
  31. static TIMConfig *config;
  32. dispatch_once(&onceToken, ^{
  33. config = [[TIMConfig alloc] init];
  34. });
  35. return config;
  36. }
  37. - (NSArray<TUIFaceGroup *> *)faceGroups {
  38. id<TUIEmojiMeditorProtocol> service = [[TIMCommonMediator share] getObject:@protocol(TUIEmojiMeditorProtocol)];
  39. return [service getFaceGroup];
  40. }
  41. - (NSArray<TUIFaceGroup *> *)chatPopDetailGroups {
  42. id<TUIEmojiMeditorProtocol> service = [[TIMCommonMediator share] getObject:@protocol(TUIEmojiMeditorProtocol)];
  43. return [service getChatPopDetailGroups];
  44. }
  45. + (NSString *)getCurrentStyleSelectID {
  46. NSString *styleID = [[NSUserDefaults standardUserDefaults] objectForKey:@"StyleSelectkey"];
  47. if (IS_NOT_EMPTY_NSSTRING(styleID)) {
  48. return styleID;
  49. } else {
  50. // First Init
  51. NSString *initStyleID = kTUIKitFirstInitAppStyleID;
  52. [[NSUserDefaults standardUserDefaults] setValue:initStyleID forKey:@"StyleSelectkey"];
  53. [NSUserDefaults.standardUserDefaults synchronize];
  54. return initStyleID;
  55. }
  56. }
  57. + (BOOL)isClassicEntrance {
  58. NSString *styleID = [self.class getCurrentStyleSelectID];
  59. if ([styleID isKindOfClass:NSString.class]) {
  60. if (styleID.length > 0) {
  61. if ([styleID isEqualToString:@"Classic"]) {
  62. return YES;
  63. }
  64. }
  65. }
  66. return NO;
  67. }
  68. @end