M3(T-M3-13): 分享面板对齐原工程——微信SDK + QQ/抖音系统分享
对齐 Android SharePanelHelper 流程:H5 friendsSharetypeUrlToptitleDescript → 原生弹自定义面板(微信/QQ/抖音) → 按所选平台分享。 - common ShareEvents:SHOW_PANEL + SharePanelRequest/Result;ShareProvider 经一次性 resultEvent 与 entry 容器一对一解耦(双槽实例隔离,避免广播串扰) - ShareProvider 重构:微信走 SDK(type2 Canvas截图→WXImageObject / 其他→WXWebpageObject; scene 好友/朋友圈;回传 sharesuccess);QQ/抖音走 @kit.ShareKit 系统分享(文本/图片/链接/视频, 不集成对应 SDK、不回传);截图失败统一降级 - 截图:CapabilityContext.captureCanvas(WebSlot 用 controller.runJavaScript 取 canvas toDataURL,非激活/出错返回空);FileSystem.writeBytes 落盘;fileUri 给 WXImageObject/系统分享 - entry SharePanel 组件 + BridgeGameContainer 顶层叠加;重复面板/销毁均取消回投防 once 悬挂 真机验证项:微信开放平台注册后的真分享、系统分享面板拉起、canvas 截图 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
01e4c0e99e
commit
5cbe5d4dd0
@@ -64,6 +64,19 @@ export class FileSystem {
|
||||
}
|
||||
}
|
||||
|
||||
/** 写二进制(覆盖;自动建父目录)。用于截图分享落盘等。 */
|
||||
static writeBytes(path: string, bytes: Uint8Array): void {
|
||||
FileSystem.ensureDir(FileSystem.dirOf(path));
|
||||
const file: fs.File = fs.openSync(path, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE | fs.OpenMode.TRUNC);
|
||||
try {
|
||||
// 按实际视图(byteOffset/byteLength)写入,避免底层 buffer 为大池子视图时写多余字节
|
||||
const view: ArrayBuffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;
|
||||
fs.writeSync(file.fd, view);
|
||||
} finally {
|
||||
fs.closeSync(file);
|
||||
}
|
||||
}
|
||||
|
||||
/** 读文本(不存在返回空串)。 */
|
||||
static readText(path: string): string {
|
||||
if (!FileSystem.exists(path)) {
|
||||
|
||||
Reference in New Issue
Block a user