jel/Jel/JelApp.swift

35 lines
1.0 KiB
Swift

//
// JelApp.swift
// Jel
//
// Created by zerocool on 12/11/23.
//
import SwiftUI
@main
struct JelApp: App {
let datamodelController = DatamodelController.shared
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: ""))
var body: some Scene {
WindowGroup {
ContentView()
.environment(\.managedObjectContext,
datamodelController.container.viewContext)
.environmentObject(jellyfinClientController)
.task {
AuthStateController.shared.load()
SettingsController.shared.load()
jellyfinClientController.setUrl(url: AuthStateController.shared.serverUrl)
jellyfinClientController.setToken(token: AuthStateController.shared.authToken ?? "")
}
}
}
}