Files
youle_app_ios/msext/Class/Utils/WechatShareManager.h
joywayer 2296c65974 feat: 重构分享功能 - 将各平台分享逻辑整理到对应Manager中
- 新增 WechatShareManager:封装微信分享逻辑,支持ShareContent对象
- 增强 DouyinShareManager:新增ShareContent支持和分享引导功能
- 优化 QQShareManager:支持截图/纯文本分享类型自动识别
- 重构 SharePanel:简化为UI调度层,移除具体分享实现
- 实现职责分离:各Manager专注自己的平台分享逻辑
- 提升可维护性:修改某平台不影响其他平台
- 增强可扩展性:新增分享平台更容易实现
2025-06-17 19:55:44 +08:00

83 lines
2.3 KiB
Objective-C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// WechatShareManager.h
// msext
//
// Created on 2025/06/17.
// Copyright © 2025年. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, WechatShareType) {
WechatShareTypeText, // 纯文本分享
WechatShareTypeImage, // 图片分享
WechatShareTypeLink, // 链接分享
WechatShareTypeScreenshot // 截图分享
};
typedef NS_ENUM(NSInteger, WechatScene) {
WechatSceneSession, // 微信好友
WechatSceneTimeline // 微信朋友圈
};
@interface WechatShareManager : NSObject
/**
* 检查微信是否已安装
* @return BOOL 是否已安装微信
*/
+ (BOOL)isWechatInstalled;
/**
* 使用ShareContent对象进行微信分享
* @param shareContent 完整的分享内容对象包含title、desc、webpageUrl、type、sharefriend字段
* @param completion 分享完成回调
*/
+ (void)shareWithContent:(id)shareContent
completion:(void (^ _Nullable)(BOOL success))completion;
/**
* 分享链接到微信
* @param url 链接URL
* @param title 标题
* @param description 描述
* @param thumbImage 缩略图
* @param scene 分享场景(好友/朋友圈)
* @param completion 完成回调
*/
+ (void)shareLinkToWechat:(NSString *)url
title:(NSString * _Nullable)title
description:(NSString * _Nullable)description
thumbImage:(UIImage * _Nullable)thumbImage
scene:(WechatScene)scene
completion:(void (^ _Nullable)(BOOL success))completion;
/**
* 分享图片到微信
* @param image 图片
* @param tagName 标签名称
* @param messageExt 扩展信息
* @param thumbImage 缩略图
* @param scene 分享场景(好友/朋友圈)
* @param completion 完成回调
*/
+ (void)shareImageToWechat:(UIImage *)image
tagName:(NSString * _Nullable)tagName
messageExt:(NSString * _Nullable)messageExt
thumbImage:(UIImage * _Nullable)thumbImage
scene:(WechatScene)scene
completion:(void (^ _Nullable)(BOOL success))completion;
/**
* 获取应用图标作为缩略图
* @return 应用图标UIImage对象
*/
+ (UIImage * _Nullable)getAppIconImage;
@end
NS_ASSUME_NONNULL_END