Fixed a couple of crashes

Fixed an issue where sharing form Safari without adding comments would result in an invalid message getting sent.
Fixed a crash when sharing plain text from safari.
Fixed a crash when localising 'OK' (key and value can't be the same when using the new extension).
This commit is contained in:
Morgan Pretty 2022-01-13 16:37:23 +11:00
parent f02f53fc49
commit 3b07be4eed
40 changed files with 57 additions and 45 deletions

View File

@ -306,7 +306,7 @@ final class EditClosedGroupVC : BaseVC, UITableViewDataSource, UITableViewDelega
// MARK: Convenience
private func showError(title: String, message: String = "") {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
presentAlert(alert)
}
}

View File

@ -151,7 +151,7 @@ final class NewClosedGroupVC : BaseVC, UITableViewDataSource, UITableViewDelegat
@objc private func createClosedGroup() {
func showError(title: String, message: String = "") {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
presentAlert(alert)
}
guard let name = nameTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines), name.count > 0 else {
@ -184,7 +184,7 @@ final class NewClosedGroupVC : BaseVC, UITableViewDataSource, UITableViewDelegat
let title = "Couldn't Create Group"
let message = "Please check your internet connection and try again."
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
self?.presentAlert(alert)
}
}

View File

@ -65,7 +65,7 @@ final class JoinOpenGroupModal : Modal {
@objc private func joinOpenGroup() {
guard let (room, server, publicKey) = OpenGroupManagerV2.parseV2OpenGroup(from: url) else {
let alert = UIAlertController(title: "Couldn't Join", message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
return presentingViewController!.present(alert, animated: true, completion: nil)
}
presentingViewController!.dismiss(animated: true, completion: nil)
@ -77,7 +77,7 @@ final class JoinOpenGroupModal : Modal {
}
.catch(on: DispatchQueue.main) { error in
let alert = UIAlertController(title: "Couldn't Join", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
presentingViewController.present(alert, animated: true, completion: nil)
}
}

View File

@ -158,7 +158,7 @@ final class NewDMVC : BaseVC, UIPageViewControllerDataSource, UIPageViewControll
}
let message = messageOrNil ?? "Please check the Session ID or ONS name and try again"
let alert = UIAlertController(title: "Error", message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
self?.presentAlert(alert)
}
}

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Anzeigen";
/* No comment provided by engineer. */
"OK" = "Okay";
"BUTTON_OK" = "Okay";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ hat verschwindende Nachrichten deaktiviert.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Show";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ disabled disappearing messages.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Ver";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ ha desactivado la desaparición de mensajes.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "نمایش";
/* No comment provided by engineer. */
"OK" = "باشه";
"BUTTON_OK" = "باشه";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ پیام‌های محوشونده را غیرفعال کرده است.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Näytä";
/* No comment provided by engineer. */
"OK" = "Ok";
"BUTTON_OK" = "Ok";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ poisti katoavat viestit käytöstä.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Afficher";
/* No comment provided by engineer. */
"OK" = "Valider";
"BUTTON_OK" = "Valider";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ a désactivé les messages éphémères.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "दिखाएं";
/* No comment provided by engineer. */
"OK" = "ठीक है";
"BUTTON_OK" = "ठीक है";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ ने गायब संदेश अक्षम कर दिए हैं।";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Prikaži";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ je onemogućio nestajuće poruke.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Tampilkan";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@menonaktifkan pesan tersembunyi";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Mostra";
/* No comment provided by engineer. */
"OK" = "OK,";
"BUTTON_OK" = "OK,";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ ha disabilitato la scomparsa dei messaggi.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "表示内容";
/* No comment provided by engineer. */
"OK" = "確定";
"BUTTON_OK" = "確定";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@がメッセージの消失をオフにしました";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Tonen";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ heeft zelf-wissende berichten uitgeschakeld.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Pokaż";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ wyłączył(a) znikające wiadomości.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Exibir";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ desabilitou mensagens efêmeras.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Показывать";
/* No comment provided by engineer. */
"OK" = "Ок";
"BUTTON_OK" = "Ок";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ отключил(а) исчезающие сообщения.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Show";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ disabled disappearing messages.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Zobraziť";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ disabled disappearing messages.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Visa";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ inaktiverade försvinnande meddelanden.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "แสดง";
/* No comment provided by engineer. */
"OK" = "ตกลง";
"BUTTON_OK" = "ตกลง";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ ได้ปิดใช้งานข้อความที่ลบตัวเองแล้ว";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "Show";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ disabled disappearing messages.";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "顯示";
/* No comment provided by engineer. */
"OK" = "OK";
"BUTTON_OK" = "OK";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ 取消了閱後即焚模式";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -269,7 +269,7 @@
/* No comment provided by engineer. */
"NOTIFICATIONS_SHOW" = "显示";
/* No comment provided by engineer. */
"OK" = "好";
"BUTTON_OK" = "好";
/* Info Message when {{other user}} disables or doesn't support disappearing messages */
"OTHER_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION" = "%@ 取消了阅后即焚。";
/* Info Message when {{other user}} updates message expiration to {{time amount}}, see the *_TIME_AMOUNT strings for context. */

View File

@ -124,7 +124,7 @@ final class DisplayNameVC : BaseVC {
@objc private func register() {
func showError(title: String, message: String = "") {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
presentAlert(alert)
}
let displayName = displayNameTextField.text!.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)

View File

@ -124,7 +124,7 @@ final class LinkDeviceVC : BaseVC, UIPageViewControllerDataSource, UIPageViewCon
func continueWithSeed(_ seed: Data) {
if (seed.count != 16) {
let alert = UIAlertController(title: NSLocalizedString("invalid_recovery_phrase", comment: ""), message: NSLocalizedString("Please check the Recovery Phrase and try again.", comment: ""), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: { _ in
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: { _ in
self.scanQRCodeWrapperVC.startCapture()
}))
presentAlert(alert)
@ -273,7 +273,7 @@ private final class RecoveryPhraseVC : UIViewController {
@objc private func handleContinueButtonTapped() {
func showError(title: String, message: String = "") {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
presentAlert(alert)
}
let mnemonic = mnemonicTextView.text!.lowercased()

View File

@ -90,7 +90,7 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
guard selectedOptionView != nil else {
let title = NSLocalizedString("vc_pn_mode_no_option_picked_modal_title", comment: "")
let alert = UIAlertController(title: title, message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
return present(alert, animated: true, completion: nil)
}
UserDefaults.standard[.isUsingFullAPNs] = (selectedOptionView == apnsOptionView)

View File

@ -157,7 +157,7 @@ final class RestoreVC : BaseVC {
@objc private func restore() {
func showError(title: String, message: String = "") {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
presentAlert(alert)
}
let mnemonic = mnemonicTextView.text!.lowercased()

View File

@ -161,7 +161,7 @@ final class JoinOpenGroupVC : BaseVC, UIPageViewControllerDataSource, UIPageView
// MARK: Convenience
private func showError(title: String, message: String = "") {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
presentAlert(alert)
}
}

View File

@ -146,13 +146,13 @@ final class NukeDataModal : Modal {
message = String(format: NSLocalizedString("dialog_clear_all_data_deletion_failed_2", comment: ""), String(potentiallyMaliciousSnodes.count), potentiallyMaliciousSnodes.joined(separator: ", "))
}
let alert = UIAlertController(title: "Error", message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
self?.presentAlert(alert)
}
}.catch(on: DispatchQueue.main) { error in
self?.dismiss(animated: true, completion: nil) // Dismiss the loader
let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
self?.presentAlert(alert)
}
}

View File

@ -123,7 +123,7 @@ final class QRCodeVC : BaseVC, UIPageViewControllerDataSource, UIPageViewControl
fileprivate func startNewPrivateChatIfPossible(with hexEncodedPublicKey: String) {
if !ECKeyPair.isValidHexEncodedPublicKey(candidate: hexEncodedPublicKey) {
let alert = UIAlertController(title: NSLocalizedString("invalid_session_id", comment: ""), message: NSLocalizedString("Please check the Session ID and try again.", comment: ""), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
presentAlert(alert)
} else {
let thread = TSContactThread.getOrCreateThread(contactSessionID: hexEncodedPublicKey)

View File

@ -377,7 +377,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
let title = isMaxFileSizeExceeded ? "Maximum File Size Exceeded" : "Couldn't Update Profile"
let message = isMaxFileSizeExceeded ? "Please select a smaller photo and try again" : "Please check your internet connection and try again"
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
self?.present(alert, animated: true, completion: nil)
}
}
@ -443,7 +443,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
@objc private func handleSaveDisplayNameButtonTapped() {
func showError(title: String, message: String = "") {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
alert.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_OK", comment: ""), style: .default, handler: nil))
presentAlert(alert)
}
let displayName = displayNameTextField.text!.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)

View File

@ -231,7 +231,7 @@ final class ShareVC : UINavigationController, ShareViewDelegate, AppModeManagerD
func shareViewFailed(error: Error) {
let alert = UIAlertController(title: "Session", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK".localized(), style: .default, handler: { _ in
alert.addAction(UIAlertAction(title: "BUTTON_OK".localized(), style: .default, handler: { _ in
self.extensionContext!.cancelRequest(withError: error)
}))
present(alert, animated: true, completion: nil)

View File

@ -155,8 +155,16 @@ final class ThreadPickerVC: UIViewController, UITableViewDataSource, UITableView
let message = VisibleMessage()
message.sentTimestamp = NSDate.millisecondTimestamp()
message.text = messageText
message.text = (isSharingUrl && (messageText?.isEmpty == true || attachments[0].linkPreviewDraft == nil) ?
(
(messageText?.isEmpty == true ?
attachments[0].text() :
"\(attachments[0].text() ?? "")\n\n\(messageText ?? "")"
)
) :
messageText
)
let tsMessage = TSOutgoingMessage.from(message, associatedWith: selectedThread!)
Storage.write(
with: { transaction in

View File

@ -191,6 +191,7 @@ extension AttachmentApprovalInputAccessoryView: AttachmentCaptionToolbarDelegate
return
}
// TODO: Look at refactoring this behaviour to consolidate attachment mutations
currentAttachmentItem.attachment.captionText = attachmentCaptionToolbar.textView.text
delegate?.attachmentApprovalInputUpdateMediaRail()

View File

@ -415,6 +415,9 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
}
private func setupLayout() {
// Plain text will just be put in the 'message' input so do nothing
guard attachment.fileType != .text && attachment.fileType != .oversizeText else { return }
// Sizing calculations
let clampedRatio: CGFloat = {
switch attachment.fileType {

View File

@ -460,7 +460,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
UIAlertController *alert =
[UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BUTTON_OK", nil)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok")
style:UIAlertActionStyleDefault
handler:completionBlock];

View File

@ -57,7 +57,7 @@ import Foundation
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
let actionTitle = buttonTitle ?? NSLocalizedString("OK", comment: "")
let actionTitle = buttonTitle ?? NSLocalizedString("BUTTON_OK", comment: "")
let okAction = UIAlertAction(title: actionTitle, style: .default, handler: buttonAction)
okAction.accessibilityIdentifier = "OWSAlerts.\("ok")"
alert.addAction(okAction)
@ -71,7 +71,7 @@ import Foundation
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(self.cancelAction)
let actionTitle = proceedTitle ?? NSLocalizedString("OK", comment: "")
let actionTitle = proceedTitle ?? NSLocalizedString("BUTTON_OK", comment: "")
let okAction = UIAlertAction(title: actionTitle, style: .default, handler: proceedAction)
okAction.accessibilityIdentifier = "OWSAlerts.\("ok")"
alert.addAction(okAction)