diff --git a/Anytype/Sources/PresentationLayer/Flows/EditorFlow/EditorCoordinatorView.swift b/Anytype/Sources/PresentationLayer/Flows/EditorFlow/EditorCoordinatorView.swift index 50d73b0ad6..c1622222d7 100644 --- a/Anytype/Sources/PresentationLayer/Flows/EditorFlow/EditorCoordinatorView.swift +++ b/Anytype/Sources/PresentationLayer/Flows/EditorFlow/EditorCoordinatorView.swift @@ -34,11 +34,7 @@ struct EditorCoordinatorView: View { case let .recentOpen(spaceId): WidgetObjectListRecentOpenView(spaceId: spaceId, output: model) case let .bin(spaceId): - if FeatureFlags.binScreenEmptyAction { - BinListView(spaceId: spaceId, output: model) - } else { - WidgetObjectListBinView(spaceId: spaceId, output: model) - } + BinListView(spaceId: spaceId, output: model) case let .page(data): EditorPageCoordinatorView(data: data, showHeader: true, setupEditorInput: { _, _ in }) case let .list(data): diff --git a/Anytype/Sources/PresentationLayer/Modules/WidgetObjectList/Bin/WidgetObjectListBinView.swift b/Anytype/Sources/PresentationLayer/Modules/WidgetObjectList/Bin/WidgetObjectListBinView.swift deleted file mode 100644 index 6e4d635e98..0000000000 --- a/Anytype/Sources/PresentationLayer/Modules/WidgetObjectList/Bin/WidgetObjectListBinView.swift +++ /dev/null @@ -1,24 +0,0 @@ -import Foundation -import SwiftUI - -// TODO: Refactoring module -struct WidgetObjectListBinView: View { - - @StateObject private var model: WidgetObjectListViewModel - - init(spaceId: String, output: (any WidgetObjectListCommonModuleOutput)?) { - self._model = StateObject(wrappedValue: WidgetObjectListViewModel( - spaceId: spaceId, - internalModel: WidgetObjectListBinViewModel(spaceId: spaceId), - menuBuilder: WidgetObjectListMenuBuilder(), - output: output - )) - } - - var body: some View { - WidgetObjectListView(model: model) - .onAppear { - AnytypeAnalytics.instance().logScreenBin() - } - } -} diff --git a/Anytype/Sources/PresentationLayer/Modules/WidgetObjectList/Bin/WidgetObjectListBinViewModel.swift b/Anytype/Sources/PresentationLayer/Modules/WidgetObjectList/Bin/WidgetObjectListBinViewModel.swift deleted file mode 100644 index 2f457679f4..0000000000 --- a/Anytype/Sources/PresentationLayer/Modules/WidgetObjectList/Bin/WidgetObjectListBinViewModel.swift +++ /dev/null @@ -1,56 +0,0 @@ -import Foundation -import Services -import Combine -import AnytypeCore - -@MainActor -final class WidgetObjectListBinViewModel: WidgetObjectListInternalViewModelProtocol { - - // MARK: - DI - - private let spaceId: String - @Injected(\.binSubscriptionService) - private var binSubscriptionService: any BinSubscriptionServiceProtocol - - // MARK: - State - - let title = Loc.bin - let emptyStateData = WidgetObjectListEmptyStateData( - title: Loc.EmptyView.Bin.title, - subtitle: Loc.EmptyView.Bin.subtitle - ) - let editorScreenData: EditorScreenData - var rowDetailsPublisher: AnyPublisher<[WidgetObjectListDetailsData], Never> { $rowDetails.eraseToAnyPublisher()} - let editMode: WidgetObjectListEditMode = .normal(allowDnd: false) - let availableMenuItems: [WidgetObjectListMenuItem] = [.restore, .delete] - - private var details: [ObjectDetails] = [] { - didSet { rowDetails = [WidgetObjectListDetailsData(details: details)] } - } - @Published private var rowDetails: [WidgetObjectListDetailsData] = [] - - init(spaceId: String) { - self.spaceId = spaceId - self.editorScreenData = .bin(spaceId: spaceId) - } - - // MARK: - WidgetObjectListInternalViewModelProtocol - - func onAppear() { - Task { - await binSubscriptionService.legacyStartSubscription(spaceId: spaceId, objectLimit: nil) { [weak self] details in - self?.details = details - } - } - } - - func onDisappear() { - Task { - await binSubscriptionService.stopSubscription() - } - } - - func subtitle(for details: ObjectDetails) -> String? { - return details.objectType.displayName - } -} diff --git a/Anytype/Sources/ServiceLayer/Subscriptions/BinSubscriptionService.swift b/Anytype/Sources/ServiceLayer/Subscriptions/BinSubscriptionService.swift index 6c97daafd2..92a1f0978d 100644 --- a/Anytype/Sources/ServiceLayer/Subscriptions/BinSubscriptionService.swift +++ b/Anytype/Sources/ServiceLayer/Subscriptions/BinSubscriptionService.swift @@ -8,12 +8,6 @@ protocol BinSubscriptionServiceProtocol: AnyObject, Sendable { var dataSequence: AnyAsyncSequence<[ObjectDetails]> { get async } - func legacyStartSubscription( - spaceId: String, - objectLimit: Int?, - update: @escaping @MainActor ([ObjectDetails]) -> Void - ) async - func startSubscription(spaceId: String, objectLimit: Int?, name: String?) async func stopSubscription() async @@ -36,38 +30,6 @@ actor BinSubscriptionService: BinSubscriptionServiceProtocol { return subscriptionStorage.statePublisher.map { $0.items }.values.eraseToAnyAsyncSequence() } - func legacyStartSubscription( - spaceId: String, - objectLimit: Int?, - update: @escaping @MainActor ([ObjectDetails]) -> Void - ) async { - - let sort = SearchHelper.sort( - relation: BundledPropertyKey.lastModifiedDate, - type: .desc - ) - - let filters: [DataviewFilter] = .builder { - SearchHelper.notHiddenFilters(isArchive: true) - } - - let searchData: SubscriptionData = .search( - SubscriptionData.Search( - identifier: subscriptionId, - spaceId: spaceId, - sorts: [sort], - filters: filters, - limit: objectLimit ?? Constants.limit, - offset: 0, - keys: BundledPropertyKey.objectListKeys.map { $0.rawValue } - ) - ) - - try? await subscriptionStorage.startOrUpdateSubscription(data: searchData) { data in - await update(data.items) - } - } - func startSubscription(spaceId: String, objectLimit: Int?, name: String?) async { let sort = SearchHelper.sort( relation: BundledPropertyKey.lastModifiedDate, diff --git a/Modules/AnytypeCore/AnytypeCore/Generated/FeatureFlags+Flags.swift b/Modules/AnytypeCore/AnytypeCore/Generated/FeatureFlags+Flags.swift index 36dbaca5a0..f56f91ac9b 100644 --- a/Modules/AnytypeCore/AnytypeCore/Generated/FeatureFlags+Flags.swift +++ b/Modules/AnytypeCore/AnytypeCore/Generated/FeatureFlags+Flags.swift @@ -6,10 +6,6 @@ public extension FeatureFlags { // Static value reader - static var binScreenEmptyAction: Bool { - value(for: .binScreenEmptyAction) - } - static var muteSpacePossibility: Bool { value(for: .muteSpacePossibility) } @@ -144,7 +140,6 @@ public extension FeatureFlags { // All toggles static let features: [FeatureDescription] = [ - .binScreenEmptyAction, .muteSpacePossibility, .addNotificationsSettings, .swipeToReply, diff --git a/Modules/AnytypeCore/AnytypeCore/Utils/FeatureFlags/FeatureDescription+Flags.swift b/Modules/AnytypeCore/AnytypeCore/Utils/FeatureFlags/FeatureDescription+Flags.swift index 98fea965ea..36916b431a 100644 --- a/Modules/AnytypeCore/AnytypeCore/Utils/FeatureFlags/FeatureDescription+Flags.swift +++ b/Modules/AnytypeCore/AnytypeCore/Utils/FeatureFlags/FeatureDescription+Flags.swift @@ -4,12 +4,6 @@ import Foundation public extension FeatureDescription { - static let binScreenEmptyAction = FeatureDescription( - title: "Bin screen - empty action", - type: .feature(author: "m@anytype.io", releaseVersion: "13"), - defaultValue: true - ) - static let muteSpacePossibility = FeatureDescription( title: "Mute space possibility", type: .feature(author: "joe_pusya@anytype.io", releaseVersion: "13"),