Skip to content

Commit

Permalink
IOS-2478 Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mgolovko committed Apr 1, 2024
1 parent 81314c1 commit 4c9082b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import AnytypeCore
import SwiftUI

enum EditorPageConfigurationConstants {
static let dataSourceAnimationEnabled = false
static let dataSourceAnimationEnabled = true
}

final class EditorPageController: UIViewController {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AnytypeCore
import UIKit
import ProtobufMessages

@MainActor
protocol KeyboardActionHandlerProtocol {
func handle(
info: BlockInformation,
Expand All @@ -12,6 +13,7 @@ protocol KeyboardActionHandlerProtocol {
) async throws
}

@MainActor
final class KeyboardActionHandler: KeyboardActionHandlerProtocol {
private let documentId: String
private let service: BlockActionServiceProtocol
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4c9082b

Please sign in to comment.