diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index 217fe1993..5fbf06844 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ CoreDataStack.xcscheme_^#shared#^_ orderHint - 15 + 16 Mastodon - RTL.xcscheme_^#shared#^_ @@ -32,7 +32,7 @@ NotificationService.xcscheme_^#shared#^_ orderHint - 16 + 15 SuppressBuildableAutocreation diff --git a/Mastodon/Diffiable/Section/ComposeStatusSection.swift b/Mastodon/Diffiable/Section/ComposeStatusSection.swift index 875a82842..836d91e73 100644 --- a/Mastodon/Diffiable/Section/ComposeStatusSection.swift +++ b/Mastodon/Diffiable/Section/ComposeStatusSection.swift @@ -141,8 +141,8 @@ extension ComposeStatusSection { attribute.contentWarningContent.value = text } .store(in: &cell.disposeBag) - ComposeStatusSection.configureCustomEmojiPicker(viewModel: customEmojiPickerInputViewModel, customEmojiReplacableTextInput: cell.textEditorView, disposeBag: &cell.disposeBag) - ComposeStatusSection.configureCustomEmojiPicker(viewModel: customEmojiPickerInputViewModel, customEmojiReplacableTextInput: cell.statusContentWarningEditorView.textView, disposeBag: &cell.disposeBag) + ComposeStatusSection.configureCustomEmojiPicker(viewModel: customEmojiPickerInputViewModel, customEmojiReplaceableTextInput: cell.textEditorView, disposeBag: &cell.disposeBag) + ComposeStatusSection.configureCustomEmojiPicker(viewModel: customEmojiPickerInputViewModel, customEmojiReplaceableTextInput: cell.statusContentWarningEditorView.textView, disposeBag: &cell.disposeBag) return cell case .attachment(let attachmentService): @@ -228,7 +228,7 @@ extension ComposeStatusSection { .assign(to: \.value, on: attribute.option) .store(in: &cell.disposeBag) cell.delegate = composeStatusPollOptionCollectionViewCellDelegate - ComposeStatusSection.configureCustomEmojiPicker(viewModel: customEmojiPickerInputViewModel, customEmojiReplacableTextInput: cell.pollOptionView.optionTextField, disposeBag: &cell.disposeBag) + ComposeStatusSection.configureCustomEmojiPicker(viewModel: customEmojiPickerInputViewModel, customEmojiReplaceableTextInput: cell.pollOptionView.optionTextField, disposeBag: &cell.disposeBag) return cell case .pollOptionAppendEntry: let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: ComposeStatusPollOptionAppendEntryCollectionViewCell.self), for: indexPath) as! ComposeStatusPollOptionAppendEntryCollectionViewCell @@ -295,7 +295,7 @@ protocol CustomEmojiReplaceableTextInput: AnyObject { var isFirstResponder: Bool { get } } -class CustomEmojiReplacableTextInputReference { +class CustomEmojiReplaceableTextInputReference { weak var value: CustomEmojiReplaceableTextInput? init(value: CustomEmojiReplaceableTextInput? = nil) { @@ -320,7 +320,7 @@ extension ComposeStatusSection { static func configureCustomEmojiPicker( viewModel: CustomEmojiPickerInputViewModel?, - customEmojiReplacableTextInput: CustomEmojiReplaceableTextInput, + customEmojiReplaceableTextInput: CustomEmojiReplaceableTextInput, disposeBag: inout Set ) { guard let viewModel = viewModel else { return } @@ -328,9 +328,9 @@ extension ComposeStatusSection { .receive(on: DispatchQueue.main) .sink { [weak viewModel] isCustomEmojiComposing in guard let viewModel = viewModel else { return } - customEmojiReplacableTextInput.inputView = isCustomEmojiComposing ? viewModel.customEmojiPickerInputView : nil - customEmojiReplacableTextInput.reloadInputViews() - viewModel.append(customEmojiReplacableTextInput: customEmojiReplacableTextInput) + customEmojiReplaceableTextInput.inputView = isCustomEmojiComposing ? viewModel.customEmojiPickerInputView : nil + customEmojiReplaceableTextInput.reloadInputViews() + viewModel.append(customEmojiReplaceableTextInput: customEmojiReplaceableTextInput) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Compose/ComposeViewController.swift b/Mastodon/Scene/Compose/ComposeViewController.swift index 6fb52d2f3..595c8743b 100644 --- a/Mastodon/Scene/Compose/ComposeViewController.swift +++ b/Mastodon/Scene/Compose/ComposeViewController.swift @@ -61,7 +61,8 @@ final class ComposeViewController: UIViewController, NeedsDependency { var systemKeyboardHeight: CGFloat = .zero { didSet { // note: some system AutoLayout warning here - customEmojiPickerInputView.frame.size.height = systemKeyboardHeight != .zero ? systemKeyboardHeight : 300 + let height = max(300, systemKeyboardHeight) + customEmojiPickerInputView.frame.size.height = height } } diff --git a/Mastodon/Scene/Compose/View/CustomEmojiPickerInputViewModel.swift b/Mastodon/Scene/Compose/View/CustomEmojiPickerInputViewModel.swift index fec205d6f..8314dfc3f 100644 --- a/Mastodon/Scene/Compose/View/CustomEmojiPickerInputViewModel.swift +++ b/Mastodon/Scene/Compose/View/CustomEmojiPickerInputViewModel.swift @@ -12,7 +12,7 @@ final class CustomEmojiPickerInputViewModel { var disposeBag = Set() - private var customEmojiReplacableTextInputReferences: [CustomEmojiReplacableTextInputReference] = [] + private var customEmojiReplaceableTextInputReferences: [CustomEmojiReplaceableTextInputReference] = [] // input weak var customEmojiPickerInputView: CustomEmojiPickerInputView? @@ -25,27 +25,27 @@ final class CustomEmojiPickerInputViewModel { extension CustomEmojiPickerInputViewModel { private func removeEmptyReferences() { - customEmojiReplacableTextInputReferences.removeAll(where: { element in + customEmojiReplaceableTextInputReferences.removeAll(where: { element in element.value == nil }) } - func append(customEmojiReplacableTextInput textInput: CustomEmojiReplaceableTextInput) { + func append(customEmojiReplaceableTextInput textInput: CustomEmojiReplaceableTextInput) { removeEmptyReferences() - let isContains = customEmojiReplacableTextInputReferences.contains(where: { element in + let isContains = customEmojiReplaceableTextInputReferences.contains(where: { element in element.value === textInput }) guard !isContains else { return } - customEmojiReplacableTextInputReferences.append(CustomEmojiReplacableTextInputReference(value: textInput)) + customEmojiReplaceableTextInputReferences.append(CustomEmojiReplaceableTextInputReference(value: textInput)) } - func insertText(_ text: String) -> CustomEmojiReplacableTextInputReference? { + func insertText(_ text: String) -> CustomEmojiReplaceableTextInputReference? { removeEmptyReferences() - for reference in customEmojiReplacableTextInputReferences { + for reference in customEmojiReplaceableTextInputReferences { guard reference.value?.isFirstResponder == true else { continue } reference.value?.insertText(text) return reference