feat(share): 朋友圈分享(sharefriend=2)走文本分享但指引专门指向朋友圈

ShareGuideRequest 加 timeline 标记(sharefriend==2);指引框 timeline 时显示『分享到朋友圈步骤』
(打开微信→发现→朋友圈→长按相机发表文字→粘贴→发表),否则好友/群聊步骤。
This commit is contained in:
lanterngamescn
2026-06-27 15:58:58 +08:00
parent 0b6c5dfc54
commit f82ec89027
4 changed files with 20 additions and 6 deletions
+3 -3
View File
@@ -45,14 +45,14 @@ export interface SharePanelResult {
export interface ShareGuideRequest {
/** 渠道:'wechat' | 'qq' | 'douyin'。 */
platform: string;
/** 内容类型:'text' | 'image'(决定指引文案与系统分享走 systemText/systemImage)。 */
contentKind: string;
/** 是否朋友圈直发(true=微信朋友圈,引导发朋友圈;false=好友/群聊)。 */
timeline: boolean;
/** 用户选定动作后回投的一次性事件名(ShareProvider 已 EventBus.once 监听)。 */
resultEvent: string;
}
/** 指引窗动作回投载荷。 */
export interface ShareGuideResult {
/** 'open'(打开App| 'system'(用系统分享)| 'cancel'。 */
/** 'open'立即打开App| 'cancel'(稍后分享/取消)。 */
action: string;
}
@@ -7,6 +7,8 @@
export struct ShareGuideDialog {
/** 渠道:'wechat' | 'qq' | 'douyin'。 */
platform: string = 'wechat';
/** 是否朋友圈直发(true=微信朋友圈,引导发朋友圈;false=好友/群聊)。 */
timeline: boolean = false;
/** 动作回调:'open'(立即打开App| 'cancel'(稍后分享/点空白)。 */
onPick: (action: string) => void = () => { };
@@ -31,8 +33,17 @@ export struct ShareGuideDialog {
return '#07C160';
}
/** 各渠道"分享到好友或群聊"分步文案(差异主要在第 1 步进入聊天的入口)。 */
/** 步骤标题。 */
private stepHeader(): string {
return this.timeline ? '🎯 分享到朋友圈步骤:' : '🎯 分享到好友或群聊步骤:';
}
/** 分步文案:朋友圈直发一套;否则各渠道"好友或群聊"一套(差异在第 1 步进入聊天的入口)。 */
private steps(): string[] {
if (this.timeline) {
// 微信朋友圈(sharefriend==2 直发微信)
return ['打开微信,进入「发现」→「朋友圈」', '长按右上角相机图标(发表文字)', '在输入框长按粘贴内容', '点击「发表」即可分享'];
}
if (this.platform === 'qq') {
return ['打开QQ,进入「消息」列表', '选择好友或群聊进入聊天', '在输入框长按粘贴内容', '点击发送即可分享'];
}
@@ -83,7 +94,7 @@ export struct ShareGuideDialog {
.width('100%')
.margin({ top: 14 })
Text('🎯 分享到好友或群聊步骤:')
Text(this.stepHeader())
.fontSize(14)
.fontColor('#666666')
.width('100%')
@@ -56,6 +56,7 @@ export struct BridgeGameContainer {
/** 分享指引窗显隐(渠道选定后叠在 Stack 顶层)。 */
@State private shareGuideVisible: boolean = false;
private shareGuidePlatform: string = '';
private shareGuideTimeline: boolean = false;
/** 当前指引窗的一次性回投事件名(用户选动作后 emit 回 ShareProvider)。 */
private shareGuideResultEvent: string = '';
@@ -165,6 +166,7 @@ export struct BridgeGameContainer {
}
const req = p as ShareGuideRequest;
this.shareGuidePlatform = req.platform;
this.shareGuideTimeline = req.timeline;
this.shareGuideResultEvent = req.resultEvent;
this.shareGuideVisible = true;
}
@@ -429,6 +431,7 @@ export struct BridgeGameContainer {
if (this.shareGuideVisible) {
ShareGuideDialog({
platform: this.shareGuidePlatform,
timeline: this.shareGuideTimeline,
onPick: (action: string) => this.emitShareGuideResult(action),
})
}
@@ -223,7 +223,7 @@ export class ShareProvider implements CapabilityProvider {
this.guideCancelFn = undefined;
this.onGuideAction(bean, platform, p);
});
const req: ShareGuideRequest = { platform, contentKind: 'text', resultEvent };
const req: ShareGuideRequest = { platform, timeline: bean.sharefriend === '2', resultEvent };
EventBus.emit(ShareEvents.SHOW_GUIDE, req);
}