From 4d10fe4ac9e20d1c9108d419c57ac511ce70095f Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 15 Feb 2023 12:02:03 +0100 Subject: [PATCH] Fixes --- LeCountdown/Sound/SoundPlayer.swift | 2 +- LeCountdown/Views/ContentView.swift | 7 ++++++- LeCountdown/Views/Countdown/CountdownFormView.swift | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/LeCountdown/Sound/SoundPlayer.swift b/LeCountdown/Sound/SoundPlayer.swift index 0eee38d..1751c61 100644 --- a/LeCountdown/Sound/SoundPlayer.swift +++ b/LeCountdown/Sound/SoundPlayer.swift @@ -49,7 +49,7 @@ enum SoundPlayerError : Error { _player = try AVAudioPlayer(contentsOf: url) _player?.prepareToPlay() // let loopCount = repeats ? Int.max : 0 - _player?.numberOfLoops = 0 //loopCount +// _player?.numberOfLoops = 0 //loopCount _player?.volume = 1.0 _player?.delegate = self diff --git a/LeCountdown/Views/ContentView.swift b/LeCountdown/Views/ContentView.swift index bb690b9..e8bf6d2 100644 --- a/LeCountdown/Views/ContentView.swift +++ b/LeCountdown/Views/ContentView.swift @@ -158,6 +158,11 @@ struct ContentView: View { .sheet(isPresented: $boringContext.isShowingNewData, content: { self._newView(isPresented: $boringContext.isShowingNewData) .environment(\.managedObjectContext, viewContext) + .onDisappear { + withAnimation { + self._buildItemsList() + } + } }) .toolbar { ToolbarItem(placement: .navigationBarTrailing) { @@ -255,7 +260,7 @@ struct ContentView: View { } fileprivate func _askPermissions() { - UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { success, error in + UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .criticalAlert]) { success, error in print("requestAuthorization > success = \(success), error = \(String(describing: error))") } } diff --git a/LeCountdown/Views/Countdown/CountdownFormView.swift b/LeCountdown/Views/Countdown/CountdownFormView.swift index 07609c8..1e7e103 100644 --- a/LeCountdown/Views/Countdown/CountdownFormView.swift +++ b/LeCountdown/Views/Countdown/CountdownFormView.swift @@ -7,7 +7,6 @@ import SwiftUI - struct CountdownFormView : View { @EnvironmentObject var model: TimerModel