This commit is contained in:
Trey t
2023-07-13 22:39:44 -05:00
parent 59dc0bbc4c
commit 93b8d674b4
13 changed files with 205 additions and 103 deletions

View File

@@ -26,22 +26,33 @@ struct ExerciseElement: Codable, Equatable {
}
extension ExerciseElement {
func videoURL(nsfw: Bool) -> URL? {
var _url: URL?
func videoURL(thotStyle: ThotStyle) -> URL? {
var urlString: String?
if nsfw {
let viddd = exercise.nsfwVideoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
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
}
} else {
let viddd = exercise.videoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
case .random:
if Bool.random() {
urlString = exercise.nsfwVideoURL
} else {
urlString = exercise.videoURL
}
}
return _url
if let urlString = urlString,
let url = URL(string: BaseURLs.currentBaseURL + urlString) {
return url
}
return nil
}
}
@@ -84,21 +95,32 @@ struct ExerciseExercise: Codable, Hashable, Identifiable {
}
extension ExerciseExercise {
func videoURL(nsfw: Bool) -> URL? {
var _url: URL?
func videoURL(thotStyle: ThotStyle) -> URL? {
var urlString: String?
if nsfw {
let viddd = nsfwVideoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
switch thotStyle {
case .always:
urlString = nsfwVideoURL
case .never:
urlString = videoURL
case .recovery:
if self.name.lowercased() == "recovery" {
urlString = nsfwVideoURL
} else {
urlString = videoURL
}
} else {
let viddd = videoURL
if let url = URL(string: BaseURLs.currentBaseURL + viddd) {
_url = url
case .random:
if Bool.random() {
urlString = nsfwVideoURL
} else {
urlString = videoURL
}
}
return _url
if let urlString = urlString,
let url = URL(string: BaseURLs.currentBaseURL + urlString) {
return url
}
return nil
}
}