Updated on 2023-03-23 GMT+08:00

Customizing a Contact Selection UI

openContactSelectPage:scene:completeHander:

API Description

This API is used to customize a contact selection UI.

Figure 1 Customizing a contact selection UI

Precautions

  1. If you need to customize a contact selection UI, set the array of contacts to be added.

Method Definition

1
2
3
- (void)openContactSelectPage:(NSArray<HWMConfContactModel *> *)param
                        scene:(HWMSelectedContactScene)scene
               completeHander:(void(^)(NSArray<HWMContactSelectedModel *> *result, NSError *error))handler;

Parameter Description

None

Return Values

None

Sample Code
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/// Customize a contact selection UI.
- (void)openContactSelectPage:(NSArray<HWMConfContactModel *> *)param
                        scene:(HWMSelectedContactScene)scene
               completeHander:(void(^)(NSArray<HWMContactSelectedModel *> *result, NSError *error))handler {
    NSLog(@"enter open contact select page");
    ContactSelectViewController * contactSelectVc = [[ContactSelectViewController alloc] initWithResultHandler:handler];
    [self pushViewControllerWithVc:contactSelectVc];
}

/// Simulate the scenario where a callback function is triggered to add participants.
- (void)initSlectedModels {
    NSMutableArray *slectedModels = [NSMutableArray array];
    HWMContactSelectedModel *model = [[HWMContactSelectedModel alloc] initWithName:@"Test account 01" number:@"" contactType:HWMContactTypeEnterprise];
    [slectedModels addObject:model];
    HWMContactSelectedModel *model2 = [[HWMContactSelectedModel alloc] initWithName:@"Test account 02" number:@"" contactType:HWMContactTypeEnterprise];
    [slectedModels addObject:model2];
    HWMContactSelectedModel *model3 = [[HWMContactSelectedModel alloc] initWithName:@"Test account 03" number:@"" contactType:HWMContactTypeEnterprise];
    [slectedModels addObject:model3];
    HWMContactSelectedModel *model4 = [[HWMContactSelectedModel alloc] initWithName:@"Test account 04" number:@"" contactType:HWMContactTypeEnterprise];
    [slectedModels addObject:model4];

    /// Sample code in the app ID login scenario
    HWMContactSelectedModel *model5 = [[HWMContactSelectedModel alloc] initWithName:@"Test account 05" number:@"" contactType:HWMContactTypeEnterprise];
    model5.thirdUserId = @"test";
    [slectedModels addObject:model5];
 
    self.completeHandler(slectedModels, nil);
}

1. You are advised to customize the contacts and UI in the app ID login scenario. thirdUserId needs to be transferred when you construct the contact data.

2. You can use completeHander to directly call back the participants to be added. If the UI is not required, directly call back related data.

3. Transfer data for initSlectedModels based on actual situations.