Skip to content

Commit

Permalink
Merge branch 'release/0.30.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstrba committed Oct 25, 2022
2 parents 02bee60 + 7d720b4 commit 9ea6efa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MARKETING_VERSION = 0.30.2
MARKETING_VERSION = 0.30.3

12 changes: 8 additions & 4 deletions DuckDuckGo/Bookmarks/Model/BookmarkList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
}

}
2 changes: 0 additions & 2 deletions DuckDuckGo/Suggestions/Model/SuggestionContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,3 @@ extension HistoryEntry: BrowserServicesKit.HistoryEntry {
}

}

extension Bookmark: BrowserServicesKit.Bookmark {}
12 changes: 8 additions & 4 deletions Unit Tests/Bookmarks/Model/BookmarkListTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}

Expand All @@ -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() {
Expand All @@ -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])
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -141,4 +141,8 @@ fileprivate extension Bookmark {
isFavorite: false,
faviconManagement: FaviconManagerMock())

var identifiableBookmark: BookmarkList.IdentifiableBookmark {
return BookmarkList.IdentifiableBookmark(from: self)
}

}
2 changes: 0 additions & 2 deletions Unit Tests/Bookmarks/Model/LocalBookmarkManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 9ea6efa

Please sign in to comment.