Files
youle_app_ios/msext/Class/Utils/PasteboardManager.h
joywayer 93b1881e52 feat: 优化分享功能和剪贴板管理
- 修改gameController分享逻辑,支持不同分享类型
- 新增PasteboardManager类,优化iOS 14+剪贴板访问
- 减少剪贴板权限弹窗,提升用户体验
2025-06-17 20:53:07 +08:00

43 lines
822 B
Objective-C
Raw 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.
//
// PasteboardManager.h
// msext
//
// Created on 2025/06/17.
// Copyright © 2025年. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
* 剪贴板管理器 - 优化iOS 14+的剪贴板访问,减少权限弹窗
*/
@interface PasteboardManager : NSObject
/**
* 安全地读取剪贴板文本内容
* 在iOS 14+中会先检查是否有内容,避免不必要的权限弹窗
*/
+ (nullable NSString *)safeReadPasteboardText;
/**
* 写入文本到剪贴板
*/
+ (void)writeTextToPasteboard:(NSString *)text;
/**
* 检查剪贴板是否有文本内容iOS 14+可用,不会触发权限弹窗)
*/
+ (BOOL)hasTextInPasteboard API_AVAILABLE(ios(14.0));
/**
* 清空剪贴板内容
*/
+ (void)clearPasteboard;
@end
NS_ASSUME_NONNULL_END