Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #4040: Add a new section in history for items dated earlier than …
Browse files Browse the repository at this point in the history
…last month period in limits (#4041)
  • Loading branch information
soner-yuksel authored Sep 3, 2021
1 parent 7be04ea commit 38a1445
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions BraveShared/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ extension Strings {
public static let yesterday = NSLocalizedString("Yesterday", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Yesterday", comment: "History tableview section header")
public static let lastWeek = NSLocalizedString("LastWeek", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Last week", comment: "History tableview section header")
public static let lastMonth = NSLocalizedString("LastMonth", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Last month", comment: "History tableview section header")
public static let earlier = NSLocalizedString("Earlier", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Earlier", comment: "History tableview section header that indicated history items earlier than last month")
public static let savedLogins = NSLocalizedString("SavedLogins", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Saved Logins", comment: "Settings item for clearing passwords and login data")
public static let downloadedFiles = NSLocalizedString("DownloadedFiles", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Downloaded files", comment: "Settings item for clearing downloaded files.")
public static let browsingHistory = NSLocalizedString("BrowsingHistory", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Browsing History", comment: "Settings item for clearing browsing history")
Expand Down
3 changes: 2 additions & 1 deletion Client/Frontend/Sync/BraveCore/History/HistoryFetchers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ class Historyv2Fetcher: NSObject, HistoryV2FetchResultsController {
private var sectionDetails: OrderedDictionary<Historyv2.Section, Int> = [.today: 0,
.yesterday: 0,
.lastWeek: 0,
.thisMonth: 0]
.thisMonth: 0,
.earlier: 0]

private func clearHistoryData() {
historyList.removeAll()
Expand Down
6 changes: 5 additions & 1 deletion Client/Frontend/Sync/BraveCore/History/Historyv2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class Historyv2: WebsitePresentable {
case lastWeek
/// History happened between end of this week and end of this month
case thisMonth
/// History happened after the end of this month
case earlier

/// The list of titles time period
var title: String {
Expand All @@ -38,6 +40,8 @@ class Historyv2: WebsitePresentable {
return Strings.lastWeek
case .thisMonth:
return Strings.lastMonth
case .earlier:
return Strings.earlier
}
}
}
Expand Down Expand Up @@ -98,7 +102,7 @@ class Historyv2: WebsitePresentable {
return .thisMonth
}

return nil
return .earlier
}

private func getDate(_ dayOffset: Int) -> Date {
Expand Down

0 comments on commit 38a1445

Please sign in to comment.