- (UIView *)customLoadingViewWithAppInfo:(TMFMiniAppInfo *)appInfo frame:(CGRect)frame {UIView *view = [[UIView alloc] initWithFrame:frame];// Set up the specific view content herereturn view;}
Key | Description |
TMA_SK_MINIAPP_CloseButton | Close button icon. |
TMA_SK_MINIAPP_CloseButtonDark | Close button in dark mode. |
TMA_SK_MINIAPP_HomeButton | Home button icon. |
TMA_SK_MINIAPP_HomeButtonDark | Home button icon in dark mode. |
TMA_SK_MINIAPP_BackButton | Back button icon. |
TMA_SK_MINIAPP_BackButtonDark | Back button icon in dark mode. |
TMA_SK_MINIAPP_MoreButton | More button icon. |
TMA_SK_MINIAPP_MoreButtonDark | More button icon in dark mode. |
TMA_SK_MINIAPP_RecordButton | Record button icon. |
TMA_SK_MINIAPP_RecordButtonDark | Record button icon in dark mode. |
TMA_SK_MINIAPP_MoreBackground | Capsule button background. |
TMA_SK_MINIAPP_MoreBackgroundDark | Capsule button background in dark mode. |
- (NSString *)stringWithConfigKey:(NSString *)key {// Set the Close button in light modeif([key isEqualToString:TMA_SK_MINIAPP_CloseButton]) {return [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"white_close-circle.png"];} else if([key isEqualToString:TMA_SK_MINIAPP_CloseButtonDark]) {return [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"dark_close-circle.png"];}return nil;}
// Set the mini program startup transition animation to Bottom to top- (TMFSlideAnimationType)getTMFSlideAnimationType{return TMFSlideAnimationTypeBottomToTop;}
/*** @brief - Create a custom authorization window** @param frame - Window size* @param scope - The scope of the authorization, similar to WeChat authorization scope* @param title - Permission name* @param desc - Permission description* @param privacyApi - The API being called that requires the permission* @param appInfo - Information of the current mini program* @param allowBlock - Callback for allowing the permission* @param denyBlock - Callback for denying the permission*/- (UIView *)createAuthorizeAlertViewWithFrame:(CGRect)framescope:(NSString *)scopetitle:(NSString *)titledesc:(NSString *)descprivacyApi:(NSString *)privacyApiappInfo:(TMFMiniAppInfo *_Nullable)appInfoallowBlock:(void (^)(void))allowBlockdenyBlock:(void (^)(void))denyBlock;
Mini program API | TMFMiniAppSDKDelegate method |
wx.showLoading |
|
wx.hideLoading |
|
wx.showToast |
|
wx.hideToast |
|
wx.showActionSheet (actionSheetType = 0) |
|
wx.showActionSheet (actionSheetType = 1) |
|
wx.showModal |
|
#pragma mark - Exit retention- (BOOL)shouldDetainUser:(TMFMiniAppInfo *)app;
// Tap the Capsule button to call up the panel/// If this method is not implemented, showActionSheetWithTitle:cancelButtonTitle:cancelAction:otherButtonTitleAndActions:dismissBlock:presentingViewController: will be called.// @param app - Mini program information// @param cancelButtonTitle - Cancel the title// @param cancelAction - Cancel the operation// @param otherButtonTitleAndActions - Other buttons and response operations// @param dismissBlock - The operation that needs to be performed after the panel is closed (must be called to ensure the proper running of the feature).// @param parentVC - Call up the ViewController of 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 host app, you can customize the sharing channel and determine the display order of the buttons, which are currently used in the ActionSheet called up by tapping the More button or the button component (open-type="share").// 1. Default channels: QQ, Qzone, WeChat, and Moments (for specific types, see MAUIDelegateShareViewType). They are determined by the developer, and only their display order can be changed in the host app.// 2. Custom channels: Customized in the host app (type set to MAUIDelegateShareViewTypeCustomizedShare. Enter a value greater than 100 for MAShareTarget. In the mini program page, onShareAppMessage returns the sharing content, and shareMessageWithModel is used uniformly. The host handles it separately according to ShareTarget).// 3. Custom event processing: Host app customization (type set to MAUIDelegateShareViewTypeCustomizedAction).// The display order of the above three 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(@"Tap");}];item2.icon = [UIImage imageNamed:@"icon_moreOperation_collect"];[arrays addObject:item2];return arrays;}
- (void)customizedConfigForMoreButtonActions:(NSMutableArray *)moreButtonTitleAndActions withApp:(TMFMiniAppInfo *)app{/*// Add a custom share 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];*/}
// Select media from the image picker// @param model - Configuration// @param parentVC - ViewController@param completionBlock - After the selection is completed, data needs to be returned. Accept TMAPickerImageModel or TMAPickerVideoModel based on the selected type.- (void)selectMediaFromPickerWithModel:(TMAMediaChooseConfigModel *)modelparentVC:(UIViewController *)parentVCcompletionBlock:(void(^)(NSArray * _Nullable medias, NSError * _Nullable error))completionBlock;// Shooting media// @param model - Configuration// @param parentVC - ViewController@param completionBlock - After the selection is completed, data needs to be returned. Accept TMACameraImageModel or TMACameraVideoModel based on the selected type.- (void)selectMediaFromCameraWithModel:(TMAMediaChooseConfigModel *)modelparentVC:(UIViewController *)parentVCcompletionBlock:(void(^)(id _Nullable media, NSError * _Nullable error))completionBlock;// Get image data from PHAsset// @param phAsset - Media object// @param needCompress - Whether compression is required- (NSData *)imageDataFromPhAsset:(PHAsset *)phAsset needCompress:(BOOL)needCompress;
// Image preview// @param navigationController - The navigation controller that calls up the image preview// @param currentAbsoluteUrl - Current page address// @param absUrlsInPreviewArray - Images to be previewed- (void)navigationController:(UINavigationController *)navigationControllerpresentImageWithCurrentUrl:(NSString *)currentAbsoluteUrlimageUrlArray:(NSArray *)absUrlsInPreviewArray;
// Open document preview// @param filePath - Path to the document// @param titleName - Title// @param appInfo appinfo - Mini program app info- (void)openDocument:(NSString *)filePathtitle:(NSString *)titleNameappInfo:(TMFMiniAppInfo *_Nonnull)appInfo;
// You can configure whether to display the progress bar when the web-view component loads the page. The default is to display the progress bar (0).OBJC_EXTERN NSString* const TMA_SK_MINIAPP_WebView_Progress_Hide;// You can configure the color of the progress bar when the web-view component loads a page. The default value is #5BC8F6.OBJC_EXTERN NSString* const TMA_SK_MINIAPP_WebView_Progress_ProgressTintColor;// You can configure the background color of the unfinished part of the progress bar when the web-view component loads the page. The default value is #E4E4E4.OBJC_EXTERN NSString* const TMA_SK_MINIAPP_WebView_Progress_TrackTintColor;- (NSString *)stringWithConfigKey:(NSString *)key {if([key isEqualToString:TMA_SK_MINIAPP_WebView_Progress_Hide]) {return @"1";}return nil;}