// 点击胶囊按钮后的默认分享渠道-MAShareTarget中的MAShareTargetQQ、MAShareTargetQzone、MAShareTargetWXFriends、MAShareTargetWXMoment(小程序配置的必须是App的子集)// The default sharing channel after clicking the pill button - MAShareTarget (MAShareTargetQQ、MAShareTargetQzone、MAShareTargetWXFriends、MAShareTargetWXMoment)// (The configuration of the mini program must be a subset of the App)- (NSArray<NSNumber *> *)defaultSharingChannels;
- (NSArray<NSNumber *> *)defaultSharingChannels{return @[@(MAShareTargetQQ),@(MAShareTargetWXFriends),@(MAShareTargetWXMoment)];}
// 宿主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"];item1.shareTarget = 10001;[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;}
/*** @brief 分享的接口 - shared interface* @param shareModel 分享model - share model* @param appInfo 小程序appinfo - Mini program appinfo* @param completionBlock 回调 - callback*/- (void)shareMessageWithModel:(TMAShareModel *_Nonnull)shareModelappInfo:(TMFMiniAppInfo *_Nonnull)appInfocompletionBlock:(nullable void(^)(NSError * _Nullable error))completionBlock;
本页内容是否解决了您的问题?