快捷发言增加cd时间

This commit is contained in:
chenguilong
2022-10-11 17:19:19 +08:00
parent 5fd35972cc
commit e00b799073

View File

@@ -12,6 +12,7 @@
///Tool ///Tool
#import "AccountInfoStorage.h" #import "AccountInfoStorage.h"
#import "XPConstant.h" #import "XPConstant.h"
#import "XCHUDTool.h"
///Model ///Model
#import "XPMessageRemoteExtModel.h" #import "XPMessageRemoteExtModel.h"
#import "UserInfoModel.h" #import "UserInfoModel.h"
@@ -26,6 +27,8 @@
@property (nonatomic,strong) UIButton *closeButton; @property (nonatomic,strong) UIButton *closeButton;
/// ///
@property (nonatomic,weak) id<RoomHostDelegate> delegate; @property (nonatomic,weak) id<RoomHostDelegate> delegate;
///
@property (nonatomic, assign) long long lastSendTime;
@end @end
@@ -81,6 +84,14 @@
} }
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - (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]; NSString *str = self.titleArray[indexPath.row];
[self sendText:str]; [self sendText:str];
} }