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

74 lines
2.0 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.
//
// DouyinShareManager.h
// msext
//
// Created on 2025/06/15.
// Copyright © 2025年. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, DouyinShareType) {
DouyinShareTypeImage, // 图片分享
DouyinShareTypeVideo, // 视频分享
DouyinShareTypeHashtag, // 话题挑战分享
DouyinShareTypeOpenProfile // 打开个人主页
};
@interface DouyinShareManager : NSObject
/**
* 检查抖音是否已安装
* @return BOOL 是否已安装抖音
*/
+ (BOOL)isDouyinInstalled;
/**
* 分享到抖音
* @param type 分享类型
* @param hashtagName 话题名称(仅用于话题挑战类型)
* @param image 图片(仅用于图片分享类型)
* @param videoUrl 视频本地URL仅用于视频分享类型
* @param userId 用户ID仅用于打开个人主页类型
* @param completion 完成回调
*/
+ (void)shareToDouyin:(DouyinShareType)type
hashtagName:(NSString * _Nullable)hashtagName
image:(UIImage * _Nullable)image
videoUrl:(NSURL * _Nullable)videoUrl
userId:(NSString * _Nullable)userId
completion:(void(^_Nullable)(BOOL success))completion;
/**
* 处理从抖音返回的URL
* 需要在 AppDelegate 的 application:openURL:options: 方法中调用
*/
+ (BOOL)handleOpenURL:(NSURL *)url;
/**
* 使用ShareContent对象进行抖音分享
* 支持根据type字段自动选择分享类型
* - type=2截图分享复制图片到剪贴板+引导)
* - 其他:文本分享(复制文本到剪贴板+引导)
* @param shareContent 完整的分享内容对象包含title、desc、type字段
* @param completion 分享完成回调
*/
+ (void)shareWithContent:(id)shareContent
completion:(void (^ _Nullable)(BOOL success))completion;
/**
* 显示抖音图片分享引导弹窗
*/
+ (void)showImageShareGuidance;
/**
* 显示抖音文本分享引导弹窗
*/
+ (void)showTextShareGuidance;
@end
NS_ASSUME_NONNULL_END