123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- //
- // CYGroupSendHelperViewController.m
- // shiku_im
- //
- // Created by JayLuo on 2019/12/13.
- // Copyright © 2019 Reese. All rights reserved.
- //
- #import "CYGroupSendHelperViewController.h"
- #import "CYGroupSendHelperCell.h"
- #import "CYGroupSendMsgViewController.h"
- #import "JXLabelObject.h"
- #import "JXChatViewController.h"
- #import "JXGroupMessagesSelectFriendVC.h"
- @interface CYGroupSendHelperViewController ()<UITableViewDelegate, UITableViewDataSource>
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (nonatomic, strong) NSMutableArray *array;
- @end
- @implementation CYGroupSendHelperViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [g_notify addObserver:self selector:@selector(getRecord) name:kGroupHelperRefreshNotif object:nil];
- // 创建数据库
- NSString* myUserId = MY_USER_ID;
- FMDatabase* db = [[JXXMPP sharedInstance] openUserDb:myUserId];
- BOOL result = [JXLabelObject.sharedInstance checkGroupHelperRecordTableCreatedInDb:db];
- if (result) {
- NSLog(@"创建成功--GroupHelperRecordTable");
- }
- // Do any additional setup after loading the view from its nib.
- self.title = @"群发助手";
- self.isGotoBack = YES;
- self.heightFooter = 0;
- self.heightHeader = JX_SCREEN_TOP;
-
- //下拉刷新
- // self.tableView. = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(getRecord)];
-
- [self createHeadAndFoot];
- // _facePackages = [NSMutableArray array];
- [self.tableView registerNib:[UINib nibWithNibName:@"CYGroupSendHelperCell" bundle:nil] forCellReuseIdentifier:@"CYGroupSendHelperCell"];
- [self getRecord];
- }
- - (void)getRecord {
- _array = [NSMutableArray array];
- _array = [JXLabelObject.sharedInstance fetchAllRecordsFromLocal];
-
-
- [self.tableView reloadData];
-
-
- }
- - (void)dealloc {
- [g_notify removeObserver:self];
- }
- - (IBAction)btnClick:(UIButton *)sender {
- CYGroupSendMsgViewController *vc = [[CYGroupSendMsgViewController alloc] init];
- // JXGroupMessagesSelectFriendVC *vc = [[JXGroupMessagesSelectFriendVC alloc] init];
- [g_navigation pushViewController:vc animated:YES];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return _array.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- CYGroupSendHelperCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CYGroupSendHelperCell"];
-
- JXLabelObject *obj = _array[indexPath.row];
-
- cell.model = obj;
-
- cell.resendClickCallback = ^(JXLabelObject * _Nonnull model) {
-
- // 再发送
- JXChatViewController *vc = [[JXChatViewController alloc] init];
-
- NSString *string = model.userNmaesWithFriend;
- NSArray *userNmaesWithFriend = [string componentsSeparatedByString:@","];
- string = model.userIds;
- NSArray *userIds = [string componentsSeparatedByString:@","];
- string = model.userNames;
- NSArray *userNames = [string componentsSeparatedByString:@","];
- string = model.userNamesWithGroup;
- NSArray *userNamesWithGroup = [string componentsSeparatedByString:@","];
- vc.userNmaesWithFriend = userNmaesWithFriend.copy;
- vc.userIds = userIds.copy;
- vc.userNames = userNames.copy;
- vc.userNamesWithGroup = userNamesWithGroup.copy;
- vc.isGroupMessages = YES;
- vc.isCYMSGgroupANDFriendy = YES;
- [g_navigation pushViewController:vc animated:YES];
- };
-
- return cell;
- }
- //- (void)nextBtnAction:(UIButton *)btn {
- // JXChatViewController *vc = [[JXChatViewController alloc] init];
- //
- // NSMutableArray *idArr = [NSMutableArray arrayWithArray:self.mode.selFriendyIdArr];
- // NSMutableArray *nameArr = [NSMutableArray arrayWithArray:self.mode.selFriendyNameArr];
- // NSMutableArray *nameArrGroup = [NSMutableArray arrayWithArray:self.mode.selGroupNameArr];
- //
- // vc.userNmaesWithFriend = [NSMutableArray arrayWithArray:self.mode.selFriendyNameArr];
- //
- // [idArr addObjectsFromArray:self.mode.selGroupIdArr];
- // [nameArr addObjectsFromArray:self.mode.selGroupNameArr];
- //
- //
- // vc.userIds = idArr;
- // vc.userNames = nameArr;
- //
- //
- // vc.userNamesWithGroup = nameArrGroup;
- // vc.isGroupMessages = YES;
- // vc.isCYMSGgroupANDFriendy = YES;
- // [g_navigation pushViewController:vc animated:YES];
- // // [g_navigation popToViewController:[CYGroupSendMsgViewController class] animated:YES];
- //}
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 180;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return 20;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return JX_SCREEN_TOP - (THE_DEVICE_HAVE_HEAD?40:20);
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- UIView *header = [[UIView alloc]init];
- header.backgroundColor = [UIColor clearColor];
- return header;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
- UIView *footer = [[UIView alloc]init];
- footer.backgroundColor = [UIColor clearColor];
- return footer;
- }
- @end
|