新增小喇叭

This commit is contained in:
liyuhua
2023-08-25 16:32:51 +08:00
parent faf495cf97
commit dc1d1b46e7
34 changed files with 1132 additions and 20 deletions

View File

@@ -174,6 +174,11 @@
2331C1BD2A60F69E00E1D940 /* UILabel+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C1BC2A60F69E00E1D940 /* UILabel+Utils.m */; };
2369F9912A89CE0E00563B48 /* PIUserSexView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2369F9902A89CE0E00563B48 /* PIUserSexView.m */; };
2369F9932A8B21EB00563B48 /* pi_treasure_fairy_gift_bg.svga in Resources */ = {isa = PBXBuildFile; fileRef = 2369F9922A8B21EA00563B48 /* pi_treasure_fairy_gift_bg.svga */; };
237B94BC2A984DA7007853E3 /* XPTrumpetPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 237B94AE2A984DA7007853E3 /* XPTrumpetPresenter.m */; };
237B94BD2A984DA7007853E3 /* XPNobleTrumpetModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 237B94B32A984DA7007853E3 /* XPNobleTrumpetModel.m */; };
237B94BE2A984DA7007853E3 /* XPRoomTrumpetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 237B94B72A984DA7007853E3 /* XPRoomTrumpetViewController.m */; };
237B94BF2A984DA7007853E3 /* XPRoomTrumpetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 237B94B82A984DA7007853E3 /* XPRoomTrumpetView.m */; };
237B94C02A984DA7007853E3 /* Api+RoomTrumpet.m in Sources */ = {isa = PBXBuildFile; fileRef = 237B94BA2A984DA7007853E3 /* Api+RoomTrumpet.m */; };
23942E912A86424500D0ECC2 /* XPLoginAuthCodeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 23942E902A86424500D0ECC2 /* XPLoginAuthCodeVC.m */; };
23B2AEC12A64E9C200543D17 /* LoginForgetEditView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2AEC02A64E9C200543D17 /* LoginForgetEditView.m */; };
23B2AEC42A6516C200543D17 /* LoginForgetPasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2AEC22A6516C200543D17 /* LoginForgetPasswordViewController.m */; };
@@ -1671,6 +1676,17 @@
2369F98F2A89CE0E00563B48 /* PIUserSexView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIUserSexView.h; sourceTree = "<group>"; };
2369F9902A89CE0E00563B48 /* PIUserSexView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIUserSexView.m; sourceTree = "<group>"; };
2369F9922A8B21EA00563B48 /* pi_treasure_fairy_gift_bg.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = pi_treasure_fairy_gift_bg.svga; sourceTree = "<group>"; };
237B94AD2A984DA7007853E3 /* XPTrumpetPresenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPTrumpetPresenter.h; sourceTree = "<group>"; };
237B94AE2A984DA7007853E3 /* XPTrumpetPresenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPTrumpetPresenter.m; sourceTree = "<group>"; };
237B94B02A984DA7007853E3 /* XPRoomTrumpetProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetProtocol.h; sourceTree = "<group>"; };
237B94B22A984DA7007853E3 /* XPNobleTrumpetModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPNobleTrumpetModel.h; sourceTree = "<group>"; };
237B94B32A984DA7007853E3 /* XPNobleTrumpetModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPNobleTrumpetModel.m; sourceTree = "<group>"; };
237B94B52A984DA7007853E3 /* XPRoomTrumpetViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetViewController.h; sourceTree = "<group>"; };
237B94B62A984DA7007853E3 /* XPRoomTrumpetView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetView.h; sourceTree = "<group>"; };
237B94B72A984DA7007853E3 /* XPRoomTrumpetViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPRoomTrumpetViewController.m; sourceTree = "<group>"; };
237B94B82A984DA7007853E3 /* XPRoomTrumpetView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPRoomTrumpetView.m; sourceTree = "<group>"; };
237B94BA2A984DA7007853E3 /* Api+RoomTrumpet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Api+RoomTrumpet.m"; sourceTree = "<group>"; };
237B94BB2A984DA7007853E3 /* Api+RoomTrumpet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Api+RoomTrumpet.h"; sourceTree = "<group>"; };
23942E8F2A86424500D0ECC2 /* XPLoginAuthCodeVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPLoginAuthCodeVC.h; sourceTree = "<group>"; };
23942E902A86424500D0ECC2 /* XPLoginAuthCodeVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPLoginAuthCodeVC.m; sourceTree = "<group>"; };
23B2AEBF2A64E9C200543D17 /* LoginForgetEditView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginForgetEditView.h; sourceTree = "<group>"; };
@@ -4856,6 +4872,64 @@
path = UILabel;
sourceTree = "<group>";
};
237B94AB2A984DA7007853E3 /* NobleTrumpet */ = {
isa = PBXGroup;
children = (
237B94AC2A984DA7007853E3 /* Presenter */,
237B94AF2A984DA7007853E3 /* Protocol */,
237B94B12A984DA7007853E3 /* Model */,
237B94B42A984DA7007853E3 /* View */,
237B94B92A984DA7007853E3 /* Api */,
);
path = NobleTrumpet;
sourceTree = "<group>";
};
237B94AC2A984DA7007853E3 /* Presenter */ = {
isa = PBXGroup;
children = (
237B94AD2A984DA7007853E3 /* XPTrumpetPresenter.h */,
237B94AE2A984DA7007853E3 /* XPTrumpetPresenter.m */,
);
path = Presenter;
sourceTree = "<group>";
};
237B94AF2A984DA7007853E3 /* Protocol */ = {
isa = PBXGroup;
children = (
237B94B02A984DA7007853E3 /* XPRoomTrumpetProtocol.h */,
);
path = Protocol;
sourceTree = "<group>";
};
237B94B12A984DA7007853E3 /* Model */ = {
isa = PBXGroup;
children = (
237B94B22A984DA7007853E3 /* XPNobleTrumpetModel.h */,
237B94B32A984DA7007853E3 /* XPNobleTrumpetModel.m */,
);
path = Model;
sourceTree = "<group>";
};
237B94B42A984DA7007853E3 /* View */ = {
isa = PBXGroup;
children = (
237B94B52A984DA7007853E3 /* XPRoomTrumpetViewController.h */,
237B94B62A984DA7007853E3 /* XPRoomTrumpetView.h */,
237B94B72A984DA7007853E3 /* XPRoomTrumpetViewController.m */,
237B94B82A984DA7007853E3 /* XPRoomTrumpetView.m */,
);
path = View;
sourceTree = "<group>";
};
237B94B92A984DA7007853E3 /* Api */ = {
isa = PBXGroup;
children = (
237B94BA2A984DA7007853E3 /* Api+RoomTrumpet.m */,
237B94BB2A984DA7007853E3 /* Api+RoomTrumpet.h */,
);
path = Api;
sourceTree = "<group>";
};
23E9E9AB2A81E8E900B792F2 /* Event */ = {
isa = PBXGroup;
children = (
@@ -8712,6 +8786,7 @@
E8A1F78D290641D80099C952 /* MorePlay */,
E8DEC9962764A51F0078CB70 /* MoreView */,
9B9BBF80288FBF93004E2E74 /* NewUserGift */,
237B94AB2A984DA7007853E3 /* NobleTrumpet */,
E87AE8C2284E1A6B00CAFBB3 /* NewUserGreet */,
9B2F72CD28E45A1C0000E4FA /* QuickMessageView */,
9BC5C915277C809E007C8719 /* ReleaseRadio */,
@@ -10045,6 +10120,7 @@
9B6E8573281AB9B20041A321 /* XPRoomInsideRecommendCell.m in Sources */,
E8A3538528FD67320014A784 /* GiftLuckyBroadcastModel.m in Sources */,
9B4C5B86292F81FA00CEA41B /* XPSessionListFansPartyModel.m in Sources */,
237B94BD2A984DA7007853E3 /* XPNobleTrumpetModel.m in Sources */,
E82325F5274E2E09003A3332 /* XPUserCardPresenter.m in Sources */,
23E9EA532A837BE400B792F2 /* XPTreasureFairyMyView.m in Sources */,
E80EC80B28ACD84000D133C5 /* QInputBarViewConfiguration.m in Sources */,
@@ -10084,6 +10160,7 @@
2331C1672A5EB71000E1D940 /* NobleLevelUpModel.m in Sources */,
9BA812E428BF70A600783EA7 /* XPRoomRedPacketPwdView.m in Sources */,
23E9EB1B2A84D28A00B792F2 /* XPMineUserInfoEditTagView.m in Sources */,
237B94BE2A984DA7007853E3 /* XPRoomTrumpetViewController.m in Sources */,
2331C1662A5EB71000E1D940 /* NobleCenterModel.m in Sources */,
E8998D8B2859CB6A00C68558 /* XPMineUserInfoGiftWallSubViewController.m in Sources */,
E8DEC9A42764A6600078CB70 /* XPMoreMenuPresenter.m in Sources */,
@@ -10176,6 +10253,7 @@
9BD63FAB277EE885006EB744 /* Api+RoomRadio.m in Sources */,
E8A30BF328534B17003B4873 /* Api+FindNew.m in Sources */,
E852D7412863249F001465ED /* XPMonentsReplyTableViewCell.m in Sources */,
237B94BC2A984DA7007853E3 /* XPTrumpetPresenter.m in Sources */,
23E9EA942A84BE4800B792F2 /* XPGiftUserDataViewController.m in Sources */,
2331C16D2A5EB71000E1D940 /* XPNobleSettingNavView.m in Sources */,
E8AEAED6271412EC0017FCE0 /* XPRoomViewController.m in Sources */,
@@ -10469,6 +10547,7 @@
E8E7DAEB2745158500C631CC /* XPGiftUserInfoModel.m in Sources */,
E88863C6278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m in Sources */,
E8AC722C26F49580007D6E91 /* XPMineNotificaViewController.m in Sources */,
237B94BF2A984DA7007853E3 /* XPRoomTrumpetView.m in Sources */,
9B335B492925D8A00048A116 /* XPAnchorPKSelectTypeController.m in Sources */,
E8098CAE282E07C00090B9F0 /* XPMonentsEmptyTableViewCell.m in Sources */,
E85E7B4F2A4EB0D300B6D00A /* XPMineExchangeAuthorityVC.m in Sources */,
@@ -10666,6 +10745,7 @@
23E9EA842A84B6FD00B792F2 /* XPMineUserInfoTagModel.m in Sources */,
E8998D852859B4FA00C68558 /* XPMineUserInfoGiftView.m in Sources */,
186A536B26FC6F2E00D67B2C /* XPShareItemCell.m in Sources */,
237B94C02A984DA7007853E3 /* Api+RoomTrumpet.m in Sources */,
9B42869228C1AED4009034D2 /* XPReceiveRedPacketModel.m in Sources */,
E8B846C526FDB41A00A777FE /* XPMineUserInfolbumPresenter.m in Sources */,
9BFB101F2897CC4300B3985E /* XPAnchorCardView.m in Sources */,

View File

@@ -31,7 +31,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"

View File

@@ -106,7 +106,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
[[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"uid":uid}];
ClientConfig *config = [ClientConfig shareConfig];
config.roomId = uid;
}else if(type == 3){
}else if(type == 7){
NSString *uid = [NSString stringWithFormat:@"%@",paramsDict[@"uid"]];
[[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"type":@"kOpenChat",@"uid":uid}];
ClientConfig *config = [ClientConfig shareConfig];

View File

@@ -414,7 +414,7 @@
if (!_accountView) {
_accountView = [[XPLoginInputView alloc] init];
_accountView.areaStackView.hidden = YES;
NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginPwdViewController2")];
NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginPwdViewController6")];
[placeholder addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0xB3B3C3) range:NSMakeRange(0, placeholder.length)];
_accountView.inputTextField.attributedPlaceholder = placeholder;
_accountView.inputTextField.keyboardType = UIKeyboardTypeNumberPad;

View File

@@ -22,7 +22,7 @@ typedef NS_ENUM(NSUInteger, TTBindingPhoneNumType) {
@class UserInfoModel;
@interface XPLoginVerifBindPhoneViewController : MvpViewController
@property (nonatomic, assign) TTBindingPhoneNumType bindingPhoneNumType;
@property(nonatomic,assign) BOOL isLogout;
///用户信息
@property (nonatomic, strong) UserInfoModel *userInfo;
@end

View File

@@ -26,6 +26,7 @@
#import "XPLoginBindSuccessView.h"
#import "LoginForgetEditView.h"
#import "XPLoginAraeViewController.h"
#import "XPMineLoginPasswordViewController.h"
@interface XPLoginVerifBindPhoneViewController ()<XPLoginAraeViewControllerDelegate,XPLoginVerifBindPhoneProtocol, CountDownHelperDelegate>
@@ -216,6 +217,16 @@
}];
} else if (self.bindingPhoneNumType == XPBindingPhoneNumTypeNormal) {
@weakify(self);
if(self.isLogout == YES){
XPMineLoginPasswordViewController *vc = [[XPMineLoginPasswordViewController alloc] init];
vc.userInfo = self.userInfo;
vc.isModifiPwd = NO;
vc.isLogout = YES;
[self.navigationController pushViewController:vc animated:YES];
return;
}
[XPLoginBindSuccessView showBindSuccessViewWithHandler:^{
@strongify(self);
[self.navigationController popViewControllerAnimated:YES];

View File

@@ -584,6 +584,7 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubLookLove) {
@property (nonatomic,assign) int first;
@property (nonatomic,assign) int second;
@property (nonatomic, strong) id data;
@property(nonatomic,assign) BOOL isBroadcast;
@end
NS_ASSUME_NONNULL_END

View File

@@ -186,7 +186,9 @@
}
#pragma mark - XPGuildIncomeHeaderViewDelegate
- (void)xPNewGuildIncomeHeaderView:(XPMineGuildPersonalBillRecordHeadView *)view didChooseTime:(UIButton *)sender {
- (void)xPMineGuildPersonalBillRecordHeadView:(XPMineGuildPersonalBillRecordHeadView *_Nonnull)view didChooseTime:(UILabel *_Nullable)sender{
if (self.timeType == NewGuildIncomeRecrdTimeType_Mouth) {
[self.monthPickerView setDate:[NSDate date] animated:YES];
[self.monthPickerView show];
@@ -199,6 +201,7 @@
}
}
#pragma mark - XPGuildTimeMonthPickerViewDelegate
- (void)datePicker:(XPGuildTimeMonthPickerView *)datePicker didCancel:(UIButton *)sender {
[TTPopup dismiss];
@@ -209,9 +212,7 @@
[self monthWithCurrentDate:date];
self.pi_startTimeStr = [PLTimeUtil getYYMMDDWithDate:date];
self.pi_endTimeStr = [PLTimeUtil getYYMMDDWithDate:self.endDate];
[self.formatter setDateFormat:YMLocalizedString(@"PLTimeUtil3")];
NSString * currentDay = [self.formatter stringFromDate:date];
self.headerView.time = currentDay;
self.headerView.time = [NSString stringWithFormat:@"%@ %@ %@",self.pi_startTimeStr,YMLocalizedString(@"XPIncomeRecordGoldDetailsVC1"),self.pi_endTimeStr];
[self headerRefresh];
}
@@ -228,7 +229,7 @@
self.headerView.time = [NSString stringWithFormat:@"%@ %@ %@",self.pi_startTimeStr,YMLocalizedString(@"XPIncomeRecordGoldDetailsVC1"),self.pi_endTimeStr];
} else {
self.pi_startTimeStr = [PLTimeUtil getYYMMDDWithDate:view.startDate];
self.pi_endTimeStr = [PLTimeUtil getYYMMDDWithDate:view.startDate];;
self.pi_endTimeStr = [PLTimeUtil getYYMMDDWithDate:view.endDate];;
self.headerView.time = [NSString stringWithFormat:@"%@ %@ %@",self.pi_startTimeStr,YMLocalizedString(@"XPIncomeRecordGoldDetailsVC1"),self.pi_endTimeStr];
}
[self headerRefresh];

View File

@@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong) UserInfoModel *userInfo;
///是否是修改密码
@property (nonatomic,assign) BOOL isModifiPwd;
@property(nonatomic,assign) BOOL isLogout;
@end
NS_ASSUME_NONNULL_END

View File

@@ -99,7 +99,25 @@
#pragma mark - XPMineLoginPasswordProtocol
- (void)setLoginPasswordSuccess {
[self showSuccessToast:YMLocalizedString(@"XPMineLoginPasswordViewController0")];
self.userInfo.isBindPasswd = YES;
if(self.isLogout == YES){
//
__block __kindof UIViewController *vc;
[self.navigationController.childViewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[XPMineSettingViewController class]]) {
vc = obj; // VC
}
}];
if ([self.navigationController.childViewControllers containsObject:vc]) {
[self.navigationController popToViewController:vc animated:YES];
} else {
[self.navigationController popViewControllerAnimated:YES];
}
return;
}
[self.navigationController popViewControllerAnimated:YES];
}
- (void)modifyLoginPasswordSuccess {

View File

@@ -326,7 +326,6 @@
#pragma mark - Event Response
- (void)logoutButtonAction:(UIButton *)sender {
id isSaveBindPwd = [[NSUserDefaults standardUserDefaults]valueForKey:@"kSaveBindPwd"];
if(self.userInfo.isBindPasswd == NO && isSaveBindPwd == nil){
[[NSUserDefaults standardUserDefaults]setValue:@"1" forKey:@"kSaveBindPwd"];
[[NSUserDefaults standardUserDefaults]synchronize];
@@ -334,6 +333,16 @@
config.title = YMLocalizedString(@"XPMineSettingViewController9");
config.message = YMLocalizedString(@"XPMineSettingViewController10");
[TTPopup alertWithConfig:config confirmHandler:^{
if (!self.userInfo.isBindPhone) {
XPLoginVerifBindPhoneViewController *vc = [[XPLoginVerifBindPhoneViewController alloc] init];
vc.bindingPhoneNumType = XPBindingPhoneNumTypeNormal;
vc.userInfo = self.userInfo;
vc.isLogout = YES;
[self.navigationController pushViewController:vc animated:YES];
return;
}
XPMineLoginPasswordViewController *vc = [[XPMineLoginPasswordViewController alloc] init];
vc.userInfo = self.userInfo;
vc.isModifiPwd = NO;

View File

@@ -11,6 +11,7 @@
@class AnchorRoomScrollView;
@protocol AnchorRoomScrollViewDelegate <NSObject>
@optional
///滚动到上一个时回调
- (void)anchorScrollViewScrollToPrevious:(AnchorRoomScrollView *)anchorScrollView;
///滚动到下一个时回调

View File

@@ -12,7 +12,6 @@ NS_ASSUME_NONNULL_BEGIN
@class Music;
@interface XPRoomFunctionContainerView : UIView <RoomGuestDelegate>
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate;
///获取当前的音乐
- (Music *)getCurrentMusic;
///是否正在播放

View File

@@ -92,6 +92,10 @@
#import "XPRoomPKProgressView.h"
#import "XPAnchorPKMatchView.h"
#import "XPRoomTrumpetView.h"
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate, XPAnchorPkPanelViewDelegate, XPRoomBackMusicPlayerViewDelegate, XPRoomNewUserGreetViewDelegate, XPWishGiftViewControllerDelegate>
///host
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
@@ -121,6 +125,12 @@
@property (nonatomic, strong) XPAnchorFansRelationModel *relationFansModel;
///PK
@property (nonatomic, strong) XPAnchorPkPanelView *anchorPKPanelView;
///
@property (nonatomic, strong) XPRoomTrumpetView *trumpetView;
///
@property (nonatomic, strong) NSMutableArray *trumpetQueue;
///
@property (nonatomic, strong) dispatch_source_t trumpetTimer;
///
@property (nonatomic,strong) UIButton *musicEnterButton;
///
@@ -146,6 +156,9 @@
if (self.followAnchorTimer != nil) {
dispatch_source_cancel(self.followAnchorTimer);
}
if (self.trumpetTimer != nil) {
dispatch_source_cancel(self.trumpetTimer);
}
if (self.userGiftTimer != nil) {
dispatch_source_cancel(self.userGiftTimer);
}
@@ -382,6 +395,9 @@
if (self.followAnchorTimer != nil) {
dispatch_source_cancel(self.followAnchorTimer);
}
if (self.trumpetTimer != nil) {
dispatch_source_cancel(self.trumpetTimer);
}
if (self.userGiftTimer != nil) {
dispatch_source_cancel(self.userGiftTimer);
}
@@ -806,6 +822,8 @@
}
} else if (attachment.first == CustomMessageType_Anchor_FansTeam) {
[self handleAnchorFansTeam:attachment];
}else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Trumpet) {
[self handleTrumpet:attachment];
}
}
}
@@ -1337,6 +1355,95 @@
self.delegate.getRoomInfo.winUid = nil;
self.delegate.getRoomInfo.pkMatchStartTime = nil;
}
#pragma mark -
- (void)handleTrumpet:(AttachmentModel *)attachment {
if (self.trumpetQueue.count) {
[self.trumpetQueue addObject:attachment.data];
} else {
[self.trumpetQueue addObject:attachment.data];
__block NSInteger time = 5.0; //
if (_trumpetTimer == nil) {
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
_trumpetTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(_trumpetTimer,dispatch_walltime(NULL, 0), time*NSEC_PER_SEC, 0); //
@weakify(self);
dispatch_source_set_event_handler(_trumpetTimer, ^{
@strongify(self);
if (self.trumpetQueue.count) {
dispatch_sync(dispatch_get_main_queue(), ^{
[self createTrumpetAnimation:self.trumpetQueue.firstObject];
[self.trumpetQueue removeObjectAtIndex:0];
});
} else {
dispatch_sync(dispatch_get_main_queue(), ^{
[self.trumpetView removeFromSuperview];
});
if (self.trumpetTimer != nil) {
dispatch_source_cancel(self.trumpetTimer);
self.trumpetTimer = nil;
}
}
});
dispatch_resume(_trumpetTimer);
}
}
}
- (void)createTrumpetAnimation:(NSDictionary *)attatchment {
if (!self.trumpetView.superview) {
[self addSubview:self.trumpetView];
[self.trumpetView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.delegate.getRoomInfo.type == RoomType_MiniGame ? kNavigationHeight: kNavigationHeight + 110);
make.left.mas_equalTo(0);
make.right.mas_equalTo(0);
make.height.mas_equalTo(153);
}];
}
self.trumpetView.data = attatchment;
POPBasicAnimation *animation2 = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame];
animation2.beginTime = CACurrentMediaTime();
animation2.duration = 0.1;
CGFloat width = self.frame.size.width - 15;
CGFloat height = 28;
animation2.fromValue = [NSValue valueWithCGRect:CGRectMake(0, 153-34-28, width, height)];
animation2.toValue = [NSValue valueWithCGRect:CGRectMake(0, 153-34-28-14, width, height)];
animation2.removedOnCompletion = NO;
animation2.repeatCount = 1;
POPBasicAnimation *animation3 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerOpacity];
animation3.duration = 0.1;
animation3.beginTime = CACurrentMediaTime();
animation3.fromValue = @1;
animation3.toValue = @0;
animation3.repeatCount = 1;
animation3.removedOnCompletion = NO;
[animation2 setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *animation2 = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame];
animation2.beginTime = CACurrentMediaTime();
animation2.duration = 0.1;
CGFloat width = self.frame.size.width - 15;
CGFloat height = 28;
animation2.fromValue = [NSValue valueWithCGRect:CGRectMake(0, 153 - 34 - 14, width, height)];
animation2.toValue = [NSValue valueWithCGRect:CGRectMake(0, 153 - 34 - 28, width, height)];
animation2.removedOnCompletion = NO;
animation2.repeatCount = 1;
POPBasicAnimation *animation3 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerOpacity];
animation3.duration = 0.1;
animation3.beginTime = CACurrentMediaTime();
animation3.fromValue = @0;
animation3.toValue = @1;
animation3.repeatCount = 1;
animation3.removedOnCompletion = NO;
[self.trumpetView.mainView.layer pop_addAnimation:animation2 forKey:@"animation4"];
[self.trumpetView.mainView.layer pop_addAnimation:animation3 forKey:@"animation5"];
}
}];
[self.trumpetView.mainView.layer pop_addAnimation:animation2 forKey:@"animation2"];
[self.trumpetView.mainView.layer pop_addAnimation:animation3 forKey:@"animation3"];
}
#pragma mark -
- (void)updateContrionEntranceWithRoomUid:(NSString *)roomUid type:(NSString *)type {
[Api requestRoomRankings:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {//
@@ -1698,5 +1805,17 @@
}
return _wishGiftView;
}
- (XPRoomTrumpetView *)trumpetView {
if (!_trumpetView) {
_trumpetView = [[XPRoomTrumpetView alloc] init];
}
return _trumpetView;
}
- (NSMutableArray *)trumpetQueue {
if (!_trumpetQueue) {
_trumpetQueue = [NSMutableArray array];
}
return _trumpetQueue;
}
@end

View File

@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
@protocol XPFirstRechargeViewDelegate <NSObject>
@optional
-(void)rechargeHandle;
@end

View File

@@ -59,6 +59,18 @@
- (XPMessageInfoModel*)parseMessageAttribute:(NIMMessage *)message {
NIMMessageType messageType = message.messageType;
XPMessageInfoModel * messageInfo = [[XPMessageInfoModel alloc] init];
if([message.messageObject isKindOfClass:[NIMCustomObject class]] ){
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel * attachment = (AttachmentModel *)obj.attachment;
if(attachment.isBroadcast == YES){
return [self makeCustomAttribute:message messageInfo:messageInfo];
}
}
}
switch (messageType) {
case NIMMessageTypeText:
return [self makeChatAttribute:message messageInfo:messageInfo];

View File

@@ -565,6 +565,9 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
#pragma mark - RoomGuestDelegate
- (void)handleNIMCustomAttachment:(AttachmentModel *)attachment{
}
- (void)handleNIMCustomMessage:(NIMMessage *)message {
self.isMiniEnter = NO;
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;

View File

@@ -38,7 +38,8 @@ NS_ASSUME_NONNULL_BEGIN
///获取房间广播模板内容
/// @param type 房间类型
- (void)getRoomRadioMessageListWithType:(NSString *)type;
/// 获取房间贵族小喇叭信息
- (void)getRoomgetUserVipRoomTrumpet:(NSString *)roomUid;
///结束个播跨房PK
- (void)requestFinishAnchorPK:(NSString *)roundId;

View File

@@ -17,6 +17,7 @@
#import "XPRoomMoreItemModel.h"
#import "RoomInfoModel.h"
#import "XPReleaseRadioModel.h"
#import "XPNobleTrumpetModel.h"
///P
#import "XPMoreMenuProtocol.h"
#import "DJDKMIMOMColor.h"
@@ -110,6 +111,11 @@
releaseRadio.type = RoomMoreMenuType_Release_Radio;
releaseRadio.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * trumpet = [[XPRoomMoreItemModel alloc] init];
trumpet.title = YMLocalizedString(@"XPMoreMenuPresenter35");
trumpet.imageName = @"room_more_menu_trumpet";
trumpet.type = RoomMoreMenuType_Room_trumpet;
trumpet.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * redPacket = [[XPRoomMoreItemModel alloc] init];
redPacket.title = YMLocalizedString(@"XPMoreMenuPresenter24");
@@ -160,7 +166,8 @@
if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor && roomInfo.type != RoomType_MiniGame) {
[array insertObject:dating atIndex:0];
}
[array addObject:inviteFriend];
// [array addObject:inviteFriend];
[array addObject:trumpet];
if (isCreator && roomInfo.type != RoomType_Anchor && roomInfo.isPermitRoom != PermitRoomType_Licnese && roomInfo.isPermitRoom != PermitRoomType_YoungerStar) {
[array addObject:releaseRadio];
}
@@ -170,6 +177,7 @@
[array addObject:clearScreen];
[array addObject:giftValue];
} else {
[array addObject:trumpet];
[array addObject:giftEffect];
}
if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open && roomInfo.redEnvelopeOpen) {
@@ -249,7 +257,13 @@
[[self getView] getReleaseRadioSuccess:model];
}] roomType:type];
}
///
- (void)getRoomgetUserVipRoomTrumpet:(NSString *)roomUid {
[Api getUserVipRoomTrumpet:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
XPNobleTrumpetModel *model = [XPNobleTrumpetModel modelWithJSON:data.data];
[[self getView] getTrumpetSuccess:model];
}] roomUid:roomUid];
}
///PK
- (void)requestFinishAnchorPK:(NSString *)roundId {
[Api requestEndAnchorRoomPk:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {

View File

@@ -35,6 +35,7 @@
#import "BaseNavigationController.h"
#import "XPWishGiftCreateViewController.h"
#import "XPAnchorPKSelectTypeController.h"
#import "XPRoomTrumpetViewController.h"
///P
#import "XPMoreMenuPresenter.h"
#import "XPMoreMenuProtocol.h"
@@ -194,6 +195,10 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
///
- (void)getTrumpetSuccess:(XPNobleTrumpetModel *)model {
[self dismissViewControllerAnimated:YES completion:nil];
XPRoomTrumpetViewController * trumpetVC = [[XPRoomTrumpetViewController alloc] initWithDelegate:self.hostDelegate];
trumpetVC.model = model;
trumpetVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self.hostDelegate.getCurrentNav presentViewController:trumpetVC animated:YES completion:nil];
}
///PK
@@ -343,6 +348,9 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"releaseRadio"}];
[self.presenter getRoomRadioMessageListWithType:[NSString stringWithFormat:@"%zd", self.roomInfo.type]];
}
break;
case RoomMoreMenuType_Room_trumpet:
[self.presenter getRoomgetUserVipRoomTrumpet:roomUid];
break;
case RoomMoreMenuType_Room_Across_PK_Open:
{

View File

@@ -0,0 +1,19 @@
//
// Api+RoomTrumpet.h
// xplan-ios
//
// Created by GreenLand on 2022/3/16.
//
#import "Api.h"
NS_ASSUME_NONNULL_BEGIN
@interface Api (RoomTrumpet)
// 发送贵族小喇叭消息
+ (void)sendRoomTrumpet:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid content:(NSString *)content;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,17 @@
//
// Api+RoomTrumpet.m
// xplan-ios
//
// Created by GreenLand on 2022/3/16.
//
#import "Api+RoomTrumpet.h"
@implementation Api (RoomTrumpet)
//
+ (void)sendRoomTrumpet:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid content:(NSString *)content {
[self makeRequest:@"vip/sendRoomHorn" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, content, nil];
}
@end

View File

@@ -0,0 +1,23 @@
//
// XPNobleTrumpetModel.h
// xplan-ios
//
// Created by GreenLand on 2022/3/15.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPNobleTrumpetModel : NSObject
///上次发送的时间
@property (nonatomic, assign) long long lastSendTime;
///剩余次数
@property (nonatomic, assign) NSInteger remainCount;
///总数
@property (nonatomic, assign) NSInteger totalCount;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// XPNobleTrumpetModel.m
// xplan-ios
//
// Created by GreenLand on 2022/3/15.
//
#import "XPNobleTrumpetModel.h"
@implementation XPNobleTrumpetModel
@end

View File

@@ -0,0 +1,21 @@
//
// XPTrumpetPresenter.h
// xplan-ios
//
// Created by GreenLand on 2022/3/16.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPTrumpetPresenter : BaseMvpPresenter
///发送房间小喇叭
/// @param roomId 房间ID
/// @param message 小喇叭内容
- (void)releaseRoomTrumpetWithRoomUid:(NSString *)roomUid message:(NSString *)message;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,23 @@
//
// XPTrumpetPresenter.m
// xplan-ios
//
// Created by GreenLand on 2022/3/16.
//
#import "XPTrumpetPresenter.h"
#import "Api+RoomTrumpet.h"
#import "XPRoomTrumpetProtocol.h"
@implementation XPTrumpetPresenter
///
/// @param roomUid ID
/// @param message
- (void)releaseRoomTrumpetWithRoomUid:(NSString *)roomUid message:(NSString *)message {
[Api sendRoomTrumpet:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] releaseRoomTrumpetSuccess];
}] roomUid:roomUid content:message];
}
@end

View File

@@ -0,0 +1,14 @@
//
// XPRoomTrumpetProtocol.h
// xplan-ios
//
// Created by GreenLand on 2022/3/16.
//
#import <Foundation/Foundation.h>
@protocol XPRoomTrumpetProtocol <NSObject>
///发布房间小喇叭成功
- (void)releaseRoomTrumpetSuccess;
@end

View File

@@ -0,0 +1,20 @@
//
// XPRoomTrumpetView.h
// xplan-ios
//
// Created by GreenLand on 2022/3/18.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomTrumpetView : UIView
@property (nonatomic, strong) UIView *mainView;
@property (nonatomic, strong) NSDictionary *data;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,176 @@
//
// XPRoomTrumpetView.m
// xplan-ios
//
// Created by GreenLand on 2022/3/18.
//
#import "XPRoomTrumpetView.h"
#import "NetImageView.h"
///tool
#import "ThemeColor+NobleCenter.h"
///Third
#import <Masonry/Masonry.h>
#import <MarqueeLabel.h>
@interface XPRoomTrumpetView()
///
@property (nonatomic, strong) UIImageView *backView;
///
@property (nonatomic,strong) NetImageView *avatarImageView;
///
@property (nonatomic,strong) NetImageView *nobleImageView;
///
@property (nonatomic, strong) UILabel *nickLabel;
///
@property (nonatomic, strong) MarqueeLabel *contentLabel;
@end
@implementation XPRoomTrumpetView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
[self initContraints];
}
return self;
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
return nil;
}
- (void)initSubViews {
[self addSubview:self.backView];
[self addSubview:self.mainView];
[self.mainView addSubview:self.avatarImageView];
[self.mainView addSubview:self.nobleImageView];
[self.mainView addSubview:self.nickLabel];
[self.mainView addSubview:self.contentLabel];
}
- (void)initContraints {
[self.mainView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self);
make.right.mas_equalTo(self.backView);
make.height.mas_equalTo(28);
make.bottom.mas_equalTo(self.backView).mas_offset(-34);
}];
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.mas_equalTo(self);
make.width.mas_equalTo(375);
make.height.mas_equalTo(153);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.backView).mas_offset(58);
make.width.height.mas_equalTo(28);
make.centerY.mas_equalTo(self.mainView);
}];
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(4);
make.width.mas_equalTo(25);
make.height.mas_equalTo(22);
make.centerY.mas_equalTo(self.mainView);
}];
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nobleImageView.mas_right).mas_offset(5);
make.centerY.mas_equalTo(self.mainView);
make.width.mas_greaterThanOrEqualTo(40).priority(500);
}];
//
[self.nickLabel setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nickLabel.mas_right).mas_offset(2);
make.right.mas_equalTo(0);
make.centerY.mas_equalTo(self.mainView);
}];
[self.contentLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
}
- (void)setData:(NSDictionary *)data {
_data = data;
self.avatarImageView.imageUrl = data[@"avatar"];
self.nobleImageView.imageUrl = data[@"vipIcon"];
NSString *nickStr = data[@"nick"];
if (nickStr.length > 5) {
nickStr = [NSString stringWithFormat:@"%@…:", [nickStr substringToIndex:5]];
} else {
nickStr = [NSString stringWithFormat:@"%@:", nickStr];
}
self.nickLabel.text = nickStr;
self.contentLabel.text = data[@"content"];
[self layoutIfNeeded];
}
#pragma mark - getter
- (UIView *)mainView {
if (!_mainView) {
_mainView = [[UIView alloc] init];
}
return _mainView;
}
- (UIImageView *)backView {
if (!_backView) {
_backView = [[UIImageView alloc] init];
_backView.userInteractionEnabled = YES;
_backView.image = [UIImage imageNamed:@"rooom_trumpet_bgImage"];
_backView.contentMode = UIViewContentModeScaleAspectFit;
}
return _backView;
}
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig *config = [[NetImageConfig alloc] init];
config.imageType = ImageTypeUserIcon;
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.contentMode = UIViewContentModeScaleAspectFit;
_avatarImageView.layer.cornerRadius = 14;
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.borderWidth = 0.75;
_avatarImageView.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _avatarImageView;
}
- (NetImageView *)nobleImageView {
if (!_nobleImageView) {
NetImageConfig *config = [[NetImageConfig alloc] init];
config.imageType = ImageTypeUserIcon;
_nobleImageView = [[NetImageView alloc] initWithConfig:config];
_nobleImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _nobleImageView;
}
- (UILabel *)nickLabel {
if (!_nickLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
label.textColor = UIColorFromRGB(0x392700);
[label sizeToFit];
_nickLabel = label;
}
return _nickLabel;
}
- (MarqueeLabel *)contentLabel{
if (!_contentLabel) {
_contentLabel = [[MarqueeLabel alloc] init];
_contentLabel.scrollDuration = 5.0;
_contentLabel.fadeLength = 6.0f;
_contentLabel.font = [UIFont systemFontOfSize:12];
_contentLabel.textColor = UIColorFromRGB(0x392700);
}
return _contentLabel;
}
@end

View File

@@ -0,0 +1,21 @@
//
// XPRoomTrumpetViewController.h
// xplan-ios
//
// Created by GreenLand on 2022/3/16.
//
#import "MvpViewController.h"
#import "RoomHostDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@class XPNobleTrumpetModel;
@interface XPRoomTrumpetViewController : MvpViewController
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
@property (nonatomic, strong) XPNobleTrumpetModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,446 @@
//
// XPRoomTrumpetViewController.m
// xplan-ios
//
// Created by GreenLand on 2022/3/16.
//
#import "XPRoomTrumpetViewController.h"
///tool
#import <YYText/YYText.h>
#import "ThemeColor+NobleCenter.h"
///Third
#import <Masonry/Masonry.h>
#import "UIImage+Utils.h"
///view
///P
#import "XPTrumpetPresenter.h"
#import "XPRoomTrumpetProtocol.h"
///model
#import "XPNobleTrumpetModel.h"
#import "RoomInfoModel.h"
@interface XPRoomTrumpetViewController ()<YYTextViewDelegate, XPRoomTrumpetProtocol>
///host
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
///view
@property (nonatomic,strong) UIView *topTapView;
///view
@property (nonatomic,strong) UIView *bottomTapView;
///
@property (nonatomic,strong) UIImageView *backView;
///
@property (nonatomic,strong) UILabel *headLabel;
///广
@property (nonatomic,strong) UILabel *radioTitleLabel;
///
@property (nonatomic, strong) UIStackView *releaseNumView;
///
@property (nonatomic, strong) UILabel *releaseNumTitle;
///
@property (nonatomic, strong) UILabel *releaseNumLabel;
///广
@property (nonatomic,strong) YYTextView *trumpetTextView;
///
@property (nonatomic,strong) UILabel *maxCountLabel;
///
@property (nonatomic, strong) UIButton *releaseButton;
///()
@property (nonatomic, strong) UILabel *releaseTimeDescLabel;
///
@property (nonatomic,strong) UIView *countDownStackView;
///
@property (nonatomic,strong) UILabel *countDownLabel;
///
@property (nonatomic, strong) UILabel *countDownDescLabel;
@property (strong, nonatomic) dispatch_source_t timer;
@end
@implementation XPRoomTrumpetViewController
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
if (self = [super init]) {
self.hostDelegate = delegate;
}
return self;
}
- (XPTrumpetPresenter *)createPresenter {
return [[XPTrumpetPresenter alloc] init];
}
- (void)dealloc {
if (self.timer != nil) {
dispatch_source_cancel(self.timer);
}
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
}
#pragma mark - XPRoomTrumpetProtocol
///
- (void)releaseRoomTrumpetSuccess {
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"XPRoomTrumpetViewController0")];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing:YES];
}
- (void)setModel:(XPNobleTrumpetModel *)model {
_model = model;
self.releaseNumLabel.text = [NSString stringWithFormat:@"%zd/%zd",self.model.remainCount, self.model.totalCount];
if ([self intervalSinceNow:model.lastSendTime] < 60) {
[self openCountdown:60 - [self intervalSinceNow:model.lastSendTime]];
self.countDownStackView.hidden = NO;
self.releaseTimeDescLabel.hidden = YES;
self.releaseButton.enabled = NO;
} else {
self.countDownStackView.hidden = YES;
self.releaseTimeDescLabel.hidden = NO;
self.releaseButton.enabled = YES;
}
if (self.model.remainCount < 1) {
self.releaseButton.enabled = NO;
}
}
- (NSInteger)intervalSinceNow:(long long)theDate {
NSDate *nowDate = [NSDate date]; //
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd HH-mm-ss";
NSTimeInterval time= theDate/1000;
NSDate *creat =[NSDate dateWithTimeIntervalSince1970:time];
NSTimeInterval delta = [nowDate timeIntervalSinceDate:creat]; //
if (delta/60 < 1) {
return (NSInteger)delta % 60;
} else {
return 61;
}
}
#pragma mark - Private Method
- (void)initSubViews {
self.view.backgroundColor = [UIColor clearColor];
[self.view addSubview:self.topTapView];
[self.view addSubview:self.backView];
[self.view addSubview:self.bottomTapView];
[self.backView addSubview:self.headLabel];
[self.backView addSubview:self.radioTitleLabel];
[self.backView addSubview:self.releaseNumView];
[self.releaseNumView addArrangedSubview:self.releaseNumTitle];
[self.releaseNumView addArrangedSubview:self.releaseNumLabel];
[self.backView addSubview:self.trumpetTextView];
[self.backView addSubview:self.maxCountLabel];
[self.backView addSubview:self.releaseButton];
[self.backView addSubview:self.releaseTimeDescLabel];
[self.backView addSubview:self.countDownStackView];
[self.countDownStackView addSubview:self.countDownLabel];
[self.countDownStackView addSubview:self.countDownDescLabel];
}
- (void)initSubViewConstraints {
[self.topTapView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.backView.mas_top);
}];
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(300);
make.height.mas_equalTo(286);
make.centerY.centerX.mas_equalTo(self.view);
}];
[self.bottomTapView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view);
make.top.mas_equalTo(self.backView.mas_bottom);
make.bottom.mas_equalTo(self.view);
}];
[self.headLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backView);
make.top.mas_equalTo(self.backView).offset(24);
make.height.mas_equalTo(24);
}];
[self.radioTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.headLabel.mas_bottom).offset(16);
make.height.mas_equalTo(16);
make.left.mas_equalTo(self.backView).mas_offset(16);
}];
[self.releaseNumView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.radioTitleLabel);
make.left.mas_equalTo(self.radioTitleLabel.mas_right).mas_offset(4);
make.height.mas_equalTo(20);
}];
[self.trumpetTextView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView).inset(16);
make.top.mas_equalTo(self.radioTitleLabel.mas_bottom).mas_offset(8);
make.height.mas_equalTo(82);
}];
[self.maxCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.mas_equalTo(self.trumpetTextView).inset(3);
make.height.mas_equalTo(12);
}];
[self.releaseButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.trumpetTextView.mas_bottom).mas_offset(32);
make.centerX.mas_equalTo(self.backView);
make.width.mas_equalTo(160);
make.height.mas_equalTo(44);
}];
[self.releaseTimeDescLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backView);
make.top.mas_equalTo(self.releaseButton.mas_bottom).mas_offset(10);
make.height.mas_equalTo(14);
}];
[self.countDownStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(15);
make.centerX.mas_equalTo(self.backView);
make.top.mas_equalTo(self.releaseButton.mas_bottom).mas_offset(10);
}];
[self.countDownLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.mas_equalTo(self.countDownStackView);
make.right.mas_equalTo(self.countDownDescLabel.mas_left);
}];
[self.countDownDescLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.right.bottom.mas_equalTo(self.countDownStackView);
}];
}
- (void)openCountdown:(NSInteger)countDown{
__block NSInteger time = countDown; //
if (_timer != nil) {
dispatch_source_cancel(_timer);
}
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(_timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //
dispatch_source_set_event_handler(_timer, ^{
if(time <= 0){ //
@kWeakify(self);
dispatch_source_cancel(self.timer);
dispatch_async(dispatch_get_main_queue(), ^{
@kStrongify(self);
self.releaseTimeDescLabel.hidden = NO;
self.countDownStackView.hidden = YES;
if (self.model.remainCount < 1) {
self.releaseButton.enabled = NO;
} else {
self.releaseButton.enabled = YES;
}
});
}else{
NSInteger seconds = time;
dispatch_async(dispatch_get_main_queue(), ^{
//
self.countDownLabel.text = [NSString stringWithFormat:@"%zds", seconds];
});
time--;
}
});
dispatch_resume(_timer);
}
- (void)onReleaseButtonClick:(UIButton *)button {
if (self.trumpetTextView.text.length < 1) {
[self showErrorToast:YMLocalizedString(@"XPRoomTrumpetViewController1")];
return;
}
[self.presenter releaseRoomTrumpetWithRoomUid:@(self.hostDelegate.getRoomInfo.uid).stringValue message:self.trumpetTextView.text];
}
#pragma mark - Event Response
- (void)dismissTapRecognizer:(UITapGestureRecognizer *)tap {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - YYTextViewDelegate
- (void)textViewDidChange:(YYTextView *)textView {
NSInteger maxLength = 20;
NSInteger minLength = 1;
if (textView.text.length > maxLength) {
textView.text = [textView.text substringToIndex:maxLength];
}
self.maxCountLabel.text = [NSString stringWithFormat:@"%zd/%ld", textView.text.length, maxLength];
if (textView.text.length >= minLength) {
if (self.model.lastSendTime > 0 && self.countDownStackView.hidden) {
// self.releaseButton.enabled = YES;
}
} else {
// self.releaseButton.enabled = NO;
}
}
#pragma mark - Getters And Setters
- (UIView *)topTapView {
if (!_topTapView) {
_topTapView = [[UIView alloc] init];
_topTapView.backgroundColor = [UIColor clearColor];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissTapRecognizer:)];
[_topTapView addGestureRecognizer:tap];
}
return _topTapView;
}
- (UIView *)bottomTapView {
if (!_bottomTapView) {
_bottomTapView = [[UIView alloc] init];
_bottomTapView.backgroundColor = [UIColor clearColor];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissTapRecognizer:)];
[_bottomTapView addGestureRecognizer:tap];
}
return _bottomTapView;
}
- (UIImageView *)backView {
if (!_backView) {
_backView = [[UIImageView alloc] init];
_backView.userInteractionEnabled = YES;
_backView.image = [UIImage imageNamed:@"noble_time_popBg"];
}
return _backView;
}
- (UILabel *)headLabel {
if (!_headLabel) {
_headLabel = [[UILabel alloc] init];
_headLabel.text = YMLocalizedString(@"XPRoomTrumpetViewController2");
_headLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
_headLabel.textColor = [DJDKMIMOMColor hightNobleLightTextColor];
}
return _headLabel;
}
- (UILabel *)radioTitleLabel {
if (!_radioTitleLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = YMLocalizedString(@"XPRoomTrumpetViewController3");
label.font = [UIFont systemFontOfSize:14];
label.textColor = [DJDKMIMOMColor hightNobleLightTextColor];
_radioTitleLabel = label;
}
return _radioTitleLabel;
}
- (UIStackView *)releaseNumView {
if (!_releaseNumView) {
_releaseNumView = [[UIStackView alloc] init];
_releaseNumView.axis = UILayoutConstraintAxisHorizontal;
_releaseNumView.distribution = UIStackViewDistributionFill;
_releaseNumView.alignment = UIStackViewAlignmentCenter;
_releaseNumView.spacing = 2;
}
return _releaseNumView;
}
- (UILabel *)releaseNumTitle {
if (!_releaseNumTitle) {
UILabel *label = [[UILabel alloc] init];
label.text = YMLocalizedString(@"XPRoomTrumpetViewController4");
label.font = [UIFont systemFontOfSize:10];
label.textColor = [DJDKMIMOMColor normalNobleTextColor];
_releaseNumTitle = label;
}
return _releaseNumTitle;
}
- (UILabel *)releaseNumLabel {
if (!_releaseNumLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = @"100/100";
label.font = [UIFont systemFontOfSize:10];
label.textColor = [DJDKMIMOMColor normalNobleTextColor];
_releaseNumLabel = label;
}
return _releaseNumLabel;
}
- (YYTextView *)trumpetTextView {
if (!_trumpetTextView) {
_trumpetTextView = [[YYTextView alloc] init];
_trumpetTextView.backgroundColor = UIColorFromRGB(0x2C200E);
_trumpetTextView.layer.cornerRadius = 8;
_trumpetTextView.layer.masksToBounds = YES;
_trumpetTextView.placeholderText = YMLocalizedString(@"XPRoomTrumpetViewController5");
_trumpetTextView.placeholderTextColor = [DJDKMIMOMColor noContainDescTextColor];
_trumpetTextView.placeholderFont = [UIFont systemFontOfSize:12];
_trumpetTextView.font = [UIFont systemFontOfSize:12];
_trumpetTextView.textColor = [DJDKMIMOMColor hightNobleLightTextColor];
_trumpetTextView.delegate = self;
}
return _trumpetTextView;
}
- (UIButton *)releaseButton {
if (!_releaseButton) {
_releaseButton = [[UIButton alloc] init];
[_releaseButton setTitleColor:[DJDKMIMOMColor confirmButtonTextColor] forState:UIControlStateNormal];
[_releaseButton setBackgroundImage:[UIImage imageNamed:@"rooom_trumpet_send"] forState:UIControlStateNormal];
[_releaseButton addTarget:self action:@selector(onReleaseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _releaseButton;
}
- (UILabel *)releaseTimeDescLabel {
if (!_releaseTimeDescLabel) {
_releaseTimeDescLabel = [[UILabel alloc] init];
_releaseTimeDescLabel.text = YMLocalizedString(@"XPRoomTrumpetViewController6");
_releaseTimeDescLabel.font = [UIFont systemFontOfSize:10];
_releaseTimeDescLabel.textColor = [DJDKMIMOMColor normalNobleTextColor];
}
return _releaseTimeDescLabel;
}
- (UIView *)countDownStackView {
if (!_countDownStackView) {
_countDownStackView = [[UIView alloc] init];
_countDownStackView.hidden = YES;
}
return _countDownStackView;
}
- (UILabel *)countDownLabel {
if (!_countDownLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = @"0s";
label.font = [UIFont systemFontOfSize:10];
label.textColor = UIColorFromRGB(0xFDA615);
_countDownLabel = label;
}
return _countDownLabel;
}
- (UILabel *)countDownDescLabel {
if (!_countDownDescLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = YMLocalizedString(@"XPRoomTrumpetViewController7");
label.font = [UIFont systemFontOfSize:10];
label.textColor = [DJDKMIMOMColor textThirdColor];
_countDownDescLabel = label;
}
return _countDownDescLabel;
}
- (UILabel *)maxCountLabel {
if (!_maxCountLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = @"0/20";
label.font = [UIFont systemFontOfSize:12];
label.textColor = [DJDKMIMOMColor textThirdColor];
_maxCountLabel = label;
}
return _maxCountLabel;
}
@end

View File

@@ -64,6 +64,7 @@
#import "RoomGuestDelegate.h"
#import "XNDJTDDLoadingTool.h"
#import "ClientConfig.h"
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
@@ -73,7 +74,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//
NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//退
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate, XPRoomSettingInputViewDelegate, AnchorRoomScrollViewDelegate, XPFirstRechargeViewDelegate>
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate, XPRoomSettingInputViewDelegate, AnchorRoomScrollViewDelegate, XPFirstRechargeViewDelegate,NIMBroadcastManagerDelegate>
///
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
@@ -203,6 +204,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
[[NIMSDK sharedSDK].loginManager removeDelegate:self];
[[NIMSDK sharedSDK].conversationManager removeDelegate:self];
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@@ -237,6 +239,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[[NIMSDK sharedSDK].chatManager addDelegate:self];
[[NIMSDK sharedSDK].loginManager addDelegate:self];
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
[[NIMSDK sharedSDK].broadcastManager addDelegate:self];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myGiftEffectUpdate:) name:kRoomGiftEffectUpdateNotificationKey object:nil];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(showRoomFirstChargeWindowFormNot:) name:kShowFirstRechargeView object:nil];
[XPSkillCardPlayerManager shareInstance].isInRoom = YES;
@@ -1332,7 +1335,24 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
}
}
#pragma mark - NIMBroadcastDelegate
// 广
- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage{
if (![ClientConfig shareConfig].canOpen) {
return;
}
if (broadcastMessage.content) {
NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject];
AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]];
attachment.isBroadcast = YES;
NIMMessage *message = [NIMMessage new];
NIMCustomObject *object = [NIMCustomObject new];
object.attachment = attachment;
message.messageObject = object;
[self.messageContainerView handleNIMTextMessage:message];
}
}
//
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
//
@@ -1353,7 +1373,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
if (message.messageType == NIMMessageTypeCustom) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel * attachment = obj.attachment;
AttachmentModel * attachment = (AttachmentModel *)obj.attachment;
[self.stageView handleNIMCustomMessage:message];
[self.animationView handleNIMCustomMessage:message];
[self.functionView handleNIMCustomMessage:message];

View File

@@ -1083,7 +1083,7 @@
"XPMoreMenuPresenter34" = "开启公屏";
"XPMoreMenuPresenter35" = "房间小喇叭";
"XPRoomMoreMenuViewController0" = "开启礼物值成功";
"XPRoomMoreMenuViewController1" = "关闭礼物值成功";
@@ -2160,6 +2160,7 @@
"XPLoginPwdViewController3" = "请输入密码";
"XPLoginPwdViewController4" = "手机号登录";
"XPLoginPwdViewController5" = "忘记密码";
"XPLoginPwdViewController6" = "请输入piko账号";
"XPLoginBindPhoneResultViewController0" = "绑定手机";
"XPLoginBindPhoneResultViewController1" = "您当前绑定的手机号为";
@@ -2876,6 +2877,17 @@
///PIUserSexView.m
"PIUserSexView0" = "男生";
"PIUserSexView1" = "女生";
///XPRoomTrumpetViewController.m
"XPRoomTrumpetViewController0" = "发布成功";
"XPRoomTrumpetViewController1" = "请输入内容";
"XPRoomTrumpetViewController2" = "房间小喇叭";
"XPRoomTrumpetViewController3" = "消息内容";
"XPRoomTrumpetViewController4" = "剩馀次数";
"XPRoomTrumpetViewController5" = "输入内容最多20个字哦~";
"XPRoomTrumpetViewController6" = "发布后1分钟内不可使用小喇叭~";
"XPRoomTrumpetViewController7" = "后可以再次使用喇叭喊话~";
///不能脚本生成的
"App_Common_And" = "和";
"App_Common_Male" = "男";

View File

@@ -1087,7 +1087,7 @@
"XPMoreMenuPresenter32" = "主播PK中";
"XPMoreMenuPresenter33" = "主播PK";
"XPMoreMenuPresenter34" = "開啟公屏";
"XPMoreMenuPresenter35" = "房間小喇叭";
@@ -2165,6 +2165,7 @@
"XPLoginPwdViewController3" = "請輸入密碼";
"XPLoginPwdViewController4" = "手機號登錄";
"XPLoginPwdViewController5" = "忘記密碼";
"XPLoginPwdViewController6" = "請輸入piko賬號";
"XPLoginBindPhoneResultViewController0" = "綁定手機";
"XPLoginBindPhoneResultViewController1" = "您當前綁定的手機號為";
@@ -2878,6 +2879,15 @@
///PIUserSexView.m
"PIUserSexView0" = "男生";
"PIUserSexView1" = "女生";
///XPRoomTrumpetViewController.m
"XPRoomTrumpetViewController0" = "發佈成功";
"XPRoomTrumpetViewController1" = "請輸入內容";
"XPRoomTrumpetViewController2" = "房間小喇叭";
"XPRoomTrumpetViewController3" = "消息內容";
"XPRoomTrumpetViewController4" = "剩餘次數";
"XPRoomTrumpetViewController5" = "輸入內容最多20個字哦~";
"XPRoomTrumpetViewController6" = "發佈後1分鐘內不可使用小喇叭~";
"XPRoomTrumpetViewController7" = "後可以再次使用喇叭喊話~";
///不能腳本生成的
"App_Common_And" = "和";
"App_Common_Male" = "男";