feat: 盲盒主页面
This commit is contained in:
parent
0c5083f72c
commit
817cd23c4a
@ -2,309 +2,369 @@ import SwiftUI
|
|||||||
import SwiftData
|
import SwiftData
|
||||||
import AVKit
|
import AVKit
|
||||||
|
|
||||||
// MARK: - 自定义过渡动画
|
// MARK: - Constants
|
||||||
extension AnyTransition {
|
private enum MediaURLs {
|
||||||
/// 创建从左向右的滑动过渡动画
|
static let videoURL = "https://cdn.memorywake.com/users/7363409620351717377/files/7366657553935241216/39C069E1-7C3E-4261-8486-12058F855B38.mov"
|
||||||
static var slideFromLeading: AnyTransition {
|
static let imageURL = "https://cdn.fairclip.cn/files/7343228671693557760/20250604-164000.jpg"
|
||||||
.asymmetric(
|
static let VideoBlindURL = "https://cdn.memorywake.com/users/7363409620351717377/files/7366658779259211776/AD970D28-9D1E-4817-A245-F11967441B8F.mp4"
|
||||||
insertion: .move(edge: .trailing).combined(with: .opacity), // 从右侧滑入
|
|
||||||
removal: .move(edge: .leading).combined(with: .opacity) // 向左侧滑出
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Video Player View
|
private enum BlindBoxAnimationPhase {
|
||||||
struct VideoPlayerView: View {
|
case loading
|
||||||
let player: AVPlayer
|
case ready
|
||||||
@Binding var isFullscreen: Bool
|
case opening
|
||||||
|
}
|
||||||
var body: some View {
|
|
||||||
ZStack(alignment: .bottomTrailing) {
|
extension Notification.Name {
|
||||||
VideoPlayer(player: player)
|
static let navigateToMediaViewer = Notification.Name("navigateToMediaViewer")
|
||||||
.frame(width: 300, height: 200)
|
|
||||||
.cornerRadius(12)
|
|
||||||
.overlay(
|
|
||||||
RoundedRectangle(cornerRadius: 12)
|
|
||||||
.stroke(Color.gray.opacity(0.3), lineWidth: 1)
|
|
||||||
)
|
|
||||||
|
|
||||||
// 全屏按钮
|
|
||||||
Button(action: {
|
|
||||||
isFullscreen = true
|
|
||||||
player.play()
|
|
||||||
}) {
|
|
||||||
Image(systemName: "arrow.up.left.and.arrow.down.right")
|
|
||||||
.font(.system(size: 20))
|
|
||||||
.foregroundColor(.white)
|
|
||||||
.padding(8)
|
|
||||||
.background(Color.black.opacity(0.6))
|
|
||||||
.clipShape(Circle())
|
|
||||||
}
|
|
||||||
.padding(16)
|
|
||||||
}
|
|
||||||
.frame(width: 300, height: 200)
|
|
||||||
.onTapGesture {
|
|
||||||
player.play()
|
|
||||||
}
|
|
||||||
.onAppear {
|
|
||||||
player.play()
|
|
||||||
}
|
|
||||||
.fullScreenCover(isPresented: $isFullscreen) {
|
|
||||||
ZStack(alignment: .topLeading) {
|
|
||||||
// 全屏视频播放器
|
|
||||||
VideoPlayer(player: player)
|
|
||||||
.edgesIgnoringSafeArea(.all)
|
|
||||||
.onAppear { player.play() }
|
|
||||||
|
|
||||||
// 关闭按钮
|
|
||||||
Button(action: {
|
|
||||||
isFullscreen = false
|
|
||||||
player.pause()
|
|
||||||
}) {
|
|
||||||
Image(systemName: "xmark.circle.fill")
|
|
||||||
.font(.title)
|
|
||||||
.foregroundColor(.white)
|
|
||||||
.padding()
|
|
||||||
.background(Color.black.opacity(0.4))
|
|
||||||
.clipShape(Circle())
|
|
||||||
}
|
|
||||||
.padding(.top, 50)
|
|
||||||
.padding(.leading, 20)
|
|
||||||
}
|
|
||||||
.background(Color.black.edgesIgnoringSafeArea(.all))
|
|
||||||
.statusBar(hidden: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - 主视图
|
// MARK: - 主视图
|
||||||
struct ContentView: View {
|
struct VisualEffectView: UIViewRepresentable {
|
||||||
// MARK: - 状态属性
|
var effect: UIVisualEffect?
|
||||||
@State private var showModal = false // 控制用户资料弹窗显示
|
|
||||||
@State private var showSettings = false // 控制设置页面显示
|
|
||||||
@State private var contentOffset: CGFloat = 0 // 内容偏移量
|
|
||||||
@State private var showLogin = false
|
|
||||||
@State private var animateGradient = false
|
|
||||||
@State private var showLottieAnimation = true // 控制Lottie动画显示
|
|
||||||
@State private var showVideoPlayer = false // 控制视频播放器显示
|
|
||||||
@State private var isVideoFullscreen = false // 控制视频全屏状态
|
|
||||||
|
|
||||||
let timer = Timer.publish(every: 0.02, on: .main, in: .common).autoconnect()
|
func makeUIView(context: Context) -> UIVisualEffectView {
|
||||||
|
let view = UIVisualEffectView(effect: nil)
|
||||||
|
|
||||||
|
// Use a simpler approach without animator
|
||||||
|
let blurEffect = UIBlurEffect(style: .systemUltraThinMaterialLight)
|
||||||
|
|
||||||
|
// Create a custom blur effect with reduced intensity
|
||||||
|
let blurView = UIVisualEffectView(effect: blurEffect)
|
||||||
|
blurView.alpha = 0.3 // Reduce intensity
|
||||||
|
|
||||||
|
// Add a white background with low opacity for better frosted effect
|
||||||
|
let backgroundView = UIView()
|
||||||
|
backgroundView.backgroundColor = UIColor.white.withAlphaComponent(0.1)
|
||||||
|
backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||||
|
|
||||||
|
view.contentView.addSubview(backgroundView)
|
||||||
|
view.contentView.addSubview(blurView)
|
||||||
|
blurView.frame = view.bounds
|
||||||
|
blurView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||||
|
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
// 获取模型上下文
|
func updateUIView(_ uiView: UIVisualEffectView, context: Context) {
|
||||||
@Environment(\.modelContext) private var modelContext
|
// No need to update the effect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AVPlayerController: UIViewControllerRepresentable {
|
||||||
|
@Binding var player: AVPlayer?
|
||||||
|
|
||||||
// 查询数据 - 简单查询
|
func makeUIViewController(context: Context) -> AVPlayerViewController {
|
||||||
@Query private var login: [Login]
|
let controller = AVPlayerViewController()
|
||||||
|
controller.player = player
|
||||||
|
controller.showsPlaybackControls = false
|
||||||
|
controller.videoGravity = .resizeAspect
|
||||||
|
controller.view.backgroundColor = .clear
|
||||||
|
return controller
|
||||||
|
}
|
||||||
|
|
||||||
// 视频播放器
|
func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) {
|
||||||
private let player: AVPlayer?
|
uiViewController.player = player
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BlindBoxView: View {
|
||||||
|
enum BlindBoxMediaType {
|
||||||
|
case video
|
||||||
|
case image
|
||||||
|
case all
|
||||||
|
}
|
||||||
|
|
||||||
init() {
|
let mediaType: BlindBoxMediaType
|
||||||
// 使用远程视频URL
|
@State private var showLottieAnimation = true
|
||||||
if let videoURL = URL(string: "https://cdn.fairclip.cn/files/7342843896868769793/飞书20250617-144935.mp4") {
|
@State private var showScalingOverlay = false
|
||||||
self.player = AVPlayer(url: videoURL)
|
@State private var animationPhase: BlindBoxAnimationPhase = .loading
|
||||||
} else {
|
@State private var scale: CGFloat = 0.1
|
||||||
self.player = nil
|
@State private var videoPlayer: AVPlayer?
|
||||||
print("Error: Invalid video URL")
|
@State private var showControls = false
|
||||||
|
@State private var isAnimating = true
|
||||||
|
@State private var aspectRatio: CGFloat = 1.0
|
||||||
|
@State private var isPortrait: Bool = false
|
||||||
|
@State private var displayImage: UIImage?
|
||||||
|
|
||||||
|
init(mediaType: BlindBoxMediaType) {
|
||||||
|
self.mediaType = mediaType
|
||||||
|
}
|
||||||
|
|
||||||
|
private func loadMedia() {
|
||||||
|
switch mediaType {
|
||||||
|
case .video:
|
||||||
|
loadVideo()
|
||||||
|
case .image:
|
||||||
|
loadImage()
|
||||||
|
case .all:
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func loadData() {
|
||||||
|
guard let url = URL(string: MediaURLs.imageURL) else { return }
|
||||||
|
URLSession.shared.dataTask(with: url) { data, _, _ in
|
||||||
|
if let data = data, let image = UIImage(data: data) {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.displayImage = image
|
||||||
|
self.aspectRatio = image.size.width / image.size.height
|
||||||
|
self.isPortrait = image.size.height > image.size.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.resume()
|
||||||
|
}
|
||||||
|
|
||||||
|
private func loadImage() {
|
||||||
|
guard let url = URL(string: MediaURLs.imageURL) else { return }
|
||||||
|
URLSession.shared.dataTask(with: url) { data, _, _ in
|
||||||
|
if let data = data, let image = UIImage(data: data) {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.displayImage = image
|
||||||
|
self.aspectRatio = image.size.width / image.size.height
|
||||||
|
self.isPortrait = image.size.height > image.size.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.resume()
|
||||||
|
}
|
||||||
|
|
||||||
|
private func loadVideo() {
|
||||||
|
guard let url = URL(string: MediaURLs.videoURL) else { return }
|
||||||
|
let asset = AVAsset(url: url)
|
||||||
|
let playerItem = AVPlayerItem(asset: asset)
|
||||||
|
let player = AVPlayer(playerItem: playerItem)
|
||||||
|
|
||||||
|
let videoTracks = asset.tracks(withMediaType: .video)
|
||||||
|
if let videoTrack = videoTracks.first {
|
||||||
|
let size = videoTrack.naturalSize.applying(videoTrack.preferredTransform)
|
||||||
|
let width = abs(size.width)
|
||||||
|
let height = abs(size.height)
|
||||||
|
|
||||||
|
aspectRatio = width / height
|
||||||
|
isPortrait = height > width
|
||||||
|
}
|
||||||
|
|
||||||
|
player.isMuted = true
|
||||||
|
self.videoPlayer = player
|
||||||
|
}
|
||||||
|
|
||||||
|
private func startScalingAnimation() {
|
||||||
|
self.scale = 0.1
|
||||||
|
self.showScalingOverlay = true
|
||||||
|
|
||||||
|
withAnimation(.spring(response: 2.0, dampingFraction: 0.5, blendDuration: 0.8)) {
|
||||||
|
self.scale = 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Computed Properties
|
||||||
|
private var scaledWidth: CGFloat {
|
||||||
|
if isPortrait {
|
||||||
|
return UIScreen.main.bounds.height * scale * 1/aspectRatio
|
||||||
|
} else {
|
||||||
|
return UIScreen.main.bounds.width * scale
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var scaledHeight: CGFloat {
|
||||||
|
if isPortrait {
|
||||||
|
return UIScreen.main.bounds.height * scale
|
||||||
|
} else {
|
||||||
|
return UIScreen.main.bounds.width * scale * 1/aspectRatio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - 主体视图
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
ZStack {
|
||||||
ZStack {
|
Color.themeTextWhiteSecondary.ignoresSafeArea()
|
||||||
// 全局背景颜色背景色
|
|
||||||
Color.themeTextWhiteSecondary.ignoresSafeArea()
|
if showScalingOverlay {
|
||||||
|
ZStack {
|
||||||
// 主内容区域
|
VisualEffectView(effect: UIBlurEffect(style: .systemUltraThinMaterialLight))
|
||||||
VStack {
|
.opacity(0.3)
|
||||||
VStack(spacing: 20) {
|
.edgesIgnoringSafeArea(.all)
|
||||||
// 顶部导航栏
|
|
||||||
HStack {
|
Group {
|
||||||
// 设置按钮
|
if mediaType == .video, let player = videoPlayer {
|
||||||
Button(action: showUserProfile) {
|
// Video Player
|
||||||
SVGImage(svgName: "User")
|
AVPlayerController(player: $videoPlayer)
|
||||||
.frame(width: 24, height: 24)
|
.frame(width: scaledWidth, height: scaledHeight)
|
||||||
|
.opacity(scale == 1 ? 1 : 0.7)
|
||||||
|
.onAppear { player.play() }
|
||||||
|
|
||||||
|
} else if mediaType == .image, let image = displayImage {
|
||||||
|
// Image View
|
||||||
|
Image(uiImage: image)
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: scaledWidth, height: scaledHeight)
|
||||||
|
.opacity(scale == 1 ? 1 : 0.7)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onTapGesture {
|
||||||
|
withAnimation(.easeInOut(duration: 0.1)) {
|
||||||
|
showControls.toggle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回按钮
|
||||||
|
if showControls {
|
||||||
|
VStack {
|
||||||
|
HStack {
|
||||||
|
Button(action: {
|
||||||
|
// 导航到BlindOutcomeView
|
||||||
|
if mediaType == .video, let videoURL = URL(string: MediaURLs.videoURL) {
|
||||||
|
Router.shared.navigate(to: .blindOutcome(media: .video(videoURL, nil)))
|
||||||
|
} else if mediaType == .image, let image = displayImage {
|
||||||
|
Router.shared.navigate(to: .blindOutcome(media: .image(image)))
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Image(systemName: "chevron.left.circle.fill")
|
||||||
|
.font(.system(size: 36))
|
||||||
|
.foregroundColor(.black)
|
||||||
|
.padding(12)
|
||||||
|
.clipShape(Circle())
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
// // 测试质感页面入口
|
}
|
||||||
// NavigationLink(destination: TestView()) {
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
// Text("TestView")
|
.padding(.top, 50)
|
||||||
// .font(.subheadline)
|
.padding(.leading, 20)
|
||||||
// .padding(.horizontal, 12)
|
.zIndex(1000)
|
||||||
// .padding(.vertical, 6)
|
.transition(.opacity)
|
||||||
// .background(Color.brown)
|
.onAppear {
|
||||||
// .foregroundColor(.white)
|
// 2秒后显示按钮
|
||||||
// .cornerRadius(8)
|
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
|
||||||
// }
|
withAnimation(.easeInOut(duration: 0.3)) {
|
||||||
|
showControls = true
|
||||||
// // 订阅测试按钮
|
}
|
||||||
// NavigationLink(destination: SubscribeView()) {
|
|
||||||
// Text("Subscribe")
|
|
||||||
// .font(.subheadline)
|
|
||||||
// .padding(.horizontal, 12)
|
|
||||||
// .padding(.vertical, 6)
|
|
||||||
// .background(Color.orange)
|
|
||||||
// .foregroundColor(.white)
|
|
||||||
// .cornerRadius(8)
|
|
||||||
// }
|
|
||||||
// .padding(.trailing)
|
|
||||||
// .fullScreenCover(isPresented: $showLogin) {
|
|
||||||
// LoginView()
|
|
||||||
// }
|
|
||||||
NavigationLink(destination: SubscribeView()) {
|
|
||||||
Text("3290")
|
|
||||||
.font(Typography.font(for: .subtitle))
|
|
||||||
.fontWeight(.bold)
|
|
||||||
.padding(.horizontal, 12)
|
|
||||||
.padding(.vertical, 6)
|
|
||||||
.background(Color.black)
|
|
||||||
.foregroundColor(.white)
|
|
||||||
.cornerRadius(16)
|
|
||||||
}
|
|
||||||
.padding(.trailing)
|
|
||||||
.fullScreenCover(isPresented: $showLogin) {
|
|
||||||
LoginView()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal)
|
}
|
||||||
.padding(.top, 20)
|
}
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
|
.animation(.easeInOut(duration: 1.0), value: scale)
|
||||||
|
.ignoresSafeArea()
|
||||||
|
.onAppear {
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
|
||||||
|
withAnimation(.spring(response: 2.5, dampingFraction: 0.6, blendDuration: 1.0)) {
|
||||||
|
self.scale = 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Original content
|
||||||
|
VStack {
|
||||||
|
VStack(spacing: 20) {
|
||||||
// 标题
|
// 标题
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
Text("Hi! Click And")
|
Text("Hi! Click And")
|
||||||
Text("Open Your Box~")
|
Text("Open Your First Box~")
|
||||||
}
|
}
|
||||||
.font(Typography.font(for: .smallLargeTitle))
|
.font(Typography.font(for: .smallLargeTitle))
|
||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
.foregroundColor(Color.themeTextMessageMain)
|
.foregroundColor(Color.themeTextMessageMain)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
|
.opacity(showScalingOverlay ? 0 : 1)
|
||||||
|
.offset(y: showScalingOverlay ? -UIScreen.main.bounds.height * 0.2 : 0)
|
||||||
|
.animation(.easeInOut(duration: 0.5), value: showScalingOverlay)
|
||||||
|
|
||||||
// 盲盒
|
// 盲盒
|
||||||
// 添加SVG背景图片
|
|
||||||
ZStack {
|
ZStack {
|
||||||
// 1. 背景SVG
|
// 1. 背景SVG
|
||||||
SVGImage(svgName: "BlindBg")
|
if !showScalingOverlay {
|
||||||
.frame(
|
SVGImage(svgName: "BlindBoxBg")
|
||||||
width: UIScreen.main.bounds.width * 1.8,
|
.frame(
|
||||||
height: UIScreen.main.bounds.height * 0.65
|
width: UIScreen.main.bounds.width * 1.8,
|
||||||
)
|
height: UIScreen.main.bounds.height * 0.85
|
||||||
.position(x: UIScreen.main.bounds.width / 2,
|
)
|
||||||
y: UIScreen.main.bounds.height * 0.325)
|
.position(x: UIScreen.main.bounds.width / 2,
|
||||||
|
y: UIScreen.main.bounds.height * 0.325)
|
||||||
// 2. Lottie动画层
|
.opacity(showScalingOverlay ? 0 : 1)
|
||||||
if showLottieAnimation {
|
.animation(.easeOut(duration: 1.5), value: showScalingOverlay)
|
||||||
GIFView(name: "Blind") {
|
|
||||||
// 点击事件处理
|
|
||||||
Router.shared.navigate(to: .blindBox(mediaType: .video))
|
|
||||||
}
|
|
||||||
.frame(width: 300, height: 300)
|
|
||||||
}
|
}
|
||||||
|
if !showScalingOverlay {
|
||||||
// 3. 视频播放器
|
VStack(spacing: 20) {
|
||||||
if showVideoPlayer, let player = player {
|
switch animationPhase {
|
||||||
VideoPlayerView(player: player, isFullscreen: $isVideoFullscreen)
|
case .loading:
|
||||||
} else if showVideoPlayer {
|
GIFView(name: "BlindLoading")
|
||||||
Text("Video not found")
|
.frame(width: 300, height: 300)
|
||||||
.foregroundColor(.red)
|
.onAppear {
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 6) {
|
||||||
|
withAnimation {
|
||||||
|
animationPhase = .ready
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case .ready:
|
||||||
|
ZStack {
|
||||||
|
GIFView(name: "BlindReady")
|
||||||
|
.frame(width: 300, height: 300)
|
||||||
|
|
||||||
|
// Add a transparent overlay to capture taps
|
||||||
|
Color.clear
|
||||||
|
.contentShape(Rectangle()) // Make the entire area tappable
|
||||||
|
.frame(width: 300, height: 300)
|
||||||
|
.onTapGesture {
|
||||||
|
print("点击了盲盒")
|
||||||
|
withAnimation {
|
||||||
|
animationPhase = .opening
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.frame(width: 300, height: 300)
|
||||||
|
|
||||||
|
case .opening:
|
||||||
|
GIFView(name: "BlindOpen")
|
||||||
|
.frame(width: 300, height: 300)
|
||||||
|
.onAppear {
|
||||||
|
self.loadMedia()
|
||||||
|
// Start animation after media is loaded
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
|
||||||
|
self.startScalingAnimation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.compositingGroup()
|
||||||
|
.padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(
|
.frame(
|
||||||
maxWidth: .infinity,
|
maxWidth: .infinity,
|
||||||
maxHeight: UIScreen.main.bounds.height * 0.65
|
maxHeight: UIScreen.main.bounds.height * 0.65
|
||||||
)
|
)
|
||||||
.clipped()
|
.opacity(showScalingOverlay ? 0 : 1)
|
||||||
// 打开
|
.animation(.easeOut(duration: 1.5), value: showScalingOverlay)
|
||||||
Button(action: showUserProfile) {
|
.offset(y: showScalingOverlay ? -100 : 0)
|
||||||
Text("Go to Buy")
|
.animation(.easeInOut(duration: 1.5), value: showScalingOverlay)
|
||||||
.font(Typography.font(for: .body))
|
|
||||||
.fontWeight(.bold)
|
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
.padding()
|
|
||||||
.background(Color.themePrimary)
|
|
||||||
.foregroundColor(Color.themeTextMessageMain)
|
|
||||||
.cornerRadius(32)
|
|
||||||
}
|
|
||||||
.padding(.horizontal)
|
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.background(Color.themeTextWhiteSecondary)
|
.background(Color.themeTextWhiteSecondary)
|
||||||
.offset(x: showModal ? UIScreen.main.bounds.width * 0.8 : 0)
|
|
||||||
.animation(.spring(response: 0.6, dampingFraction: 0.8), value: showModal)
|
|
||||||
.edgesIgnoringSafeArea(.all)
|
.edgesIgnoringSafeArea(.all)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户资料弹窗
|
|
||||||
SlideInModal(
|
|
||||||
isPresented: $showModal,
|
|
||||||
onDismiss: hideUserProfile
|
|
||||||
) {
|
|
||||||
UserProfileModal(
|
|
||||||
showModal: $showModal,
|
|
||||||
showSettings: $showSettings
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.offset(x: showSettings ? UIScreen.main.bounds.width : 0)
|
|
||||||
.animation(.spring(response: 0.6, dampingFraction: 0.8), value: showSettings)
|
|
||||||
|
|
||||||
// 设置页面遮罩层
|
|
||||||
ZStack {
|
|
||||||
if showSettings {
|
|
||||||
Color.black.opacity(0.3)
|
|
||||||
.edgesIgnoringSafeArea(.all)
|
|
||||||
.onTapGesture(perform: hideSettings)
|
|
||||||
.transition(.opacity)
|
|
||||||
}
|
|
||||||
|
|
||||||
if showSettings {
|
|
||||||
SettingsView(isPresented: $showSettings)
|
|
||||||
.transition(.move(edge: .leading))
|
|
||||||
.zIndex(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.animation(.spring(response: 0.6, dampingFraction: 0.8), value: showSettings)
|
|
||||||
}
|
}
|
||||||
.background(Color.themeTextWhiteSecondary)
|
|
||||||
.navigationBarHidden(true)
|
|
||||||
.navigationBarBackButtonHidden(true)
|
|
||||||
}
|
}
|
||||||
.navigationViewStyle(StackNavigationViewStyle())
|
|
||||||
.navigationBarHidden(true)
|
|
||||||
.navigationBarBackButtonHidden(true)
|
.navigationBarBackButtonHidden(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 显示用户资料弹窗
|
|
||||||
private func showUserProfile() {
|
|
||||||
withAnimation(.spring(response: 0.6, dampingFraction: 0.8)) {
|
|
||||||
// print("登录记录数量: \(login.count)")
|
|
||||||
// for (index, item) in login.enumerated() {
|
|
||||||
// print("记录 \(index + 1): 邮箱=\(item.email), 姓名=\(item.name)")
|
|
||||||
// }
|
|
||||||
print("当前登录记录:")
|
|
||||||
for (index, item) in login.enumerated() {
|
|
||||||
print("记录 \(index + 1): 邮箱=\(item.email), 姓名=\(item.name)")
|
|
||||||
}
|
|
||||||
showModal.toggle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 隐藏用户资料弹窗
|
|
||||||
private func hideUserProfile() {
|
|
||||||
withAnimation(.spring(response: 0.6, dampingFraction: 0.8)) {
|
|
||||||
showModal = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 隐藏设置页面
|
|
||||||
private func hideSettings() {
|
|
||||||
withAnimation(.spring(response: 0.6, dampingFraction: 0.8)) {
|
|
||||||
showSettings = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - 预览
|
// MARK: - 预览
|
||||||
#Preview {
|
#Preview {
|
||||||
ContentView()
|
BlindBoxView(mediaType: .video)
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TransparentVideoPlayer: UIViewRepresentable {
|
||||||
|
func makeUIView(context: Context) -> UIView {
|
||||||
|
let view = UIView()
|
||||||
|
view.backgroundColor = .clear
|
||||||
|
view.isOpaque = false
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateUIView(_ uiView: UIView, context: Context) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,6 @@ enum AppRoute: Hashable {
|
|||||||
case memories
|
case memories
|
||||||
case subscribe
|
case subscribe
|
||||||
case userInfo
|
case userInfo
|
||||||
case content
|
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
var view: some View {
|
var view: some View {
|
||||||
@ -37,8 +36,6 @@ enum AppRoute: Hashable {
|
|||||||
SubscribeView()
|
SubscribeView()
|
||||||
case .userInfo:
|
case .userInfo:
|
||||||
UserInfo()
|
UserInfo()
|
||||||
case .content:
|
|
||||||
ContentView()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,354 +0,0 @@
|
|||||||
import SwiftUI
|
|
||||||
import SwiftData
|
|
||||||
import AVKit
|
|
||||||
|
|
||||||
// MARK: - Constants
|
|
||||||
private enum MediaURLs {
|
|
||||||
static let videoURL = "https://cdn.memorywake.com/users/7363409620351717377/files/7366657553935241216/39C069E1-7C3E-4261-8486-12058F855B38.mov"
|
|
||||||
static let imageURL = "https://cdn.fairclip.cn/files/7343228671693557760/20250604-164000.jpg"
|
|
||||||
static let VideoBlindURL = "https://cdn.memorywake.com/users/7363409620351717377/files/7366658779259211776/AD970D28-9D1E-4817-A245-F11967441B8F.mp4"
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum BlindBoxAnimationPhase {
|
|
||||||
case loading
|
|
||||||
case ready
|
|
||||||
case opening
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Notification.Name {
|
|
||||||
static let navigateToMediaViewer = Notification.Name("navigateToMediaViewer")
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - 主视图
|
|
||||||
struct VisualEffectView: UIViewRepresentable {
|
|
||||||
var effect: UIVisualEffect?
|
|
||||||
|
|
||||||
func makeUIView(context: Context) -> UIVisualEffectView {
|
|
||||||
let view = UIVisualEffectView(effect: nil)
|
|
||||||
|
|
||||||
// Use a simpler approach without animator
|
|
||||||
let blurEffect = UIBlurEffect(style: .systemUltraThinMaterialLight)
|
|
||||||
|
|
||||||
// Create a custom blur effect with reduced intensity
|
|
||||||
let blurView = UIVisualEffectView(effect: blurEffect)
|
|
||||||
blurView.alpha = 0.3 // Reduce intensity
|
|
||||||
|
|
||||||
// Add a white background with low opacity for better frosted effect
|
|
||||||
let backgroundView = UIView()
|
|
||||||
backgroundView.backgroundColor = UIColor.white.withAlphaComponent(0.1)
|
|
||||||
backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
||||||
|
|
||||||
view.contentView.addSubview(backgroundView)
|
|
||||||
view.contentView.addSubview(blurView)
|
|
||||||
blurView.frame = view.bounds
|
|
||||||
blurView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
||||||
|
|
||||||
return view
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateUIView(_ uiView: UIVisualEffectView, context: Context) {
|
|
||||||
// No need to update the effect
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct AVPlayerController: UIViewControllerRepresentable {
|
|
||||||
@Binding var player: AVPlayer?
|
|
||||||
|
|
||||||
func makeUIViewController(context: Context) -> AVPlayerViewController {
|
|
||||||
let controller = AVPlayerViewController()
|
|
||||||
controller.player = player
|
|
||||||
controller.showsPlaybackControls = false
|
|
||||||
controller.videoGravity = .resizeAspect
|
|
||||||
controller.view.backgroundColor = .clear
|
|
||||||
return controller
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) {
|
|
||||||
uiViewController.player = player
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct BlindBoxView: View {
|
|
||||||
enum BlindBoxMediaType {
|
|
||||||
case video
|
|
||||||
case image
|
|
||||||
}
|
|
||||||
|
|
||||||
let mediaType: BlindBoxMediaType
|
|
||||||
@State private var showLottieAnimation = true
|
|
||||||
@State private var showScalingOverlay = false
|
|
||||||
@State private var animationPhase: BlindBoxAnimationPhase = .loading
|
|
||||||
@State private var scale: CGFloat = 0.1
|
|
||||||
@State private var videoPlayer: AVPlayer?
|
|
||||||
@State private var showControls = false
|
|
||||||
@State private var isAnimating = true
|
|
||||||
@State private var aspectRatio: CGFloat = 1.0
|
|
||||||
@State private var isPortrait: Bool = false
|
|
||||||
@State private var displayImage: UIImage?
|
|
||||||
|
|
||||||
init(mediaType: BlindBoxMediaType) {
|
|
||||||
self.mediaType = mediaType
|
|
||||||
}
|
|
||||||
|
|
||||||
private func loadMedia() {
|
|
||||||
switch mediaType {
|
|
||||||
case .video:
|
|
||||||
loadVideo()
|
|
||||||
case .image:
|
|
||||||
loadImage()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func loadImage() {
|
|
||||||
guard let url = URL(string: MediaURLs.imageURL) else { return }
|
|
||||||
URLSession.shared.dataTask(with: url) { data, _, _ in
|
|
||||||
if let data = data, let image = UIImage(data: data) {
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
self.displayImage = image
|
|
||||||
self.aspectRatio = image.size.width / image.size.height
|
|
||||||
self.isPortrait = image.size.height > image.size.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.resume()
|
|
||||||
}
|
|
||||||
|
|
||||||
private func loadVideo() {
|
|
||||||
guard let url = URL(string: MediaURLs.videoURL) else { return }
|
|
||||||
let asset = AVAsset(url: url)
|
|
||||||
let playerItem = AVPlayerItem(asset: asset)
|
|
||||||
let player = AVPlayer(playerItem: playerItem)
|
|
||||||
|
|
||||||
let videoTracks = asset.tracks(withMediaType: .video)
|
|
||||||
if let videoTrack = videoTracks.first {
|
|
||||||
let size = videoTrack.naturalSize.applying(videoTrack.preferredTransform)
|
|
||||||
let width = abs(size.width)
|
|
||||||
let height = abs(size.height)
|
|
||||||
|
|
||||||
aspectRatio = width / height
|
|
||||||
isPortrait = height > width
|
|
||||||
}
|
|
||||||
|
|
||||||
player.isMuted = true
|
|
||||||
self.videoPlayer = player
|
|
||||||
}
|
|
||||||
|
|
||||||
private func startScalingAnimation() {
|
|
||||||
self.scale = 0.1
|
|
||||||
self.showScalingOverlay = true
|
|
||||||
|
|
||||||
withAnimation(.spring(response: 2.0, dampingFraction: 0.5, blendDuration: 0.8)) {
|
|
||||||
self.scale = 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Computed Properties
|
|
||||||
private var scaledWidth: CGFloat {
|
|
||||||
if isPortrait {
|
|
||||||
return UIScreen.main.bounds.height * scale * 1/aspectRatio
|
|
||||||
} else {
|
|
||||||
return UIScreen.main.bounds.width * scale
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var scaledHeight: CGFloat {
|
|
||||||
if isPortrait {
|
|
||||||
return UIScreen.main.bounds.height * scale
|
|
||||||
} else {
|
|
||||||
return UIScreen.main.bounds.width * scale * 1/aspectRatio
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
ZStack {
|
|
||||||
Color.themeTextWhiteSecondary.ignoresSafeArea()
|
|
||||||
|
|
||||||
if showScalingOverlay {
|
|
||||||
ZStack {
|
|
||||||
VisualEffectView(effect: UIBlurEffect(style: .systemUltraThinMaterialLight))
|
|
||||||
.opacity(0.3)
|
|
||||||
.edgesIgnoringSafeArea(.all)
|
|
||||||
|
|
||||||
Group {
|
|
||||||
if mediaType == .video, let player = videoPlayer {
|
|
||||||
// Video Player
|
|
||||||
AVPlayerController(player: $videoPlayer)
|
|
||||||
.frame(width: scaledWidth, height: scaledHeight)
|
|
||||||
.opacity(scale == 1 ? 1 : 0.7)
|
|
||||||
.onAppear { player.play() }
|
|
||||||
|
|
||||||
} else if mediaType == .image, let image = displayImage {
|
|
||||||
// Image View
|
|
||||||
Image(uiImage: image)
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: scaledWidth, height: scaledHeight)
|
|
||||||
.opacity(scale == 1 ? 1 : 0.7)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onTapGesture {
|
|
||||||
withAnimation(.easeInOut(duration: 0.1)) {
|
|
||||||
showControls.toggle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回按钮
|
|
||||||
if showControls {
|
|
||||||
VStack {
|
|
||||||
HStack {
|
|
||||||
Button(action: {
|
|
||||||
// 导航到BlindOutcomeView
|
|
||||||
if mediaType == .video, let videoURL = URL(string: MediaURLs.videoURL) {
|
|
||||||
Router.shared.navigate(to: .blindOutcome(media: .video(videoURL, nil)))
|
|
||||||
} else if mediaType == .image, let image = displayImage {
|
|
||||||
Router.shared.navigate(to: .blindOutcome(media: .image(image)))
|
|
||||||
}
|
|
||||||
}) {
|
|
||||||
Image(systemName: "chevron.left.circle.fill")
|
|
||||||
.font(.system(size: 36))
|
|
||||||
.foregroundColor(.black)
|
|
||||||
.padding(12)
|
|
||||||
.clipShape(Circle())
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
||||||
.padding(.top, 50)
|
|
||||||
.padding(.leading, 20)
|
|
||||||
.zIndex(1000)
|
|
||||||
.transition(.opacity)
|
|
||||||
.onAppear {
|
|
||||||
// 2秒后显示按钮
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
|
|
||||||
withAnimation(.easeInOut(duration: 0.3)) {
|
|
||||||
showControls = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
||||||
.animation(.easeInOut(duration: 1.0), value: scale)
|
|
||||||
.ignoresSafeArea()
|
|
||||||
.onAppear {
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
|
|
||||||
withAnimation(.spring(response: 2.5, dampingFraction: 0.6, blendDuration: 1.0)) {
|
|
||||||
self.scale = 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Original content
|
|
||||||
VStack {
|
|
||||||
VStack(spacing: 20) {
|
|
||||||
// 标题
|
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
|
||||||
Text("Hi! Click And")
|
|
||||||
Text("Open Your First Box~")
|
|
||||||
}
|
|
||||||
.font(Typography.font(for: .smallLargeTitle))
|
|
||||||
.fontWeight(.bold)
|
|
||||||
.foregroundColor(Color.themeTextMessageMain)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
.padding(.horizontal)
|
|
||||||
.opacity(showScalingOverlay ? 0 : 1)
|
|
||||||
.offset(y: showScalingOverlay ? -UIScreen.main.bounds.height * 0.2 : 0)
|
|
||||||
.animation(.easeInOut(duration: 0.5), value: showScalingOverlay)
|
|
||||||
|
|
||||||
// 盲盒
|
|
||||||
ZStack {
|
|
||||||
// 1. 背景SVG
|
|
||||||
if !showScalingOverlay {
|
|
||||||
SVGImage(svgName: "BlindBoxBg")
|
|
||||||
.frame(
|
|
||||||
width: UIScreen.main.bounds.width * 1.8,
|
|
||||||
height: UIScreen.main.bounds.height * 0.85
|
|
||||||
)
|
|
||||||
.position(x: UIScreen.main.bounds.width / 2,
|
|
||||||
y: UIScreen.main.bounds.height * 0.325)
|
|
||||||
.opacity(showScalingOverlay ? 0 : 1)
|
|
||||||
.animation(.easeOut(duration: 1.5), value: showScalingOverlay)
|
|
||||||
}
|
|
||||||
if !showScalingOverlay {
|
|
||||||
VStack(spacing: 20) {
|
|
||||||
switch animationPhase {
|
|
||||||
case .loading:
|
|
||||||
GIFView(name: "BlindLoading")
|
|
||||||
.frame(width: 300, height: 300)
|
|
||||||
.onAppear {
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 6) {
|
|
||||||
withAnimation {
|
|
||||||
animationPhase = .ready
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case .ready:
|
|
||||||
ZStack {
|
|
||||||
GIFView(name: "BlindReady")
|
|
||||||
.frame(width: 300, height: 300)
|
|
||||||
|
|
||||||
// Add a transparent overlay to capture taps
|
|
||||||
Color.clear
|
|
||||||
.contentShape(Rectangle()) // Make the entire area tappable
|
|
||||||
.frame(width: 300, height: 300)
|
|
||||||
.onTapGesture {
|
|
||||||
print("点击了盲盒")
|
|
||||||
withAnimation {
|
|
||||||
animationPhase = .opening
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.frame(width: 300, height: 300)
|
|
||||||
|
|
||||||
case .opening:
|
|
||||||
GIFView(name: "BlindOpen")
|
|
||||||
.frame(width: 300, height: 300)
|
|
||||||
.onAppear {
|
|
||||||
self.loadMedia()
|
|
||||||
// Start animation after media is loaded
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
|
|
||||||
self.startScalingAnimation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.compositingGroup()
|
|
||||||
.padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.frame(
|
|
||||||
maxWidth: .infinity,
|
|
||||||
maxHeight: UIScreen.main.bounds.height * 0.65
|
|
||||||
)
|
|
||||||
.opacity(showScalingOverlay ? 0 : 1)
|
|
||||||
.animation(.easeOut(duration: 1.5), value: showScalingOverlay)
|
|
||||||
.offset(y: showScalingOverlay ? -100 : 0)
|
|
||||||
.animation(.easeInOut(duration: 1.5), value: showScalingOverlay)
|
|
||||||
}
|
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
||||||
.background(Color.themeTextWhiteSecondary)
|
|
||||||
.edgesIgnoringSafeArea(.all)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.navigationBarBackButtonHidden(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - 预览
|
|
||||||
#Preview {
|
|
||||||
BlindBoxView(mediaType: .video)
|
|
||||||
}
|
|
||||||
|
|
||||||
struct TransparentVideoPlayer: UIViewRepresentable {
|
|
||||||
func makeUIView(context: Context) -> UIView {
|
|
||||||
let view = UIView()
|
|
||||||
view.backgroundColor = .clear
|
|
||||||
view.isOpaque = false
|
|
||||||
return view
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateUIView(_ uiView: UIView, context: Context) {}
|
|
||||||
}
|
|
||||||
@ -35,7 +35,7 @@ struct JoinModal: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
Button(action: {
|
Button(action: {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
Router.shared.navigate(to: .content)
|
Router.shared.navigate(to: .blindBox(mediaType: .all))
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
Image(systemName: "xmark")
|
Image(systemName: "xmark")
|
||||||
|
|||||||
@ -32,32 +32,31 @@ struct WakeApp: App {
|
|||||||
|
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup {
|
WindowGroup {
|
||||||
NavigationStack(path: $router.path) {
|
ZStack {
|
||||||
ZStack {
|
if showSplash {
|
||||||
if showSplash {
|
// 显示启动页
|
||||||
// 显示启动页
|
SplashView()
|
||||||
SplashView()
|
.environmentObject(authState)
|
||||||
.environmentObject(authState)
|
.onAppear {
|
||||||
.onAppear {
|
// 启动页显示时检查token有效性
|
||||||
// 启动页显示时检查token有效性
|
checkTokenValidity()
|
||||||
checkTokenValidity()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 根据登录状态显示不同视图
|
|
||||||
if authState.isAuthenticated {
|
|
||||||
// 已登录:显示主页面
|
|
||||||
ContentView()
|
|
||||||
.environmentObject(authState)
|
|
||||||
} else {
|
|
||||||
// 未登录:显示登录界面
|
|
||||||
LoginView()
|
|
||||||
.environmentObject(authState)
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 根据登录状态显示不同视图
|
||||||
|
if authState.isAuthenticated {
|
||||||
|
// 已登录:显示主页面
|
||||||
|
NavigationStack(path: $router.path) {
|
||||||
|
BlindBoxView(mediaType: .all)
|
||||||
|
.navigationDestination(for: AppRoute.self) { route in
|
||||||
|
route.view
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 未登录:显示登录界面
|
||||||
|
LoginView()
|
||||||
|
.environmentObject(authState)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationDestination(for: AppRoute.self) { route in
|
|
||||||
route.view
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.environmentObject(router)
|
.environmentObject(router)
|
||||||
.environmentObject(authState)
|
.environmentObject(authState)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user