main
Laurent 3 years ago
parent ded4d7b32d
commit 74691184dc
  1. 4
      LeCountdown.xcodeproj/project.pbxproj
  2. 39
      LeCountdown/Views/LiveTimerListView.swift
  3. 26
      LeCountdown/Views/Reusable/BackgroundBlurView.swift

@ -38,6 +38,7 @@
C415D3F729C378D10037B215 /* QP01 0037 Tropical forest morning.wav in Resources */ = {isa = PBXBuildFile; fileRef = C415D3F629C378D10037B215 /* QP01 0037 Tropical forest morning.wav */; };
C415D3FB29C37A460037B215 /* QP01 0096 Wetland lake early morning.wav in Resources */ = {isa = PBXBuildFile; fileRef = C415D3FA29C37A460037B215 /* QP01 0096 Wetland lake early morning.wav */; };
C415D3FD29C37AA40037B215 /* QP01 0118 Riparian Zone thrush.wav in Resources */ = {isa = PBXBuildFile; fileRef = C415D3FC29C37AA40037B215 /* QP01 0118 Riparian Zone thrush.wav */; };
C42E96FB29E59E72005B1B8C /* BackgroundBlurView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C42E96FA29E59E72005B1B8C /* BackgroundBlurView.swift */; };
C438C7C12980228B00BF3EF9 /* CountdownScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C438C7C02980228B00BF3EF9 /* CountdownScheduler.swift */; };
C438C7C5298024E900BF3EF9 /* NSManagedContext+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C438C7C4298024E900BF3EF9 /* NSManagedContext+Extensions.swift */; };
C438C7C929803CA000BF3EF9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C438C7C829803CA000BF3EF9 /* AppDelegate.swift */; };
@ -361,6 +362,7 @@
C415D3FA29C37A460037B215 /* QP01 0096 Wetland lake early morning.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = "QP01 0096 Wetland lake early morning.wav"; sourceTree = "<group>"; };
C415D3FC29C37AA40037B215 /* QP01 0118 Riparian Zone thrush.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = "QP01 0118 Riparian Zone thrush.wav"; sourceTree = "<group>"; };
C418A14F298428CB00C22230 /* LeCountdown.0.1.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = LeCountdown.0.1.xcdatamodel; sourceTree = "<group>"; };
C42E96FA29E59E72005B1B8C /* BackgroundBlurView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundBlurView.swift; sourceTree = "<group>"; };
C438C7C02980228B00BF3EF9 /* CountdownScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CountdownScheduler.swift; sourceTree = "<group>"; };
C438C7C4298024E900BF3EF9 /* NSManagedContext+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSManagedContext+Extensions.swift"; sourceTree = "<group>"; };
C438C7C829803CA000BF3EF9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -916,6 +918,7 @@
C4F8B1D3298BF686005C86A5 /* Reusable */ = {
isa = PBXGroup;
children = (
C42E96FA29E59E72005B1B8C /* BackgroundBlurView.swift */,
C498E5A4299152B400E90DE0 /* GreenCheckmarkView.swift */,
C4742B5A298414B000D5D950 /* ImageSelectionView.swift */,
C415D3E129C0C0C20037B215 /* MailView.swift */,
@ -1187,6 +1190,7 @@
C4F8B1D2298BF646005C86A5 /* PermissionAlertView.swift in Sources */,
C4BA2B7329A60CF000CB4FBA /* Shortcut.swift in Sources */,
C4060DC9297AE73D003FAB80 /* Persistence.swift in Sources */,
C42E96FB29E59E72005B1B8C /* BackgroundBlurView.swift in Sources */,
C4BA2B36299F82FB00CB4FBA /* Fakes.swift in Sources */,
C4556F7629E411A400DEB40B /* LogsView.swift in Sources */,
C498E5A1298D543900E90DE0 /* LiveTimer.swift in Sources */,

@ -222,44 +222,28 @@ struct LiveCountdownView: View {
self._cancelCountdown()
self.showConfirmationPopup = false
}
.monospaced()
.padding()
.foregroundColor(.white)
.background(Color.accentColor)
.cornerRadius(8.0)
.font(.title)
// Button {
// self._actionHandler()
// self.showConfirmationPopup = false
// } label: {
// Image(systemName: "xmark.circle")
// .font(.system(size: 48.0)).foregroundColor(.accentColor)
// }
}.onTapGesture {
self.showConfirmationPopup = false
}
.background(BackgroundBlurView())
// VStack {
// Button {
// self._actionHandler()
// self.showConfirmationPopup = false
// } label: {
// Image(systemName: "xmark.circle")
// .font(.title).foregroundColor(.accentColor)
// }
// }.background(BlurView())
}
}
fileprivate func _actionHandler() {
FileLogger.log("countdown _actionHandler")
if Conductor.maestro.currentCountdowns[self.countdown.stringId] != nil {
self._cancelCountdown()
} else {
self._dismiss()
}
if Conductor.maestro.currentCountdowns[self.countdown.stringId] != nil {
self._cancelCountdown()
} else {
self._dismiss()
}
}
fileprivate func _dismiss() {
@ -280,21 +264,10 @@ struct LiveCountdownView: View {
}
}
struct BackgroundBlurView: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
let view = UIVisualEffectView(effect: UIBlurEffect(style: .light))
DispatchQueue.main.async {
view.superview?.superview?.backgroundColor = .clear
}
return view
}
func updateUIView(_ uiView: UIView, context: Context) {}
}
struct LiveTimerView_Previews: PreviewProvider {
static var previews: some View {
// LiveTimerListView().environmentObject(Conductor.maestro)
Group {
VStack(spacing: 20.0) {

@ -0,0 +1,26 @@
//
// BackgroundBlurView.swift
// LeCountdown
//
// Created by Laurent Morvillier on 11/04/2023.
//
import SwiftUI
struct BackgroundBlurView: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
let view = UIVisualEffectView(effect: UIBlurEffect(style: .light))
DispatchQueue.main.async {
view.superview?.superview?.backgroundColor = .clear
}
return view
}
func updateUIView(_ uiView: UIView, context: Context) {}
}
struct BackgroundBlurView_Previews: PreviewProvider {
static var previews: some View {
BackgroundBlurView()
}
}
Loading…
Cancel
Save