Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
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
5 changes: 4 additions & 1 deletion Classes/Issues/IssueTextActionsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ final class IssueTextActionsView: UIView, UICollectionViewDataSource, UICollecti

public var sendButtonEnabled: Bool {
get { return sendButton.isEnabled }
set { sendButton.isEnabled = newValue }
set {
sendButton.isEnabled = newValue
sendButton.alpha = newValue ? 1 : 0.25
}
}

init(operations: [IssueTextActionOperation], showSendButton: Bool) {
Expand Down
17 changes: 16 additions & 1 deletion Classes/Issues/IssuesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ final class IssuesViewController:
IssueNeckLoadSectionControllerDelegate,
FlatCacheListener,
IssueCommentSectionControllerDelegate,
IssueTextActionsViewSendDelegate {
IssueTextActionsViewSendDelegate,
MessageTextViewListener {

private let client: GithubClient
private let model: IssueDetailsModel
Expand All @@ -50,6 +51,7 @@ final class IssuesViewController:

private var needsScrollToBottom = false
private var lastTimelineElement: ListDiffable?
private var actions: IssueTextActionsView?

// must fetch collaborator info from API before showing editing controls
private var viewerIsCollaborator = false
Expand Down Expand Up @@ -183,6 +185,10 @@ final class IssuesViewController:
// text input bar uses UIVisualEffectView, don't try to match it
actions.backgroundColor = .clear
actions.sendDelegate = self
self.actions = actions

actions.sendButtonEnabled = !messageView.textView.text.isEmpty
messageView.textView.add(listener: self)

textActionsController.configure(client: client, textView: messageView.textView, actions: actions)
textActionsController.viewController = self
Expand Down Expand Up @@ -600,4 +606,13 @@ final class IssuesViewController:
}
}

// MARK: MessageTextViewListener

func didChange(textView: MessageTextView) {
actions?.sendButtonEnabled = !textView.text.isEmpty
}

func didChangeSelection(textView: MessageTextView) {}
func willChangeRange(textView: MessageTextView, to range: NSRange) {}

}