Skip to content

Commit

Permalink
Fix brave/brave-ios#7832: Restored but unopened tabs not added to Rec…
Browse files Browse the repository at this point in the history
…ently Closed Tabs (brave/brave-ios#7848)
  • Loading branch information
soner-yuksel authored Aug 8, 2023
1 parent 42ae4d3 commit 92d550f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions Sources/Brave/Frontend/Browser/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1127,13 +1127,12 @@ class TabManager: NSObject {
}

// NTP should not be passed as Recently Closed item
guard let tabUrl = tab.url,
let interactionState = tab.webView?.sessionData else { return nil }

if InternalURL(tabUrl)?.isAboutHomeURL == true {
let recentlyClosedURL = tab.url ?? SessionTab.from(tabId: tab.id)?.url

guard let tabUrl = recentlyClosedURL, tabUrl.isWebPage() else {
return nil
}

// Convert any internal URLs to their real URL for the Recently Closed item
var fetchedTabURL = tabUrl
if let url = InternalURL(fetchedTabURL),
Expand All @@ -1144,7 +1143,7 @@ class TabManager: NSObject {
return SavedRecentlyClosed(
url: fetchedTabURL,
title: tab.displayTitle,
interactionState: interactionState,
interactionState: tab.webView?.sessionData,
order: -1)
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Data/models/RecentlyClosed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public struct SavedRecentlyClosed {
public let url: String
public let title: String
public let dateAdded: Date
public let interactionState: Data
public let interactionState: Data?
public let index: Int32

public init(url: URL, title: String, dateAdded: Date = .now, interactionState: Data, order: Int32) {
public init(url: URL, title: String, dateAdded: Date = .now, interactionState: Data?, order: Int32) {
self.url = url.absoluteString
self.title = title
self.dateAdded = dateAdded
Expand Down

0 comments on commit 92d550f

Please sign in to comment.