From 9db0f353f78dc9b86b7cb24d2bcb710bd3aa55d8 Mon Sep 17 00:00:00 2001 From: cranci1 <100066266+cranci1@users.noreply.github.com> Date: Thu, 7 Aug 2025 09:49:34 +0200 Subject: [PATCH] crash fixes? --- Sora/SoraApp.swift | 31 +++++++++---------- .../Extensions/UserDefaults.swift | 2 +- Sora/Utlis & Misc/TabBar/TabBar.swift | 3 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Sora/SoraApp.swift b/Sora/SoraApp.swift index 80ebdd2..6a4bdb3 100644 --- a/Sora/SoraApp.swift +++ b/Sora/SoraApp.swift @@ -19,22 +19,6 @@ struct SoraApp: App { if let userAccentColor = UserDefaults.standard.color(forKey: "accentColor") { UIView.appearance(whenContainedInInstancesOf: [UIAlertController.self]).tintColor = userAccentColor } - - Task { - await Self.clearTmpFolder() - - await MainActor.run { - jsController.initializeDownloadSession() - } - - TraktToken.checkAuthenticationStatus { isAuthenticated in - if isAuthenticated { - Logger.shared.log("Trakt authentication is valid", type: "Debug") - } else { - Logger.shared.log("Trakt authentication required", type: "Debug") - } - } - } } var body: some Scene { @@ -60,6 +44,21 @@ struct SoraApp: App { await moduleManager.refreshModules() } } + + Task { + await Self.clearTmpFolder() + await MainActor.run { + jsController.initializeDownloadSession() + } + + TraktToken.checkAuthenticationStatus { isAuthenticated in + if isAuthenticated { + Logger.shared.log("Trakt authentication is valid", type: "Debug") + } else { + Logger.shared.log("Trakt authentication required", type: "Debug") + } + } + } } .onOpenURL { url in handleURL(url) diff --git a/Sora/Utlis & Misc/Extensions/UserDefaults.swift b/Sora/Utlis & Misc/Extensions/UserDefaults.swift index 86cb388..7426e2b 100644 --- a/Sora/Utlis & Misc/Extensions/UserDefaults.swift +++ b/Sora/Utlis & Misc/Extensions/UserDefaults.swift @@ -30,7 +30,7 @@ enum VideoQualityPreference: String, CaseIterable { } } - let preferredIndex = qualityPriority.firstIndex(of: preferred) ?? qualityPriority.count + _ = qualityPriority.firstIndex(of: preferred) ?? qualityPriority.count for i in 0..