接入微信分享 SDK 并配置 Universal Link。

集成 WechatOpenSDK、www.zhifly.cn/suixinkan/ 通用链接与邀请页分享能力,附带 AASA 部署文件与单元测试。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-02 15:02:37 +08:00
parent 5d34cda730
commit a528d9b0d7
48 changed files with 5260 additions and 506 deletions

View File

@ -13,6 +13,7 @@ struct PhotographerInviteView: View {
@EnvironmentObject private var toastCenter: ToastCenter
@Environment(\.globalLoading) private var globalLoading
@StateObject private var viewModel = PhotographerInviteViewModel()
@State private var isPresentingShareSheet = false
var body: some View {
ScrollView {
@ -37,6 +38,17 @@ struct PhotographerInviteView: View {
.navigationBarTitleDisplayMode(.inline)
.task { await reload(showLoading: true) }
.refreshable { await reload(showLoading: false) }
.sheet(isPresented: $isPresentingShareSheet) {
WeChatShareSheet(
title: "邀请你加入随心瞰商家版",
description: viewModel.inviteCode.isEmpty ? "摄影师邀请" : "邀请码:\(viewModel.inviteCode)",
url: viewModel.inviteUrl,
thumbImage: viewModel.qrImage
) { message in
toastCenter.show(message)
}
.presentationDetents([.medium])
}
}
private var inviteCard: some View {
@ -77,8 +89,11 @@ struct PhotographerInviteView: View {
.frame(height: 44)
}
Button {
viewModel.copyInviteUrl()
toastCenter.show("链接已复制,可粘贴分享")
guard !viewModel.inviteUrl.isEmpty else {
toastCenter.show("邀请链接加载中,请稍后重试")
return
}
isPresentingShareSheet = true
} label: {
Label("分享", systemImage: "square.and.arrow.up")
.frame(maxWidth: .infinity)