- (UIView *)customLoadingViewWithAppInfo:(TMFMiniAppInfo *)appInfo frame:(CGRect)frame {UIView *view = [[UIView alloc] initWithFrame:frame];//todo 设置具体的 view 相关内容return view;}
Key | 描述 |
TMA_SK_MINIAPP_CloseButton | 关闭按钮 icon |
TMA_SK_MINIAPP_CloseButtonDark | 关闭按钮 icon 深色主题 |
TMA_SK_MINIAPP_HomeButton | 主页按钮 icon |
TMA_SK_MINIAPP_HomeButtonDark | 主页按钮 icon 深色主题 |
TMA_SK_MINIAPP_BackButton | 返回按钮 icon |
TMA_SK_MINIAPP_BackButtonDark | 返回按钮 icon 深色主题 |
TMA_SK_MINIAPP_MoreButton | 更多按钮 icon |
TMA_SK_MINIAPP_MoreButtonDark | 更多按钮 icon 深色主题 |
TMA_SK_MINIAPP_RecordButton | 录音按钮 icon |
TMA_SK_MINIAPP_RecordButtonDark | 录音按钮 icon 深色主题 |
TMA_SK_MINIAPP_MoreBackground | 胶囊部分背景图片 |
TMA_SK_MINIAPP_MoreBackgroundDark | 胶囊部分背景图片深色主题 |
- (NSString *)stringWithConfigKey:(NSString *)key {//设置浅色模式下的关闭按钮if([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;}
// 设置小程序启动时转场动画为下进上出- (TMFSlideAnimationType)getTMFSlideAnimationType{return TMFSlideAnimationTypeBottomToTop;}
/*** @brief 创建自定义的授权窗口** @param frame 窗口大小* @param scope 参考微信授权 scope* @param title 权限名称* @param desc 权限描述信息* @param privacyApi 当前调用的api* @param appInfo 当前小程序信息* @param allowBlock 允许回调* @param denyBlock 拒绝回调*/- (UIView *)createAuthorizeAlertViewWithFrame:(CGRect)framescope:(NSString *)scopetitle:(NSString *)titledesc:(NSString *)descprivacyApi:(NSString *)privacyApiappInfo:(TMFMiniAppInfo *_Nullable)appInfoallowBlock:(void (^)(void))allowBlockdenyBlock:(void (^)(void))denyBlock;

小程序 api | TMFMiniAppSDKDelegate 方法 |
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;

// 点击胶囊按钮呼起的面板 - Click the capsule button to call up the panel// 如果此方法不实现,则会调用showActionSheetWithTitle:cancelButtonTitle:cancelAction:otherButtonTitleAndActions:dismissBlock:presentingViewController: - If this method is not implemented, showActionSheetWithTitle:cancelButtonTitle:cancelAction:otherButtonTitleAndActions:dismissBlock:presentingViewController: will be called.// @param app 小程序信息 - Mini program information// @param cancelButtonTitle 取消标题 - cancel 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 correct function!!!)// @param parentVC 呼起面板的vc - calls up the vc 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;

// 宿主App可以自定义分享途径、决定展示顺序,目前使用在点击更多按钮、button组件(open-type="share")呼起的ActionSheet中// 1、默认渠道:QQ好友、QQ空间、微信、朋友圈(具体type参见MAUIDelegateShareViewType),由开发商决定,宿主App只能更改展示顺序// 2、自定义分享渠道:宿主App自定义(type填MAUIDelegateShareViewTypeCustomizedShare,自定义MAShareTarget,建议大于100,在小程序页面中onShareAppMessage 回传分享内容,统一走shareMessageWithModel由宿主根据ShareTarget来分别处理)// 3、自定义事件处理:宿主App自定义(type填MAUIDelegateShareViewTypeCustomizedAction)// 以上三种渠道展示顺序支持混排///// The host App can customize the sharing path and determine the display order. It is currently used in the ActionSheet called up by clicking the more button or button component (open-type="share")// 1. Default channels: QQ Friends, QQ Space, WeChat, Moments (for specific types, see MAUIDelegateShareViewType), decided by the developer, the host App can only change the display order// 2. Customized sharing channel: Host App customization (type fills in MAUIDelegateShareViewTypeCustomizedShare, custom MAShareTarget, it is recommended to be greater than 100, in the mini program page, onShareAppMessage returns the sharing content, use shareMessageWithModel uniformly, and the host handles it separately according to ShareTarget)// 3. Custom event processing: Host App customization (type fills in MAUIDelegateShareViewTypeCustomizedAction)// The display order of the above three channels- (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 点击");}];item2.icon = [UIImage imageNamed:@"icon_moreOperation_collect"];[arrays addObject:item2];return arrays;}

- (void)customizedConfigForMoreButtonActions:(NSMutableArray *)moreButtonTitleAndActions withApp:(TMFMiniAppInfo *)app{/*//增加一个自定义分享项TMASheetItemInfo *item = [[TMASheetItemInfo alloc] initWithTitle:@"Share" type:MAUIDelegateShareViewTypeCustomizedShare shareTarget:100 shareKey:@"my"];item.icon = [UIImage imageNamed:@"icon_moreOperation_shareChat"];[moreButtonTitleAndActions addObject:item];*//*//删除复制链接菜单NSMutableArray *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 vc// @param completionBlock 选择完毕后需要回传数据 根据所选类型接受 TMAPickerImageModel TMAPickerVideoModel - After the selection is completed, data needs to be returned. Accept TMAPickerImageModel TMAPickerVideoModel according to the selected type.- (void)selectMediaFromPickerWithModel:(TMAMediaChooseConfigModel *)modelparentVC:(UIViewController *)parentVCcompletionBlock:(void(^)(NSArray * _Nullable medias, NSError * _Nullable error))completionBlock;// 拍摄媒体 - Shooting media// @param model 配置 - configuration// @param parentVC vc// @param completionBlock 选择完毕后需要回传数据,根据所选类型接受TMACameraImageModel TMACameraVideoModel - After the selection is completed, data needs to be returned, and TMACameraImageModel TMACameraVideoModel is accepted according to the selected type.- (void)selectMediaFromCameraWithModel:(TMAMediaChooseConfigModel *)modelparentVC:(UIViewController *)parentVCcompletionBlock:(void(^)(id _Nullable media, NSError * _Nullable error))completionBlock;// 从PHAsset中获取图片数据 - 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 呼起图片预览的导航栏 - calls up the navigation bar for image preview// @param currentAbsoluteUrl 当前页面地址 - current page address// @param absUrlsInPreviewArray 需要预览的图片 - Pictures to be previewed- (void)navigationController:(UINavigationController *)navigationControllerpresentImageWithCurrentUrl:(NSString *)currentAbsoluteUrlimageUrlArray:(NSArray *)absUrlsInPreviewArray;
// 打开文档预览 - Open document preview// @param filePath 文档路径 - document path// @param titleName 标题 - title// @param appInfo 小程序appinfo - Mini program appinfo- (void)openDocument:(NSString *)filePathtitle:(NSString *)titleNameappInfo:(TMFMiniAppInfo *_Nonnull)appInfo;
//app 可配置webview组件加载页面时是否显示进度条,1/0,默认为0显示//You can configure whether to display the progress bar when the webview component loads the page, 1/0, the default is 0 displayOBJC_EXTERN NSString* const TMA_SK_MINIAPP_WebView_Progress_Hide;//app 可配置webview组件加载页面时进度条显示颜色,默认值为:#5BC8F6//You can configure the progress bar display color when the webview component loads a page,The default value is:#5BC8F6OBJC_EXTERN NSString* const TMA_SK_MINIAPP_WebView_Progress_ProgressTintColor;//app 可配置webview组件加载页面时进度条未完成部分背景显示颜色,默认值为:#E4E4E4//The app can configure the background color of the unfinished part of the progress bar when the webview component loads the page. The default value is: #E4E4E4OBJC_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;}
文档反馈