- (UIView *)customLoadingViewWithAppInfo:(TMFMiniAppInfo *)appInfo frame:(CGRect)frame {UIView *view = [[UIView alloc] initWithFrame:frame];//todo Set specific view content herereturn view;}
Key | Description |
TMA_SK_MINIAPP_CloseButton | Close button icon |
TMA_SK_MINIAPP_CloseButtonDark | Close button icon for dark theme |
TMA_SK_MINIAPP_HomeButton | Home button icon |
TMA_SK_MINIAPP_HomeButtonDark | Home button icon for dark theme |
TMA_SK_MINIAPP_BackButton | Back button icon |
TMA_SK_MINIAPP_BackButtonDark | Back button icon for ark theme |
TMA_SK_MINIAPP_MoreButton | More button icon |
TMA_SK_MINIAPP_MoreButtonDark | More Button icon for dark Theme |
TMA_SK_MINIAPP_RecordButton | Record button icon |
TMA_SK_MINIAPP_RecordButtonDark | Record button icon for dark Theme |
TMA_SK_MINIAPP_MoreBackground | Capsule background image |
TMA_SK_MINIAPP_MoreBackgroundDark | Capsule background image for dark theme |
- (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;}
- (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 Click");}];item2.icon = [UIImage imageNamed:@"icon_moreOperation_collect"];[arrays addObject:item2];return arrays;}
/// Sharing panel/// If this method is not implemented, `showActionSheetWithTitle:cancelButtonTitle:cancelAction:otherButtonTitleAndActions:dismissBlock:presentingViewController` will be called./// @param title Title/// @param cancelAction Cancel operation/// @param otherButtonTitleAndActions Other buttons and response operations/// @param dismissBlock Operations to be executed after the panel is collapsed (be sure to call it so that the feature is normal)/// @param parentVC The VC that calls the panel- (void)showShareViewWithTitle:(nullable NSString *)titlecancelAction:(nullable dispatch_block_t)cancelActionotherButtonTitleAndActions:(nullable NSArray *)otherButtonTitleAndActionsdismissBlock:(nullable dispatch_block_t)dismissBlockparentVC:(UIViewController *)parentVC;
//Set the transition animation to bottom-to-top when the mini program launches- (TMFSlideAnimationType)getTMFSlideAnimationType{return TMFSlideAnimationTypeBottomToTop;}
/*** @brief Create a customized authorization window** @param frame Window size* @param scope Refer to WeChat authorization scope* @ param title Permission name* @ param desc Permission description information* @ param privacyApi Currently calling API* @ param appInfo Current mini program information* @ param allowBlock Allows callbacks* @ param denyBlock Rejects callbacks*/- (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 - exit retention- (BOOL)shouldDetainUser:(TMFMiniAppInfo *)app;
// Click 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 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 functionality!!!) function!!!)// @param parentVC - 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;
// The host App can customize the sharing channel and determine the display order. Currently, it is 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 (see MAUIDelegateShareViewType for specific types), determined by the developer, the host App can only change the display order// 2. Custom sharing channels: Host App customization (type is filled in MAUIDelegateShareViewTypeCustomizedShare, custom MAShareTarget, it is recommended to be greater than 100, onShareAppMessage returns the shared content in the mini program page, and the host handles it separately according to ShareTarget through shareMessageWithModel)// 3. Custom event processing: Host App customization (type is filled in MAUIDelegateShareViewTypeCustomizedAction)// The display order of the above three channels supports mixed arrangement///// 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 click");}];item2.icon = [UIImage imageNamed:@"icon_moreOperation_collect"];[arrays addObject:item2];return arrays;}
// Select media from the image picker - Select media from the image picker// @param model configuration - configuration// @param parentVC vc// @param completionBlock 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 - Shooting media// @param model configuration - configuration// @param parentVC vc// @param completionBlock After the selection is completed, data needs to be returned. Accept TMACameraImageModel according to the selected type. 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;// Get image data from PHAsset - Get image data from PHAsset// @param phAsset media object - media object// @param needCompress whether compression is required - 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 - Open document preview// @param filePath document path - document path// @param titleName title - title// @param appInfo Mini program appinfo - Mini program appinfo- (void)openDocument:(NSString *)filePathtitle:(NSString *)titleNameappInfo:(TMFMiniAppInfo *_Nonnull)appInfo;
Was this page helpful?