Skip to content

Commit 68e53d2

Browse files
committed
IOS-5425 Fix pull request issue
1 parent 18545f0 commit 68e53d2

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Anytype/Sources/PresentationLayer/Common/SwiftUI/Search/ObjectSearchWithMeta/ObjectSearchWithMetaViewModel.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ final class ObjectSearchWithMetaViewModel: ObservableObject {
1111
private var searchWithMetaService: any SearchWithMetaServiceProtocol
1212
@Injected(\.searchWithMetaModelBuilder)
1313
private var searchWithMetaModelBuilder: any SearchWithMetaModelBuilderProtocol
14-
14+
@Injected(\.spaceViewsStorage)
15+
private var spaceViewsStorage: any SpaceViewsStorageProtocol
16+
1517
private let dateFormatter = AnytypeRelativeDateTimeFormatter()
1618

1719
@Published var searchText = ""
@@ -36,7 +38,7 @@ final class ObjectSearchWithMetaViewModel: ObservableObject {
3638
searchResult = try await searchWithMetaService.search(
3739
text: searchText,
3840
spaceId: moduleData.spaceId,
39-
layouts: ObjectSearchWithMetaModuleData.supportedLayouts,
41+
layouts: supportedLayouts(),
4042
sorts: buildSorts(),
4143
excludedObjectIds: moduleData.excludedObjectIds
4244
)
@@ -109,10 +111,10 @@ final class ObjectSearchWithMetaViewModel: ObservableObject {
109111
)
110112
}
111113
}
112-
}
113114

114-
extension ObjectSearchWithMetaModuleData {
115-
static let supportedLayouts: [DetailsLayout] =
116-
ObjectTypeSection.pages.supportedLayouts(spaceUxType: nil) +
117-
ObjectTypeSection.lists.supportedLayouts(spaceUxType: nil)
115+
private func supportedLayouts() -> [DetailsLayout] {
116+
let spaceUxType = spaceViewsStorage.spaceView(spaceId: moduleData.spaceId)?.uxType
117+
return ObjectTypeSection.pages.supportedLayouts(spaceUxType: spaceUxType) +
118+
ObjectTypeSection.lists.supportedLayouts(spaceUxType: spaceUxType)
119+
}
118120
}

0 commit comments

Comments
 (0)