From 08c91599b6abb0306832608ef8a2424437fc0215 Mon Sep 17 00:00:00 2001 From: Danny Moesch Date: Sun, 20 Jan 2019 12:15:54 +0100 Subject: [PATCH] Use | operator to concatenate multiline strings --- pass/Controllers/PasswordDetailTableViewController.swift | 2 +- pass/Controllers/PasswordEditorTableViewController.swift | 1 - pass/Controllers/PasswordsViewController.swift | 4 ++-- pass/Controllers/QRScannerController.swift | 3 ++- passKit/Helpers/StringExtension.swift | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pass/Controllers/PasswordDetailTableViewController.swift b/pass/Controllers/PasswordDetailTableViewController.swift index b355876..ac481d8 100644 --- a/pass/Controllers/PasswordDetailTableViewController.swift +++ b/pass/Controllers/PasswordDetailTableViewController.swift @@ -357,7 +357,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni } catch { Utils.alert(title: "Error".localize(), message: error.localizedDescription, controller: self, completion: nil) } - SVProgressHUD.showSuccess(withStatus: "PasswordCopied".localize() + "\n" + "CounterUpdated".localize()) + SVProgressHUD.showSuccess(withStatus: "PasswordCopied".localize() | "CounterUpdated".localize()) SVProgressHUD.dismiss(withDelay: 1) } } diff --git a/pass/Controllers/PasswordEditorTableViewController.swift b/pass/Controllers/PasswordEditorTableViewController.swift index 6ac87dd..f7f9950 100644 --- a/pass/Controllers/PasswordEditorTableViewController.swift +++ b/pass/Controllers/PasswordEditorTableViewController.swift @@ -64,7 +64,6 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl memorablePasswordGeneratorCell?.accessoryType = .disclosureIndicator } - override func viewDidLoad() { super.viewDidLoad() if navigationItemTitle != nil { diff --git a/pass/Controllers/PasswordsViewController.swift b/pass/Controllers/PasswordsViewController.swift index 7fd4b2f..270e792 100644 --- a/pass/Controllers/PasswordsViewController.swift +++ b/pass/Controllers/PasswordsViewController.swift @@ -176,9 +176,9 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV let error = error as NSError var message = error.localizedDescription if let underlyingError = error.userInfo[NSUnderlyingErrorKey] as? NSError { - message = "\(message)\n\("UnderlyingError".localize(underlyingError.localizedDescription))" + message = message | "UnderlyingError".localize(underlyingError.localizedDescription) if underlyingError.localizedDescription.contains("WrongPassphrase".localize()) { - message = "\(message)\n\("RecoverySuggestion".localize())" + message = message | "RecoverySuggestion".localize() gitCredential.delete() } } diff --git a/pass/Controllers/QRScannerController.swift b/pass/Controllers/QRScannerController.swift index f192861..a4b695f 100644 --- a/pass/Controllers/QRScannerController.swift +++ b/pass/Controllers/QRScannerController.swift @@ -10,6 +10,7 @@ import UIKit import AVFoundation import OneTimePassword import SVProgressHUD +import passKit protocol QRScannerControllerDelegate { func checkScannedOutput(line: String) -> (accept: Bool, message: String) @@ -130,7 +131,7 @@ class QRScannerController: UIViewController, AVCaptureMetadataOutputObjectsDeleg func presentCameraSettings() { let alertController = UIAlertController(title: "Error".localize(), - message: "CameraAccessDenied.".localize() + "\n" + "WarningToggleCameraPermissionsResetsApp.".localize(), + message: "CameraAccessDenied.".localize() | "WarningToggleCameraPermissionsResetsApp.".localize(), preferredStyle: .alert) alertController.addAction(UIAlertAction(title: "Cancel".localize(), style: .default)) alertController.addAction(UIAlertAction(title: "Settings".localize(), style: .cancel) { _ in diff --git a/passKit/Helpers/StringExtension.swift b/passKit/Helpers/StringExtension.swift index f083bc4..4f54db7 100644 --- a/passKit/Helpers/StringExtension.swift +++ b/passKit/Helpers/StringExtension.swift @@ -23,7 +23,7 @@ public extension String { } extension String { - static func | (left: String, right: String) -> String { + public static func | (left: String, right: String) -> String { return right.isEmpty ? left : left + "\n" + right } }