Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
a88a02b671
commit
403eeb620f
@ -13,7 +13,6 @@ struct ClockView: View {
|
|||||||
|
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@Bindable var viewModel: ClockViewModel
|
@Bindable var viewModel: ClockViewModel
|
||||||
@State private var showFullScreenHint = false
|
|
||||||
@State private var idleTimer: Timer?
|
@State private var idleTimer: Timer?
|
||||||
@State private var didHandleTouch = false
|
@State private var didHandleTouch = false
|
||||||
|
|
||||||
@ -35,21 +34,11 @@ struct ClockView: View {
|
|||||||
// Top overlay container
|
// Top overlay container
|
||||||
ClockOverlayContainer(style: viewModel.style)
|
ClockOverlayContainer(style: viewModel.style)
|
||||||
|
|
||||||
// Full screen hint overlay
|
|
||||||
if showFullScreenHint {
|
|
||||||
FullScreenHintView(isDisplayMode: viewModel.isDisplayMode)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.ignoresSafeArea(.all, edges: viewModel.isDisplayMode ? .bottom : [])
|
.ignoresSafeArea()
|
||||||
.statusBarHidden(viewModel.isDisplayMode)
|
.toolbar(.hidden, for: .navigationBar)
|
||||||
.overlay {
|
|
||||||
// Toolbar overlay
|
|
||||||
ClockToolbar(
|
|
||||||
isDisplayMode: viewModel.isDisplayMode
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.overlay {
|
.overlay {
|
||||||
// Tab bar management overlay
|
// Tab bar management overlay
|
||||||
ClockTabBarManager(isDisplayMode: viewModel.isDisplayMode)
|
ClockTabBarManager(isDisplayMode: viewModel.isDisplayMode)
|
||||||
@ -95,15 +84,11 @@ struct ClockView: View {
|
|||||||
private func enterDisplayModeFromIdle() {
|
private func enterDisplayModeFromIdle() {
|
||||||
guard !viewModel.isDisplayMode else { return }
|
guard !viewModel.isDisplayMode else { return }
|
||||||
viewModel.toggleDisplayMode()
|
viewModel.toggleDisplayMode()
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
|
||||||
showFullScreenHint = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleUserInteraction() {
|
private func handleUserInteraction() {
|
||||||
if viewModel.isDisplayMode {
|
if viewModel.isDisplayMode {
|
||||||
viewModel.toggleDisplayMode()
|
viewModel.toggleDisplayMode()
|
||||||
showFullScreenHint = false
|
|
||||||
}
|
}
|
||||||
resetIdleTimer()
|
resetIdleTimer()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,73 +0,0 @@
|
|||||||
//
|
|
||||||
// FullScreenHintView.swift
|
|
||||||
// TheNoiseClock
|
|
||||||
//
|
|
||||||
// Created by Matt Bruce on 9/10/25.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
/// Component that shows a subtle hint for how to exit full-screen mode
|
|
||||||
struct FullScreenHintView: View {
|
|
||||||
|
|
||||||
// MARK: - Properties
|
|
||||||
let isDisplayMode: Bool
|
|
||||||
@State private var hintOpacity: Double = 0.0
|
|
||||||
|
|
||||||
// MARK: - Body
|
|
||||||
var body: some View {
|
|
||||||
if isDisplayMode {
|
|
||||||
VStack {
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
HStack {
|
|
||||||
Image(systemName: "hand.point.up.left")
|
|
||||||
.font(.title2)
|
|
||||||
.foregroundColor(.white.opacity(0.7))
|
|
||||||
|
|
||||||
Text("Long press to exit full screen")
|
|
||||||
.font(.headline)
|
|
||||||
.foregroundColor(.white.opacity(0.7))
|
|
||||||
|
|
||||||
Image(systemName: "hand.point.up.left")
|
|
||||||
.font(.title2)
|
|
||||||
.foregroundColor(.white.opacity(0.7))
|
|
||||||
}
|
|
||||||
.padding(.horizontal, 20)
|
|
||||||
.padding(.vertical, 12)
|
|
||||||
.background(
|
|
||||||
RoundedRectangle(cornerRadius: 20)
|
|
||||||
.fill(.black.opacity(0.6))
|
|
||||||
.blur(radius: 1)
|
|
||||||
)
|
|
||||||
.opacity(hintOpacity)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
.frame(height: 100) // Space above tab bar area
|
|
||||||
}
|
|
||||||
.transition(.opacity.combined(with: .scale(scale: 0.9)))
|
|
||||||
.onAppear {
|
|
||||||
withAnimation(.easeInOut(duration: 0.5)) {
|
|
||||||
hintOpacity = 1.0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auto-hide after 3 seconds
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
|
|
||||||
withAnimation(.easeInOut(duration: 0.5)) {
|
|
||||||
hintOpacity = 0.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Preview
|
|
||||||
#Preview {
|
|
||||||
ZStack {
|
|
||||||
Color.black.ignoresSafeArea()
|
|
||||||
|
|
||||||
FullScreenHintView(isDisplayMode: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user