
#pragma mark Exit confirmation- (BOOL)shouldDetainUser:(TMFMiniAppInfo *)app;
{"detainConfig": [{"exitPage": "pages/order/*","content": "The order process is not completed. Claim a coupon now to enjoy more discounts.","exitButton": "Leave","enterButton": "Claim coupon","openType": "navigateTo","openLink": "/pages/coupon/claim?source=exit_detainment"}]}
{"exitPage": "*","content": "Are you sure you want to exit the current mini program?","exitButton": "Exit","enterButton": "Continue","openType": "reLaunch"}

// Panel triggered by tapping the "More" button in the capsule.// If this method is not implemented, showActionSheetWithTitle:cancelButtonTitle:cancelAction:otherButtonTitleAndActions:dismissBlock:presentingViewController: will be called// @param app Mini program information// @param cancelButtonTitle Title of the "Cancel" button// @param cancelAction Action to perform when the "Cancel" button is tapped.// @param otherButtonTitleAndActions Other button titles and their corresponding actions// @param dismissBlock Action to perform after the panel is dismissed. This block MUST be called to ensure correct functionality.// @param parentVC The view controller that presents the panel- (void)showMoreButtonActionSheetWithApp:(TMFMiniAppInfo *)appcancelButtonTitle:(nullable NSString *)cancelButtonTitlecancelAction:(nullable dispatch_block_t)cancelActionotherButtonTitleAndActions:(nullable NSArray *)otherButtonTitleAndActionsdismissBlock:(nullable dispatch_block_t)dismissBlockparentVC:(UIViewController *)parentVC;

// In the superapp, you can customize the sharing channels and determine their display order. This feature is currently implemented in the ActionSheet triggered by tapping the "More" button or the button component (open-type="share").// 1. Default channels: QQ friends, Qzone, WeChat, and Moments (for specific types, see MAUIDelegateShareViewType). They are determined by the developer and the display order can only be changed within the superapp.// 2. Custom sharing channels: Customized in the superapp (set the type to MAUIDelegateShareViewTypeCustomizedShare, and when defining MAShareTarget, the value must be greater than 100. In the mini program page, onShareAppMessage will return the sharing content, which will be uniformly handled through shareMessageWithModel, allowing the superapp to process each ShareTarget individually.)// 3. Custom events: Customized in the superapp (set the type to MAUIDelegateShareViewTypeCustomizedAction).// The display order of the above three types of channels supports mixed arrangement- (NSArray<TMASheetItemInfo *> *)customizedConfigForShare;
- (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"];[arrays addObject:item1];TMASheetItemInfo *item2 = [[TMASheetItemInfo alloc] initWithTitle:@"click" type:MAUIDelegateShareViewTypeCustomizedAction action:^(TMASheetActionParams * _Nullable params) {NSLog(@"click action triggered");}];item2.icon = [UIImage imageNamed:@"icon_moreOperation_collect"];[arrays addObject:item2];return arrays;}

- (void)customizedConfigForMoreButtonActions:(NSMutableArray *)moreButtonTitleAndActions withApp:(TMFMiniAppInfo *)app{/*// Add a custom sharing channelTMASheetItemInfo *item = [[TMASheetItemInfo alloc] initWithTitle:@"Share" type:MAUIDelegateShareViewTypeCustomizedShare shareTarget:100 shareKey:@"my"];item.icon = [UIImage imageNamed:@"icon_moreOperation_shareChat"];[moreButtonTitleAndActions addObject:item];*//*// Delete the “Copy link” buttonNSMutableArray *newArrays = [[NSMutableArray alloc] initWithCapacity:moreButtonTitleAndActions.count];for (TMASheetItemInfo *item in moreButtonTitleAndActions) {if(item.type != MAUIDelegateShareViewTypeCopyLink) {[newArrays addObject:item];}}[moreButtonTitleAndActions removeAllObjects];[moreButtonTitleAndActions addObjectsFromArray:newArrays];*/}
- (TMAMoreMenuItem)visibleItemsForMoreMenuWithApp:(TMFMiniAppInfo *)app {// Only display "Settings" and "Restart mini program"; hide other built-in itemsreturn TMAMoreMenuItemSetting | TMAMoreMenuItemRestart;}
- (BOOL)shouldHandleMoreMenuAction:(TMAMoreMenuAction)actionwithApp:(TMFMiniAppInfo *)appuserInfo:(nullable NSDictionary<NSString *, id> *)userInfo {if (action == TMAMoreMenuActionPerfPanel) {BOOL shown = [userInfo[TMAMoreMenuActionInfoPerfPanelCurrentlyShownKey] boolValue];NSLog(@"Performance panel currently shown: %d", shown);return YES; // Superapp takes over; SDK does not toggle the performance panel}return NO; // Other actions proceed with default logic}
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback