diff --git a/wake/Assets/Images/Blind.gif b/wake/Assets/Images/Blind.gif deleted file mode 100644 index 16ac098..0000000 Binary files a/wake/Assets/Images/Blind.gif and /dev/null differ diff --git a/wake/Assets/Images/Gif/BlindLoading.gif b/wake/Assets/Images/Gif/BlindLoading.gif new file mode 100644 index 0000000..f030e66 Binary files /dev/null and b/wake/Assets/Images/Gif/BlindLoading.gif differ diff --git a/wake/Assets/Images/Gif/BlindOpen.gif b/wake/Assets/Images/Gif/BlindOpen.gif new file mode 100644 index 0000000..e4533ed Binary files /dev/null and b/wake/Assets/Images/Gif/BlindOpen.gif differ diff --git a/wake/Assets/Images/Gif/BlindReady.gif b/wake/Assets/Images/Gif/BlindReady.gif new file mode 100644 index 0000000..db2a56e Binary files /dev/null and b/wake/Assets/Images/Gif/BlindReady.gif differ diff --git a/wake/Assets/Svg/Tips.svg b/wake/Assets/Svg/Tips.svg new file mode 100644 index 0000000..a591d93 --- /dev/null +++ b/wake/Assets/Svg/Tips.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/wake/ContentView.swift b/wake/ContentView.swift index 3ff2cc5..161e83c 100644 --- a/wake/ContentView.swift +++ b/wake/ContentView.swift @@ -169,7 +169,7 @@ struct ContentView: View { LoginView() } } - .padding() + .padding(.horizontal) .padding(.top, 20) // 标题 VStack(alignment: .leading, spacing: 4) { diff --git a/wake/Utils/Router.swift b/wake/Utils/Router.swift index a30bd05..0230790 100644 --- a/wake/Utils/Router.swift +++ b/wake/Utils/Router.swift @@ -11,6 +11,7 @@ enum AppRoute: Hashable { case blindOutcome(media: MediaType) case memories case subscribe + case userInfo @ViewBuilder var view: some View { @@ -33,6 +34,8 @@ enum AppRoute: Hashable { MemoriesView() case .subscribe: SubscribeView() + case .userInfo: + UserInfo() } } } diff --git a/wake/View/Blind/BlindBox.swift b/wake/View/Blind/BlindBox.swift index f3c4ab7..606d357 100644 --- a/wake/View/Blind/BlindBox.swift +++ b/wake/View/Blind/BlindBox.swift @@ -9,6 +9,12 @@ private enum MediaURLs { 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") } @@ -71,6 +77,7 @@ struct BlindBoxView: View { 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 @@ -263,20 +270,49 @@ struct BlindBoxView: View { .opacity(showScalingOverlay ? 0 : 1) .animation(.easeOut(duration: 1.5), value: showScalingOverlay) } - if !showScalingOverlay { VStack(spacing: 20) { - let player = AVPlayer(url: URL(string: MediaURLs.VideoBlindURL)!) - VideoPlayer(player: player) - .background(TransparentVideoPlayer()) + 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) - .onAppear { - player.play() - player.isMuted = true - } - .onDisappear { - player.pause() - } + + 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() @@ -298,13 +334,6 @@ struct BlindBoxView: View { } } .navigationBarBackButtonHidden(true) - .onAppear { - self.loadMedia() - // Start animation after media is loaded - DispatchQueue.main.asyncAfter(deadline: .now() + 5) { - self.startScalingAnimation() - } - } } } diff --git a/wake/View/Login/Login.swift b/wake/View/Login/Login.swift index e23c732..276b154 100644 --- a/wake/View/Login/Login.swift +++ b/wake/View/Login/Login.swift @@ -61,11 +61,6 @@ struct LoginView: View { } .navigationBarBackButtonHidden(true) .navigationBarHidden(true) - .fullScreenCover(isPresented: $isLoggedIn) { - NavigationStack { - UserInfo() - } - } } // MARK: - Views @@ -264,6 +259,8 @@ struct LoginView: View { self.errorMessage = "登录信息不完整,请重试" self.showError = true } + // 跳转到userinfo + Router.shared.navigate(to: .userInfo) case .failure(let error): print("❌ [15] 后端认证失败") diff --git a/wake/View/Owner/UserInfo/UserInfo.swift b/wake/View/Owner/UserInfo/UserInfo.swift index af54e66..f9f63da 100644 --- a/wake/View/Owner/UserInfo/UserInfo.swift +++ b/wake/View/Owner/UserInfo/UserInfo.swift @@ -61,28 +61,23 @@ struct UserInfo: View { .background(Color.themeTextWhiteSecondary) .zIndex(1) // 确保导航栏在最上层 // Dynamic text that changes based on keyboard state - HStack(spacing: 20) { + HStack(spacing: 6) { + SVGImage(svgName: "Tips") + .frame(width: 16, height: 16) + .padding(.leading,6) Text("Choose a photo as your avatar, and we'll generate a video mystery box for you.") .font(Typography.font(for: .caption)) .foregroundColor(.black) .frame(maxWidth: .infinity, alignment: .leading) - .lineLimit(isKeyboardVisible ? 1 : 2) - .padding(6) - .background( - LinearGradient( - gradient: Gradient(colors: [ - Color(red: 1.0, green: 0.97, blue: 0.87), - .white, - Color(red: 1.0, green: 0.97, blue: 0.84) - ]), - startPoint: .topLeading, - endPoint: .bottomTrailing - ) - ) + .padding(3) } - .padding(10) .animation(.easeInOut(duration: 0.3), value: isKeyboardVisible) .transition(.opacity) + .background( + Color.themeTextWhite + .cornerRadius(12) + ) + .padding(10) // 可滚动的内容区域 GeometryReader { geometry in @@ -141,7 +136,6 @@ struct UserInfo: View { // Continue Button Button(action: { - Router.shared.navigate(to: .blindBox(mediaType: .image)) if showUsername { let parameters: [String: Any] = [ "username": userName, diff --git a/wake/View/Upload/MediaUploadView.swift b/wake/View/Upload/MediaUploadView.swift index 3bedbfd..633e2e5 100644 --- a/wake/View/Upload/MediaUploadView.swift +++ b/wake/View/Upload/MediaUploadView.swift @@ -82,33 +82,28 @@ struct MediaUploadView: View { .padding(.trailing, 16) } .background(Color.themeTextWhiteSecondary) - .padding(.horizontal) + // .padding(.horizontal) .zIndex(1) // 确保导航栏显示在最上层 } /// 上传提示视图 private var uploadHintView: some View { - HStack { + HStack (spacing: 6) { + SVGImage(svgName: "Tips") + .frame(width: 16, height: 16) + .padding(.leading,6) Text("The upload process will take approximately 2 minutes. Thank you for your patience.") .font(.caption) .foregroundColor(.black) .frame(maxWidth: .infinity, alignment: .leading) .padding(3) - .background( - LinearGradient( - gradient: Gradient(colors: [ - Color(red: 1.0, green: 0.97, blue: 0.87), - .white, - Color(red: 1.0, green: 0.97, blue: 0.84) - ]), - startPoint: .topLeading, - endPoint: .bottomTrailing - ) - .cornerRadius(8) - ) - .padding(.horizontal) } + .background( + Color.themeTextWhite + .cornerRadius(6) + ) .padding(.vertical, 8) + .padding(.horizontal) } /// 继续按钮 diff --git a/wake/WakeApp.swift b/wake/WakeApp.swift index 5f77c43..894aea3 100644 --- a/wake/WakeApp.swift +++ b/wake/WakeApp.swift @@ -46,10 +46,10 @@ struct WakeApp: App { // 根据登录状态显示不同视图 if authState.isAuthenticated { // 已登录:显示userInfo页面 + LoginView() + .environmentObject(authState) // ContentView() // .environmentObject(authState) - ContentView() - .environmentObject(authState) } else { // 未登录:显示登录界面 LoginView()