jel/Jel/JelApp.swift

35 lines
1.0 KiB
Swift
Raw Normal View History

2023-12-11 19:27:48 +00:00
//
// JelApp.swift
// Jel
//
// Created by zerocool on 12/11/23.
//
import SwiftUI
@main
struct JelApp: App {
2023-12-12 06:22:43 +00:00
let datamodelController = DatamodelController.shared
2023-12-12 22:09:15 +00:00
let jellyfinClientController = JellyfinClientController(authHeaders: AuthHeaders(
Client: "Jel",
Device: UIDevice.current.systemName,
DeviceId: UIDevice.current.identifierForVendor!.uuidString,
Version: Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "0.0.0",
Token: ""))
2023-12-12 06:22:43 +00:00
var body: some Scene {
WindowGroup {
2023-12-15 15:41:00 +00:00
ContentView()
2023-12-12 06:22:43 +00:00
.environment(\.managedObjectContext,
datamodelController.container.viewContext)
2023-12-12 22:09:15 +00:00
.environmentObject(jellyfinClientController)
2023-12-12 06:22:43 +00:00
.task {
2023-12-15 15:41:00 +00:00
AuthStateController.shared.load()
SettingsController.shared.load()
jellyfinClientController.setUrl(url: AuthStateController.shared.serverUrl)
jellyfinClientController.setToken(token: AuthStateController.shared.authToken ?? "")
2023-12-11 19:27:48 +00:00
}
}
2023-12-12 06:22:43 +00:00
}
2023-12-11 19:27:48 +00:00
}