Adding customised share buttons
By overriding the customisedConfigForShare method, you can customize the sharing route and determine the display order.
API description
- (NSArray<TMASheetItemInfo *> *)customisedConfigForShare;
Sample code:
- (NSArray<TMASheetItemInfo *> *)customizedConfigForShare {
NSMutableArray *arrays = [[NSMutableArray alloc] init];
TMASheetItemInfo *item1 = [[TMASheetItemInfo alloc] initWithTitle:@"More sharing" type:MAUIDelegateShareViewTypeCustomizedShare shareTarget:100 shareKey:@"my"];
item1.icon = [UIImage imageNamed:@"icon_moreOperation_shareChat"];
item1.shareTarget = 10001;
[arrays addObject:item1];
TMASheetItemInfo *item2 = [[TMASheetItemInfo alloc] initWithTitle:@"click" type:MAUIDelegateShareViewTypeCustomizedAction action:^(TMASheetActionParams * _Nullable params) {
NSLog(@"click Sample code:");
}];
item2.icon = [UIImage imageNamed:@"icon_moreOperation_collect"];
[arrays addObject:item2];
return arrays;
}
The effect is as follows:
Internal logic of the mini program
The mini program internally listens for user clicks on the share class button via onShareAppMessage and customises the forwarded content.
Share Logic Implementation
After the host APP receives the sharing data returned from the mini program, it triggers shareMessageWithModel to execute the final sharing action, and the developer can process the content to be shared according to the shareTarget and other data by themselves, and docking to the three-party sharing platform.
- (void)shareMessageWithModel:(TMAShareModel *_Nonnull)shareModel
appInfo:(TMFMiniAppInfo *_Nonnull)appInfo
completionBlock:(nullable void(^)(NSError * _Nullable error))completionBlock;
Was this page helpful?