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-3509 renamed page -> object #2220

Merged
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 @@ -65,8 +65,8 @@ private extension CustomTextView {
numberOfTapsRequired: 2,
tapHandler: LinkAttributeSelectionHandler()
)
let mentionSelectionHandler = MentionAttributeSelectionHandler { [weak self] pageId in
self?.delegate?.showPage(blockId: pageId)
let mentionSelectionHandler = MentionAttributeSelectionHandler { [weak self] objectId in
self?.delegate?.showObject(objectId: objectId)
}
let mentionSelection = TextViewAttributeSelectionInteraction(
textView: textView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protocol CustomTextViewDelegate: AnyObject {
func textViewDidChangeText(_ textView: UITextView)

func openURL(_ url: URL)
func showPage(blockId: String)
func showObject(objectId: String)
func changeCaretPosition(_ range: NSRange)

func keyboardAction(_ action: CustomTextView.KeyboardAction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import UIKit

struct MentionAttributeSelectionHandler {

private let showPage: (String) -> Void
private let showObject: (String) -> Void

init(showPage: @escaping (String) -> Void) {
self.showPage = showPage
init(showObject: @escaping (String) -> Void) {
self.showObject = showObject
}
}

Expand All @@ -31,14 +31,14 @@ extension MentionAttributeSelectionHandler: TextViewAttributeSelectionHandler {
return
}

guard let pageId: String = textView.attributedText.value(
guard let objectId: String = textView.attributedText.value(
for: attribute,
range: NSRange(location: characterIndex, length: 1)
) else {
textView.selectedRange = .init(location: characterIndex, length: 0)
textView.becomeFirstResponder()
return
}
showPage(pageId)
showObject(objectId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ final class SimpleTableCellsBuilder {
accessoryViewStateManager: accessoryStateManager,
markupChanger: blockMarkupChanger,
responderScrollViewHelper: responderScrollViewHelper,
showPage: { [weak self] objectId in
self?.router.showPage(objectId: objectId)
showObject: { [weak self] objectId in
self?.router.showObject(objectId: objectId)
},
openURL: { [weak moduleOutput] url in
moduleOutput?.openUrl(url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ final class SimpleTablesTextBlockActionHandler: TextBlockActionHandlerProtocol {
private let document: any BaseDocumentProtocol
var info: BlockInformation

let showPage: (String) -> Void
let showObject: (String) -> Void
let openURL: (URL) -> Void
private let onShowStyleMenu: (BlockInformation) -> Void
private let onEnterSelectionMode: (BlockInformation) -> Void
Expand Down Expand Up @@ -52,7 +52,7 @@ final class SimpleTablesTextBlockActionHandler: TextBlockActionHandlerProtocol {
accessoryViewStateManager: some AccessoryViewStateManager,
markupChanger: some BlockMarkupChangerProtocol,
responderScrollViewHelper: ResponderScrollViewHelper,
showPage: @escaping (String) -> Void,
showObject: @escaping (String) -> Void,
openURL: @escaping (URL) -> Void,
onShowStyleMenu: @escaping (BlockInformation) -> Void,
onEnterSelectionMode: @escaping (BlockInformation) -> Void,
Expand All @@ -64,7 +64,7 @@ final class SimpleTablesTextBlockActionHandler: TextBlockActionHandlerProtocol {
self.document = document
self.info = info
self.focusSubject = focusSubject
self.showPage = showPage
self.showObject = showObject
self.openURL = openURL
self.onShowStyleMenu = onShowStyleMenu
self.onEnterSelectionMode = onEnterSelectionMode
Expand Down Expand Up @@ -95,8 +95,8 @@ final class SimpleTablesTextBlockActionHandler: TextBlockActionHandlerProtocol {
createEmptyBlock: { [weak self] in
self?.createEmptyBlock()
},
showPage: { [weak self] in
self?.showPage($0)
showObject: { [weak self] in
self?.showObject($0)
},
openURL: { [weak self] in
self?.openURL($0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class TextBlockActionHandler: TextBlockActionHandlerProtocol {
private let document: any BaseDocumentProtocol
var info: BlockInformation

let showPage: (String) -> Void
let showObject: (String) -> Void
let openURL: (URL) -> Void
private let onShowStyleMenu: (BlockInformation) -> Void
private let onEnterSelectionMode: (BlockInformation) -> Void
Expand Down Expand Up @@ -51,7 +51,7 @@ final class TextBlockActionHandler: TextBlockActionHandlerProtocol {
document: some BaseDocumentProtocol,
info: BlockInformation,
focusSubject: PassthroughSubject<BlockFocusPosition, Never>,
showPage: @escaping (String) -> Void,
showObject: @escaping (String) -> Void,
openURL: @escaping (URL) -> Void,
onShowStyleMenu: @escaping (BlockInformation) -> Void,
onEnterSelectionMode: @escaping (BlockInformation) -> Void,
Expand All @@ -73,7 +73,7 @@ final class TextBlockActionHandler: TextBlockActionHandlerProtocol {
self.document = document
self.info = info
self.focusSubject = focusSubject
self.showPage = showPage
self.showObject = showObject
self.openURL = openURL
self.onShowStyleMenu = onShowStyleMenu
self.onEnterSelectionMode = onEnterSelectionMode
Expand Down Expand Up @@ -107,8 +107,8 @@ final class TextBlockActionHandler: TextBlockActionHandlerProtocol {
createEmptyBlock: { [weak self] in
self?.createEmptyBlock()
},
showPage: { [weak self] in
self?.showPage($0)
showObject: { [weak self] in
self?.showObject($0)
},
openURL: { [weak self] in
self?.openURL($0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct TextBlockContentConfiguration: BlockConfiguration {
let copy: (NSRange) -> Void
let cut: (NSRange) -> Void
let createEmptyBlock: () -> Void
let showPage: (String) -> Void
let showObject: (String) -> Void
let openURL: (URL) -> Void

let handleKeyboardAction: (CustomTextView.KeyboardAction, UITextView) -> Void
Expand Down Expand Up @@ -123,7 +123,7 @@ extension TextBlockContentConfiguration {
copy: { _ in },
cut: { _ in },
createEmptyBlock: { },
showPage: { _ in },
showObject: { _ in },
openURL: { _ in },
handleKeyboardAction: { _, _ in },
becomeFirstResponder: { },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ extension TextBlockContentView: CustomTextViewDelegate {
actions?.handleKeyboardAction(action, textView.textView)
}

func showPage(blockId: String) {
actions?.showPage(blockId)
func showObject(objectId: String) {
actions?.showObject(objectId)
}

func openURL(_ url: URL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,15 +490,15 @@ final class EditorPageBlocksStateManager: EditorPageBlocksStateManagerProtocol {
)
guard case let .bookmark(bookmark) = elements.first?.content else { return }
AnytypeAnalytics.instance().logOpenAsObject()
router.showPage(objectId: bookmark.targetObjectID)
router.showObject(objectId: bookmark.targetObjectID)
case .openSource:
anytypeAssert(
elements.count == 1,
"Number of elements should be 1"
)
guard case let .dataView(data) = elements.first?.content else { return }
AnytypeAnalytics.instance().logOpenAsSource()
router.showPage(objectId: data.targetObjectID)
router.showObject(objectId: data.targetObjectID)
case .style:
let elements = elements.map { $0.info }
editingState = .selecting(blocks: elements.map { $0.id}, allSelected: editingState.allSelected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ final class BlockViewModelBuilder {
document: document,
info: info,
focusSubject: subjectsHolder.focusSubject(for: info.id),
showPage: { [weak self] objectId in
self?.router.showPage(objectId: objectId)
showObject: { [weak self] objectId in
self?.router.showObject(objectId: objectId)
},
openURL: { [weak output] url in
output?.openUrl(url)
Expand Down Expand Up @@ -203,7 +203,7 @@ final class BlockViewModelBuilder {
case .video, .image:
router?.openImage(fileContext)
case .audio, .file:
router?.showPage(objectId: fileContext.file.file.metadata.targetObjectId)
router?.showObject(objectId: fileContext.file.file.metadata.targetObjectId)
case .none:
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class EditorRouter: NSObject, EditorRouterProtocol, ObjectSettingsCoordina
super.init()
}

func showPage(objectId: String) {
func showObject(objectId: String) {
guard let details = document.detailsStorage.get(id: objectId) else {
anytypeAssertionFailure("Details not found")
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protocol EditorRouterProtocol:
ObjectHeaderRouterProtocol
{
func showAlert(alertModel: AlertModel)
func showPage(objectId: String)
func showObject(objectId: String)
func showEditorScreen(data: EditorScreenData)
func replaceCurrentPage(with data: EditorScreenData)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final class SetObjectCreationCoordinator: SetObjectCreationCoordinatorProtocol {
private func showCreateObject(details: ObjectDetails, titleInputType: CreateObjectTitleInputType) {
let moduleViewController = createObjectModuleAssembly.makeCreateObject(objectId: details.id, titleInputType: titleInputType) { [weak self] in
self?.navigationContext.dismissTopPresented()
self?.showPage(data: details.editorScreenData())
self?.showObject(data: details.editorScreenData())
} closeAction: { [weak self] in
self?.navigationContext.dismissTopPresented()
}
Expand Down Expand Up @@ -87,7 +87,7 @@ final class SetObjectCreationCoordinator: SetObjectCreationCoordinatorProtocol {
navigationContext.present(moduleViewController)
}

private func showPage(data: EditorScreenData) {
private func showObject(data: EditorScreenData) {
output?.showEditorScreen(data: data)
}
}
Expand Down
Loading