Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS-4012 Widgets | support bookmarks widget #2670

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ struct EditorCoordinatorView: View {
WidgetObjectListListsView(spaceId: spaceId, output: model)
case let .media(spaceId):
WidgetObjectListMediaView(spaceId: spaceId, output: model)
case let .bookmarks(spaceId):
WidgetObjectListBookmarksView(spaceId: spaceId, output: model)
case let .page(data):
EditorPageCoordinatorView(data: data, showHeader: true, setupEditorInput: { _, _ in })
case let .list(data):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ struct HomeWidgetSubmoduleView: View {
} else {
EmptyView()
}
case (.bookmarks, .compactList):
if FeatureFlags.allContentWidgets {
BookmarksCompactListWidgetSubmoduleView(data: widgetData)
} else {
EmptyView()
}
case (.bookmarks, .list):
if FeatureFlags.allContentWidgets {
BookmarksListWidgetSubmoduleView(data: widgetData)
} else {
EmptyView()
}
case _:
EmptyView()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation
import SwiftUI

struct BookmarksCompactListWidgetSubmoduleView: View {

let data: WidgetSubmoduleData

var body: some View {
AllObjectCommonListWidgetSubmoduleView(data: data, style: .compactList, type: .bookmarks)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation
import SwiftUI

struct BookmarksListWidgetSubmoduleView: View {

let data: WidgetSubmoduleData

var body: some View {
AllObjectCommonListWidgetSubmoduleView(data: data, style: .list, type: .bookmarks)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ enum AllObjectWidgetType: String {
case pages
case lists
case media
case bookmarks
}

extension AllObjectWidgetType {
Expand All @@ -15,6 +16,8 @@ extension AllObjectWidgetType {
Loc.lists
case .media:
Loc.media
case .bookmarks:
Loc.bookmarks
}
}

Expand All @@ -26,6 +29,8 @@ extension AllObjectWidgetType {
.lists(spaceId: spaceId)
case .media:
.media(spaceId: spaceId)
case .bookmarks:
.bookmarks(spaceId: spaceId)
}
}

Expand All @@ -37,6 +42,8 @@ extension AllObjectWidgetType {
.lists
case .media:
.media
case .bookmarks:
.bookmarks
}
}

Expand All @@ -48,6 +55,8 @@ extension AllObjectWidgetType {
.lists
case .media:
.media
case .bookmarks:
.bookmarks
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Foundation
import SwiftUI

struct WidgetObjectListBookmarksView: View {

@StateObject private var model: WidgetObjectListViewModel

init(spaceId: String, output: (any WidgetObjectListCommonModuleOutput)?) {
self._model = StateObject(wrappedValue: WidgetObjectListViewModel(
spaceId: spaceId,
internalModel: WidgetObjectListAllContentViewModel(spaceId: spaceId, type: .bookmarks),
menuBuilder: WidgetObjectListMenuBuilder(),
output: output
))
}

var body: some View {
WidgetObjectListView(model: model)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extension EditorScreenData {

var objectId: String? {
switch self {
case .favorites, .recentEdit, .recentOpen, .sets, .collections, .bin, .allContent, .date, .pages, .lists, .media:
case .favorites, .recentEdit, .recentOpen, .sets, .collections, .bin, .allContent, .date, .pages, .lists, .media, .bookmarks:
return nil
case .page(let object):
return object.objectId
Expand Down Expand Up @@ -77,6 +77,8 @@ extension EditorScreenData {
return spaceId
case .media(let spaceId):
return spaceId
case .bookmarks(let spaceId):
return spaceId
case .allContent(let spaceId):
return spaceId
case .page(let object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum EditorScreenData: Hashable, Codable, Equatable, Identifiable {
case pages(spaceId: String)
case lists(spaceId: String)
case media(spaceId: String)
case bookmarks(spaceId: String)
// Object
case page(EditorPageObject)
case list(EditorListObject)
Expand Down
Loading