跨房pk 邀请以及邀请之后的结果
@@ -515,6 +515,8 @@
|
||||
E8C6FFEA2755040B004DC9F0 /* XPHomeSearchNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C6FFE92755040B004DC9F0 /* XPHomeSearchNavView.m */; };
|
||||
E8C6FFED27550CC2004DC9F0 /* HomeSearchResultModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C6FFEC27550CC2004DC9F0 /* HomeSearchResultModel.m */; };
|
||||
E8CEA03D26EA3DE500644B44 /* LoginPasswordPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E8CEA03C26EA3DE500644B44 /* LoginPasswordPresent.m */; };
|
||||
E8D4824A278D1F73003C1D08 /* XPAcrossRoomPKInviteView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D48249278D1F73003C1D08 /* XPAcrossRoomPKInviteView.m */; };
|
||||
E8D4824D278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D4824C278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.m */; };
|
||||
E8DACCFB2766EDC60052092C /* MicroGiftValueView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */; };
|
||||
E8DACCFE27673F870052092C /* GiftValueInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFD27673F870052092C /* GiftValueInfoModel.m */; };
|
||||
E8DEC98B27637EA50078CB70 /* candyTree_open.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8DEC98927637EA50078CB70 /* candyTree_open.svga */; };
|
||||
@@ -1584,6 +1586,10 @@
|
||||
E8CEA03B26EA3DE500644B44 /* LoginPasswordPresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPasswordPresent.h; sourceTree = "<group>"; };
|
||||
E8CEA03C26EA3DE500644B44 /* LoginPasswordPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginPasswordPresent.m; sourceTree = "<group>"; };
|
||||
E8CEA03E26EA3E0200644B44 /* LoginPasswordProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPasswordProtocol.h; sourceTree = "<group>"; };
|
||||
E8D48248278D1F72003C1D08 /* XPAcrossRoomPKInviteView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKInviteView.h; sourceTree = "<group>"; };
|
||||
E8D48249278D1F73003C1D08 /* XPAcrossRoomPKInviteView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKInviteView.m; sourceTree = "<group>"; };
|
||||
E8D4824B278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKInviteResultView.h; sourceTree = "<group>"; };
|
||||
E8D4824C278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKInviteResultView.m; sourceTree = "<group>"; };
|
||||
E8DACCF92766EDC60052092C /* MicroGiftValueView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroGiftValueView.h; sourceTree = "<group>"; };
|
||||
E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroGiftValueView.m; sourceTree = "<group>"; };
|
||||
E8DACCFC27673F870052092C /* GiftValueInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftValueInfoModel.h; sourceTree = "<group>"; };
|
||||
@@ -3745,6 +3751,10 @@
|
||||
children = (
|
||||
E880B3B0278C1D1800A83B0D /* XPAcrossRoomPKRuleView.h */,
|
||||
E880B3B1278C1D1800A83B0D /* XPAcrossRoomPKRuleView.m */,
|
||||
E8D48248278D1F72003C1D08 /* XPAcrossRoomPKInviteView.h */,
|
||||
E8D48249278D1F73003C1D08 /* XPAcrossRoomPKInviteView.m */,
|
||||
E8D4824B278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.h */,
|
||||
E8D4824C278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.m */,
|
||||
);
|
||||
path = SubViews;
|
||||
sourceTree = "<group>";
|
||||
@@ -5076,6 +5086,7 @@
|
||||
9B85B6DA279FDC5200A0A1AC /* XPUserCardSkillCollectionViewCell.m in Sources */,
|
||||
189DD68426E1FDBB00AB55B1 /* XCHUDTool.m in Sources */,
|
||||
E8A6C29B27CF53BF00AC7442 /* XPHomeLikePresenter.m in Sources */,
|
||||
E8D4824A278D1F73003C1D08 /* XPAcrossRoomPKInviteView.m in Sources */,
|
||||
189DD73F26E21C3F00AB55B1 /* YYUtility+Carrier.m in Sources */,
|
||||
E87AE7F9277AABE50037823A /* XPRoomTagListViewController.m in Sources */,
|
||||
18E7B26926E8D5D60064BC9B /* XCCurrentVCStackManager.m in Sources */,
|
||||
@@ -5246,6 +5257,7 @@
|
||||
186A536926FC6F2E00D67B2C /* XPShareView.m in Sources */,
|
||||
9BC5C91C277C8A7B007C8719 /* XPReleaseRadioViewController.m in Sources */,
|
||||
186A534C26FC6ED900D67B2C /* TTAlertView.m in Sources */,
|
||||
E8D4824D278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.m in Sources */,
|
||||
E866B6E52759F96F009B002A /* XPMiniRoomView.m in Sources */,
|
||||
9B7B605B27BB53060070BB72 /* XPAnchorAudienceUpMicView.m in Sources */,
|
||||
E8B825BF26E9E57D009E8E9F /* LoginTicketInfo.m in Sources */,
|
||||
|
22
xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_invite_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_across_pk_invite_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_across_pk_invite_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 67 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_across_pk_invite_result_accept_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_across_pk_invite_result_accept_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_across_pk_invite_result_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_across_pk_invite_result_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_across_pk_invite_result_close@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_across_pk_invite_result_close@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 531 B |
After Width: | Height: | Size: 1.3 KiB |
@@ -48,6 +48,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
|
||||
CustomMessageType_First_Recharge_Reward = 76,
|
||||
///访客记录
|
||||
CustomMessageType_First_VisitorRecord = 78,
|
||||
///跨房PK
|
||||
CustomMessageType_Across_Room_PK = 83,
|
||||
///贵族VIP
|
||||
CustomMessageType_Noble_VIP = 85,
|
||||
///个播房观众点击空坑位,房主收到请求上麦提示
|
||||
@@ -223,6 +225,28 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubFirstRecharge) {
|
||||
Custom_Message_Sub_Room_First_Recharge_Reward= 761,
|
||||
};
|
||||
|
||||
/// 访客记录
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageSubVisitorRecord) {
|
||||
/// 访客记录
|
||||
Custom_Message_Sub_Visitor_Record = 781,
|
||||
};
|
||||
|
||||
///first = CustomMessageType_Across_Room_PK
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageSubAcrossRoomPK) {
|
||||
/// 收到跨房PK邀请
|
||||
Custom_Message_Sub_AcrossRoomPK_Invite = 831,
|
||||
/// 拒绝跨房PK
|
||||
Custom_Message_Sub_AcrossRoomPK_Reject = 832,
|
||||
/// 接受跨房PK
|
||||
Custom_Message_Sub_AcrossRoomPK_Accept = 833,
|
||||
/// 面板消息
|
||||
Custom_Message_Sub_AcrossRoomPK_Panel = 834,
|
||||
/// 跨房PK结束通知
|
||||
Custom_Message_Sub_AcrossRoomPK_End = 835,
|
||||
/// 跨房PK结束飘屏
|
||||
Custom_Message_Sub_AcrossRoomPK_Result = 836,
|
||||
};
|
||||
|
||||
///first = CustomMessageType_Noble_VIP
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageSubNobleVIP) {
|
||||
/// 开通贵族房内消息(公屏显示)
|
||||
@@ -242,11 +266,6 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubNobleVIP) {
|
||||
|
||||
};
|
||||
|
||||
/// 访客记录
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageSubVisitorRecord) {
|
||||
/// 访客记录
|
||||
Custom_Message_Sub_Visitor_Record = 781,
|
||||
};
|
||||
|
||||
@interface AttachmentModel : NSObject<NIMCustomAttachment>
|
||||
@property (nonatomic,assign) int first;
|
||||
|
@@ -94,13 +94,18 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param roomUid 房间的uid
|
||||
/// @param uid uid
|
||||
/// @param type 1 收藏 2 取消收藏
|
||||
+ (void)collectRoom:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid type:(NSString *)type;
|
||||
+ (void)collectRoom:(HttpRequestHelperCompletion)completion
|
||||
roomUid:(NSString *)roomUid
|
||||
uid:(NSString *)uid
|
||||
type:(NSString *)type;
|
||||
|
||||
/// 改变相亲的状态的
|
||||
/// @param completion 完成
|
||||
/// @param roomUserId 房主的uid
|
||||
/// @param roundId 相亲进行到哪一步
|
||||
+ (void)changeRoomDatingState:(HttpRequestHelperCompletion)completion roomUserId:(NSString *)roomUserId roundId:(NSString *)roundId;
|
||||
+ (void)changeRoomDatingState:(HttpRequestHelperCompletion)completion
|
||||
roomUserId:(NSString *)roomUserId
|
||||
roundId:(NSString *)roundId;
|
||||
|
||||
/// 上报用户进房
|
||||
/// @param completion 完成
|
||||
@@ -116,6 +121,15 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param ticket ticket
|
||||
+ (void)requestReportUserOutRoom:(HttpRequestHelperCompletion)completion uid:(NSString *)uid roomUid:(NSString *)roomUid ticket:(NSString *)ticket;
|
||||
|
||||
/// 处理跨房PK的邀请
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房主的ui
|
||||
/// @param roundId pk的id
|
||||
/// @param isAccept o拒绝 1 接受
|
||||
+ (void)handleAcrossRoomPKInvite:(HttpRequestHelperCompletion)completion
|
||||
roomUid:(NSString *)roomUid
|
||||
roundId:(NSString *)roundId
|
||||
isAccept:(NSString *)isAccept;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -135,4 +135,13 @@
|
||||
[self makeRequest:@"userroom/outV2" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, roomUid, ticket, nil];
|
||||
}
|
||||
|
||||
/// 处理跨房PK的邀请
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房主的ui
|
||||
/// @param roundId pk的id
|
||||
/// @param isAccept o拒绝 1 接受
|
||||
+ (void)handleAcrossRoomPKInvite:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid roundId:(NSString *)roundId isAccept:(NSString *)isAccept {
|
||||
[self makeRequest:@"crossroompkround/replyChallenge" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, roundId, isAccept, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -94,7 +94,7 @@
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 38/2;
|
||||
_avatarImageView.layer.cornerRadius = 60/2;
|
||||
_avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor;
|
||||
}
|
||||
return _avatarImageView;
|
||||
|
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// XPAcrossRoomPKInviteResultView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/1/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@interface XPAcrossRoomPKInviteResultView : UIView
|
||||
///是否是接受
|
||||
@property (nonatomic,assign) BOOL isAccept;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// XPAcrossRoomPKInviteResultView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/1/11.
|
||||
//
|
||||
|
||||
#import "XPAcrossRoomPKInviteResultView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
|
||||
@interface XPAcrossRoomPKInviteResultView ()
|
||||
///标题
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
///关闭
|
||||
@property (nonatomic, strong) UIButton *closeButton;
|
||||
///背景
|
||||
@property (nonatomic, strong) UIImageView *backImageView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPAcrossRoomPKInviteResultView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.backImageView];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.closeButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(0);
|
||||
}];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.left.mas_equalTo(12);
|
||||
}];
|
||||
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.right.mas_equalTo(-12);
|
||||
make.width.height.mas_equalTo(16);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)closeButtonAction:(UIButton *)button {
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
#pragma mark - getter
|
||||
- (void)setIsAccept:(BOOL)isAccept {
|
||||
if (isAccept) {
|
||||
self.titleLabel.text = @"对方接受你的pk请求,pk准备中";
|
||||
self.backImageView.image = [UIImage imageNamed:@"room_across_pk_invite_result_accept_bg"];
|
||||
} else {
|
||||
self.titleLabel.text = @"对方拒绝你的pk请求";
|
||||
self.backImageView.image = [UIImage imageNamed:@"room_across_pk_invite_result_bg"];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImageView *)backImageView {
|
||||
if (!_backImageView) {
|
||||
_backImageView = [[UIImageView alloc] init];
|
||||
_backImageView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _backImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightBold];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)closeButton {
|
||||
if (!_closeButton) {
|
||||
_closeButton = [[UIButton alloc] init];
|
||||
[_closeButton setImage:[UIImage imageNamed:@"room_across_pk_invite_result_close"] forState:UIControlStateNormal];
|
||||
[_closeButton addTarget:self action:@selector(closeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _closeButton;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// XPAcrossRoomPKInviteView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/1/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPAcrossRoomPKInviteView : UIView
|
||||
///房主的uid
|
||||
@property (nonatomic,copy) NSString *roomUid;
|
||||
///数据源
|
||||
@property (nonatomic,copy) NSDictionary *dataDic;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,355 @@
|
||||
//
|
||||
// XPAcrossRoomPKInviteView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/1/11.
|
||||
//
|
||||
|
||||
#import "XPAcrossRoomPKInviteView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "Api+Room.h"
|
||||
#import "XCHudTool.h"
|
||||
|
||||
@interface XPAcrossRoomPKInviteSubView : UIView
|
||||
///显示标题
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///内容
|
||||
@property (nonatomic,strong) UILabel *contentLabel;
|
||||
@end
|
||||
|
||||
@implementation XPAcrossRoomPKInviteSubView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.contentLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(17);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(50);
|
||||
make.left.centerY.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.titleLabel.mas_right).offset(15);
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.right.mas_lessThanOrEqualTo(self).offset(-5);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.textColor = UIColorFromRGB(0xffffff);
|
||||
_titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_titleLabel.text = @"PK时长";
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)contentLabel {
|
||||
if (!_contentLabel) {
|
||||
_contentLabel = [[UILabel alloc] init];
|
||||
_contentLabel.textColor = UIColorFromRGB(0xE8E035);
|
||||
_contentLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold];
|
||||
}
|
||||
return _contentLabel;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface XPAcrossRoomPKInviteView ()
|
||||
///标题
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///邀请方
|
||||
@property (nonatomic,strong) XPAcrossRoomPKInviteSubView *inviteView;
|
||||
///PK时长
|
||||
@property (nonatomic,strong) XPAcrossRoomPKInviteSubView *timeView;
|
||||
///PK玩法
|
||||
@property (nonatomic,strong) XPAcrossRoomPKInviteSubView *descView;
|
||||
///操作按钮的容器
|
||||
@property (nonatomic,strong) UIStackView *operaStackView;
|
||||
///拒绝
|
||||
@property (nonatomic, strong) UIButton *rejectButton;
|
||||
///接受
|
||||
@property (nonatomic, strong) UIButton *acceptButton;
|
||||
///背景
|
||||
@property (nonatomic, strong) UIImageView *backImageView;
|
||||
///倒计时
|
||||
@property (nonatomic, strong) UIButton *countDownButton;
|
||||
//拒绝邀请
|
||||
@property (strong, nonatomic) dispatch_source_t inviteTimer;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPAcrossRoomPKInviteView
|
||||
|
||||
- (void)dealloc {
|
||||
if (self.inviteTimer != nil) {
|
||||
dispatch_source_cancel(self.inviteTimer);
|
||||
self.inviteTimer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.backImageView];
|
||||
|
||||
[self.backImageView addSubview:self.titleLabel];
|
||||
[self.backImageView addSubview:self.stackView];
|
||||
[self.backImageView addSubview:self.operaStackView];
|
||||
[self.backImageView addSubview:self.countDownButton];
|
||||
|
||||
[self.stackView addArrangedSubview:self.inviteView];
|
||||
[self.stackView addArrangedSubview:self.timeView];
|
||||
[self.stackView addArrangedSubview:self.descView];
|
||||
|
||||
[self.operaStackView addArrangedSubview:self.rejectButton];
|
||||
[self.operaStackView addArrangedSubview:self.acceptButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(KScreenWidth - 47 * 2);
|
||||
make.bottom.mas_equalTo(self.backImageView.mas_bottom);
|
||||
}];
|
||||
|
||||
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.top.mas_equalTo(self);
|
||||
make.width.mas_equalTo(KScreenWidth - 47 * 2);
|
||||
make.bottom.mas_equalTo(self.operaStackView.mas_bottom).offset(16);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.top.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
[self.countDownButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.titleLabel);
|
||||
make.right.mas_equalTo(-15);
|
||||
make.width.mas_equalTo(32);
|
||||
make.height.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.backImageView).offset(16);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(18);
|
||||
make.right.mas_equalTo(self.backImageView);
|
||||
}];
|
||||
|
||||
[self.operaStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backImageView).inset(16);
|
||||
make.height.mas_equalTo(35);
|
||||
make.top.mas_equalTo(self.stackView.mas_bottom).offset(26);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)acceptButtonAction:(UIButton *)sender {
|
||||
NSString *roundId = self.dataDic[@"roundId"];
|
||||
[Api handleAcrossRoomPKInvite:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
dispatch_source_cancel(self.inviteTimer);
|
||||
self.inviteTimer = nil;
|
||||
[self removeFromSuperview];
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:msg];
|
||||
}
|
||||
} roomUid:self.roomUid roundId:roundId isAccept:@"1"];
|
||||
}
|
||||
|
||||
- (void)rejectButtonAction:(UIButton *)sender {
|
||||
NSString *roundId = self.dataDic[@"roundId"];
|
||||
[Api handleAcrossRoomPKInvite:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
dispatch_source_cancel(self.inviteTimer);
|
||||
self.inviteTimer = nil;
|
||||
[self removeFromSuperview];
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:msg];
|
||||
}
|
||||
} roomUid:self.roomUid roundId:roundId isAccept:@"0"];
|
||||
}
|
||||
|
||||
#pragma mark - getter
|
||||
- (void)setDataDic:(NSDictionary *)dataDic {
|
||||
_dataDic = dataDic;
|
||||
if (_dataDic.allKeys.count > 0) {
|
||||
self.inviteView.contentLabel.text = _dataDic[@"inviteRoomTitle"];
|
||||
self.timeView.contentLabel.text = [NSString stringWithFormat:@"%@分钟", _dataDic[@"pkDuration"]];
|
||||
NSString *desc = _dataDic[@"pkDesc"];
|
||||
if (desc.length > 0) {
|
||||
self.descView.hidden = NO;
|
||||
self.descView.contentLabel.text = desc;
|
||||
} else {
|
||||
self.descView.hidden = YES;
|
||||
}
|
||||
|
||||
if (_inviteTimer != nil) {
|
||||
dispatch_source_cancel(_inviteTimer);
|
||||
}
|
||||
__block NSInteger time = 10; //倒计时时间
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
|
||||
_inviteTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
||||
@kWeakify(self);
|
||||
dispatch_source_set_timer(_inviteTimer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行
|
||||
dispatch_source_set_event_handler(_inviteTimer, ^{
|
||||
if(time <= 0){ //倒计时结束,关闭
|
||||
dispatch_source_cancel(self.inviteTimer);
|
||||
self.inviteTimer = nil;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
[self removeFromSuperview];
|
||||
|
||||
});
|
||||
}else{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
[self.countDownButton setTitle:[NSString stringWithFormat:@"%02ld", time] forState:UIControlStateNormal];
|
||||
});
|
||||
time--;
|
||||
}
|
||||
});
|
||||
dispatch_resume(_inviteTimer);
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImageView *)backImageView {
|
||||
if (!_backImageView) {
|
||||
_backImageView = [[UIImageView alloc] init];
|
||||
_backImageView.userInteractionEnabled = YES;
|
||||
_backImageView.image = [UIImage imageNamed:@"room_across_pk_invite_bg"];
|
||||
}
|
||||
return _backImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold];
|
||||
_titleLabel.text = @"PK邀请";
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisVertical;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentFill;
|
||||
_stackView.spacing = 18;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
- (XPAcrossRoomPKInviteSubView *)inviteView {
|
||||
if (!_inviteView) {
|
||||
_inviteView = [[XPAcrossRoomPKInviteSubView alloc] init];
|
||||
_inviteView.titleLabel.text = @"邀请方";
|
||||
}
|
||||
return _inviteView;
|
||||
}
|
||||
|
||||
- (XPAcrossRoomPKInviteSubView *)timeView {
|
||||
if (!_timeView) {
|
||||
_timeView = [[XPAcrossRoomPKInviteSubView alloc] init];
|
||||
_timeView.titleLabel.text = @"PK时长";
|
||||
}
|
||||
return _timeView;
|
||||
}
|
||||
|
||||
- (XPAcrossRoomPKInviteSubView *)descView {
|
||||
if (!_descView) {
|
||||
_descView = [[XPAcrossRoomPKInviteSubView alloc] init];
|
||||
_descView.titleLabel.text = @"PK玩法";
|
||||
}
|
||||
return _descView;
|
||||
}
|
||||
|
||||
- (UIButton *)countDownButton {
|
||||
if (!_countDownButton) {
|
||||
_countDownButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_countDownButton setTitleColor:UIColorFromRGB(0xFFF600) forState:UIControlStateNormal];
|
||||
_countDownButton.titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
|
||||
[_countDownButton setBackgroundImage:[UIImage imageWithColor:UIColorRGBAlpha(0xFF9813, 0.2)] forState:UIControlStateNormal];
|
||||
_countDownButton.layer.masksToBounds = YES;
|
||||
_countDownButton.layer.cornerRadius = 8;
|
||||
_countDownButton.layer.borderWidth = 0.5;
|
||||
_countDownButton.layer.borderColor = UIColorFromRGB(0xFFFAD5).CGColor;
|
||||
}
|
||||
return _countDownButton;
|
||||
}
|
||||
|
||||
- (UIStackView *)operaStackView {
|
||||
if (!_operaStackView) {
|
||||
_operaStackView = [[UIStackView alloc] init];
|
||||
_operaStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_operaStackView.distribution = UIStackViewDistributionFillEqually;
|
||||
_operaStackView.alignment = UIStackViewAlignmentFill;
|
||||
_operaStackView.spacing = 29;
|
||||
}
|
||||
return _operaStackView;
|
||||
}
|
||||
|
||||
- (UIButton *)rejectButton {
|
||||
if (!_rejectButton) {\
|
||||
_rejectButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_rejectButton.layer.masksToBounds = YES;
|
||||
_rejectButton.layer.cornerRadius = 25 / 2;
|
||||
[_rejectButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xBCDDFF), UIColorFromRGB(0xD6BEF7)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_rejectButton setTitleColor:UIColorFromRGB(0x4C5AF1) forState:UIControlStateNormal];
|
||||
[_rejectButton setTitle:@"拒绝" forState:UIControlStateNormal];
|
||||
_rejectButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||||
[_rejectButton addTarget:self action:@selector(rejectButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _rejectButton;
|
||||
}
|
||||
|
||||
- (UIButton *)acceptButton {
|
||||
if (!_acceptButton) {
|
||||
_acceptButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_acceptButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x218EFF), UIColorFromRGB(0x7727E4)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_acceptButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_acceptButton setTitle:@"接受" forState:UIControlStateNormal];
|
||||
_acceptButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||||
[_acceptButton addTarget:self action:@selector(acceptButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_acceptButton.layer.masksToBounds = YES;
|
||||
_acceptButton.layer.cornerRadius = 25 / 2;
|
||||
}
|
||||
return _acceptButton;
|
||||
}
|
||||
@end
|
@@ -58,7 +58,7 @@
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
self.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||
[self addSubview:self.backButton];
|
||||
[self addSubview:self.inputBackView];
|
||||
[self addSubview:self.tableView];
|
||||
@@ -69,7 +69,6 @@
|
||||
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onKeyBoardResign:)];
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [ThemeColor appBackgroundColor];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -108,7 +107,8 @@
|
||||
|
||||
[self.searchTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.inputBackView).offset(25);
|
||||
make.right.top.bottom.mas_equalTo(self.inputBackView);
|
||||
make.top.bottom.mas_equalTo(self.inputBackView);
|
||||
make.right.mas_equalTo(self.searchButton.mas_left).offset(-5);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@
|
||||
- (UIView *)inputBackView {
|
||||
if (!_inputBackView) {
|
||||
_inputBackView = [[UIView alloc] init];
|
||||
_inputBackView.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||
_inputBackView.backgroundColor = [ThemeColor appBackgroundColor];
|
||||
_inputBackView.layer.masksToBounds = YES;
|
||||
_inputBackView.layer.cornerRadius = 15;
|
||||
}
|
||||
@@ -326,9 +326,6 @@
|
||||
_searchTextField.font = [UIFont systemFontOfSize:13];
|
||||
NSString *placeholder = [NSString stringWithFormat:@"请输入厅的大鹅号"];
|
||||
_searchTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:13], NSForegroundColorAttributeName : [ThemeColor secondTextColor]}];
|
||||
_searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
_searchTextField.returnKeyType = UIReturnKeySearch;
|
||||
_searchTextField.enablesReturnKeyAutomatically = YES;
|
||||
}
|
||||
return _searchTextField;
|
||||
}
|
||||
|
@@ -249,7 +249,7 @@
|
||||
}
|
||||
#pragma mark - XPAcrossRoomProtocol
|
||||
- (void)beginAcrossRoomPKSuccess {
|
||||
[self showSuccessToast:@"开启成功"];
|
||||
[self showSuccessToast:@"pk已发起,请等待对方接受"];
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#import "AnchorGiftValueView.h"
|
||||
#import "XPRoomTopicViewController.h"
|
||||
#import "XPRoomTopicAlertView.h"
|
||||
#import "XPAcrossRoomPKInviteView.h"
|
||||
#import "XPAcrossRoomPKInviteResultView.h"
|
||||
@interface XPRoomFunctionContainerView ()
|
||||
///host 代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
|
||||
@@ -57,9 +59,9 @@
|
||||
@implementation XPRoomFunctionContainerView
|
||||
|
||||
- (void)dealloc {
|
||||
if (self.followAnchorTimer != nil) {
|
||||
dispatch_source_cancel(self.followAnchorTimer);
|
||||
}
|
||||
if (self.followAnchorTimer != nil) {
|
||||
dispatch_source_cancel(self.followAnchorTimer);
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
|
||||
@@ -75,7 +77,7 @@
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.contributionButton];
|
||||
[self addSubview:self.anchorGiftValueView];
|
||||
[self addSubview:self.anchorGiftValueView];
|
||||
[self addSubview:self.topicStackView];
|
||||
[self.topicStackView addArrangedSubview:self.topicLabel];
|
||||
[self.topicStackView addArrangedSubview:self.editButton];
|
||||
@@ -88,11 +90,11 @@
|
||||
make.width.mas_equalTo(90);
|
||||
make.height.mas_equalTo(26);
|
||||
}];
|
||||
[self.anchorGiftValueView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contributionButton.mas_right).mas_offset(8);
|
||||
make.centerY.mas_equalTo(self.contributionButton);
|
||||
make.height.mas_equalTo(26);
|
||||
}];
|
||||
[self.anchorGiftValueView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contributionButton.mas_right).mas_offset(8);
|
||||
make.centerY.mas_equalTo(self.contributionButton);
|
||||
make.height.mas_equalTo(26);
|
||||
}];
|
||||
|
||||
[self.topicStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
@@ -136,61 +138,139 @@
|
||||
[self.datingProgresButton removeFromSuperview];
|
||||
}
|
||||
}
|
||||
if (roomInfo.type == RoomType_Anchor) {
|
||||
[self.contributionButton setTitle:@"主播榜" forState:UIControlStateNormal];
|
||||
self.anchorGiftValueView.hidden = !roomInfo.showGiftValue;
|
||||
if (!roomInfo.showGiftValue) {
|
||||
self.anchorGiftValueView.giftValue = 0;
|
||||
}
|
||||
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(statusbarHeight+49);
|
||||
}];
|
||||
} else {
|
||||
[self.contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
|
||||
self.anchorGiftValueView.hidden = YES;
|
||||
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(statusbarHeight+57);
|
||||
}];
|
||||
}
|
||||
if (roomInfo.type == RoomType_Anchor) {
|
||||
[self.contributionButton setTitle:@"主播榜" forState:UIControlStateNormal];
|
||||
self.anchorGiftValueView.hidden = !roomInfo.showGiftValue;
|
||||
if (!roomInfo.showGiftValue) {
|
||||
self.anchorGiftValueView.giftValue = 0;
|
||||
}
|
||||
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(statusbarHeight+49);
|
||||
}];
|
||||
} else {
|
||||
[self.contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
|
||||
self.anchorGiftValueView.hidden = YES;
|
||||
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(statusbarHeight+57);
|
||||
}];
|
||||
}
|
||||
[self updateRoomTopic];
|
||||
}
|
||||
|
||||
- (void)onRoomEntered {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
||||
if (roomInfo.type == RoomType_Anchor) {//个播房
|
||||
if (![[AccountInfoStorage instance].getUid isEqualToString:roomUid]) {//非房主
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api attentionStatusCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {//是否关注了个播房主
|
||||
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
||||
if (!isLike) {
|
||||
[self setFollowAnchorTimer];
|
||||
}
|
||||
} uid:uid isLikeUid:roomUid];
|
||||
}
|
||||
}
|
||||
if (roomInfo.type == RoomType_Anchor) {//个播房
|
||||
if (![[AccountInfoStorage instance].getUid isEqualToString:roomUid]) {//非房主
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api attentionStatusCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {//是否关注了个播房主
|
||||
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
||||
if (!isLike) {
|
||||
[self setFollowAnchorTimer];
|
||||
}
|
||||
} uid:uid isLikeUid:roomUid];
|
||||
}
|
||||
}
|
||||
[self updateRoomTopic];
|
||||
}
|
||||
|
||||
- (void)onMicroGiftValueUpdate:(NSDictionary *)data {
|
||||
[self handleAnchorGiftValue:data];
|
||||
[self handleAnchorGiftValue:data];
|
||||
}
|
||||
|
||||
- (void)handleNIMCustomMessage:(NIMMessage *)message {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
if (attachment.first == CustomMessageType_AnchorRoom_AudienceUpMic) {
|
||||
[self showAskForUpMic:attachment.data];
|
||||
} else if(attachment.first == CustomMessageType_Room_GiftValue && attachment.second == Custom_Message_Sub_Room_GiftValue_Sync) {
|
||||
[self handleAnchorGiftValue:attachment.data];
|
||||
} else if(attachment.first == CustomMessageType_Gift && (attachment.second == Custom_Message_Sub_Gift_Send || attachment.second == Custom_Message_Sub_Gift_LuckySend || attachment.second == Custom_Message_Sub_Gift_ChannelNotify)) {
|
||||
[self handleAnchorGiftValue:attachment.data];
|
||||
}else if(attachment.first == CustomMessageType_AllMicroSend && (attachment.second == Custom_Message_Sub_AllMicroSend || attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend)) {
|
||||
[self handleAnchorGiftValue:attachment.data];
|
||||
}
|
||||
if (attachment.first == CustomMessageType_AnchorRoom_AudienceUpMic) {
|
||||
[self showAskForUpMic:attachment.data];
|
||||
} else if(attachment.first == CustomMessageType_Room_GiftValue && attachment.second == Custom_Message_Sub_Room_GiftValue_Sync) {
|
||||
[self handleAnchorGiftValue:attachment.data];
|
||||
} else if(attachment.first == CustomMessageType_Gift && (attachment.second == Custom_Message_Sub_Gift_Send || attachment.second == Custom_Message_Sub_Gift_LuckySend || attachment.second == Custom_Message_Sub_Gift_ChannelNotify)) {
|
||||
[self handleAnchorGiftValue:attachment.data];
|
||||
}else if(attachment.first == CustomMessageType_AllMicroSend && (attachment.second == Custom_Message_Sub_AllMicroSend || attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend)) {
|
||||
[self handleAnchorGiftValue:attachment.data];
|
||||
} else if (attachment.first == CustomMessageType_Across_Room_PK) {
|
||||
switch (attachment.second) {
|
||||
case Custom_Message_Sub_AcrossRoomPK_Invite:
|
||||
{
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
||||
request.userIds = @[[AccountInfoStorage instance].getUid];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
if (error == nil) {
|
||||
NIMChatroomMember * member = [members firstObject];
|
||||
if (member.type == NIMTeamMemberTypeOwner) {
|
||||
XPAcrossRoomPKInviteView * inviteView = [[XPAcrossRoomPKInviteView alloc] init];
|
||||
inviteView.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
||||
inviteView.dataDic = attachment.data;
|
||||
[self addSubview:inviteView];
|
||||
[inviteView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
break;
|
||||
case Custom_Message_Sub_AcrossRoomPK_Accept:
|
||||
{
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
||||
request.userIds = @[[AccountInfoStorage instance].getUid];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
if (error == nil) {
|
||||
NIMChatroomMember * member = [members firstObject];
|
||||
if (member.type == NIMTeamMemberTypeOwner) {
|
||||
XPAcrossRoomPKInviteResultView * inviteResutView = [[XPAcrossRoomPKInviteResultView alloc] init];
|
||||
inviteResutView.isAccept = YES;
|
||||
[self addSubview:inviteResutView];
|
||||
[inviteResutView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self).offset(114 + kSafeAreaTopHeight);
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.size.mas_equalTo(CGSizeMake(281, 42));
|
||||
}];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[inviteResutView removeFromSuperview];
|
||||
});
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case Custom_Message_Sub_AcrossRoomPK_Reject:
|
||||
{
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
||||
request.userIds = @[[AccountInfoStorage instance].getUid];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
if (error == nil) {
|
||||
NIMChatroomMember * member = [members firstObject];
|
||||
if (member.type == NIMTeamMemberTypeOwner) {
|
||||
XPAcrossRoomPKInviteResultView * inviteResutView = [[XPAcrossRoomPKInviteResultView alloc] init];
|
||||
inviteResutView.isAccept = NO;
|
||||
[self addSubview:inviteResutView];
|
||||
[inviteResutView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self).offset(114 + kSafeAreaTopHeight);
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.size.mas_equalTo(CGSizeMake(281, 42));
|
||||
}];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[inviteResutView removeFromSuperview];
|
||||
});
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
|
||||
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
||||
@@ -235,11 +315,11 @@
|
||||
if (roomInfo.blindDateState == RoomPlayDateingType_Talk) {
|
||||
message = @"进入心动选人环节?";
|
||||
} else if(roomInfo.blindDateState == RoomPlayDateingType_Pick) {
|
||||
message = @"进入心动公布环节?";
|
||||
message = @"进入心动公布环节?";
|
||||
} else if(roomInfo.blindDateState == RoomPlayDateingType_Result) {
|
||||
message = @"结束本轮,同时清空魅力值?";
|
||||
message = @"结束本轮,同时清空魅力值?";
|
||||
} else if (roomInfo.blindDateState == RoomPlayDateingType_Finish) {
|
||||
message = @"进入嘉宾交流环节?";
|
||||
message = @"进入嘉宾交流环节?";
|
||||
}
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.message = message;
|
||||
@@ -258,13 +338,13 @@
|
||||
}];}
|
||||
|
||||
- (void)tapGiftValueRecognizer {
|
||||
if (self.anchorGiftValueView.hidden) return;
|
||||
if (self.delegate.getUserInfo && self.delegate.getUserInfo.uid > 0) {
|
||||
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
||||
webView.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
||||
webView.url = [NSString stringWithFormat:@"%@?uid=%ld", URLWithType(kRoomCharmRankURL), self.delegate.getRoomInfo.uid];
|
||||
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
||||
}
|
||||
if (self.anchorGiftValueView.hidden) return;
|
||||
if (self.delegate.getUserInfo && self.delegate.getUserInfo.uid > 0) {
|
||||
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
||||
webView.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
||||
webView.url = [NSString stringWithFormat:@"%@?uid=%ld", URLWithType(kRoomCharmRankURL), self.delegate.getRoomInfo.uid];
|
||||
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 房间话题
|
||||
@@ -277,7 +357,7 @@
|
||||
offsetY += (120 + 5 + 6 + 20 +60 + 3);
|
||||
} else {
|
||||
offsetY += (58 + 5 + 6 + 12 + 3 );
|
||||
}
|
||||
}
|
||||
|
||||
[self.topicStackView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(offsetY);
|
||||
@@ -329,84 +409,84 @@
|
||||
|
||||
#pragma mark - 个播模式弹窗关注主播
|
||||
- (void)setFollowAnchorTimer {
|
||||
if (self.followAnchorTimer != nil) {
|
||||
dispatch_source_cancel(self.followAnchorTimer);
|
||||
}
|
||||
if (self.followAnchorTimer != nil) {
|
||||
dispatch_source_cancel(self.followAnchorTimer);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
NSInteger totalTime = 5;
|
||||
NSInteger totalTime = 5;
|
||||
#else
|
||||
NSInteger totalTime = 420;
|
||||
NSInteger totalTime = 420;
|
||||
#endif
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
self.followAnchorTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
||||
dispatch_source_set_timer(self.followAnchorTimer,dispatch_walltime(NULL, totalTime*NSEC_PER_SEC), totalTime*NSEC_PER_SEC, 0); //每秒执行
|
||||
@weakify(self);
|
||||
dispatch_source_set_event_handler(self.followAnchorTimer, ^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@strongify(self);
|
||||
if (self.followAnchorTimer != nil) {
|
||||
dispatch_source_cancel(self.followAnchorTimer);
|
||||
self.followAnchorTimer = nil;
|
||||
}
|
||||
RoomInfoModel* roomInfo = self.delegate.getRoomInfo;
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api attentionStatusCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
||||
if (!isLike) { // 还没有关注
|
||||
if (self.window) {
|
||||
[self showFollowAnchorView];
|
||||
}
|
||||
}
|
||||
} uid:uid isLikeUid:roomUid];
|
||||
});
|
||||
});
|
||||
dispatch_resume(self.followAnchorTimer);
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
self.followAnchorTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
||||
dispatch_source_set_timer(self.followAnchorTimer,dispatch_walltime(NULL, totalTime*NSEC_PER_SEC), totalTime*NSEC_PER_SEC, 0); //每秒执行
|
||||
@weakify(self);
|
||||
dispatch_source_set_event_handler(self.followAnchorTimer, ^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@strongify(self);
|
||||
if (self.followAnchorTimer != nil) {
|
||||
dispatch_source_cancel(self.followAnchorTimer);
|
||||
self.followAnchorTimer = nil;
|
||||
}
|
||||
RoomInfoModel* roomInfo = self.delegate.getRoomInfo;
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api attentionStatusCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
||||
if (!isLike) { // 还没有关注
|
||||
if (self.window) {
|
||||
[self showFollowAnchorView];
|
||||
}
|
||||
}
|
||||
} uid:uid isLikeUid:roomUid];
|
||||
});
|
||||
});
|
||||
dispatch_resume(self.followAnchorTimer);
|
||||
}
|
||||
|
||||
//弹出关注主播的窗口
|
||||
- (void)showFollowAnchorView {
|
||||
RoomInfoModel* roomInfo = self.delegate.getRoomInfo;
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
|
||||
[Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
UserInfoModel *userInfo = [UserInfoModel modelWithDictionary:data.data];
|
||||
XPRoomAnchorInfoCardView *view = [[XPRoomAnchorInfoCardView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 300)];
|
||||
view.userInfo = self.delegate.getUserInfo;
|
||||
view.targetUserInfo = userInfo;
|
||||
view.roomId =roomInfo.roomId;
|
||||
[TTPopup popupView:view style:TTPopupStyleActionSheet];
|
||||
} uid:roomUid];
|
||||
RoomInfoModel* roomInfo = self.delegate.getRoomInfo;
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
|
||||
[Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
UserInfoModel *userInfo = [UserInfoModel modelWithDictionary:data.data];
|
||||
XPRoomAnchorInfoCardView *view = [[XPRoomAnchorInfoCardView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 300)];
|
||||
view.userInfo = self.delegate.getUserInfo;
|
||||
view.targetUserInfo = userInfo;
|
||||
view.roomId =roomInfo.roomId;
|
||||
[TTPopup popupView:view style:TTPopupStyleActionSheet];
|
||||
} uid:roomUid];
|
||||
}
|
||||
|
||||
///个播房用户请求上麦弹窗
|
||||
- (void)showAskForUpMic:(NSDictionary *)dict {
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid];
|
||||
if (![roomUid isEqualToString:[AccountInfoStorage instance].getUid]) {
|
||||
return;
|
||||
}
|
||||
UserInfoModel *model = [UserInfoModel modelWithJSON:dict];
|
||||
XPAnchorAudienceUpMicView *upMicView = [[XPAnchorAudienceUpMicView alloc] initWithFrame:CGRectMake(0, 0, 300, 226) delegate:self.delegate];
|
||||
upMicView.info = model;
|
||||
TTPopupConfig *config = [[TTPopupConfig alloc] init];
|
||||
config.filterIdentifier = @"audienceRequestUpMic";
|
||||
config.shouldFilterPopup = YES;
|
||||
config.contentView = upMicView;
|
||||
config.style = TTPopupStyleAlert;
|
||||
[TTPopup popupWithConfig:config];
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid];
|
||||
if (![roomUid isEqualToString:[AccountInfoStorage instance].getUid]) {
|
||||
return;
|
||||
}
|
||||
UserInfoModel *model = [UserInfoModel modelWithJSON:dict];
|
||||
XPAnchorAudienceUpMicView *upMicView = [[XPAnchorAudienceUpMicView alloc] initWithFrame:CGRectMake(0, 0, 300, 226) delegate:self.delegate];
|
||||
upMicView.info = model;
|
||||
TTPopupConfig *config = [[TTPopupConfig alloc] init];
|
||||
config.filterIdentifier = @"audienceRequestUpMic";
|
||||
config.shouldFilterPopup = YES;
|
||||
config.contentView = upMicView;
|
||||
config.style = TTPopupStyleAlert;
|
||||
[TTPopup popupWithConfig:config];
|
||||
}
|
||||
|
||||
- (void)handleAnchorGiftValue:(NSDictionary *)dict {
|
||||
if (self.delegate.getRoomInfo.type != RoomType_Anchor) {//个播房房主位置魅力值刷新
|
||||
return;
|
||||
}
|
||||
GiftValueInfoModel * model = [GiftValueInfoModel modelWithDictionary:dict];
|
||||
for (int i = 0; i < model.giftValueVos.count; i++) {
|
||||
GiftValueDetailModel * giftValueModel = [model.giftValueVos objectAtIndex:i];
|
||||
if (![giftValueModel.uid isEqualToString:[NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid]]) {
|
||||
continue;
|
||||
}
|
||||
self.anchorGiftValueView.giftValue = giftValueModel.giftValue;
|
||||
}
|
||||
if (self.delegate.getRoomInfo.type != RoomType_Anchor) {//个播房房主位置魅力值刷新
|
||||
return;
|
||||
}
|
||||
GiftValueInfoModel * model = [GiftValueInfoModel modelWithDictionary:dict];
|
||||
for (int i = 0; i < model.giftValueVos.count; i++) {
|
||||
GiftValueDetailModel * giftValueModel = [model.giftValueVos objectAtIndex:i];
|
||||
if (![giftValueModel.uid isEqualToString:[NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid]]) {
|
||||
continue;
|
||||
}
|
||||
self.anchorGiftValueView.giftValue = giftValueModel.giftValue;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
@@ -442,15 +522,15 @@
|
||||
}
|
||||
|
||||
- (AnchorGiftValueView *)anchorGiftValueView {
|
||||
if (!_anchorGiftValueView) {
|
||||
_anchorGiftValueView = [[AnchorGiftValueView alloc] init];
|
||||
_anchorGiftValueView.hidden = YES;
|
||||
_anchorGiftValueView.layer.cornerRadius = 13;
|
||||
_anchorGiftValueView.layer.masksToBounds = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGiftValueRecognizer)];
|
||||
[_anchorGiftValueView addGestureRecognizer:tap];
|
||||
}
|
||||
return _anchorGiftValueView;
|
||||
if (!_anchorGiftValueView) {
|
||||
_anchorGiftValueView = [[AnchorGiftValueView alloc] init];
|
||||
_anchorGiftValueView.hidden = YES;
|
||||
_anchorGiftValueView.layer.cornerRadius = 13;
|
||||
_anchorGiftValueView.layer.masksToBounds = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGiftValueRecognizer)];
|
||||
[_anchorGiftValueView addGestureRecognizer:tap];
|
||||
}
|
||||
return _anchorGiftValueView;
|
||||
}
|
||||
|
||||
- (UIStackView *)topicStackView {
|
||||
|