Skip to main content

Group Notification Page

tip

This feature is supported starting from version 5.12.2.

The group notification list page displays group notifications received by the current user. Upon entering this page, the SDK automatically fetches group information from the database.
IMKit provides RCGroupNotificationViewController, a group notification page class based on UITableView.

The group notification list page typically consists of three components: a navigation bar, search bar, and group list.

Initialization

Initialize the group notification list page by calling the RCGroupNotificationViewController constructor. Note: You need to create an RCGroupNotificationViewModel object as the business logic handler for RCGroupNotificationViewController.

Parameters

ParameterTypeDescription
viewModelRCGroupNotificationViewModelThe business logic handler for RCGroupNotificationViewController. Manages UI configuration and group notification data fetching.

Sample Code

RCGroupNotificationViewModel *viewModel = [[RCGroupNotificationViewModel alloc] init];
RCGroupNotificationViewController *vc = [[RCGroupNotificationViewController alloc] initWithViewModel:viewModel];
[self.navigationController pushViewController:vc animated:YES];

Customization

IMKit allows customization of the group notification interface.

Custom Navigation Bar

RCGroupNotificationViewController uses the system navigation bar to display the page title. Override the viewDidLoad method in a subclass to modify the title via the title property.

- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Custom Title";
}

Custom Group Notification Cell

1. Create RCCustomCell

@interface RCCustomCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel;
@end

@implementation
// Cell rendering logic
@end

2. Create RCCustomCellViewModel

tip

Custom CellViewModel must inherit from RCGroupNotificationCellViewModel.

@interface RCCustomCellViewModel : RCGroupNotificationCellViewModel
/// Application info
@property (nonatomic, strong) RCGroupApplicationInfo *application;
/// Constructor
- (instancetype)initWithApplicationInfo:(RCGroupApplicationInfo *)application;
@end

@implementation RCCustomCellViewModel

- (instancetype)initWithApplicationInfo:(RCGroupApplicationInfo *)application {
self = [super init];
if (self) {
self.application = application;
...
}
return self;
}

// Register and customize cell
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *cellIdentifier = @"RCCustomCellIdentifier";
[tableView registerClass:RCCustomCell.class forCellReuseIdentifier:cellIdentifier];
RCCustomCellViewModel *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
}
// Modify UI
cell.titleLabel.text = self.application.inviterInfo.name;
...
return cell;
}
@end

3. Modify Data Source

Implement the data source callback:

- (NSArray *_Nullable)groupNotificationViewModel:(RCGroupNotificationViewModel *)viewModel
willLoadItemsInDataSource:(NSArray *_Nullable)dataSource {
// Process data source (add/delete/modify)
}

4. Custom Cell Tap Event

/// Configure custom tap events. Returns: Whether the app handles the event [YES: SDK skips processing, NO: SDK handles internally]
- (BOOL)groupNotificationViewModel:(RCGroupNotificationViewModel *)viewModel
viewController:(UIViewController*)viewController
tableView:(UITableView *)tableView
didSelectRow:(NSIndexPath *)indexPath
cellViewModel:(RCBaseCellViewModel *)cellViewModel {
}