WIP
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
import WatchConnectivity
|
||||
import AVFoundation
|
||||
|
||||
enum WatchActions: Codable {
|
||||
case nextExercise
|
||||
@@ -125,6 +126,14 @@ class BridgeModule: NSObject, ObservableObject {
|
||||
let watchModel = WatchPackageModel(currentExerciseName: currentExercise?.exercise.name ?? "-", currentTimeLeft: currentExerciseTimeLeft, workoutStartDate: workoutStartDate ?? Date())
|
||||
let data = try! JSONEncoder().encode(watchModel)
|
||||
send(data)
|
||||
|
||||
if currentExerciseTimeLeft == 0 {
|
||||
playFinished()
|
||||
} else {
|
||||
if currentExerciseTimeLeft < 4 {
|
||||
playBeep()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nextExercise()
|
||||
}
|
||||
@@ -166,6 +175,18 @@ class BridgeModule: NSObject, ObservableObject {
|
||||
completedWorkout?()
|
||||
}
|
||||
}
|
||||
|
||||
func playBeep() {
|
||||
#if os(iOS)
|
||||
AudioServicesPlaySystemSound(SystemSoundID(1052))
|
||||
#endif
|
||||
}
|
||||
|
||||
func playFinished() {
|
||||
#if os(iOS)
|
||||
AudioServicesPlaySystemSound(SystemSoundID(1070))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
extension BridgeModule: WCSessionDelegate {
|
||||
|
||||
Reference in New Issue
Block a user