JXMsgViewController.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. //
  2. // JXMsgViewController.h
  3. //
  4. // Created by flyeagleTang on 14-4-3.
  5. // Copyright (c) 2014年 Reese. All rights reserved.
  6. //
  7. #import "JXTableViewController.h"
  8. #import <UIKit/UIKit.h>
  9. #import "JXMessageTableVc.h"
  10. #import "JXXMMainVc.h"
  11. #import "JXMyModel.h"
  12. #import <AVFoundation/AVFoundation.h>
  13. #import "SimpleAudioPlayer.h"
  14. /// <#Description#>
  15. @interface JXMsgViewController : JXMessageTableVc <UIScrollViewDelegate>{
  16. // NSMutableArray *_array;
  17. int _refreshCount;
  18. int _recordCount;
  19. float lastContentOffset;
  20. int upOrDown;
  21. JXAudioPlayer* _audioPlayer;
  22. JXRoomObject *_chatRoom;
  23. roomData* _room;
  24. }
  25. @property(nonatomic,assign) int msgTotal;
  26. @property (nonatomic, strong) NSMutableArray *array;
  27. @property (nonatomic, strong) UIView *backView;
  28. @property (nonatomic,copy)NSArray *customerArr; //客服信息
  29. @property (nonatomic,weak) UILabel *titleLb;
  30. - (void)cancelBtnAction;
  31. - (void)getTotalNewMsgCount;
  32. @property (nonatomic,strong) AVPlayer *palyer;
  33. @property (nonatomic,assign) NSInteger reciveScrollViewIndex;
  34. @property (nonatomic,strong) NSMutableArray *dataArrOneOne;
  35. //记录收到的新消息
  36. @property (nonatomic,assign) int reciveNewMessage2222;
  37. @property (nonatomic,assign) int reciveNewMessage;
  38. @property (nonatomic,strong) NSDictionary *dictMsag;
  39. @property (nonatomic,strong) AVAudioPlayer *player;
  40. @end
  41. /*
  42. if( [aDownload.action isEqualToString:act_getGroupOneType] ){
  43. _indexNums++;
  44. [_tempGoundArr addObject:dict];
  45. if (_reciveNewMessage2222==100) {
  46. _dataArrOneOne=_tempGoundArr;
  47. [[NSUserDefaults standardUserDefaults] setObject:_indexGoundArr forKey:@"groundType"];
  48. [[NSUserDefaults standardUserDefaults] synchronize];
  49. [_table reloadData];
  50. }else{
  51. if (_indexNums==_array.count) {
  52. _indexGoundArr=_tempGoundArr;
  53. [[NSUserDefaults standardUserDefaults] setObject:_indexGoundArr forKey:@"groundType"];
  54. [[NSUserDefaults standardUserDefaults] synchronize];
  55. [_table reloadData];
  56. return;
  57. }else{
  58. [_indexGoundArr removeAllObjects];
  59. }
  60. }
  61. //[_tempGoundArr removeAllObjects];
  62. JXCell* cell = [_table cellForRowAtIndexPath:[NSIndexPath indexPathForRow:_reciveScrollViewIndex inSection:0]];
  63. if (dict[@"data"]==nil) {
  64. cell.chujiIMG.image=[UIImage imageNamed:dict[@"typeName"]];
  65. }else{
  66. // cell.chujiIMG.image=[UIImage imageNamed:@""];
  67. }
  68. [_array enumerateObjectsUsingBlock:^(JXMsgAndUserObject *_Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  69. JXCell* cell = [_table cellForRowAtIndexPath:[NSIndexPath indexPathForRow:idx inSection:1]];
  70. if (dict[@"data"]==nil) {
  71. cell.chujiIMG.image=[UIImage imageNamed:@""];
  72. }else{
  73. if ([dict[@"data"][@"typeName"] isEqualToString:@"普通群"]) {
  74. cell.chujiIMG.image=[UIImage imageNamed:@"msgChuji"];
  75. }if ([dict[@"data"][@"typeName"] isEqualToString:@"msgzhongji"]) {
  76. cell.chujiIMG.image=[UIImage imageNamed:@"msgChuji"];
  77. }if ([dict[@"data"][@"typeName"] isEqualToString:@"高级群"]) {
  78. cell.chujiIMG.image=[UIImage imageNamed:@"msgGaoji"];
  79. }if ([dict[@"data"][@"typeName"] isEqualToString:@"特级群"]) {
  80. cell.chujiIMG.image=[UIImage imageNamed:@"msgTeji"];
  81. }
  82. }
  83. if ([obj.message.fromUserId isEqualToString:@""]) {
  84. }
  85. }];
  86. }
  87. */
  88. //- (void)getLastChatList {
  89. //
  90. // BOOL isFirstSync = [g_default boolForKey:kISFirstGetLastChatList];
  91. //
  92. // long long syncTimeLen;
  93. //
  94. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  95. //
  96. //
  97. // [self.header endRefreshing];
  98. // });
  99. //
  100. // if (!isFirstSync) {
  101. //// if ([g_myself.chatSyncTimeLen longLongValue] > [g_myself.groupChatSyncTimeLen longLongValue]) {
  102. // syncTimeLen = [g_myself.chatSyncTimeLen longLongValue];
  103. //// }else {
  104. //// syncTimeLen = [g_myself.groupChatSyncTimeLen longLongValue];
  105. //// }
  106. //
  107. // double m = syncTimeLen * 24 * 3600 * 1000;
  108. // syncTimeLen = [[NSDate date] timeIntervalSince1970] * 1000.0 - m;
  109. //
  110. // if ([g_myself.chatSyncTimeLen longLongValue] == 0 || [g_myself.chatSyncTimeLen longLongValue] == -1) {
  111. // syncTimeLen = 0;
  112. // }
  113. //
  114. //
  115. // }else {
  116. // syncTimeLen = g_server.lastOfflineTime * 1000.0;
  117. // }
  118. //
  119. // NSMutableArray* p = [[JXMessageObject sharedInstance] fetchRecentChat];
  120. // _array=p;
  121. // [_table reloadData];
  122. //
  123. //// if ([g_myself.chatSyncTimeLen longLongValue] == -2) {
  124. ////
  125. //// [g_xmpp.roomPool createAll];
  126. //
  127. //// }else {//修改了 去掉最后一条消息
  128. //// [g_server getLastChatListStartTime:@1592203493000 toView:self];
  129. // [g_server getLastChatListStartTime:[NSNumber numberWithLong:syncTimeLen] toView:self];
  130. // [self getAllChatList];
  131. //// }
  132. //
  133. //}
  134. //viewdidapper
  135. // NSMutableArray* p = [[JXMessageObject sharedInstance] fetchRecentChat];
  136. //
  137. // [_array addObjectsFromArray:p];
  138. // [_table reloadData];
  139. // [UIView animateWithDuration:0.4 animations:^{
  140. // self.view.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT);
  141. // }];_reciveNewMessage
  142. // [_array enumerateObjectsUsingBlock:^(JXMsgAndUserObject *_Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  143. // _reciveNewMessage2222=0;
  144. // NSLog(@".message.isGroup %d",obj.message.isGroup);
  145. //
  146. // JXMessageObject *msgUse=obj.message;
  147. // long time = (long)[[NSDate date] timeIntervalSince1970];
  148. // time = (time *1000 + g_server.timeDifference);
  149. // NSString *salt = [NSString stringWithFormat:@"%ld", time];
  150. //// [g_server Useract_getGroupOneType:salt jid:msgUse.fromUserId andToView:self];
  151. //
  152. // // [g_server getact_act_act_getGroupListType:salt andToView:self];
  153. //
  154. //
  155. // }];