diff --git a/Model/NavigationModel.swift b/Model/NavigationModel.swift index 22850eeb..d23c4d5e 100644 --- a/Model/NavigationModel.swift +++ b/Model/NavigationModel.swift @@ -65,6 +65,11 @@ final class NavigationModel: ObservableObject { @Published var tabSelection: TabSelection! { didSet { if oldValue == tabSelection { multipleTapHandler() } + if tabSelection == nil, let item = recents.presentedItem { + DispatchQueue.main.async { [weak self] in + self?.tabSelection = .recentlyOpened(item.tag) + } + } }} @Published var presentingAddToPlaylist = false diff --git a/Model/RecentsModel.swift b/Model/RecentsModel.swift index 4ce95369..70b19cb7 100644 --- a/Model/RecentsModel.swift +++ b/Model/RecentsModel.swift @@ -62,6 +62,12 @@ final class RecentsModel: ObservableObject { return nil } + var presentedItem: RecentItem? { + guard let recent = items.last else { return nil } + + return recent + } + static func symbolSystemImage(_ name: String) -> String { let firstLetter = name.first?.lowercased() let regex = #"^[a-z0-9]$"#