diff --git a/Sora/Utils/Drops/DropManager.swift b/Sora/Utils/Drops/DropManager.swift index 3956f4b..8cdce3a 100644 --- a/Sora/Utils/Drops/DropManager.swift +++ b/Sora/Utils/Drops/DropManager.swift @@ -17,10 +17,8 @@ class DropManager { private init() {} func showDrop(title: String, subtitle: String, duration: TimeInterval, icon: UIImage?) { - // Add to queue notificationQueue.append((title: title, subtitle: subtitle, duration: duration, icon: icon)) - // Process queue if not already processing if !isProcessingQueue { processQueue() } @@ -33,11 +31,8 @@ class DropManager { } isProcessingQueue = true - - // Get the next notification let notification = notificationQueue.removeFirst() - // Show the notification let drop = Drop( title: notification.title, subtitle: notification.subtitle, @@ -48,7 +43,6 @@ class DropManager { Drops.show(drop) - // Schedule next notification DispatchQueue.main.asyncAfter(deadline: .now() + notification.duration) { [weak self] in self?.processQueue() } @@ -69,9 +63,7 @@ class DropManager { showDrop(title: "Info", subtitle: message, duration: duration, icon: icon) } - // Method for handling download notifications with accurate status determination func downloadStarted(episodeNumber: Int) { - // Use the JSController method to accurately determine if download will start immediately let willStartImmediately = JSController.shared.willDownloadStartImmediately() let message = willStartImmediately diff --git a/Sora/Views/DownloadView.swift b/Sora/Views/DownloadView.swift index 556f62f..05eb9d5 100644 --- a/Sora/Views/DownloadView.swift +++ b/Sora/Views/DownloadView.swift @@ -833,7 +833,7 @@ struct EnhancedActiveDownloadCard: View { } .padding(16) - if download != download { // Not last item (placeholder condition) + if download != download { Divider() .padding(.horizontal, 16) } diff --git a/Sora/Views/SearchView.swift b/Sora/Views/SearchView.swift index f157d4c..867a1f3 100644 --- a/Sora/Views/SearchView.swift +++ b/Sora/Views/SearchView.swift @@ -37,6 +37,7 @@ struct SearchView: View { @State private var searchHistory: [String] = [] @State private var isSearchFieldFocused = false @State private var saveDebounceTimer: Timer? + @State private var searchDebounceTimer: Timer? private let columns = [GridItem(.adaptive(minimum: 150))] @@ -142,17 +143,22 @@ struct SearchView: View { } } .onChange(of: searchQuery) { newValue in + searchDebounceTimer?.invalidate() + if newValue.isEmpty { saveDebounceTimer?.invalidate() searchItems = [] hasNoResults = false isSearching = false } else { - performSearch() + searchDebounceTimer = Timer.scheduledTimer(withTimeInterval: 0.7, repeats: false) { _ in + performSearch() + } saveDebounceTimer?.invalidate() saveDebounceTimer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: false) { _ in - self.addToSearchHistory(newValue)} + self.addToSearchHistory(newValue) + } } } } diff --git a/Sora/Views/SearchView/SearchComponents.swift b/Sora/Views/SearchView/SearchComponents.swift index 5efb4d8..920af2e 100644 --- a/Sora/Views/SearchView/SearchComponents.swift +++ b/Sora/Views/SearchView/SearchComponents.swift @@ -48,18 +48,15 @@ struct SearchHistoryRow: View { var body: some View { HStack { - // Clock Icon Image(systemName: "clock") .frame(width: 24, height: 24) .foregroundStyle(Color.primary) - // Search Text Text(text) .foregroundStyle(Color.primary) Spacer() - // Delete Button Button(action: onDelete) { Image(systemName: "xmark.circle.fill") .foregroundStyle(Color.secondary) @@ -70,7 +67,6 @@ struct SearchHistoryRow: View { .contentShape(Rectangle()) .onTapGesture(perform: onTap) - // Divider if needed if showDivider { Divider() .padding(.horizontal, 16)