Browse Source

factor out two UIAltertAction

B. Petersen 2 years ago
parent
commit
12023f14dc
1 changed files with 3 additions and 6 deletions
  1. 3 6
      deltachat-ios/Controller/FullMessageViewController.swift

+ 3 - 6
deltachat-ios/Controller/FullMessageViewController.swift

@@ -83,12 +83,9 @@ class FullMessageViewController: WebViewViewController {
         let alert = UIAlertController(title: String.localized("load_remote_content"),
         let alert = UIAlertController(title: String.localized("load_remote_content"),
                                       message: String.localized("load_remote_content_ask"),
                                       message: String.localized("load_remote_content_ask"),
                                       preferredStyle: .safeActionSheet)
                                       preferredStyle: .safeActionSheet)
-        if isContactRequest {
-            alert.addAction(UIAlertAction(title: "\(neverCheckmark)\(String.localized("no"))", style: .default, handler: neverActionPressed(_:)))
-            alert.addAction(UIAlertAction(title: "\(onceCheckmark)\(String.localized("once"))", style: .default, handler: onceActionPressed(_:)))
-        } else {
-            alert.addAction(UIAlertAction(title: "\(neverCheckmark)\(String.localized("never"))", style: .default, handler: neverActionPressed(_:)))
-            alert.addAction(UIAlertAction(title: "\(onceCheckmark)\(String.localized("once"))", style: .default, handler: onceActionPressed(_:)))
+        alert.addAction(UIAlertAction(title: "\(neverCheckmark)\(String.localized(isContactRequest ? "no" : "never"))", style: .default, handler: neverActionPressed(_:)))
+        alert.addAction(UIAlertAction(title: "\(onceCheckmark)\(String.localized("once"))", style: .default, handler: onceActionPressed(_:)))
+        if !isContactRequest {
             alert.addAction(UIAlertAction(title: "\(alwaysCheckmark)\(String.localized("always"))", style: .default, handler: alwaysActionPressed(_:)))
             alert.addAction(UIAlertAction(title: "\(alwaysCheckmark)\(String.localized("always"))", style: .default, handler: alwaysActionPressed(_:)))
         }
         }