快捷回复根据服务端返回
This commit is contained in:
@@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
|
||||
@property (nonatomic, strong) NSArray *titleArray;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -21,8 +21,6 @@
|
||||
@interface XPRoomQuickMessageContainView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
|
||||
@property (nonatomic, strong) UICollectionView *collectionView;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray *titleArray;
|
||||
///关闭
|
||||
@property (nonatomic,strong) UIButton *closeButton;
|
||||
///代理
|
||||
@@ -72,7 +70,9 @@
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPRoomQuidkMessageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomQuidkMessageCell class]) forIndexPath:indexPath];
|
||||
cell.title = self.titleArray[indexPath.row];
|
||||
if (self.titleArray.count > 0) {
|
||||
cell.title = self.titleArray[indexPath.row];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
@@ -84,16 +84,18 @@
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
NSDate *datenow = [NSDate date];//现在时间
|
||||
long time2 = (long)([datenow timeIntervalSince1970]*1000);
|
||||
long aTime = (time2 - self.lastSendTime) / 1000;
|
||||
if (aTime < 10) {
|
||||
[XCHUDTool showErrorWithMessage:@"你发送的太频繁啦,请稍后再试"];
|
||||
return;
|
||||
}
|
||||
self.lastSendTime = time2;
|
||||
NSString *str = self.titleArray[indexPath.row];
|
||||
[self sendText:str];
|
||||
if (self.titleArray.count > 0) {
|
||||
NSDate *datenow = [NSDate date];//现在时间
|
||||
long time2 = (long)([datenow timeIntervalSince1970]*1000);
|
||||
long aTime = (time2 - self.lastSendTime) / 1000;
|
||||
if (aTime < 10) {
|
||||
[XCHUDTool showErrorWithMessage:@"你发送的太频繁啦,请稍后再试"];
|
||||
return;
|
||||
}
|
||||
self.lastSendTime = time2;
|
||||
NSString *str = self.titleArray[indexPath.row];
|
||||
[self sendText:str];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sendText:(NSString *)text {
|
||||
@@ -150,6 +152,11 @@
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setTitleArray:(NSArray *)titleArray {
|
||||
_titleArray = titleArray;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
- (UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
@@ -165,14 +172,6 @@
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)titleArray {
|
||||
if (!_titleArray) {
|
||||
_titleArray = [NSMutableArray arrayWithObjects:@"萌新求关注", @"ღ( ´・ᴗ・` )比心", @"贴贴", @"这个怎么玩呀?", @"我要上麦", @"么么叽!么么哒", @"老板大气", @"下次一定!", nil];
|
||||
}
|
||||
return _titleArray;
|
||||
}
|
||||
|
||||
|
||||
- (UIButton *)closeButton {
|
||||
if (!_closeButton) {
|
||||
_closeButton = [[UIButton alloc] init];
|
||||
|
@@ -235,7 +235,6 @@
|
||||
if (self.levelTwoGiftList.count > 0) {
|
||||
giftInfo = self.levelTwoGiftList.firstObject;
|
||||
}
|
||||
self.giftView.datasource = self.levelTwoGiftList;
|
||||
self.textField.text = @"10";
|
||||
[self handleGiftDatasource:self.levelTwoGiftList giftId:giftInfo.giftId];
|
||||
} else {
|
||||
@@ -250,6 +249,14 @@
|
||||
[self.giftView configDefaultInfo:giftInfo];
|
||||
} else {
|
||||
self.giftInfo = info;
|
||||
[self.giftView configDefaultInfo:info];
|
||||
if (self.levleInfo.level == WishGiftLevel_Normal) {
|
||||
[self handleGiftDatasource:self.levelOneGiftList giftId:info.giftId];
|
||||
} else if (self.levleInfo.level == WishGiftLevel_Middle) {
|
||||
[self handleGiftDatasource:self.levelTwoGiftList giftId:info.giftId];
|
||||
} else {
|
||||
[self handleGiftDatasource:self.levelThirdGiftList giftId:info.giftId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,13 +321,13 @@
|
||||
#pragma mark - Event Response
|
||||
- (void)sureButtonAction:(UIButton *)sender {
|
||||
if (![self canSubtractMinCount:self.number]) {
|
||||
NSString * toast = [NSString stringWithFormat:@"物数量范围需为%d~%d", [self subtractMinCount], [self addMaxCount]];
|
||||
NSString * toast = [NSString stringWithFormat:@"礼物数量范围需为%d~%d", [self subtractMinCount], [self addMaxCount]];
|
||||
[self showErrorToast:toast];
|
||||
self.textField.text = [NSString stringWithFormat:@"%d", [self subtractMinCount]];
|
||||
self.number = [self subtractMinCount];
|
||||
return;
|
||||
} else if(![self canAddMaxCount:self.number]){
|
||||
NSString * toast = [NSString stringWithFormat:@"物数量范围需为%d~%d", [self subtractMinCount], [self addMaxCount]];
|
||||
NSString * toast = [NSString stringWithFormat:@"礼物数量范围需为%d~%d", [self subtractMinCount], [self addMaxCount]];
|
||||
[self showErrorToast:toast];
|
||||
self.textField.text = [NSString stringWithFormat:@"%d", [self addMaxCount]];
|
||||
self.number = [self addMaxCount];
|
||||
|
@@ -242,14 +242,18 @@
|
||||
}
|
||||
|
||||
- (void)createButtonAction:(UIButton *)sender {
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"";
|
||||
config.message = @"确认创建当前心愿? \n创建后当日不可在编辑或删除";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[self.presenter addWishGift:self.roomUid];
|
||||
} cancelHandler:^{
|
||||
if (self.datasource.count > 0) {
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"";
|
||||
config.message = @"确认创建当前心愿? \n创建后当日不可在编辑或删除";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[self.presenter addWishGift:self.roomUid];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}];
|
||||
} else {
|
||||
[self showErrorToast:@"至少需要添加一个心愿礼物"];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user