diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2cc4541a43..84bda1bd64 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -69,8 +69,8 @@ jobs: with: submodules: recursive - - name: Select Xcode 13.4 - run: sudo xcode-select -s /Applications/Xcode_13.4.app/Contents/Developer + - name: Select Xcode 14.0 + run: sudo xcode-select -s /Applications/Xcode_14.0.app/Contents/Developer - name: Build and test run: | diff --git a/Configuration/Version.xcconfig b/Configuration/Version.xcconfig index d1c3ebe2e2..74beed4843 100644 --- a/Configuration/Version.xcconfig +++ b/Configuration/Version.xcconfig @@ -1,2 +1,2 @@ -MARKETING_VERSION = 0.30.2 +MARKETING_VERSION = 0.30.3 diff --git a/DuckDuckGo/Bookmarks/Model/BookmarkList.swift b/DuckDuckGo/Bookmarks/Model/BookmarkList.swift index a39ba410ef..f57a2367f0 100644 --- a/DuckDuckGo/Bookmarks/Model/BookmarkList.swift +++ b/DuckDuckGo/Bookmarks/Model/BookmarkList.swift @@ -17,17 +17,22 @@ // import Foundation +import BrowserServicesKit import os.log struct BookmarkList { - struct IdentifiableBookmark: Equatable { + struct IdentifiableBookmark: Equatable, BrowserServicesKit.Bookmark { let id: UUID let url: URL + let title: String + let isFavorite: Bool init(from bookmark: Bookmark) { self.id = bookmark.id self.url = bookmark.url + self.title = bookmark.title + self.isFavorite = bookmark.isFavorite } } @@ -149,9 +154,8 @@ struct BookmarkList { return newBookmark } - func bookmarks() -> [Bookmark] { - let mappedBookmarks = allBookmarkURLsOrdered.compactMap { itemsDict[$0.url] } - return mappedBookmarks.reduce([], +) + func bookmarks() -> [IdentifiableBookmark] { + return allBookmarkURLsOrdered } } diff --git a/DuckDuckGo/Suggestions/Model/SuggestionContainer.swift b/DuckDuckGo/Suggestions/Model/SuggestionContainer.swift index 299e61ef23..0817bdd2d9 100644 --- a/DuckDuckGo/Suggestions/Model/SuggestionContainer.swift +++ b/DuckDuckGo/Suggestions/Model/SuggestionContainer.swift @@ -115,5 +115,3 @@ extension HistoryEntry: BrowserServicesKit.HistoryEntry { } } - -extension Bookmark: BrowserServicesKit.Bookmark {} diff --git a/Unit Tests/Bookmarks/Model/BookmarkListTests.swift b/Unit Tests/Bookmarks/Model/BookmarkListTests.swift index ee621227e3..57aefc00b4 100644 --- a/Unit Tests/Bookmarks/Model/BookmarkListTests.swift +++ b/Unit Tests/Bookmarks/Model/BookmarkListTests.swift @@ -30,7 +30,7 @@ final class BookmarkListTests: XCTestCase { bookmarkList.insert(bookmark) XCTAssert(bookmarkList.bookmarks().count == 1) - XCTAssert(bookmarkList.bookmarks().first == bookmark) + XCTAssert((bookmarkList.bookmarks()).first == bookmark.identifiableBookmark) XCTAssertNotNil(bookmarkList[bookmark.url]) } @@ -42,7 +42,7 @@ final class BookmarkListTests: XCTestCase { bookmarkList.insert(bookmark) XCTAssert(bookmarkList.bookmarks().count == 1) - XCTAssert(bookmarkList.bookmarks().first == bookmark) + XCTAssert(bookmarkList.bookmarks().first == bookmark.identifiableBookmark) } func testWhenBookmarkIsRemoved_ThenItIsNoLongerInList() { @@ -53,7 +53,7 @@ final class BookmarkListTests: XCTestCase { bookmarkList.remove(bookmark) - XCTAssertFalse(bookmarkList.bookmarks().contains(bookmark)) + XCTAssertFalse(bookmarkList.bookmarks().contains(bookmark.identifiableBookmark)) XCTAssertNil(bookmarkList[bookmark.url]) } @@ -87,7 +87,7 @@ final class BookmarkListTests: XCTestCase { XCTAssert(bookmarkList[bookmark.url]?.isFavorite == bookmark.isFavorite) XCTAssert(bookmarkList[bookmark.url]?.title == bookmark.title) XCTAssert(bookmarkList.bookmarks().count == 1) - XCTAssert(bookmarkList.bookmarks().first == bookmark) + XCTAssert(bookmarkList.bookmarks().first == bookmark.identifiableBookmark) XCTAssertNotNil(bookmarkList[bookmark.url]) XCTAssertNil(bookmarkList[unknownBookmark.url]) XCTAssertNil(updateUrlResult) @@ -141,4 +141,8 @@ fileprivate extension Bookmark { isFavorite: false, faviconManagement: FaviconManagerMock()) + var identifiableBookmark: BookmarkList.IdentifiableBookmark { + return BookmarkList.IdentifiableBookmark(from: self) + } + } diff --git a/Unit Tests/Bookmarks/Model/LocalBookmarkManagerTests.swift b/Unit Tests/Bookmarks/Model/LocalBookmarkManagerTests.swift index 4701cf91eb..b766173986 100644 --- a/Unit Tests/Bookmarks/Model/LocalBookmarkManagerTests.swift +++ b/Unit Tests/Bookmarks/Model/LocalBookmarkManagerTests.swift @@ -147,8 +147,6 @@ final class LocalBookmarkManagerTests: XCTestCase { let (bookmarkManager, bookmarkStoreMock) = LocalBookmarkManager.aManager let bookmark = bookmarkManager.makeBookmark(for: URL.duckDuckGo, title: "Title", isFavorite: false)! - bookmark.isFavorite = !bookmark.isFavorite - let newURL = URL.duckDuckGoAutocomplete let newBookmark = bookmarkManager.updateUrl(of: bookmark, to: newURL)