From b9177e89c64324c5085813c08cb9dc74d954816a Mon Sep 17 00:00:00 2001 From: Fabian Thies Date: Fri, 13 Jan 2023 13:37:38 +0100 Subject: [PATCH] [FIX] Issues introduced by changes to the AltSource specification. --- AltStore/Manager/NotificationManager.swift | 6 +++-- AltStore/Views/App Detail/AppDetailView.swift | 22 +++++++++++-------- AltStore/Views/My Apps/MyAppsView.swift | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/AltStore/Manager/NotificationManager.swift b/AltStore/Manager/NotificationManager.swift index 30ae6068..af6d1e8a 100644 --- a/AltStore/Manager/NotificationManager.swift +++ b/AltStore/Manager/NotificationManager.swift @@ -64,11 +64,13 @@ class NotificationManager: ObservableObject { self.showNotification(title: text, detailText: detailText) } - + func showNotification(title: String, detailText: String?) { let notificationId = UUID() - self.notifications[notificationId] = Notification(id: notificationId, title: title, message: detailText) + DispatchQueue.main.async { + self.notifications[notificationId] = Notification(id: notificationId, title: title, message: detailText) + } let dismissWorkItem = DispatchWorkItem { self.notifications.removeValue(forKey: notificationId) diff --git a/AltStore/Views/App Detail/AppDetailView.swift b/AltStore/Views/App Detail/AppDetailView.swift index e8020087..c499d7bc 100644 --- a/AltStore/Views/App Detail/AppDetailView.swift +++ b/AltStore/Views/App Detail/AppDetailView.swift @@ -162,19 +162,23 @@ struct AppDetailView: View { .bold() .font(.title3) - Text("\(L10n.AppDetailView.version) \(storeApp.version)") - .font(.callout) - .foregroundColor(.secondary) + if let version = storeApp.latestVersion?.version { + Text("\(L10n.AppDetailView.version) \(version)") + .font(.callout) + .foregroundColor(.secondary) + } } Spacer() - - VStack(alignment: .trailing) { - Text(dateFormatter.string(from: storeApp.versionDate)) - Text(byteCountFormatter.string(fromByteCount: Int64(storeApp.size))) + + if let versionDate = storeApp.versionDate, let versionSize = storeApp.size { + VStack(alignment: .trailing) { + Text(dateFormatter.string(from: versionDate)) + Text(byteCountFormatter.string(fromByteCount: Int64(versionSize))) + } + .font(.callout) + .foregroundColor(.secondary) } - .font(.callout) - .foregroundColor(.secondary) } if let versionDescription = storeApp.versionDescription { diff --git a/AltStore/Views/My Apps/MyAppsView.swift b/AltStore/Views/My Apps/MyAppsView.swift index 4e087488..cbcb36a7 100644 --- a/AltStore/Views/My Apps/MyAppsView.swift +++ b/AltStore/Views/My Apps/MyAppsView.swift @@ -15,10 +15,10 @@ struct MyAppsView: View { // TODO: Refactor @SwiftUI.FetchRequest(sortDescriptors: [ - NSSortDescriptor(keyPath: \InstalledApp.storeApp?.versionDate, ascending: true), + NSSortDescriptor(keyPath: \InstalledApp.storeApp?.latestVersion?.date, ascending: true), NSSortDescriptor(keyPath: \InstalledApp.name, ascending: true) ], predicate: NSPredicate(format: "%K == YES AND %K != nil AND %K != %K", - #keyPath(InstalledApp.isActive), #keyPath(InstalledApp.storeApp), #keyPath(InstalledApp.version), #keyPath(InstalledApp.storeApp.version))) + #keyPath(InstalledApp.isActive), #keyPath(InstalledApp.storeApp), #keyPath(InstalledApp.version), #keyPath(InstalledApp.storeApp.latestVersion.version))) var updates: FetchedResults