This commit is contained in:
Trey t
2023-08-12 13:41:53 -05:00
parent 4824fbc0fe
commit 2aa83f12f2
6 changed files with 89 additions and 6 deletions

View 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
}
}
}
}