WIP
This commit is contained in:
40
Werkout_ios/APIModels/AudioQueue.swift
Normal file
40
Werkout_ios/APIModels/AudioQueue.swift
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// AudioQueue.swift
|
||||
// Werkout_ios
|
||||
//
|
||||
// Created by Trey Tartt on 8/12/23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum AudioType {
|
||||
case shortBeep
|
||||
case finishBeep
|
||||
case remoteURL(URL)
|
||||
}
|
||||
|
||||
struct AudioQueue: Codable, Identifiable, Equatable {
|
||||
var id = UUID()
|
||||
|
||||
let playAt: Int
|
||||
let audioURL: String
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case playAt = "play_at"
|
||||
case audioURL = "audio_url"
|
||||
}
|
||||
|
||||
var audioType: AudioType {
|
||||
if audioURL == "short_beep" {
|
||||
return .shortBeep
|
||||
} else if audioURL == "long_beep" {
|
||||
return .finishBeep
|
||||
} else {
|
||||
if let url = URL(string: BaseURLs.currentBaseURL + "/media/" + audioURL) {
|
||||
return .remoteURL(url)
|
||||
} else {
|
||||
return .shortBeep
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ struct SupersetExercise: Identifiable, Codable, Equatable, Hashable {
|
||||
let order, superset: Int?
|
||||
let uniqueID: String?
|
||||
let description: String?
|
||||
let audioQueues: [AudioQueue]?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case workout, exercise, weight, reps, duration, order, superset, id, description
|
||||
@@ -28,6 +29,7 @@ struct SupersetExercise: Identifiable, Codable, Equatable, Hashable {
|
||||
case weightAudio = "weight_audio"
|
||||
case createdAt = "created_at"
|
||||
case uniqueID = "unique_id"
|
||||
case audioQueues = "audio_queues"
|
||||
}
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
@@ -49,7 +51,7 @@ struct Exercise: Identifiable, Codable, Equatable {
|
||||
let isDistance, isDuration, isReps: Bool
|
||||
let jointsUsed, movementPatterns, equipmentRequired, muscleGroups: String
|
||||
let synonyms: String?
|
||||
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id, muscles, equipment
|
||||
case audioURL = "audio_url"
|
||||
|
||||
Reference in New Issue
Block a user