提交
This commit is contained in:
@@ -116,8 +116,8 @@ typedef void (^showFinishBlock)(void);
|
||||
-(void)finishTask;
|
||||
|
||||
-(void)vibrationFeedback;
|
||||
|
||||
|
||||
/// 进入房间后开始保活
|
||||
-(void)startKeepAlive;
|
||||
-(void)dirfViewDidToBackground;
|
||||
-(void)dirfViewBecomeToFront;
|
||||
@end
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
@property (nonatomic,assign)BOOL isClickJoinRoom;
|
||||
|
||||
@property (nonatomic,strong)QXTimer *timer;
|
||||
@property (nonatomic,strong)NSTimer *keepTimer;
|
||||
|
||||
@property (nonatomic,assign)NSInteger taskTime;
|
||||
@end
|
||||
@implementation QXGlobal
|
||||
@@ -319,6 +321,29 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)startKeepAlive{
|
||||
[self stopKeepTimer];
|
||||
self.keepTimer = [NSTimer scheduledTimerWithTimeInterval:60
|
||||
target:self
|
||||
selector:@selector(checkAndUpdateRedPackets)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
}
|
||||
|
||||
-(void)checkAndUpdateRedPackets{
|
||||
if ([self.roomId isExist]) {
|
||||
[QXMineNetwork appKeepAliveWithRoomId:self.roomId];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)stopKeepTimer{
|
||||
if (self.keepTimer) {
|
||||
[self.keepTimer invalidate];
|
||||
self.keepTimer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showAlertWithMessage:(NSString*)message roomId:(NSString*)roomId{
|
||||
UIAlertController *al = [UIAlertController alertControllerWithTitle:@"温馨提示" message:message preferredStyle:(UIAlertControllerStyleAlert)];
|
||||
if ([roomId isExist] && self.roomId==nil) {
|
||||
@@ -347,6 +372,7 @@
|
||||
}
|
||||
}
|
||||
-(void)quitRoomWithRoomId:(NSString *)roomId{
|
||||
[self stopKeepTimer];
|
||||
[UIApplication sharedApplication].idleTimerDisabled = NO;
|
||||
/// 移除所有红包
|
||||
[[QXRedPacketManager sharedManager] destoryRedpacketInfo];
|
||||
|
||||
Reference in New Issue
Block a user