diff --git a/Anytype/Sources/PresentationLayer/TextEditor/BlocksViews/Blocks/FeaturedRelations/FeaturedRelationsBlockViewModel.swift b/Anytype/Sources/PresentationLayer/TextEditor/BlocksViews/Blocks/FeaturedRelations/FeaturedRelationsBlockViewModel.swift index ff6019f8a7..53b2f51398 100644 --- a/Anytype/Sources/PresentationLayer/TextEditor/BlocksViews/Blocks/FeaturedRelations/FeaturedRelationsBlockViewModel.swift +++ b/Anytype/Sources/PresentationLayer/TextEditor/BlocksViews/Blocks/FeaturedRelations/FeaturedRelationsBlockViewModel.swift @@ -30,7 +30,7 @@ final class FeaturedRelationsBlockViewModel: BlockViewModelProtocol { guard let self else { return } if featuredRelationValues != newFeaturedRelations { self.featuredRelationValues = newFeaturedRelations - collectionController.reconfigure(items: [.block(self)]) + collectionController.itemDidChangeFrame(item: .block(self)) } }.store(in: &cancellables) } diff --git a/Anytype/Sources/PresentationLayer/TextEditor/BlocksViews/Blocks/Text/Base/TextBlockContentView.swift b/Anytype/Sources/PresentationLayer/TextEditor/BlocksViews/Blocks/Text/Base/TextBlockContentView.swift index 504b7db45e..693c8ab02d 100644 --- a/Anytype/Sources/PresentationLayer/TextEditor/BlocksViews/Blocks/Text/Base/TextBlockContentView.swift +++ b/Anytype/Sources/PresentationLayer/TextEditor/BlocksViews/Blocks/Text/Base/TextBlockContentView.swift @@ -110,12 +110,10 @@ final class TextBlockContentView: UIView, BlockContentView, DynamicHeightView, F focusSubscription = configuration .focusPublisher + .receiveOnMain() .sink { [weak self] focus in - DispatchQueue.main.async { - self?.textView.textView.setFocus(focus) - } - - } + self?.textView.textView.setFocus(focus) + } resetSubscription = configuration.resetPublisher.sink { [weak self] configuration in configuration.map { diff --git a/Anytype/Sources/PresentationLayer/TextEditor/EditorPage/EditorPageController.swift b/Anytype/Sources/PresentationLayer/TextEditor/EditorPage/EditorPageController.swift index f586ce776e..042f164df2 100644 --- a/Anytype/Sources/PresentationLayer/TextEditor/EditorPage/EditorPageController.swift +++ b/Anytype/Sources/PresentationLayer/TextEditor/EditorPage/EditorPageController.swift @@ -5,7 +5,7 @@ import AnytypeCore import SwiftUI enum EditorPageConfigurationConstants { - static let dataSourceAnimationEnabled = false + static let dataSourceAnimationEnabled = true } final class EditorPageController: UIViewController { @@ -358,7 +358,7 @@ extension EditorPageController: EditorPageViewInput { let existingItems = items.filter { snapshot.itemIdentifiers.contains($0) } snapshot.reconfigureItems(existingItems) - dataSource.apply(snapshot, animatingDifferences: true) + dataSource.apply(snapshot, animatingDifferences: EditorPageConfigurationConstants.dataSourceAnimationEnabled) } func update( @@ -408,7 +408,7 @@ extension EditorPageController: EditorPageViewInput { func itemDidChangeFrame(item: EditorItem) { DispatchQueue.main.async { [weak self] in guard let self else { return } - dataSource.apply(dataSource.snapshot(), animatingDifferences: true) + dataSource.apply(dataSource.snapshot(), animatingDifferences: EditorPageConfigurationConstants.dataSourceAnimationEnabled) } } diff --git a/Anytype/Sources/ServiceLayer/Block/BlockActionHandler/KeyboardActionHandler/KeyboardActionHandler.swift b/Anytype/Sources/ServiceLayer/Block/BlockActionHandler/KeyboardActionHandler/KeyboardActionHandler.swift index 8302527dee..868421e182 100644 --- a/Anytype/Sources/ServiceLayer/Block/BlockActionHandler/KeyboardActionHandler/KeyboardActionHandler.swift +++ b/Anytype/Sources/ServiceLayer/Block/BlockActionHandler/KeyboardActionHandler/KeyboardActionHandler.swift @@ -4,6 +4,7 @@ import AnytypeCore import UIKit import ProtobufMessages +@MainActor protocol KeyboardActionHandlerProtocol { func handle( info: BlockInformation, @@ -12,6 +13,7 @@ protocol KeyboardActionHandlerProtocol { ) async throws } +@MainActor final class KeyboardActionHandler: KeyboardActionHandlerProtocol { private let documentId: String private let service: BlockActionServiceProtocol @@ -110,7 +112,6 @@ final class KeyboardActionHandler: KeyboardActionHandlerProtocol { } } - @MainActor private func onDelete(text: BlockText, info: BlockInformation, parent: BlockInformation, textView: UITextView) async throws { if text.contentType.isList || text.contentType == .quote || text.contentType == .callout { try await service.turnInto(.text, blockId: info.id)