2
0

GroupMemberControlTableViewController.m 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. if (@available(iOS 15, *)) {
  22. self.tableView.sectionHeaderTopPadding = 0;
  23. }
  24. self.tableView.delegate = self;
  25. self.tableView.dataSource = self;
  26. self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  27. [self.tableView reloadData];
  28. [self.view addSubview:self.tableView];
  29. }
  30. - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
  31. WFCUGeneralSwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
  32. if (cell == nil) {
  33. cell = [[WFCUGeneralSwitchTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
  34. }
  35. cell.on = !self.groupInfo.privateChat;
  36. cell.textLabel.text = WFCString(@"AllowTemporarySession");
  37. cell.onSwitch = ^(BOOL value, int type, void (^onDone)(BOOL success)) {
  38. [[WFCCIMService sharedWFCIMService] modifyGroupInfo:self.groupInfo.target type:Modify_Group_PrivateChat newValue:value?@"0":@"1" notifyLines:@[@(0)] notifyContent:nil success:^{
  39. onDone(YES);
  40. } error:^(int error_code) {
  41. onDone(NO);
  42. }];
  43. };
  44. return cell;
  45. }
  46. - (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  47. return 1;
  48. }
  49. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  50. return 1;
  51. }
  52. @end