添加multishare配置,用来开启关闭3分享

This commit is contained in:
joywayer
2026-07-03 22:20:48 +08:00
parent 113b4d4960
commit d76064c4c5
4 changed files with 45 additions and 16 deletions
+3 -1
View File
@@ -11,7 +11,7 @@
<key>gamestart</key>
<string>gamehall</string>
<key>gameconfig</key>
<string>tsgames.daoqi88.cn-config_test-update_jsonv2_test</string>
<string>tsgames.daoqi88.cn-config-update_jsonv2</string>
<key>market</key>
<string>2</string>
<key>agent</key>
@@ -22,5 +22,7 @@
<string></string>
<key>appleconfig</key>
<string></string>
<key>multishare</key>
<string>0</string>
</dict>
</plist>
+19 -4
View File
@@ -2,16 +2,19 @@
// BundleConfig.swift
// ylgamehall
//
// 渠道注入配置:从 Bundle 内的 ChannelConfig.plist 读 10 个 string 值。
// 渠道注入配置:从 Bundle 内的 ChannelConfig.plist 读 11 个 string 值。
// 设计模式与契约见 docs/H5-Native-Implementation-Design.md §7 / ADR-007。
//
// 注:原有 qiniudomain 字段已于 2026-06-27 移除,七牛 CDN 域名改由
// RemoteConfig 顶层 audio_domain 单一权威源动态下发。
// 注:
// - 原有 qiniudomain 字段已于 2026-06-27 移除,七牛 CDN 域名改由
// RemoteConfig 顶层 audio_domain 单一权威源动态下发。
// - 新增 multishare 字段:控制子游戏 sharefriend=1 好友分享的形态
// ("1" = SharePanel 三选一 / "0" = 仅微信直发)。
//
import Foundation
/// 渠道注入配置(10 项),由 `BundleConfig.shared` 在 App 启动时一次性加载,运行期不变。
/// 渠道注入配置(11 项),由 `BundleConfig.shared` 在 App 启动时一次性加载,运行期不变。
///
/// 多渠道分发:构建后用 `plutil` 修改 `.app/ChannelConfig.plist` + 重签,
/// 不需要重新 Xcode build。详见 ADR-007。
@@ -30,6 +33,17 @@ nonisolated public final class BundleConfig: Sendable {
public let appVersion: String
public let other: String
public let appleConfig: String
/// 子游戏内 sharefriend=1 好友分享的形态开关(渠道级):
/// "1" → SharePanel 三选一(微信 / QQ / 抖音,当前默认行为)
/// "0" → 关闭三分享,直接走微信分享(不弹面板)
/// 缺失或其他值视为 "1"(默认开启,兼容旧行为)。
public let multiShare: String
/// 是否启用 SharePanel 三选一。等价 `multiShare != "0"`;
/// 空字符串 / 缺失字段视为启用(默认行为)。
public var isMultiShareEnabled: Bool {
multiShare != "0"
}
/// 单测可注入任意 bundle 验证不同 plist fixture。
public init(bundle: Bundle = .main) {
@@ -44,6 +58,7 @@ nonisolated public final class BundleConfig: Sendable {
appVersion = dict["appversion"] ?? ""
other = dict["other"] ?? ""
appleConfig = dict["appleconfig"] ?? ""
multiShare = dict["multishare"] ?? ""
}
private static func loadPlist(bundle: Bundle) -> [String: String] {
+12 -3
View File
@@ -6,7 +6,10 @@
// ViewController 各注册一份且**行为不同**,新外壳按页面 mode 分发:
//
// • dispatchSubGame — 对齐 msext gameController.m:575-597(活路径):
// - sharefriend == "1" → SharePanel 三选一(微信/QQ/抖音)
// - sharefriend == "1" 且 BundleConfig.isMultiShareEnabled
// → SharePanel 三选一(微信/QQ/抖音)
// - sharefriend == "1" 且 multishare 关闭
// → 直发微信好友(渠道级降级为单一平台)
// - 其他 → WechatShare.share() 朋友圈 timeline
//
// • dispatchLobby — 对齐 msext NewRootVC.m:453-537:直发微信,无 SharePanel
@@ -27,8 +30,14 @@ public enum ShareCenter {
public static func dispatchSubGame(_ content: ShareContent) {
switch content.sharefriend {
case "1":
// 好友/私聊 → SharePanel 三选一
SharePanel.show(content: content)
// 好友/私聊:渠道级开关决定弹面板还是直发微信
if BundleConfig.shared.isMultiShareEnabled {
SharePanel.show(content: content)
} else {
// multishare = "0" → 三分享关闭,直接走微信好友(scene 参数在
// 剪贴板路径下用于文案 / 语义标注,不实际影响粘贴目标)
WechatShare.shared.share(content, scene: .friend)
}
default:
// sharefriend == "2" 或缺失或其他 → msext WechatShareManager