Fix breakage from recents changes in share extension.

This commit is contained in:
Matthew Chen 2018-05-29 10:45:58 -04:00
parent f87b715144
commit 21b54bee4f
2 changed files with 14 additions and 8 deletions

View File

@ -23,13 +23,7 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat
let contactsManager: OWSContactsManager
private(set) var textView: UITextView!
private var sendButton: UIBarButtonItem = {
return UIBarButtonItem(title: NSLocalizedString("SEND_BUTTON_TITLE",
comment: "Label for the send button in the conversation view."),
style: .plain,
target: self,
action: #selector(sendPressed))
}()
private var sendButton: UIBarButtonItem!
// MARK: Initializers
@ -52,10 +46,16 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat
override public func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.title = NSLocalizedString("MESSAGE_APPROVAL_DIALOG_TITLE",
comment: "Title for the 'message approval' dialog.")
self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: #selector(cancelPressed))
sendButton = UIBarButtonItem(title: NSLocalizedString("SEND_BUTTON_TITLE",
comment: "Label for the send button in the conversation view."),
style: .plain,
target: self,
action: #selector(sendPressed))
self.navigationItem.rightBarButtonItem = sendButton
}
@ -63,6 +63,12 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat
sendButton.isEnabled = textView.text.count > 0
}
override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
updateSendButton()
}
// MARK: - Create Views
public override func loadView() {

View File

@ -976,7 +976,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
messages:deviceMessages
relay:recipient.relay
timeStamp:message.timestamp];
if (TSSocketManager.sharedManager.canMakeRequests) {
if (CurrentAppContext().isMainApp && TSSocketManager.sharedManager.canMakeRequests) {
[TSSocketManager.sharedManager makeRequest:request
success:^(id _Nullable responseObject) {
[self messageSendDidSucceed:message