GroupMemberControlTableViewController.m 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // ManagerTableViewController.m
  3. // WFChatUIKit
  4. //
  5. // Created by heavyrain lee on 2019/6/26.
  6. // Copyright © 2019 WildFireChat. All rights reserved.
  7. //
  8. #import "GroupMemberControlTableViewController.h"
  9. #import <SDWebImage/SDWebImage.h>
  10. #import "WFCUContactListViewController.h"
  11. #import "WFCUGeneralSwitchTableViewCell.h"
  12. @interface GroupMemberControlTableViewController () <UITableViewDelegate, UITableViewDataSource>
  13. @property(nonatomic, strong)UITableView *tableView;
  14. @property(nonatomic, strong)NSMutableArray<WFCCGroupMember *> *managerList;
  15. @end
  16. @implementation GroupMemberControlTableViewController
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. self.title = WFCString(@"MemberPrivilege");
  20. self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStyleGrouped];
  21. self.tableView.delegate = self;
  22. self.tableView.dataSource = self;
  23. self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  24. [self.tableView reloadData];
  25. [self.view addSubview:self.tableView];
  26. }
  27. - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
  28. WFCUGeneralSwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
  29. if (cell == nil) {
  30. cell = [[WFCUGeneralSwitchTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
  31. }
  32. cell.on = !self.groupInfo.privateChat;
  33. cell.textLabel.text = WFCString(@"AllowTemporarySession");
  34. cell.onSwitch = ^(BOOL value, int type, void (^onDone)(BOOL success)) {
  35. [[WFCCIMService sharedWFCIMService] modifyGroupInfo:self.groupInfo.target type:Modify_Group_PrivateChat newValue:value?@"0":@"1" notifyLines:@[@(0)] notifyContent:nil success:^{
  36. onDone(YES);
  37. } error:^(int error_code) {
  38. onDone(NO);
  39. }];
  40. };
  41. return cell;
  42. }
  43. - (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  44. return 1;
  45. }
  46. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  47. return 1;
  48. }
  49. @end