Commit 74676b10 by ludi

拍一拍模块完成,待测

parent 649aff8a
Showing with 1093 additions and 24 deletions
......@@ -86,6 +86,7 @@
#define ROOM_CID_LIVE_ROOM_TYPE_CHANGED 11009 // 切换直播类型
#define ROOM_CID_BECOME_FANS_GROUP_MEMBER 11010 // 用户成为粉丝团成员
#define ROOM_CID_RoomPopularChanged 11019 // 人气值变化消息
#define ROOM_CID_receivePatAudience 11025 // 接收撩一撩信息的cid
// 更新直播间互动游戏开关状态socket
#define ROOM_CID_liveInteractionGameStateDidChanged 20204
......
......@@ -7,12 +7,12 @@
<key>FUSChatCenterBundle.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>73</integer>
<integer>74</integer>
</dict>
<key>FUSChatCenterModule.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>72</integer>
<integer>71</integer>
</dict>
</dict>
</dict>
......
......@@ -7,16 +7,22 @@
objects = {
/* Begin PBXBuildFile section */
00A1DCF72CA6B2C50000541F /* liveRoom_patAudience_pat_animate.webp in Resources */ = {isa = PBXBuildFile; fileRef = 00A1DCF62CA6B2C50000541F /* liveRoom_patAudience_pat_animate.webp */; };
00A516AB2CA265930022DE40 /* FUSCheckInDayRewardModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A516AA2CA265930022DE40 /* FUSCheckInDayRewardModel.m */; };
00A516AC2CA265930022DE40 /* FUSCheckInDayRewardModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 00A516A92CA265930022DE40 /* FUSCheckInDayRewardModel.h */; };
00A516AF2CA266880022DE40 /* FUSCheckInRewardItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A516AE2CA266880022DE40 /* FUSCheckInRewardItemModel.m */; };
00A516B02CA266880022DE40 /* FUSCheckInRewardItemModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 00A516AD2CA266880022DE40 /* FUSCheckInRewardItemModel.h */; };
00A516B62CA29A990022DE40 /* FUSNewUserRewardItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A516B42CA29A990022DE40 /* FUSNewUserRewardItemCell.swift */; };
00A516B72CA29A990022DE40 /* FUSNewUserMultiRewardItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A516B52CA29A990022DE40 /* FUSNewUserMultiRewardItemCell.swift */; };
00A84DC32CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.h in Headers */ = {isa = PBXBuildFile; fileRef = 00A84DC12CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.h */; };
00A84DC42CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A84DC22CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.m */; };
00AD7DF42CA1626B00E02376 /* FUSSevenDayCheckinAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00AD7DF32CA1626B00E02376 /* FUSSevenDayCheckinAlertView.m */; };
00AD7DF52CA1626B00E02376 /* FUSSevenDayCheckinAlertView.h in Headers */ = {isa = PBXBuildFile; fileRef = 00AD7DF22CA1626B00E02376 /* FUSSevenDayCheckinAlertView.h */; };
00AD7DF92CA1803900E02376 /* FUSSevenDayCheckinListModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 00AD7DF72CA1803900E02376 /* FUSSevenDayCheckinListModel.h */; };
00AD7DFA2CA1803900E02376 /* FUSSevenDayCheckinListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 00AD7DF82CA1803900E02376 /* FUSSevenDayCheckinListModel.m */; };
00B90AD22CA5072100BE935B /* FUSPatAudienceGiftCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00B90AD12CA5072100BE935B /* FUSPatAudienceGiftCell.swift */; };
00B90AD52CA5092300BE935B /* FUSPatAudiencePatDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 00B90AD42CA5092300BE935B /* FUSPatAudiencePatDataModel.m */; };
00B90AD62CA5092300BE935B /* FUSPatAudiencePatDataModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B90AD32CA5092300BE935B /* FUSPatAudiencePatDataModel.h */; };
BE189D972C733B450008418B /* FSRActiveModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BE189CE52C733B450008418B /* FSRActiveModel.h */; };
BE189D982C733B450008418B /* FSRActiveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BE189CE62C733B450008418B /* FSRActiveModel.m */; };
BE189D992C733B450008418B /* FSRActiveMotorEffectModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BE189CE72C733B450008418B /* FSRActiveMotorEffectModel.h */; };
......@@ -1280,16 +1286,22 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
00A1DCF62CA6B2C50000541F /* liveRoom_patAudience_pat_animate.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = liveRoom_patAudience_pat_animate.webp; sourceTree = "<group>"; };
00A516A92CA265930022DE40 /* FUSCheckInDayRewardModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSCheckInDayRewardModel.h; sourceTree = "<group>"; };
00A516AA2CA265930022DE40 /* FUSCheckInDayRewardModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSCheckInDayRewardModel.m; sourceTree = "<group>"; };
00A516AD2CA266880022DE40 /* FUSCheckInRewardItemModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSCheckInRewardItemModel.h; sourceTree = "<group>"; };
00A516AE2CA266880022DE40 /* FUSCheckInRewardItemModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSCheckInRewardItemModel.m; sourceTree = "<group>"; };
00A516B42CA29A990022DE40 /* FUSNewUserRewardItemCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FUSNewUserRewardItemCell.swift; sourceTree = "<group>"; };
00A516B52CA29A990022DE40 /* FUSNewUserMultiRewardItemCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FUSNewUserMultiRewardItemCell.swift; sourceTree = "<group>"; };
00A84DC12CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSPatAudiencePromptAlertView.h; sourceTree = "<group>"; };
00A84DC22CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSPatAudiencePromptAlertView.m; sourceTree = "<group>"; };
00AD7DF22CA1626B00E02376 /* FUSSevenDayCheckinAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSSevenDayCheckinAlertView.h; sourceTree = "<group>"; };
00AD7DF32CA1626B00E02376 /* FUSSevenDayCheckinAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSSevenDayCheckinAlertView.m; sourceTree = "<group>"; };
00AD7DF72CA1803900E02376 /* FUSSevenDayCheckinListModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSSevenDayCheckinListModel.h; sourceTree = "<group>"; };
00AD7DF82CA1803900E02376 /* FUSSevenDayCheckinListModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSSevenDayCheckinListModel.m; sourceTree = "<group>"; };
00B90AD12CA5072100BE935B /* FUSPatAudienceGiftCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSPatAudienceGiftCell.swift; sourceTree = "<group>"; };
00B90AD32CA5092300BE935B /* FUSPatAudiencePatDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSPatAudiencePatDataModel.h; sourceTree = "<group>"; };
00B90AD42CA5092300BE935B /* FUSPatAudiencePatDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSPatAudiencePatDataModel.m; sourceTree = "<group>"; };
842ED23FEE639B8A5B65A322 /* Pods-FUSShowRoomModule.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FUSShowRoomModule.debug.xcconfig"; path = "Target Support Files/Pods-FUSShowRoomModule/Pods-FUSShowRoomModule.debug.xcconfig"; sourceTree = "<group>"; };
97F831FBE9C41BC899CF9232 /* Pods-FUSShowRoomModule.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FUSShowRoomModule.release.xcconfig"; path = "Target Support Files/Pods-FUSShowRoomModule/Pods-FUSShowRoomModule.release.xcconfig"; sourceTree = "<group>"; };
B8B2CC1956F16144828BF43D /* Pods_FUSShowRoomModule.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FUSShowRoomModule.framework; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -2942,6 +2954,8 @@
BED655772C5B745D00668116 /* FUSOnlineUserModel.m */,
BED6557C2C5B745D00668116 /* FUSStreamModel.h */,
BED6557D2C5B745D00668116 /* FUSStreamModel.m */,
00B90AD32CA5092300BE935B /* FUSPatAudiencePatDataModel.h */,
00B90AD42CA5092300BE935B /* FUSPatAudiencePatDataModel.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -3356,6 +3370,9 @@
BED656DF2C5B745D00668116 /* FUSScreenShotShareView.h */,
BED656E02C5B745D00668116 /* FUSScreenShotShareView.m */,
BED656E12C5B745D00668116 /* FUSScreenShotShareView.xib */,
00A84DC12CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.h */,
00A84DC22CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.m */,
00B90AD12CA5072100BE935B /* FUSPatAudienceGiftCell.swift */,
);
path = Other;
sourceTree = "<group>";
......@@ -4876,6 +4893,7 @@
BEF675EB2C6B156500A670FB /* img_novaList_cell_new_animation.webp */,
BEF675EC2C6B156500A670FB /* live_linkmic_bgImg.png */,
BEF675ED2C6B156500A670FB /* live_pk_background_image.png */,
00A1DCF62CA6B2C50000541F /* liveRoom_patAudience_pat_animate.webp */,
BEF675EE2C6B156500A670FB /* live_treasure_box_bg_img.png */,
BEF675EF2C6B156500A670FB /* live_userinfo_level_secrect.png */,
);
......@@ -5156,6 +5174,7 @@
BED65A2F2C5B745F00668116 /* FUSLiveShareToChatCell.h in Headers */,
BE189E352C733B460008418B /* FSRRecommonddictSettingRoomGuarderOnlineView.h in Headers */,
BED6598F2C5B745E00668116 /* FUSLiveHeadView.h in Headers */,
00B90AD62CA5092300BE935B /* FUSPatAudiencePatDataModel.h in Headers */,
BED659FC2C5B745F00668116 /* FUSPKMainStartView.h in Headers */,
BED658C92C5B745E00668116 /* FUSContributeListModel.h in Headers */,
BED65A4A2C5B745F00668116 /* FUSLiveBoxSettingView.h in Headers */,
......@@ -5197,6 +5216,7 @@
BED65AA42C5B745F00668116 /* FUSHomeLanguageSegmentView.h in Headers */,
00AD7DF92CA1803900E02376 /* FUSSevenDayCheckinListModel.h in Headers */,
BE189E2B2C733B460008418B /* FSRLivedictRoomManagerShowRoomView.h in Headers */,
00A84DC32CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.h in Headers */,
BED659892C5B745E00668116 /* FUSLiveCoinTicketView.h in Headers */,
BED659E32C5B745F00668116 /* FUSPKHttpHelper.h in Headers */,
BED658842C5B745E00668116 /* FUSLiveStaticActivityModel.h in Headers */,
......@@ -5633,6 +5653,7 @@
BEF676CF2C6B156600A670FB /* new_live_userlist_guardian_29@2x.png in Resources */,
BEF6776B2C6B156600A670FB /* PK_Win_Animation_30@2x.png in Resources */,
BEF6777C2C6B156600A670FB /* PK_Win_Animation_47@2x.png in Resources */,
00A1DCF72CA6B2C50000541F /* liveRoom_patAudience_pat_animate.webp in Resources */,
BEF676032C6B156500A670FB /* 1_First_Kill_Animation_19@3x.png in Resources */,
BEF677902C6B156600A670FB /* PK_Win_Animation_67@2x.png in Resources */,
BEF677792C6B156600A670FB /* PK_Win_Animation_44@2x.png in Resources */,
......@@ -6026,6 +6047,7 @@
BED659882C5B745E00668116 /* FUSLiveUserCollectionViewCell.m in Sources */,
BED658892C5B745E00668116 /* FUSOnlineUserModel.m in Sources */,
BED65B092C5B746000668116 /* FUSOpenScreenPushModel.m in Sources */,
00B90AD52CA5092300BE935B /* FUSPatAudiencePatDataModel.m in Sources */,
BED658ED2C5B745E00668116 /* FUSLiveBeautyStickerItemCell.swift in Sources */,
BED659902C5B745E00668116 /* FUSLiveHeadView.m in Sources */,
BE189E382C733B460008418B /* FSRRoomguarderdictGiftShowRoomRoomGuarderView.m in Sources */,
......@@ -6242,6 +6264,7 @@
BED659C22C5B745F00668116 /* FUSEmitterViewCell.m in Sources */,
BED65C702C60C5D400668116 /* FUSShowRoomCenterBunble.m in Sources */,
BED65ADE2C5B746000668116 /* FUSBaoFangBroadcastModel.m in Sources */,
00B90AD22CA5072100BE935B /* FUSPatAudienceGiftCell.swift in Sources */,
BED6590D2C5B745E00668116 /* FUSLiveChatToolGiftTipView.m in Sources */,
BE189DBE2C733B460008418B /* FSRShowRoomEffectRecommondModel.m in Sources */,
BED65A082C5B745F00668116 /* FUSPKEmptyView.m in Sources */,
......@@ -6274,6 +6297,7 @@
BED659FD2C5B745F00668116 /* FUSPKMainStartView.m in Sources */,
BE189D9A2C733B450008418B /* FSRActiveMotorEffectModel.m in Sources */,
BED658A82C5B745E00668116 /* FUSLiveEndChangeLinkMicModeView.m in Sources */,
00A84DC42CA41D0C000A3BED /* FUSPatAudiencePromptAlertView.m in Sources */,
BED659D72C5B745F00668116 /* FUSPKReceiveGiftSocreSocketModel.m in Sources */,
BED65B032C5B746000668116 /* FUSBaofangStreamPlayerView.m in Sources */,
BED6596F2C5B745E00668116 /* FUSGiftNumSelectView.m in Sources */,
......
......@@ -7,12 +7,12 @@
<key>FUSShowRoomBundle.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>71</integer>
<integer>75</integer>
</dict>
<key>FUSShowRoomModule.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>74</integer>
<integer>73</integer>
</dict>
</dict>
</dict>
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_chat_patAudience_gift_follow@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_chat_tableviewcell_pat_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -21,3 +21,4 @@ FOUNDATION_EXPORT const unsigned char FUSShowRoomModuleVersionString[];
#import "FUSShowRoomCenterBunble.h"
#import "FUSCheckInDayRewardModel.h"
#import "FUSCheckInRewardItemModel.h"
#import "FUSPatAudiencePatDataModel.h"
......@@ -125,4 +125,14 @@ typedef NS_ENUM(NSInteger,FUSLiveChatModelClickType) {
/// cell 宽度缓存
@property (nonatomic, assign) CGFloat cellCacheWidth;
/// (patStatus 拍一拍状态值(0:否、1:是))
@property (nonatomic, assign) BOOL patStatus;
/// 指令(100:拍一拍, 101:惩罚-去解救, 102: 回拍。103:觀看超過3分鐘)
@property (nonatomic, assign) NSInteger order;
/// 判定是否有通用点击事件,因为后台没有返回默认的order,需要自行判定归纳全是否是order通用点击
-(BOOL)ffisClickOrderModel;
@end
......@@ -15,6 +15,7 @@
{
self = [super init];
if (self) {
self.patStatus = NO;
}
return self;
}
......@@ -80,4 +81,8 @@
return _languageContent;
}
- (BOOL)ffisClickOrderModel{
return self.order == 101;
}
@end
//
// FUSPatAudiencePatDataModel.h
// FUSShowRoomModule
//
// Created by aaa on 2024/9/26.
//
#import <FUSFoundation/FUSFoundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface FUSPatAudienceGiftModel : FUSBaseModel
/// 礼物ID
@property (nonatomic, copy) NSString *gid;
/// 礼物名称
@property (nonatomic, copy) NSString *giftName;
/// 礼物图标
@property (nonatomic, copy) NSString *giftUrl;
/// 礼物货币单位(3:宝石、4:寨券、5:露水)
@property (nonatomic, assign) NSInteger giftCurrency;
/// 礼物价值
@property (nonatomic, assign) NSInteger giftPrice;
/// 是否默认选择
@property (nonatomic, assign) BOOL selected;
/// 内部属性,用于区分礼物的类型,用于卡片展示,-1=关注,0=礼物
@property (nonatomic, assign) NSInteger fus_modelType;
@end
@interface FUSPatAudiencePatDataModel : FUSBaseModel
///关注(0:关闭、1:显示)
@property (nonatomic, assign) NSInteger follow;
/// 普通礼物列表
@property (nonatomic, strong) NSMutableArray<FUSPatAudienceGiftModel *> *giftList;
@end
NS_ASSUME_NONNULL_END
//
// FUSPatAudiencePatDataModel.m
// FUSShowRoomModule
//
// Created by aaa on 2024/9/26.
//
#import "FUSPatAudiencePatDataModel.h"
@implementation FUSPatAudienceGiftModel
- (instancetype)init
{
self = [super init];
if (self) {
self.fus_modelType = 0;
}
return self;
}
@end
@implementation FUSPatAudiencePatDataModel
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{@"giftList": [FUSPatAudienceGiftModel class]};
}
@end
......@@ -779,4 +779,23 @@
succeed:(void(^)(NSArray<NSString *> *notList))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
/// 回撩
/// @param roomId 房间id
/// @param type 类型(1:关注、2:送礼)
/// @param gid 礼物ID(type=2必传)
+(void)fus_livePatReplyWithRoomId:(NSString *)roomId
type:(NSInteger)type
gid:(NSString *)gid
succeed:(void(^)(NSMutableDictionary *changed))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
/// 撩一撩用户
/// @param roomId 房间id
/// @param toUserId 撩谁
/// @param succeed 成功
/// @param failure 失败
+(void)fus_livePatUserWithRoomId:(NSString *)roomId
toUserId:(NSString *)toUserId
succeed:(void(^)(void))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
@end
......@@ -2415,4 +2415,27 @@
}];
}
+ (void)fus_livePatReplyWithRoomId:(NSString *)roomId type:(NSInteger)type gid:(NSString *)gid succeed:(void (^)(NSMutableDictionary *))succeed failure:(void (^)(NSString *, NSInteger))failure{
NSDictionary *parm = @{@"roomId": roomId ?: @"",
@"type": [NSString stringWithFormat:@"%ld",type],
@"gid": gid ?: @""};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_LIVE_PAT_REPLY params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
NSMutableDictionary *changedDict = [[NSMutableDictionary alloc] initWithDictionary:dataDict[@"cv"]];
changedDict[@"rich"] = dataDict[@"rich"];
succeed(changedDict);
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) failure(dataDict[@"msg"],code);
}];
}
+ (void)fus_livePatUserWithRoomId:(NSString *)roomId toUserId:(NSString *)toUserId succeed:(void (^)(void))succeed failure:(void (^)(NSString *, NSInteger))failure{
NSDictionary *parm = @{@"roomId": roomId ?: @"",
@"toUserId": toUserId};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_LIVE_PAT_USER params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
succeed();
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) failure(dataDict[@"msg"],code);
}];
}
@end
......@@ -196,6 +196,9 @@
*/
- (NSInteger)indexForModel:(FUSLiveChatModel *)model;
/// 取出撩一撩的范围
- (NSRange)patAudienceRangeForModelID:(NSString *)modelId;
/**
取出解析好的富文本
......
......@@ -59,6 +59,9 @@
*/
@property (nonatomic, strong) NSMutableDictionary *cellWidthDict;
/// 拍一拍按钮的范围
@property (nonatomic, strong) NSMutableDictionary *patAudienceRangeDict;
#pragma mark - Property:Other
/**
等级字典
......@@ -182,15 +185,15 @@
if (lastModel.isFold && welcomeMessageFoldSwitch) {
NSAttributedString *attr = [self attributedStringForModelID:model.ID];
// NSRange nicknameRange;
// NSRange patAudienceRange;
NSRange patAudienceRange = NSMakeRange(NSNotFound, 0);;
// NSRange orderBtnRange;
//
// if (self.nicknameRangeDict[model.ID]) {
// nicknameRange = [self.nicknameRangeDict[model.ID] rangeValue];
// }
// if (self.patAudienceRangeDict[model.ID]) {
// patAudienceRange = [self.patAudienceRangeDict[model.ID] rangeValue];
// }
if (self.patAudienceRangeDict[model.ID]) {
patAudienceRange = [self.patAudienceRangeDict[model.ID] rangeValue];
}
//
// if (self.orderBtnRangeDict[model.ID]) {
// orderBtnRange = [self.orderBtnRangeDict[model.ID] rangeValue];
......@@ -202,9 +205,9 @@
if (lastWidth != width || lastHeight != height) {
[addedRefreshList addObject:model];
} else {
if ([lastCell respondsToSelector:@selector(fus_changeCellToModel:attributedString:height:width:completionHandler:)]) {
if ([lastCell respondsToSelector:@selector(fus_changeCellToModel:attributedString:patAudienceRange:height:width:completionHandler:)]) {
[lastCell fus_changeCellToModel:model attributedString:attr height:height width:width completionHandler:^(FUSLiveChatModel *oldModel) {
[lastCell fus_changeCellToModel:model attributedString:attr patAudienceRange:patAudienceRange height:height width:width completionHandler:^(FUSLiveChatModel *oldModel) {
}];
}
}
......@@ -320,6 +323,13 @@
return _waitForRefreshDataList;
}
- (NSMutableDictionary *)patAudienceRangeDict{
if (!_patAudienceRangeDict) {
_patAudienceRangeDict = [NSMutableDictionary dictionary];
}
return _patAudienceRangeDict;
}
#pragma mark - method
#pragma mark -- 添加
// 添加 model
......@@ -635,6 +645,12 @@
return width.doubleValue;
}
// 取出撩一撩的范围
- (NSRange)patAudienceRangeForModelID:(NSString *)modelId{
NSRange range = [[self.patAudienceRangeDict objectForKey:modelId] rangeValue];
return range;
}
// 取出解析好的富文本
- (NSAttributedString *)attributedStringForModelID:(NSString *)modelId
{
......@@ -692,6 +708,7 @@
[self.cellHeightDict removeObjectForKey:model.ID];
[self.cellWidthDict removeObjectForKey:model.ID];
[self.cellStringDict removeObjectForKey:model.ID];
[self.patAudienceRangeDict removeObjectForKey:model.ID];
}else{
......@@ -701,6 +718,7 @@
[self.cellHeightDict removeObjectForKey:model.ID];
[self.cellWidthDict removeObjectForKey:model.ID];
[self.cellStringDict removeObjectForKey:model.ID];
[self.patAudienceRangeDict removeObjectForKey:model.ID];
});
......@@ -764,6 +782,18 @@
}
}
//在主线程组合生成额外按钮
NSAttributedString *orderBtnAttr = nil;
NSMutableDictionary *orderBtnRangeDict = nil;
if ([FUSLiveHelper shareInstance].liveType == FUSLiveTypeAnchor) {
if (model.patStatus == YES) {
//拍一拍
orderBtnAttr = [self fus_getPatAudienceAttr];
orderBtnRangeDict = self.patAudienceRangeDict;
}
}
CGFloat imageH = 14;
CGFloat imageW = 0;
......@@ -776,6 +806,15 @@
[attr appendAttributedString:contentAttr];
}
// 添加按钮
if (orderBtnAttr && orderBtnAttr.length > 0 && orderBtnRangeDict) {
if ((model.ID && model.ID.length > 0) && (attr && attr.length > 0)) {
[orderBtnRangeDict setValue:[NSValue valueWithRange:NSMakeRange(attr.length, 1)] forKey:model.ID];
[attr appendAttributedString:orderBtnAttr];
}
}
[self fus_rectWithAttr:attr completed:^(CGRect rect) {
complete([[NSMutableAttributedString alloc] initWithAttributedString:attr],rect);
}];
......@@ -1271,6 +1310,11 @@
contentStr = @"";
}
/// 拍一拍的数据
if (socketDict[@"patStatus"] != nil) {
messageModel.patStatus = [socketDict[@"patStatus"] boolValue];
}
// 循环搜索符合正则表达式的结果
NSArray *matchArray = nil;
......@@ -1743,6 +1787,43 @@
return YES;
}
/// 创建拍一拍的按钮图标
- (NSAttributedString *)fus_getPatAudienceAttr{
// 创建按钮
UIView *btnView = [[UIView alloc] init];
btnView.backgroundColor = [UIColor fus_themeColor];
UIImageView *patImageView = [[UIImageView alloc] initWithImage:[FUSShowRoomCenterBunble imageNamed:@"live_chat_tableviewcell_pat_icon"]];
patImageView.contentMode = UIViewContentModeScaleAspectFit;
patImageView.frame = CGRectMake(6, 0, _fontSize - 4, _fontSize - 4);
patImageView.centerY = (_fontSize + 2) / 2;
[btnView addSubview:patImageView];
UILabel *patTitleLabel = [[UILabel alloc] init];
patTitleLabel.font = [UIFont fus_themeFont:_fontSize - 4];
patTitleLabel.textColor = [UIColor colorWithHex:@"#22222B"];
patTitleLabel.text = [NSString fus_versionLocalString:@"撩一撩"];
[patTitleLabel sizeToFit];
patTitleLabel.x = CGRectGetMaxX(patImageView.frame) + 2;
patTitleLabel.centerY = (_fontSize + 2) / 2;
[btnView addSubview:patTitleLabel];
btnView.height = _fontSize + 2;
btnView.width = CGRectGetMaxX(patTitleLabel.frame) + 6;
btnView.layer.cornerRadius = btnView.height / 2;
UIView *btnBgView = [[UIView alloc] init];
btnBgView.userInteractionEnabled = NO;
btnBgView.frame = btnView.bounds;
btnBgView.width = btnView.width + 10;
btnBgView.height = btnView.height + 4;
[btnBgView addSubview:btnView];
btnView.center = btnBgView.center;
return [NSAttributedString attachmentStringWithContent:btnBgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:btnBgView.size alignToFont:FUS_LIVE_FONT(self.fontSize) alignment:YYTextVerticalAlignmentCenter];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter]removeObserver:self];
......
......@@ -20,6 +20,9 @@
*/
@property (nonatomic, copy) void(^onClickNicknameHandler)(FUSLiveChatModel *model);
/// 点击拍一拍回调
@property (nonatomic, copy) void(^onClickPatAudiencetHandler)(FUSLiveChatModel *model);
/**
允许发送通知
*/
......@@ -57,6 +60,9 @@
// 创建一个系统消息
- (void)fus_addSystemTip:(NSString *)tip;
/// 更新一个信息
- (void)fus_UpdataMessageWithModel:(FUSLiveChatModel *)model;
/**
滚动到底部
......
......@@ -166,6 +166,8 @@
NSAttributedString *attr = [self.dataSourceHelper attributedStringForModelID:model.ID];
NSRange patAudienceRange = [self.dataSourceHelper patAudienceRangeForModelID:model.ID];
CGFloat height = [self.dataSourceHelper heightForModelID:model.ID];
CGFloat width = [self.dataSourceHelper widthForModelID:model.ID];
......@@ -186,7 +188,7 @@
showBackground = YES;
}
[cell fus_setupCellWithModel:model attributedString:attr height:height width:width showBackground:showBackground];
[cell fus_setupCellWithModel:model attributedString:attr patAudienceRange:patAudienceRange height:height width:width showBackground:showBackground];
[cell setOnClickNicknameWithModel:^(FUSLiveChatModel *model) {
......@@ -195,6 +197,13 @@
}
}];
[cell setOnClickPatAudienceWithModel:^(FUSLiveChatModel *model) {
// 点击了撩一撩
if (weakSelf.onClickPatAudiencetHandler) {
weakSelf.onClickPatAudiencetHandler(model);
}
}];
return cell;
}
......@@ -395,6 +404,11 @@
[self.dataSourceHelper fus_addSystemTip:tip];
}
/// 更新一个信息
- (void)fus_UpdataMessageWithModel:(FUSLiveChatModel *)model{
[self.dataSourceHelper fus_updateMessageWithModel:model];
}
#pragma mark - method
- (void)fus_scrollToBottom{
......
......@@ -21,14 +21,18 @@
@property (nonatomic, copy) void(^onClickNicknameWithModel)(FUSLiveChatModel *);
@property (nonatomic, copy) void(^onClickPatAudienceWithModel)(FUSLiveChatModel *);
- (void)fus_setupCellWithModel:(FUSLiveChatModel *)model
attributedString:(NSAttributedString *)attr
patAudienceRange:(NSRange)patAudienceRange
height:(CGFloat)height
width:(CGFloat)width
showBackground:(BOOL)showBackground;
- (void)fus_changeCellToModel:(FUSLiveChatModel *)model
attributedString:(NSAttributedString *)attr
patAudienceRange:(NSRange)patAudienceRange
height:(CGFloat)height
width:(CGFloat)width
completionHandler:(void(^)(FUSLiveChatModel *oldModel))completionHandler;
......
......@@ -30,6 +30,9 @@
// 背景 View
@property (nonatomic, strong) UIImageView *bgView;
/// 拍一拍的范围
@property (nonatomic, assign) NSRange patAudienceRange;
@end
@implementation FUSLiveChatTableViewCell
......@@ -90,26 +93,54 @@
[_bgView addSubview:_contentLabel];
// 添加点击
[_contentLabel addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onTapContentLabel:)]];
// [_contentLabel addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onTapContentLabel:)]];
// ludy:新版本由这个替代
MJWeakSelf
_contentLabel.textTapAction = ^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
if (weakSelf.model.patStatus == 1 && range.location == weakSelf.patAudienceRange.location) {
// 撩一撩
if ([FUSLiveHelper shareInstance].liveType == FUSLiveTypeAudience) {
// 如果是观众端,那么直接无视
return;
}
if (weakSelf.onClickPatAudienceWithModel) {
weakSelf.onClickPatAudienceWithModel(weakSelf.model);
}
}
else {
//其他情况
if ((![NSString isNull:weakSelf.model.uid] && weakSelf.model.uid.integerValue != 0)
|| weakSelf.model.clickType == FUSLiveChatModelClickTypeDewGift
|| (weakSelf.model.clickType == FUSLiveChatModelClickTypeOtherLiveRoom && ![NSString isNull:weakSelf.model.toUid])) {
// 能nickname的就交付给nickname
if (weakSelf.onClickNicknameWithModel) weakSelf.onClickNicknameWithModel(weakSelf.model);
}
}
};
}
// 点击事件
- (void)onTapContentLabel:(UITapGestureRecognizer *)tap
{
if ((![NSString isNull:_model.uid] && _model.uid.integerValue != 0)
|| _model.clickType == FUSLiveChatModelClickTypeDewGift
|| (_model.clickType == FUSLiveChatModelClickTypeOtherLiveRoom && ![NSString isNull:_model.toUid])) {
if (self.onClickNicknameWithModel) self.onClickNicknameWithModel(_model);
}
}
//- (void)onTapContentLabel:(UITapGestureRecognizer *)tap
//{
// if ((![NSString isNull:_model.uid] && _model.uid.integerValue != 0)
// || _model.clickType == FUSLiveChatModelClickTypeDewGift
// || (_model.clickType == FUSLiveChatModelClickTypeOtherLiveRoom && ![NSString isNull:_model.toUid])) {
// if (self.onClickNicknameWithModel) self.onClickNicknameWithModel(_model);
// }
//}
- (void)fus_setupCellWithModel:(FUSLiveChatModel *)model
attributedString:(NSAttributedString *)attr
patAudienceRange:(NSRange)patAudienceRange
height:(CGFloat)height
width:(CGFloat)width
showBackground:(BOOL)showBackground
{
_patAudienceRange = patAudienceRange;
if (attr.length && [self.contentLabel.attributedText isEqualToAttributedString:attr]) {
// 设置 frame
_contentLabel.frame = CGRectMake(CELL_LEADING_SPACE, CELL_MARGIN, width, height);
......@@ -166,7 +197,12 @@
_contentLabel.alpha = 1;
}
- (void)fus_changeCellToModel:(FUSLiveChatModel *)model attributedString:(NSAttributedString *)attr height:(CGFloat)height width:(CGFloat)width completionHandler:(void(^)(FUSLiveChatModel *oldModel))completionHandler
- (void)fus_changeCellToModel:(FUSLiveChatModel *)model
attributedString:(NSAttributedString *)attr
patAudienceRange:(NSRange)patAudienceRange
height:(CGFloat)height
width:(CGFloat)width
completionHandler:(void(^)(FUSLiveChatModel *oldModel))completionHandler
{
if (_isChanging) {
return;
......@@ -188,7 +224,7 @@
}
// 设置 lable
[self fus_setupCellWithModel:model attributedString:attr height:height width:width showBackground:showBackground];
[self fus_setupCellWithModel:model attributedString:attr patAudienceRange:patAudienceRange height:height width:width showBackground:showBackground];
// 持有当前内容
self.currentString = model.msg;
// 设置 frame
......
......@@ -382,6 +382,12 @@ typedef NS_ENUM(NSInteger, FUSFunctionMode) {
/// @param url 动画图片url
- (void)fus_startHeadViewReceiveGiftAnimWithImgUrl:(NSString *)url;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
/// 接收富豪等级变化通知
-(void)fus_recieveRichLevelChangeWithUID:(NSString *)uid newLevel:(NSString *)newLevel;
#pragma mark - 直播间最小化最大化关闭操作
/// 退出当前直播间
- (void)fus_exitRoomCompelete:(void(^)(void))compelete;
......
......@@ -41,6 +41,7 @@
#import "FUSVideoChatUserInfoView.h"
#import "FUSHalfWebView.h"
#import "FUSRoomFirstChargeAlertView.h"
#import "FUSPatAudiencePromptAlertView.h"
#import "FUSLiveManagerViewController.h"
......@@ -327,6 +328,9 @@ FUSLinkMicUserListDelegate
/// 半屏网页的管理,内部全是弱引用,放心添加网页
@property (nonatomic, strong) FUSLiveFunctionViewHalfWebManager *halfWebManager;
/// 观众端拍一拍的弹窗
@property (nonatomic, strong) FUSPatAudiencePromptAlertView *patAudienceProptAlertView;
@end
@implementation FUSLiveFunctionView
......@@ -777,6 +781,33 @@ FUSLinkMicUserListDelegate
_chatTableView.enableSendNotification = YES;
[_chatViewBgView addSubview:_chatTableView];
__weak typeof(_chatTableView) weakChatTableView = _chatTableView;
__weak typeof(_pusherChatTableView) weakPusherChatTableView = _pusherChatTableView;
[_chatTableView setOnClickPatAudiencetHandler:^(FUSLiveChatModel *model) {
if ([NSString isNullWithString:model.realUid]) {
return;
}
model.patStatus = NO;
[weakChatTableView fus_UpdataMessageWithModel:model];
[weakPusherChatTableView fus_UpdataMessageWithModel:model];
[FUSLiveHttpHelper fus_livePatUserWithRoomId:[FUSLiveHelper shareInstance].roomInfoModel.roomId toUserId:model.realUid succeed:^{
} failure:^(NSString *msg, NSInteger code) {
// -20109为已经拍过这个用户了,所以不需要重新显示了
if (code != -20109) {
// 拍失败则重新显示
model.patStatus = YES;
[weakChatTableView fus_UpdataMessageWithModel:model];
[weakPusherChatTableView fus_UpdataMessageWithModel:model];
}
[FUSDialogView fus_showDialog:msg];
}];
}];
[_chatTableView setOnClickNicknameHandler:^(FUSLiveChatModel *model) {
[weakSelf endEditing:YES];
......@@ -1019,6 +1050,33 @@ FUSLinkMicUserListDelegate
_pusherChatTableView.enableSendNotification = NO;
[bgView addSubview:_pusherChatTableView];
__weak typeof(_chatTableView) weakChatTableView = _chatTableView;
__weak typeof(_pusherChatTableView) weakPusherChatTableView = _pusherChatTableView;
[_pusherChatTableView setOnClickPatAudiencetHandler:^(FUSLiveChatModel *model) {
if ([NSString isNullWithString:model.realUid]) {
return;
}
model.patStatus = NO;
[weakChatTableView fus_UpdataMessageWithModel:model];
[weakPusherChatTableView fus_UpdataMessageWithModel:model];
[FUSLiveHttpHelper fus_livePatUserWithRoomId:[FUSLiveHelper shareInstance].roomInfoModel.roomId toUserId:model.realUid succeed:^{
} failure:^(NSString *msg, NSInteger code) {
// -20109为已经拍过这个用户了,所以不需要重新显示了
if (code != -20109) {
// 拍失败则重新显示
model.patStatus = YES;
[weakChatTableView fus_UpdataMessageWithModel:model];
[weakPusherChatTableView fus_UpdataMessageWithModel:model];
}
[FUSDialogView fus_showDialog:msg];
}];
}];
__weak typeof(self) weakSelf = self;
[_pusherChatTableView setOnClickNicknameHandler:^(FUSLiveChatModel *model) {
[weakSelf endEditing:YES];
......@@ -1868,6 +1926,9 @@ FUSLinkMicUserListDelegate
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_receivePKStateDidChanged:) name:FUSLiveNotificationKeys.fus_FUS_LIVE_ROOM_PK_STATUS object:nil];
// 接收主播直播拍一拍用户消息
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_receivePatAudienceUpNotification:) name:STR(ROOM_CID_receivePatAudience) object:nil];
//每进一个直播间静音状态都复原
[[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:PLAYER_SOUND_MUTE];
[self.pkHelper registNotification];
......@@ -2997,6 +3058,26 @@ FUSLinkMicUserListDelegate
}
}
/// 观众端接收拍一拍的消息
-(void)fus_receivePatAudienceUpNotification:(NSNotification *)notification {
FUSSocketMessageModel *socketModel = notification.object;
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAudience) {
return;
}
NSDictionary *dict = [socketModel fus_getJsonDict];
NSString *roomId = [dict[@"roomId"] stringValue];
if (![FUSLiveHelper.shareInstance.roomInfoModel.roomId isEqualToString:roomId]) {
return;
}
[self.patAudienceProptAlertView fus_dismissWithAnimation];
self.patAudienceProptAlertView = nil;
self.patAudienceProptAlertView = [FUSPatAudiencePromptAlertView fus_showWithData:dict showOn:[self fus_viewWithLayer:FUSLiveFunctionLayerAutoPopView]];
}
- (void)fus_showKeywordEffectNofitication:(NSNotification *)notification {
FUSSocketMessageModel *socketModel = notification.object;
......@@ -4819,6 +4900,30 @@ FUSLinkMicUserListDelegate
[self.headView fus_startHeadViewReceiveGiftAnimWithImgUrl:url];
}
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
- (void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow{
if (FUSLiveHelper.shareInstance.roomInfoModel.liked.boolValue == isFollow) {
return;
}
if (self.pkHelper.pkLiveState == FUSPKLiveStatePK) {
return;
}
// 判断键盘当前是否是编辑状态
if (_isEditing == YES) {
_keyBoardHideNeedShowLikeNotice = YES;
return;
}else{
_keyBoardHideNeedShowLikeNotice = NO;
}
[self.headView fus_showClickLikeAnimateWithIsFollow:isFollow];
}
- (void)fus_recieveRichLevelChangeWithUID:(NSString *)uid newLevel:(NSString *)newLevel{
[self.userListViewModel fus_reloadUserDataWithUID:uid newLevel:newLevel inPay:nil];
}
/**
设置热力值
......
......@@ -204,4 +204,7 @@ typedef NS_ENUM(NSInteger, FUSLiveHeadViewType) {
- (void)fus_updateUserListModel:(id)userListModel;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
@end
......@@ -612,6 +612,10 @@ NSString * const kDidHotScoreChangeNotification = @"kDidHotScoreChangeNotificati
}
}
- (void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow{
[self.portraitView fus_showClickLikeAnimateWithIsFollow:isFollow];
}
/**
获取追踪按钮在 Window 上的 rect
......
......@@ -81,6 +81,9 @@
*/
- (void)fus_onClickLikeButton:(UIButton *)sender;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
- (void)fus_anchorOffline:(BOOL)offline;
......
......@@ -785,6 +785,47 @@
}];
}
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow{
if (isFollow) {
// 设置图片动画
CGFloat framePerSecond = 12.0;
NSMutableArray *imageArr = [NSMutableArray array];
for (int i = 0; i <= 5; i++) {
UIImage *image = [FUSShowRoomCenterBunble imageNamed:[NSString stringWithFormat:@"live_head_follow_btn_anim_%d", i]];
if (image) {
[imageArr addObject:image];
}
}
CGFloat duration = imageArr.count / framePerSecond;
self.likeBtn.imageView.animationImages = imageArr;
self.likeBtn.imageView.animationDuration = duration;
self.likeBtn.imageView.animationRepeatCount = 1;
[self.likeBtn.imageView startAnimating];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.likeBtn.imageView stopAnimating];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"追踪成功"]];
[[FUSLiveHelper shareInstance]roomInfoModel].liked = @"1";
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:@{@"roomId":self.currentModel.roomId,@"like":@(YES)}];
[self fus_dismissLikeButtonWithAnimation:YES];
self.likeBtn.enabled = YES;
});
}else {
// ludy:这个居然是取消,我也不知道前面的人怎么写的,很夸张
[self fus_showLikeButtonWithAnimation:YES];
}
}
/**
手势点击 Portrait View
*/
......
//
// FUSPatAudienceGiftCell.swift
// FUSShowRoomModule
//
// Created by aaa on 2024/9/26.
//
import UIKit
@objcMembers public class FUSPatAudienceGiftCell: FUSSwiftCollectionViewCell {
static public func fus_getCellIdentifier() -> String {
return "FUSPatAudienceGiftCell"
}
public var itemSelect: Bool = false {
didSet{
bgImageView.layer.borderWidth = itemSelect ? 1 : 0
}
}
let bgImageView = UIImageView()
let iconImageView = UIImageView()
let nameLabel = UILabel()
let costBtn = UIButton(type: .custom)
public override func makeUI() {
super.makeUI()
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
bgImageView.layer.cornerRadius = 4
bgImageView.backgroundColor = .init(hex: "#EEECEC")
bgImageView.layer.borderColor = UIColor.fus_theme().cgColor
bgImageView.layer.borderWidth = 0
bgImageView.layer.masksToBounds = true
self.contentView.addSubview(bgImageView)
bgImageView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
bgImageView.addSubview(iconImageView)
iconImageView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(7)
make.centerX.equalToSuperview()
make.size.equalTo(CGSizeMake(30, 30))
}
nameLabel.font = .fus_themeFont(11)
nameLabel.textColor = .fus_textColorRich()
bgImageView.addSubview(nameLabel)
nameLabel.snp.makeConstraints { make in
make.top.equalTo(iconImageView.snp.bottom).offset(4)
make.centerX.equalToSuperview()
}
costBtn.titleLabel?.font = .fus_themeMediumFont(12)
bgImageView.addSubview(costBtn)
costBtn.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(nameLabel.snp.bottom).offset(0)
make.height.equalTo(18)
}
costBtn.imageView?.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(12, 12))
}
}
public func fus_setup(model: FUSPatAudienceGiftModel) {
if model.fus_modelType == -1 {
iconImageView.image = FUSShowRoomCenterBunble.imageNamed("live_chat_patAudience_gift_follow")
nameLabel.text = .fus_versionLocalString("关注")
costBtn.setImage(nil, for: .normal)
costBtn.setTitle(.fus_versionLocalString("免费"), for: .normal)
costBtn.setTitleColor(.fus_textColorMedium(), for: .normal)
}else if model.fus_modelType == 0 {
iconImageView.setWebImageWithSubURLString(model.giftUrl)
nameLabel.text = model.giftName
costBtn.setImage(fus_getCurrencyImage(giftCurrency: model.giftCurrency), for: .normal)
costBtn.setTitle(" \(model.giftPrice)", for: .normal)
costBtn.setTitleColor(.fus_theme(), for: .normal)
}
}
func fus_getCurrencyImage(giftCurrency: Int) -> UIImage? {
switch giftCurrency{
case 3:
return .fus_diamonIcon()
case 5:
return .fus_dewIcon()
case 6:
return .fus_diamonIcon()
default:
return nil
}
}
}
//
// FUSPatAudiencePromptAlertView.h
// FUSShowRoomModule
//
// Created by aaa on 2024/9/25.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface FUSPatAudiencePromptAlertView : UIView
+(FUSPatAudiencePromptAlertView *)fus_showWithData:(NSDictionary *)dataDict showOn:(UIView * _Nullable )onView;
-(void)fus_dismissWithAnimation;
@end
NS_ASSUME_NONNULL_END
//
// FUSPatAudiencePromptAlertView.m
// FUSShowRoomModule
//
// Created by aaa on 2024/9/25.
//
#import "FUSPatAudiencePromptAlertView.h"
#import <Masonry/Masonry.h>
#import <FUSShowRoomModule/FUSShowRoomModule-Swift.h>
@interface FUSPatAudiencePromptAlertView ()<UICollectionViewDelegate, UICollectionViewDataSource>
// UI
@property (nonatomic, strong) UIButton *bgBtn;
@property (nonatomic, strong) UIImageView *contentView;
@property (nonatomic, strong) UIButton *avatarBtn;
@property (nonatomic, strong) UILabel *anchorNameLabel;
@property (nonatomic, strong) UILabel *patTextLabel;
@property (nonatomic, strong) YYAnimatedImageView *patImageView;
@property (nonatomic, strong) UILabel *giftTextLabel;
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) UIButton *cancelBtn;
@property (nonatomic, strong) UIButton *okBtn;
// data
@property (nonatomic, copy) NSDictionary *dataDict;
@property (nonatomic, copy) NSString *roomId;
@property (nonatomic, copy) NSString *userId;
/// 显示礼物的列表
@property (nonatomic, strong) NSMutableArray<FUSPatAudienceGiftModel *> *dataSourceList;
/// 请求下来的撩一撩数据,里面只有礼物,自己创建一个回拍并关注的模型添加进去dataSourceList用来作为显示骨架
@property (nonatomic, strong) FUSPatAudiencePatDataModel *patDataModel;
@property (nonatomic, assign) NSInteger itemSelect;
@end
@implementation FUSPatAudiencePromptAlertView
+(FUSPatAudiencePromptAlertView *)fus_showWithData:(NSDictionary *)dataDict showOn:(UIView * _Nullable )onView{
UIView *showView = [UINavigationController fus_topViewController].view;
if (onView) {
showView = onView;
}
FUSPatAudiencePromptAlertView *view = [[FUSPatAudiencePromptAlertView alloc] initWithFrame:showView.bounds];
view.dataDict = dataDict;
[showView addSubview:view];
[view fus_reloadData];
[view fus_showWithAnimation];
return view;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self fus_makeUI];
}
return self;
}
-(void)fus_makeUI{
self.alpha = 0;
self.backgroundColor = [UIColor fus_alertViewBackgroundColor];
self.bgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self addSubview:self.bgBtn];
[self.bgBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
self.contentView = [[UIImageView alloc] init];
self.contentView.backgroundColor = [UIColor whiteColor];
self.contentView.layer.cornerRadius = 22;
self.contentView.userInteractionEnabled = YES;
[self.bgBtn addSubview:self.contentView];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self.bgBtn);
make.width.equalTo(@(300));
}];
self.avatarBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.avatarBtn.backgroundColor = [UIColor whiteColor];
self.avatarBtn.layer.cornerRadius = 60.0/2.0;
self.avatarBtn.layer.masksToBounds = YES;
[self.contentView addSubview:self.avatarBtn];
[self.avatarBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.top.equalTo(self.contentView).offset(28);
make.size.mas_equalTo(CGSizeMake(60, 60));
}];
self.anchorNameLabel = [[UILabel alloc] init];
self.anchorNameLabel.text = @"anchor_name";
self.anchorNameLabel.font = [UIFont fus_themeBoldFont:17];
self.anchorNameLabel.textColor = [UIColor fus_textColorRich];
[self.contentView addSubview:self.anchorNameLabel];
[self.anchorNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.top.equalTo(self.avatarBtn.mas_bottom).offset(8);
}];
self.patTextLabel = [[UILabel alloc] init];
self.patTextLabel.text = [NSString fus_versionLocalString:@"撩了撩你"];
self.patTextLabel.font = [UIFont fus_themeFont:14];
self.patTextLabel.textColor = [UIColor fus_textColorRich];
[self.contentView addSubview:self.patTextLabel];
[self.patTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView).offset(-12);
make.top.equalTo(self.anchorNameLabel.mas_bottom).offset(9);
}];
self.patImageView = [[YYAnimatedImageView alloc] init];
self.patImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.contentView addSubview:self.patImageView];
[self.patImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.patTextLabel.mas_right).offset(-1);
make.centerY.equalTo(self.patTextLabel).offset(-2);
make.size.mas_equalTo(CGSizeMake(24, 29));
}];
UIView *dashLine = [[UIView alloc] init];
dashLine.backgroundColor = [UIColor colorWithHex:@"#DDDDDD"];
[self.contentView addSubview:dashLine];
[dashLine mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView).inset(23);
make.top.equalTo(self.patTextLabel.mas_bottom).offset(17);
make.height.equalTo(@1);
}];
self.giftTextLabel = [[UILabel alloc] init];
self.giftTextLabel.text = [NSString fus_versionLocalString:@"回撩她并送出礼物"];
self.giftTextLabel.font = [UIFont fus_themeFont:14];
self.giftTextLabel.textColor = [UIColor fus_textColorRich];
[self.contentView addSubview:self.giftTextLabel];
[self.giftTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(dashLine);
make.top.equalTo(dashLine.mas_bottom).offset(12);
}];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.minimumLineSpacing = 7;
layout.minimumInteritemSpacing = 0;
layout.sectionInset = UIEdgeInsetsMake(0, 22, 0, 22);
layout.itemSize = CGSizeMake(80, 84);
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
self.collectionView.backgroundColor = [UIColor clearColor];
self.collectionView.showsVerticalScrollIndicator = NO;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.bounces = NO;
[self.collectionView registerClass:[FUSPatAudienceGiftCell class] forCellWithReuseIdentifier:[FUSPatAudienceGiftCell fus_getCellIdentifier]];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
[self.contentView addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.top.equalTo(self.giftTextLabel.mas_bottom).offset(13);
make.height.equalTo(@85);
}];
self.cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.cancelBtn.backgroundColor = [UIColor colorWithHex:@"#DBDAD9"];
[self.cancelBtn setTitleColor:[UIColor colorWithHex:@"#333333"] forState:UIControlStateNormal];
self.cancelBtn.titleLabel.font = [UIFont fus_themeMediumFont:14];
[self.cancelBtn setTitle:[NSString fus_versionLocalString:@"取消"] forState:UIControlStateNormal];
self.cancelBtn.layer.cornerRadius = 21;
self.cancelBtn.layer.masksToBounds = YES;
[self.contentView addSubview:self.cancelBtn];
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.collectionView.mas_bottom).offset(18);
make.size.mas_equalTo(CGSizeMake(108, 42));
make.right.equalTo(self.contentView.mas_centerX).offset(-7);
}];
self.okBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.okBtn.backgroundColor = [UIColor fus_themeColor];
[self.okBtn setTitleColor:[UIColor colorWithHex:@"#22222B"] forState:UIControlStateNormal];
self.okBtn.titleLabel.font = [UIFont fus_themeMediumFont:14];
[self.okBtn setTitle:[NSString fus_versionLocalString:@"回撩"] forState:UIControlStateNormal];
self.okBtn.layer.cornerRadius = 21;
self.okBtn.layer.masksToBounds = YES;
[self.contentView addSubview:self.okBtn];
[self.okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.cancelBtn.mas_top);
make.size.mas_equalTo(CGSizeMake(108, 42));
make.left.equalTo(self.contentView.mas_centerX).offset(7);
make.bottom.equalTo(self.contentView.mas_bottom).offset(-26);
}];
[self.cancelBtn addTarget:self action:@selector(cancelBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.okBtn addTarget:self action:@selector(okBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside];
}
#pragma mark - method
-(void)fus_reloadData{
self.roomId = self.dataDict[@"roomId"];
self.userId = self.dataDict[@"userId"];
self.patDataModel = [FUSPatAudiencePatDataModel fus_modelWithDict:self.dataDict[@"patData"]];
// self.itemSelect = (self.patDataModel.follow == 1 && self.patDataModel.giftList.count > 0) ? 1 : 0;
[self.dataSourceList removeAllObjects];
if (self.patDataModel.follow == 1) {
FUSPatAudienceGiftModel *model = [[FUSPatAudienceGiftModel alloc] init];
model.fus_modelType = -1;
[self.dataSourceList addObject:model];
}
[self.dataSourceList appendObjects:self.patDataModel.giftList];
self.itemSelect = 0;
MJWeakSelf
[self.dataSourceList enumerateObjectsUsingBlock:^(FUSPatAudienceGiftModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.selected == YES) {
weakSelf.itemSelect = idx;
}
}];
[self.collectionView reloadData];
[self.avatarBtn setWebImageWithSubURLString:[FUSCacheDataShare shareStore].userDetailInfo.face controlState:UIControlStateNormal placeholder:[UIImage fus_defaultIcon]];
self.anchorNameLabel.text = [FUSCacheDataShare shareStore].userDetailInfo.nickname;
}
-(void)fus_sendGift:(FUSPatAudienceGiftModel *)giftModel{
[FUSLoadingView fus_showProgressViewWithMessage:@"" canTouchBottomView:NO];
if (giftModel.fus_modelType == -1) {
// 关注
[FUSLiveHttpHelper fus_livePatReplyWithRoomId:self.roomId type:1 gid:@"" succeed:^(NSMutableDictionary *changed) {
[FUSLoadingView fus_dismissProgressView];
[[FUSLiveHelper shareInstance].currentFunctionView fus_showClickLikeAnimateWithIsFollow:YES];
} failure:^(NSString *msg, NSInteger code) {
[FUSLoadingView fus_dismissProgressView];
[FUSDialogView fus_showDialog:msg];
}];
}else {
// 送礼
MJWeakSelf
[FUSLiveHttpHelper fus_livePatReplyWithRoomId:self.roomId type:2 gid:giftModel.gid succeed:^(NSMutableDictionary *changed) {
[FUSLoadingView fus_dismissProgressView];
NSInteger lastTime = [FUSCacheDataShare shareStore].lastUpdateAccountInfoTime;
NSInteger serverTime = [changed[@"lastTime"] integerValue];
NSDictionary *changedChangedDict = changed[@"changed"];
NSString *coin = [changedChangedDict[@"coin"] stringValue];
NSString *diamond = [changedChangedDict[@"diamond"] stringValue];
NSString *level = [changedChangedDict[@"level"] stringValue];
NSString *chip = [changedChangedDict[@"chip"] stringValue];
NSString *rich = [changed[@"rich"] stringValue];
if (serverTime > lastTime) {
[FUSCacheDataShare shareStore].lastUpdateAccountInfoTime = serverTime;
if ([NSString isNull:coin]) {
coin = [[[FUSCacheDataShare shareStore]userDetailInfo]gold];
}else{
[[FUSCacheDataShare shareStore]userDetailInfo].gold = coin;
}
if ([NSString isNull:diamond]) {
diamond = [[[FUSCacheDataShare shareStore]userDetailInfo]diamond];
}else{
[[FUSCacheDataShare shareStore]userDetailInfo].diamond = diamond;
}
if ([NSString isNull:chip]) {
chip = [[[FUSCacheDataShare shareStore]userDetailInfo]chip];
}else{
[[FUSCacheDataShare shareStore]userDetailInfo].chip = chip;
}
if (![NSString isNull:level]) {
[[FUSCacheDataShare shareStore]userDetailInfo].level = level;
// 发布通知
[[FUSLiveHelper shareInstance].currentFunctionView fus_recieveRichLevelChangeWithUID:[FUSCacheDataShare shareStore].userDetailInfo.uid newLevel:level];
}
[FUSLiveHelper shareInstance].richValue = rich;
}
[[FUSLiveHelper shareInstance].currentFunctionView fus_showClickLikeAnimateWithIsFollow:YES];
[weakSelf fus_dismissWithAnimation];
} failure:^(NSString *msg, NSInteger code) {
[FUSLoadingView fus_dismissProgressView];
[FUSDialogView fus_showDialog:msg];
if (code == -116) {
// 兑换露水
FUSHalfWebViewModel *halfWebModel = [[FUSHalfWebViewModel alloc] init];
halfWebModel.popupType = FUSHalfWebViewPopupTypeHalfWeb;
halfWebModel.url = FUSCacheDataShare.shareStore.settingInitDataModel.fusiConfig.dewHalfAddress;
halfWebModel.clickBlank = YES;
halfWebModel.transparency = YES;
halfWebModel.heightR = @(82).stringValue;
[FUSLiveHelper.shareInstance.currentFunctionView fus_showHalfWebView:halfWebModel];
}else if (code == -100) {
// 兑换宝石
[weakSelf fus_checkFirstChargeAndShowHalfCharge];
}
}];
}
}
-(void)fus_checkFirstChargeAndShowHalfCharge{
if (FUSConfig.sharedInstanced.devConfigs.appStatus) {
if (self.viewController) {
[self.viewController.navigationController pushViewController:[[FUSRechargeViewController alloc] init] animated:YES];
}
}else {
// 检查手冲
MJWeakSelf
[FUSLoadingView fus_showProgressViewWithMessage:@"" canTouchBottomView:NO];
[FUSLiveHttpHelper fus_requestFirstRechargeInfoWithSuccess:^(NSDictionary *dataDict) {
[FUSLoadingView fus_dismissProgressView];
NSInteger firstCharge = [dataDict[@"firstCharge"] integerValue];
if (firstCharge == 1) {
// 有手冲
[[FUSLiveHelper shareInstance].currentFunctionView fus_showFirstChargeView:NO];
}else {
if (weakSelf.viewController) {
[weakSelf.viewController.navigationController pushViewController:[[FUSRechargeViewController alloc] init] animated:YES];
}
}
} failure:^(NSString *msg, int code) {
[FUSLoadingView fus_dismissProgressView];
[FUSDialogView fus_showDialog:msg];
}];
}
}
-(void)fus_showWithAnimation{
[UIView animateWithDuration:0.25 animations:^{
self.alpha = 1;
}];
NSString *imagePath = [[FUSShowRoomCenterBunble bundle] pathForResource:@"liveRoom_patAudience_pat_animate.webp" ofType:@""];
NSData *imageData = [NSData dataWithContentsOfFile:imagePath];
YYImage *yyImage = [YYImage imageWithData:imageData];
self.patImageView.image = yyImage;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self fus_startPatAnimation];
});
}
-(void)fus_dismissWithAnimation{
[UIView animateWithDuration:0.25 animations:^{
self.alpha = 0;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(void)fus_startPatAnimation{
CGPoint originalCenter = self.patTextLabel.center;
// 左右晃动的动画
[UIView animateWithDuration:0.18 animations:^{
CGPoint center = self.patTextLabel.center;
center.x += 3;
self.patTextLabel.center = center;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.18 animations:^{
CGPoint center = self.patTextLabel.center;
center.x -= 3;
self.patTextLabel.center = center;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.18 animations:^{
CGPoint center = self.patTextLabel.center;
center.x += 3;
self.patTextLabel.center = center;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.18 animations:^{
// 动画完成后的处理
self.patTextLabel.center = originalCenter;
} completion:^(BOOL finished) {
}];
}];
}];
}];
}
#pragma mark - button did clicked
-(void)cancelBtnDidClicked:(UIButton *)btn{
[self fus_dismissWithAnimation];
}
-(void)okBtnDidClicked:(UIButton *)btn{
if (self.itemSelect >= self.dataSourceList.count) {
return;
}
FUSPatAudienceGiftModel *model = self.dataSourceList[self.itemSelect];
[self fus_sendGift:model];
}
#pragma mark - collection view delegate
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataSourceList.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
FUSPatAudienceGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[FUSPatAudienceGiftCell fus_getCellIdentifier] forIndexPath:indexPath];
[cell fus_setupWithModel:self.dataSourceList[indexPath.row]];
cell.itemSelect = indexPath.row == self.itemSelect;
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
self.itemSelect = indexPath.row;
[collectionView reloadData];
}
#pragma mark - getter
- (NSMutableArray<FUSPatAudienceGiftModel *> *)dataSourceList{
if (!_dataSourceList) {
_dataSourceList = [[NSMutableArray alloc] init];
}
return _dataSourceList;
}
@end
......@@ -364,6 +364,12 @@ NS_ASSUME_NONNULL_BEGIN
/// 设置新人7天签到提醒
+ (NSString *)fus_URL_USER_NOVICE_CHECKIN_REMIND_SET;
/// 回拍 类型(1:关注、2:送礼)
+ (NSString *)fus_URL_LIVE_PAT_REPLY;
/// 拍一拍用户
+ (NSString *)fus_URL_LIVE_PAT_USER;
@end
......
......@@ -489,6 +489,14 @@
+ (NSString *)fus_URL_GET_IM_SEND_CHAT_RESULT {
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/imchat/getInSendChatResult.html"];
}
/// 回拍 类型(1:关注、2:送礼)
+ (NSString *)fus_URL_LIVE_PAT_REPLY{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/pat/reply"];
}
/// 拍一拍用户
+ (NSString *)fus_URL_LIVE_PAT_USER{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/pat/user"];
}
#pragma mark -- PK
// 房间PK信息
......
......@@ -7,12 +7,12 @@
<key>FUSUserCenterModule.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>75</integer>
<integer>76</integer>
</dict>
<key>FUSUserCenterModuleBundle.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>76</integer>
<integer>72</integer>
</dict>
</dict>
</dict>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment