add apple tv app

This commit is contained in:
Trey t
2024-06-18 12:03:56 -05:00
parent addeca4ead
commit 7d2b6b3e6e
134 changed files with 869 additions and 37 deletions

View File

@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,17 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
]
}

View File

@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,17 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
]
}

View File

@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,32 @@
{
"assets" : [
{
"filename" : "App Icon - App Store.imagestack",
"idiom" : "tv",
"role" : "primary-app-icon",
"size" : "1280x768"
},
{
"filename" : "App Icon.imagestack",
"idiom" : "tv",
"role" : "primary-app-icon",
"size" : "400x240"
},
{
"filename" : "Top Shelf Image Wide.imageset",
"idiom" : "tv",
"role" : "top-shelf-image-wide",
"size" : "2320x720"
},
{
"filename" : "Top Shelf Image.imageset",
"idiom" : "tv",
"role" : "top-shelf-image",
"size" : "1920x720"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,85 @@
//
// ContentView.swift
// WekoutThotViewer
//
// Created by Trey Tartt on 6/18/24.
//
import SwiftUI
import AVKit
import Combine
struct ContentView: View {
@State public var needsUpdating: Bool = true
@State var isUpdating = false
@ObservedObject var dataStore = DataStore.shared
@State var nsfwVideos: [NSFWVideo]?
@State var avPlayer = AVPlayer(url: URL(string: "https://dev.werkout.fitness/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4")!)
let videoEnded = NotificationCenter.default.publisher(for: NSNotification.Name.AVPlayerItemDidPlayToEndTime)
var body: some View {
VStack {
if isUpdating {
if isUpdating {
ProgressView()
.progressViewStyle(.circular)
}
} else {
PlayerView(player: $avPlayer)
.onAppear{
avPlayer.play()
}
.onReceive(videoEnded){ _ in
playRandomVideo()
}
}
}
.onAppear(perform: {
maybeUpdateShit()
})
}
func playRandomVideo() {
if let video = nsfwVideos?.randomElement() {
playVideo(url: video.videoFile)
}
}
func playVideo(url: String) {
let url = URL(string: BaseURLs.currentBaseURL + url)
avPlayer = AVPlayer(url: url!)
avPlayer.play()
}
func maybeUpdateShit() {
UserStore.shared.setTreyDevRegisterdUser()
if UserStore.shared.token != nil{
if UserStore.shared.plannedWorkouts.isEmpty {
UserStore.shared.fetchPlannedWorkouts()
}
if needsUpdating {
self.isUpdating = true
dataStore.fetchAllData(completion: {
DispatchQueue.main.async {
guard let allNSFWVideos = dataStore.allNSFWVideos else {
return
}
self.nsfwVideos = allNSFWVideos
self.isUpdating = false
playRandomVideo()
}
self.isUpdating = false
})
}
}
}
}
#Preview {
ContentView()
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,31 @@
//
// RegisteredUser.swift
// WekoutThotViewer
//
// Created by Trey Tartt on 6/18/24.
//
import Foundation
struct RegisteredUser: Codable, Hashable {
let id: Int
let firstName, lastName, image: String?
let nickName: String?
let token: String?
let email: String?
let hasNSFWToggle: Bool?
enum CodingKeys: String, CodingKey {
case id
case firstName = "first_name"
case lastName = "last_name"
case image, token
case email = "email_address"
case nickName = "nick_name"
case hasNSFWToggle = "has_nsfw_toggle"
}
var NSFWValue: Bool {
return hasNSFWToggle ?? false
}
}

View File

@@ -0,0 +1,17 @@
//
// WekoutThotViewerApp.swift
// WekoutThotViewer
//
// Created by Trey Tartt on 6/18/24.
//
import SwiftUI
@main
struct WekoutThotViewerApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}