WIP
This commit is contained in:
@@ -25,52 +25,6 @@ struct ExerciseElement: Codable, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ExerciseElement {
|
||||
func videoURL(thotStyle: ThotStyle) -> URL? {
|
||||
var urlString: String?
|
||||
|
||||
switch thotStyle {
|
||||
case .always:
|
||||
urlString = exercise.nsfwVideoURL
|
||||
case .never:
|
||||
urlString = exercise.videoURL
|
||||
case .recovery:
|
||||
if self.exercise.name.lowercased() == "recover" {
|
||||
urlString = exercise.nsfwVideoURL
|
||||
} else {
|
||||
urlString = exercise.videoURL
|
||||
}
|
||||
case .random:
|
||||
if Bool.random() {
|
||||
urlString = exercise.nsfwVideoURL
|
||||
} else {
|
||||
urlString = exercise.videoURL
|
||||
}
|
||||
}
|
||||
|
||||
if let urlString = urlString,
|
||||
let url = URL(string: BaseURLs.currentBaseURL + urlString) {
|
||||
return url
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func returnOtherVideoURL(currentURL: URL) -> URL? {
|
||||
var urlString: String?
|
||||
if currentURL.absoluteString.lowercased().contains(exercise.nsfwVideoURL.lowercased()) {
|
||||
urlString = exercise.videoURL
|
||||
} else {
|
||||
urlString = exercise.nsfwVideoURL
|
||||
}
|
||||
|
||||
if let urlString = urlString,
|
||||
let url = URL(string: BaseURLs.currentBaseURL + urlString) {
|
||||
return url
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
struct ExerciseExercise: Codable, Hashable, Identifiable {
|
||||
static func == (lhs: ExerciseExercise, rhs: ExerciseExercise) -> Bool {
|
||||
lhs.id == rhs.id
|
||||
@@ -79,7 +33,7 @@ struct ExerciseExercise: Codable, Hashable, Identifiable {
|
||||
let id: Int
|
||||
let muscles: [ExerciseMuscle]
|
||||
let equipment: [ExerciseEquipment]
|
||||
let audioURL, videoURL, createdAt, updatedAt, nsfwVideoURL: String
|
||||
let audioURL, videoURL, createdAt, updatedAt: String
|
||||
let name, description, side: String
|
||||
let isTwoDumbbells, isTrackableDistance, isAlternating, isWeight: Bool
|
||||
let isDistance, isDuration, isReps: Bool
|
||||
@@ -105,52 +59,5 @@ struct ExerciseExercise: Codable, Hashable, Identifiable {
|
||||
case equipmentRequired = "equipment_required"
|
||||
case muscleGroups = "muscle_groups"
|
||||
case synonyms
|
||||
case nsfwVideoURL = "nsfw_video_url"
|
||||
}
|
||||
}
|
||||
|
||||
extension ExerciseExercise {
|
||||
func videoURL(thotStyle: ThotStyle) -> URL? {
|
||||
var urlString: String?
|
||||
|
||||
switch thotStyle {
|
||||
case .always:
|
||||
urlString = nsfwVideoURL
|
||||
case .never:
|
||||
urlString = videoURL
|
||||
case .recovery:
|
||||
if self.name.lowercased() == "recovery" {
|
||||
urlString = nsfwVideoURL
|
||||
} else {
|
||||
urlString = videoURL
|
||||
}
|
||||
case .random:
|
||||
if Bool.random() {
|
||||
urlString = nsfwVideoURL
|
||||
} else {
|
||||
urlString = videoURL
|
||||
}
|
||||
}
|
||||
|
||||
if let urlString = urlString,
|
||||
let url = URL(string: BaseURLs.currentBaseURL + urlString) {
|
||||
return url
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func returnOtherVideoURL(currentURL: URL) -> URL? {
|
||||
var urlString: String?
|
||||
if currentURL.absoluteString.lowercased().contains(nsfwVideoURL.lowercased()) {
|
||||
urlString = videoURL
|
||||
} else {
|
||||
urlString = nsfwVideoURL
|
||||
}
|
||||
|
||||
if let urlString = urlString,
|
||||
let url = URL(string: BaseURLs.currentBaseURL + urlString) {
|
||||
return url
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user