// // XYLiveManger.h // Starbuds // // Created by pajia on 2019/12/31. // Copyright © 2019 翟玉磊. All rights reserved. // #import #import "XYLiveRoomMessageInfo.h" #import "AWRichText.h" #import "XYLiveMessageManager.h" #import "HDWindowLogger.h" #import "XYLiveRoomVCInfo.h" #import "XYFeedModel.h" #import "XYUserMarkIconView.h" /// 表情在AWRT中的tag static NSString * const EXPRESSION_AWRTVIEW_TAG = @"EXPRESSION_AWRTVIEW_TAG"; @interface XYLiveManger : NSObject typedef NS_ENUM(NSInteger, LiveRoomCurrentUserRole) { LiveRoomCurrentUserRoleUnknow = 0, LiveRoomCurrentUserRoleAnchor = 1,//主播 分配房管和禁言和解禁 LiveRoomCurrentUserRoleManager = 2,//房管 禁言和解禁 LiveRoomCurrentUserRoleNospeak = 3,//禁言 LiveRoomCurrentUserRoleSuperManager = 5,//下线并金箔 }; typedef NS_ENUM(NSInteger, LiveRoomBeautyType) { LiveRoomBeautyTypeUnknow,// LiveRoomBeautyTypeWhiten, //美白 LiveRoomBeautyTypeSmooth, //磨皮 LiveRoomBeautyTypeRedRosy, //红润 LiveRoomBeautyTypeHighLight, //去高光 LiveRoomBeautyTypeFaceLift, //瘦脸 LiveRoomBeautyTypeEnlargeEye, //大眼 LiveRoomBeautyTypeSmallFace, //小脸 LiveRoomBeautyTypeFaceOverall, //窄脸 LiveRoomBeautyTypeRoundEyes, //圆眼 LiveRoomBeautyTypeJaw, //下巴 LiveRoomBeautyTypeForehead, //额头 LiveRoomBeautyTypeAppleMuscle, //苹果肌 LiveRoomBeautyTypeThinNose, //瘦鼻翼 LiveRoomBeautyTypeProboscides, //长鼻 LiveRoomBeautyTypeFliter,// LiveRoomBeautyTypeSticker,// LiveRoomBeautyTypeFliterValue,// }; typedef enum{ YQSlideStateDef = 0, YQSlideStateNor = 1, YQSlideStateUp = 2, YQSlideStateDown = 3 }YQSlideState; +(XYLiveManger *)shareInstance; @property (nonatomic, readwrite, assign) BOOL closeMicrophone; @property (nonatomic, readwrite, assign) BOOL bannerAnmiShadow; @property (nonatomic, readwrite, assign) BOOL isShortVideoing; @property (nonatomic, assign) LiveRoomType liveRoomType; @property (nonatomic, strong) XYLiveRoomVCInfo *liveRoomVCInfo; @property (nonatomic, strong) XYFeedModel *shortVideoInfo; @property (nonatomic, strong) NSString *anchorCoverPath; @property (nonatomic, strong) NSDictionary *scoreLevelInfoDataDict; @property (nonatomic, assign) BOOL HDWindowLoggerShow; - (NSString *)stringFromTxtFile:(NSString *)path; - (NSString*)dictionaryToJson:(NSDictionary *)dic; - (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString; - (UIImage *)convertViewToImage:(UIView *)view; - (NSMutableArray *)leftRightTopBottomArrangeWithDatas:(NSArray *)datas; @property (nonatomic, assign) LiveRoomCurrentUserRole liveRoomCurrentUserRole; ///房间聊天列表、个人详情,设置用户标签(等级等),richText后面追加内容(名字lable) - (void)setUserMarks:(XYLiveRoomMessageInfo *)info andRichText:(AWRichText *)richText; - (UIImage *)getGradeNumImage:(XYLiveRoomMessageInfo *)info; - (UIImage *)getAnchorGradeNumImage:(XYLiveRoomMessageInfo *)info; - (void)stopAnchorLiveRoom; - (void)requestGiftListUserScoreData; - (void)beautyEffectViewClear; - (void)saveBeautyDefaultValue; - (void)setBeautyDefaultValue:(LiveRoomBeautyType )type andValue:(NSString *)value; - (NSString *)getBeautyDefaultValue:(LiveRoomBeautyType )type; @property (nonatomic, readwrite, strong) NSString *currentFilterName; @property (nonatomic, readwrite, strong) NSString *currentFilterPath; @property (nonatomic, readwrite, strong) NSString *currentFilterValue; @property (nonatomic, readwrite, strong) NSString *filterPath0; @property (nonatomic, readwrite, strong) NSString *filterValue0; @property (nonatomic, readwrite, strong) NSString *filterPath1; @property (nonatomic, readwrite, strong) NSString *filterValue1; @property (nonatomic, readwrite, strong) NSString *filterPath2; @property (nonatomic, readwrite, strong) NSString *filterValue2; @property (nonatomic, readwrite, strong) NSString *filterPath3; @property (nonatomic, readwrite, strong) NSString *filterValue3; @property (nonatomic, readwrite, strong) NSString *filterPath4; @property (nonatomic, readwrite, strong) NSString *filterValue4; @property (nonatomic, readwrite, strong) NSString *filterPath5; @property (nonatomic, readwrite, strong) NSString *filterValue5; @property (nonatomic, readwrite, strong) NSString *filterPath6; @property (nonatomic, readwrite, strong) NSString *filterValue6; @property (nonatomic, readwrite, strong) NSString *currentCity; - (void)saveFilterDefault; - (void)setFilterDefault; //- (void)setFilterDefaultPath:(NSString *)path andValue:(NSString *)value; //- (NSString *)getFilterDefaultPath:(LiveRoomBeautyType )type; //- (NSString *)getFilterDefaultValue:(LiveRoomBeautyType )type; - (NSString *)caluteWValue:(NSInteger )a; @property (nonatomic, copy) void(^AppBackBackgroundBlock)(BOOL background); @property (nonatomic, copy) void(^AppBackBackgroundBlock1)(BOOL background); @property (nonatomic, copy) void(^AppBackBackgroundBlock2)(BOOL background); @property (nonatomic, copy) void(^AppLogoutBlock)(BOOL logout); @property (nonatomic, copy) void(^AppRestartPushBlock)(BOOL restartPush); @property (nonatomic, copy) void(^AppPushSteamSpeedBlock)(NSString *speed); @property (nonatomic, copy) void(^AppCameraMicBlock)(BOOL success); @property (nonatomic, copy) void(^AppCloseMicrophoneBlock)(BOOL mute); @property (nonatomic, copy) void(^AppShortVideoShareBlock)(BOOL success); @property (nonatomic, copy) void(^AppShortVideoPlayBlock)(BOOL success); @property (nonatomic, readwrite, strong) NSString *currentRoomFansName; - (CGSize )getABstringSize:(NSAttributedString *)abString; - (void)judgeCameraMic; - (void)keepBrightScreen; - (void)cancelKeepBrightScreen; //userid当前直播间uid 毕传 //extraInfo预留实体 可不传 - (void)pushLiveRoom:(NSString *)userid extra:(XYLiveRoomVCInfo *)extraInfo; - (UIView *)getSvgaView:(XYLiveRoomMessageInfo *)info; - (NSAttributedString *)formatMessageString:(NSString *)text; #define SLIDEHEIGHT 100 #define kPFSCFont @"PingFang SC" #define kPFSCMediumFont @"PingFangSC-Medium" #define kWEAKSELF typeof(self) __weak weakSelf = self; #define kSTRONGSELF typeof(weakSelf) __strong strongSelf = weakSelf; #define kiPhoneXTopEdge (IS_IPHONE_X ? 22.0f : 0.0f) #define kiPhoneXBottomEdge (IS_IPHONE_X ? 33.0f : 0.0f) #define kViewRadius(View, Radius)\ \ [View.layer setCornerRadius:(Radius)];\ [View.layer setMasksToBounds:YES] #define kViewBorderRadius(View, Radius, Width, Color)\ \ [View.layer setCornerRadius:(Radius)];\ [View.layer setMasksToBounds:YES];\ [View.layer setBorderWidth:(Width)];\ [View.layer setBorderColor:[Color CGColor]] #define kLineHeight 0.5 #define KLiveRoomChatListCellFont [UIFont fontWithName:kPFSCFont size:16] ///两个cell间距 #define KLiveRoomChatListCellBothShadowMargin 12 ///文字距离阴影背景左边间距 #define KLiveRoomChatListCellStringLeftOrRightMargin 12 ///文字距离阴影背景底部间距 #define KLiveRoomChatListCellStringTopOrBottomMargin 6 ///cell宽度 #define KLiveRoomChatListCellWidth kXY_SCREEN_WIDTH - 10 - 85 - 15 ///聊天、礼物消息时文字宽度 #define KLiveRoomChatListCellTextGiftRichTextLableWidth KLiveRoomChatListCellWidth - 2*KLiveRoomChatListCellStringLeftOrRightMargin - 38 ///提醒、活动消息时文字宽度 #define KLiveRoomChatListCellAlertActivityTichTextLableWidth KLiveRoomChatListCellWidth - 2*KLiveRoomChatListCellStringLeftOrRightMargin #define kXY_SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height #define kXY_SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width #define YQ_MESSAGE_LIVE_SENDUSER_GIFT 41 #define KLiveRoomBannerGiftAnimWidth 158 #define KLiveRoomBannerGiftAnimHeight 32 #define kSetUserDefaults(object, key) \ ({ \ NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults]; \ [defaults setObject:object forKey:key]; \ [defaults synchronize]; \ }) #define kGetUserDefaults(key) [[NSUserDefaults standardUserDefaults] objectForKey:key] #define kRemoveUserDefaults(key) \ ({ \ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; \ [defaults removeObjectForKey:_key]; \ [defaults synchronize]; \ }) #define kRemoveAllUserDefaults [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:[[NSBundle mainBundle] bundleIdentifier]] //获取沙盒 temp #define kPathTemp NSTemporaryDirectory() //获取沙盒 Document #define kPathDocument [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] //获取沙盒 Cache #define kPathCache [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject] //Library/Caches 文件路径 #define kFilePath ([[NSFileManager defaultManager] URLForDirectory:NSCachesDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nil]) #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] #define UIColorFromRGBValue(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] #define UIColorFromRGBValueAlpha(rgbValue,alp) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alp] #define weakObj(o) autoreleasepool{} __weak typeof(o) o##Weak = o; #define strongObj(o) autoreleasepool{} __strong typeof(o) o = o##Weak; #define RUBIKREGULAR @"PingFang SC" #define Scale_X 1 //[[UIScreen mainScreen] bounds].size.width/375.0 #define Scale_Y 1 //[[UIScreen mainScreen] bounds].size.height/667.0 #define Scale_Font Scale_X #define RegularFont(s) [UIFont fontWithName:RUBIKREGULAR size:(s)*Scale_Font] #define MediumFont(s) [UIFont fontWithName:RUBIKREGULAR size:(s)*Scale_Font] #define ScreenHeight ([UIScreen mainScreen].applicationFrame.size.height) #define ScreenWidth ([UIScreen mainScreen].applicationFrame.size.width) #define YQ_SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width #define YQ_SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height #define STATUS_BAR_HEIGHT (IS_IPHONE_X ? 44.f : 20.f) #define JCKeyBoardNumHeight (250 + 40 + kiPhoneXBottomEdge) #define REQUEST_SUC @"0" #define REQUEST_INVALID @"1000" NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END