Explorar o código

enforce a indentation of 4 spaces using 'swiftformat --rules indent *'

B. Petersen %!s(int64=6) %!d(string=hai) anos
pai
achega
2777eb16aa

+ 1 - 1
deltachat-ios/AppDelegate.swift

@@ -268,7 +268,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
     // MARK: - PushNotifications
 
-	func registerForPushNotifications() {
+    func registerForPushNotifications() {
         UNUserNotificationCenter.current().delegate = self
 
         UNUserNotificationCenter.current()

+ 1 - 1
deltachat-ios/Controller/AccountSetup/SecuritySettingsController.swift

@@ -130,7 +130,7 @@ class SecurityConverter {
         }
     }
 
-	// TODO: discuss if we want to internationalize OFF and Automatic
+    // TODO: discuss if we want to internationalize OFF and Automatic
     static func convertHexToString(type: SecurityType, hex value: Int) -> String {
         switch type {
         case .IMAPSecurity:

+ 6 - 6
deltachat-ios/Controller/AccountSetupController.swift

@@ -58,7 +58,7 @@ class AccountSetupController: UITableViewController {
 
     private lazy var restoreCell: ActionCell = {
         let cell = ActionCell(frame: .zero)
-		cell.actionTitle = String.localized("import_backup_title");
+        cell.actionTitle = String.localized("import_backup_title");
         cell.accessibilityIdentifier = "restoreCell"
         return cell
     }()
@@ -131,8 +131,8 @@ class AccountSetupController: UITableViewController {
 
     lazy var smtpPasswordCell: TextFieldCell = {
         let cell = TextFieldCell(descriptionID: "login_smtp_password", placeholder: "*************", delegate: self)
-		cell.textField.textContentType = UITextContentType.password
-		cell.textField.isSecureTextEntry = true
+        cell.textField.textContentType = UITextContentType.password
+        cell.textField.isSecureTextEntry = true
         cell.accessibilityIdentifier = "SMTPPasswordCell"
         cell.textField.tag = 6
         return cell
@@ -293,7 +293,7 @@ class AccountSetupController: UITableViewController {
         }
     }
 
-	// FIXME: replace if-else-if with switch-case
+    // FIXME: replace if-else-if with switch-case
     override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         guard let tappedCell = tableView.cellForRow(at: indexPath) else { return }
         // handle tap on password -> show oAuthDialogue
@@ -329,7 +329,7 @@ class AccountSetupController: UITableViewController {
         // set flag before delete/insert operation, because cellForRowAt will be triggered and uses this flag
         advancedSectionShowing = willShow
 
-		button.text = String.localized(willShow ? "hide" : "pref_notifications_show")
+        button.text = String.localized(willShow ? "hide" : "pref_notifications_show")
 
         if willShow {
             tableView.insertRows(at: advancedIndexPaths, with: .fade)
@@ -663,7 +663,7 @@ extension AccountSetupController {
     func updateProgressHudSuccess(callback: (()->())?) {
         configProgressAlert.actions[0].isEnabled = false
         configProgressIndicator.alpha = 0
-		configProgressAlert.title = String.localized("login_successful_title")
+        configProgressAlert.title = String.localized("login_successful_title")
         configProgressAlert.message = String.localized("login_successful_message")
         loginButton.isEnabled = dc_is_configured(mailboxPointer) == 0
         DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: {

+ 18 - 18
deltachat-ios/Controller/ChatListController.swift

@@ -173,7 +173,7 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
         // assigning swipe by delete to chats
         let delete = UITableViewRowAction(style: .destructive, title: String.localized("global_menu_edit_delete_desktop")) { [unowned self] _, indexPath in
             let chatId = chatList.getChatId(index: row)
-			self.showDeleteChatConfirmationAlert(chatId: chatId)
+            self.showDeleteChatConfirmationAlert(chatId: chatId)
         }
         delete.backgroundColor = UIColor.red
         return [delete]
@@ -181,22 +181,22 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
 }
 
 extension ChatListController {
-	private func showDeleteChatConfirmationAlert(chatId: Int) {
-		let alert = UIAlertController(
-			title: String.localized("ask_delete_chat_desktop"),
-			message: nil,
-			preferredStyle: .alert
-		)
-		alert.addAction(UIAlertAction(title: String.localized("global_menu_edit_delete_desktop"), style: .default, handler: { action in
-			self.deleteChat(chatId: chatId)
-		}))
-		alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
-		self.present(alert, animated: true, completion: nil)
-	}
-	
-	private func deleteChat(chatId: Int) {
-		dc_delete_chat(mailboxPointer, UInt32(chatId))
-		self.getChatList()
-	}
+    private func showDeleteChatConfirmationAlert(chatId: Int) {
+        let alert = UIAlertController(
+            title: String.localized("ask_delete_chat_desktop"),
+            message: nil,
+            preferredStyle: .alert
+        )
+        alert.addAction(UIAlertAction(title: String.localized("global_menu_edit_delete_desktop"), style: .default, handler: { action in
+            self.deleteChat(chatId: chatId)
+        }))
+        alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
+        self.present(alert, animated: true, completion: nil)
+    }
+
+    private func deleteChat(chatId: Int) {
+        dc_delete_chat(mailboxPointer, UInt32(chatId))
+        self.getChatList()
+    }
 
 }

+ 127 - 127
deltachat-ios/Controller/ChatViewController.swift

@@ -251,7 +251,7 @@ class ChatViewController: MessagesViewController {
 
         if disableWriting {
             menuItems = [
-				UIMenuItem(title: String.localized("start_chat"), action: #selector(MessageCollectionViewCell.messageStartChat(_:))),
+                UIMenuItem(title: String.localized("start_chat"), action: #selector(MessageCollectionViewCell.messageStartChat(_:))),
                 UIMenuItem(title: String.localized("dismiss"), action: #selector(MessageCollectionViewCell.messageDismiss(_:))),
                 UIMenuItem(title: String.localized("menu_block_contact"), action: #selector(MessageCollectionViewCell.messageBlock(_:))),
             ]
@@ -1212,35 +1212,35 @@ extension MessageCollectionViewCell {
 
 
  /*
-  	let layout = messagesCollectionView.collectionViewLayout as? MessagesCollectionViewFlowLayout
-  	layout?.sectionInset = UIEdgeInsets(top: 1, left: 8, bottom: 1, right: 8)
-
-  	// Hide the outgoing avatar and adjust the label alignment to line up with the messages
-  	layout?.setMessageOutgoingAvatarSize(.zero)
-  	layout?.setMessageOutgoingMessageTopLabelAlignment(LabelAlignment(textAlignment: .right, textInsets: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 8)))
-  	layout?.setMessageOutgoingMessageBottomLabelAlignment(LabelAlignment(textAlignment: .right, textInsets: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 8)))
-
-  	// Set outgoing avatar to overlap with the message bubble
-  	if isGroupChat {
-  		layout?.setMessageIncomingMessageTopLabelAlignment(LabelAlignment(textAlignment: .left, textInsets: UIEdgeInsets(top: 0, left: 18, bottom: outgoingAvatarOverlap, right: 0)))
-  		layout?.setMessageIncomingAvatarSize(CGSize(width: 30, height: 30))
-  		layout?.setMessageIncomingMessagePadding(UIEdgeInsets(top: -outgoingAvatarOverlap, left: -18, bottom: outgoingAvatarOverlap / 2, right: 18))
-  		layout?.setMessageIncomingMessageBottomLabelAlignment(LabelAlignment(textAlignment: .left, textInsets: UIEdgeInsets(top: -7, left: 38, bottom: 0, right: 0)))
-
-  	} else {
-  		layout?.setMessageIncomingMessageTopLabelAlignment(LabelAlignment(textAlignment: .left, textInsets: UIEdgeInsets(top: 0, left: 0, bottom: 5, right: 0)))
-  		layout?.setMessageIncomingAvatarSize(CGSize.zero) // no batch displayed in singleChats
-  		layout?.setMessageIncomingMessagePadding(UIEdgeInsets(top: -outgoingAvatarOverlap, left: 0, bottom: outgoingAvatarOverlap / 2, right: 18))
-  		layout?.setMessageIncomingMessageBottomLabelAlignment(LabelAlignment(textAlignment: .left, textInsets: UIEdgeInsets(top: -7, left: 12, bottom: 0, right: 0)))
-  	}
-
-  	layout?.setMessageIncomingAccessoryViewSize(CGSize(width: 30, height: 30))
-  	layout?.setMessageIncomingAccessoryViewPadding(HorizontalEdgeInsets(left: 8, right: 0))
-  	layout?.setMessageOutgoingAccessoryViewSize(CGSize(width: 30, height: 30))
-  	layout?.setMessageOutgoingAccessoryViewPadding(HorizontalEdgeInsets(left: 0, right: 8))
-
-  	messagesCollectionView.messagesLayoutDelegate = self
-  	messagesCollectionView.messagesDisplayDelegate = self
+   	let layout = messagesCollectionView.collectionViewLayout as? MessagesCollectionViewFlowLayout
+   	layout?.sectionInset = UIEdgeInsets(top: 1, left: 8, bottom: 1, right: 8)
+
+   	// Hide the outgoing avatar and adjust the label alignment to line up with the messages
+   	layout?.setMessageOutgoingAvatarSize(.zero)
+   	layout?.setMessageOutgoingMessageTopLabelAlignment(LabelAlignment(textAlignment: .right, textInsets: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 8)))
+   	layout?.setMessageOutgoingMessageBottomLabelAlignment(LabelAlignment(textAlignment: .right, textInsets: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 8)))
+
+   	// Set outgoing avatar to overlap with the message bubble
+   	if isGroupChat {
+   		layout?.setMessageIncomingMessageTopLabelAlignment(LabelAlignment(textAlignment: .left, textInsets: UIEdgeInsets(top: 0, left: 18, bottom: outgoingAvatarOverlap, right: 0)))
+   		layout?.setMessageIncomingAvatarSize(CGSize(width: 30, height: 30))
+   		layout?.setMessageIncomingMessagePadding(UIEdgeInsets(top: -outgoingAvatarOverlap, left: -18, bottom: outgoingAvatarOverlap / 2, right: 18))
+   		layout?.setMessageIncomingMessageBottomLabelAlignment(LabelAlignment(textAlignment: .left, textInsets: UIEdgeInsets(top: -7, left: 38, bottom: 0, right: 0)))
+
+   	} else {
+   		layout?.setMessageIncomingMessageTopLabelAlignment(LabelAlignment(textAlignment: .left, textInsets: UIEdgeInsets(top: 0, left: 0, bottom: 5, right: 0)))
+   		layout?.setMessageIncomingAvatarSize(CGSize.zero) // no batch displayed in singleChats
+   		layout?.setMessageIncomingMessagePadding(UIEdgeInsets(top: -outgoingAvatarOverlap, left: 0, bottom: outgoingAvatarOverlap / 2, right: 18))
+   		layout?.setMessageIncomingMessageBottomLabelAlignment(LabelAlignment(textAlignment: .left, textInsets: UIEdgeInsets(top: -7, left: 12, bottom: 0, right: 0)))
+   	}
+
+   	layout?.setMessageIncomingAccessoryViewSize(CGSize(width: 30, height: 30))
+   	layout?.setMessageIncomingAccessoryViewPadding(HorizontalEdgeInsets(left: 8, right: 0))
+   	layout?.setMessageOutgoingAccessoryViewSize(CGSize(width: 30, height: 30))
+   	layout?.setMessageOutgoingAccessoryViewPadding(HorizontalEdgeInsets(left: 0, right: 8))
+
+   	messagesCollectionView.messagesLayoutDelegate = self
+   	messagesCollectionView.messagesDisplayDelegate = self
   */
  }
 
@@ -1297,19 +1297,19 @@ extension MessageCollectionViewCell {
  				self.clipperButtonPressed()
  		}
  /*
-  		InputBarButtonItem()
-  		.configure {
-  		$0.spacing = .fixed(0)
-  		$0.image = UIImage(named: "camera")?.withRenderingMode(.alwaysTemplate)
-  		$0.setSize(CGSize(width: 36, height: 36), animated: false)
-  		$0.tintColor = UIColor(white: 0.8, alpha: 1)
-  		}.onSelected {
-  		$0.tintColor = DCColors.primary
-  		}.onDeselected {
-  		$0.tintColor = UIColor(white: 0.8, alpha: 1)
-  		}.onTouchUpInside { _ in
-  		self.didPressPhotoButton()
-  		},
+   		InputBarButtonItem()
+   		.configure {
+   		$0.spacing = .fixed(0)
+   		$0.image = UIImage(named: "camera")?.withRenderingMode(.alwaysTemplate)
+   		$0.setSize(CGSize(width: 36, height: 36), animated: false)
+   		$0.tintColor = UIColor(white: 0.8, alpha: 1)
+   		}.onSelected {
+   		$0.tintColor = DCColors.primary
+   		}.onDeselected {
+   		$0.tintColor = UIColor(white: 0.8, alpha: 1)
+   		}.onTouchUpInside { _ in
+   		self.didPressPhotoButton()
+   		},
   */
  	]
 
@@ -1666,23 +1666,23 @@ extension MessageCollectionViewCell {
 
 
  /*
-  extension ChatViewController: MessagesDisplayDelegate {
-  // MARK: - Text Messages
-  func textColor(for _: MessageType, at _: IndexPath, in _: MessagesCollectionView) -> UIColor {
-  	return .darkText
-  }
+   extension ChatViewController: MessagesDisplayDelegate {
+   // MARK: - Text Messages
+   func textColor(for _: MessageType, at _: IndexPath, in _: MessagesCollectionView) -> UIColor {
+   	return .darkText
+   }
 
-  // MARK: - All Messages
-  func backgroundColor(for message: MessageType, at _: IndexPath, in _: MessagesCollectionView) -> UIColor {
-  	return isFromCurrentSender(message: message) ? DCColors.messagePrimaryColor : DCColors.messageSecondaryColor
-  }
+   // MARK: - All Messages
+   func backgroundColor(for message: MessageType, at _: IndexPath, in _: MessagesCollectionView) -> UIColor {
+   	return isFromCurrentSender(message: message) ? DCColors.messagePrimaryColor : DCColors.messageSecondaryColor
+   }
 
 
 
-  func enabledDetectors(for _: MessageType, at _: IndexPath, in _: MessagesCollectionView) -> [DetectorType] {
-  	return [.url, .date, .phoneNumber, .address]
-  }
-  }
+   func enabledDetectors(for _: MessageType, at _: IndexPath, in _: MessagesCollectionView) -> [DetectorType] {
+   	return [.url, .date, .phoneNumber, .address]
+   }
+   }
   */
 
  // MARK: - MessagesLayoutDelegate
@@ -1700,56 +1700,56 @@ extension MessageCollectionViewCell {
  }
 
  /*
-  extension ChatViewController: MessagesLayoutDelegate {
-  func cellTopLabelHeight(for _: MessageType, at indexPath: IndexPath, in _: MessagesCollectionView) -> CGFloat {
-  	if isTimeLabelVisible(at: indexPath) {
-  		return 18
-  	}
-  	return !isPreviousMessageSameSender(at: indexPath) ? 18 : 0
-  }
-
-  func messageTopLabelHeight(for message: MessageType, at indexPath: IndexPath, in _: MessagesCollectionView) -> CGFloat {
-  	if isInfoMessage(at: indexPath) {
-  		return 0
-  	}
-
-  	if isFromCurrentSender(message: message) {
-  		if !isGroupChat {
-  			return !isPreviousMessageSameSender(at: indexPath) ? 20 : 0
-  		} else {
-  			return !isPreviousMessageSameSender(at: indexPath) ? 20 : 0
-  		}
-  	} else {
-  		if !isGroupChat {
-  			return !isPreviousMessageSameSender(at: indexPath) ? 20 : 0
-  		} else {
-  			return !isPreviousMessageSameSender(at: indexPath) ? (20 + outgoingAvatarOverlap) : 0
-  		}
-  	}
-  }
-
-  func messageBottomLabelHeight(for message: MessageType, at indexPath: IndexPath, in _: MessagesCollectionView) -> CGFloat {
-  	if isInfoMessage(at: indexPath) {
-  		return 0
-  	}
-
-  	if !isNextMessageSameSender(at: indexPath) {
-  		return 16
-  	}
-
-  	if isFromCurrentSender(message: message) {
-  		return 0
-  	}
-  	return 0
-  }
-
-  func heightForLocation(message _: MessageType, at _: IndexPath, with _: CGFloat, in _: MessagesCollectionView) -> CGFloat {
-  	return 40
-  }
-
-  func footerViewSize(for _: MessageType, at _: IndexPath, in messagesCollectionView: MessagesCollectionView) -> CGSize {
-  	return CGSize(width: messagesCollectionView.bounds.width, height: 10)
-  }
+   extension ChatViewController: MessagesLayoutDelegate {
+   func cellTopLabelHeight(for _: MessageType, at indexPath: IndexPath, in _: MessagesCollectionView) -> CGFloat {
+   	if isTimeLabelVisible(at: indexPath) {
+   		return 18
+   	}
+   	return !isPreviousMessageSameSender(at: indexPath) ? 18 : 0
+   }
+
+   func messageTopLabelHeight(for message: MessageType, at indexPath: IndexPath, in _: MessagesCollectionView) -> CGFloat {
+   	if isInfoMessage(at: indexPath) {
+   		return 0
+   	}
+
+   	if isFromCurrentSender(message: message) {
+   		if !isGroupChat {
+   			return !isPreviousMessageSameSender(at: indexPath) ? 20 : 0
+   		} else {
+   			return !isPreviousMessageSameSender(at: indexPath) ? 20 : 0
+   		}
+   	} else {
+   		if !isGroupChat {
+   			return !isPreviousMessageSameSender(at: indexPath) ? 20 : 0
+   		} else {
+   			return !isPreviousMessageSameSender(at: indexPath) ? (20 + outgoingAvatarOverlap) : 0
+   		}
+   	}
+   }
+
+   func messageBottomLabelHeight(for message: MessageType, at indexPath: IndexPath, in _: MessagesCollectionView) -> CGFloat {
+   	if isInfoMessage(at: indexPath) {
+   		return 0
+   	}
+
+   	if !isNextMessageSameSender(at: indexPath) {
+   		return 16
+   	}
+
+   	if isFromCurrentSender(message: message) {
+   		return 0
+   	}
+   	return 0
+   }
+
+   func heightForLocation(message _: MessageType, at _: IndexPath, with _: CGFloat, in _: MessagesCollectionView) -> CGFloat {
+   	return 40
+   }
+
+   func footerViewSize(for _: MessageType, at _: IndexPath, in messagesCollectionView: MessagesCollectionView) -> CGSize {
+   	return CGSize(width: messagesCollectionView.bounds.width, height: 10)
+   }
   */
 
  extension ChatViewController {
@@ -1887,25 +1887,25 @@ extension MessageCollectionViewCell {
 
  // MARK: - LocationMessageDisplayDelegate
  /*
-  extension ChatViewController: LocationMessageDisplayDelegate {
-  func annotationViewForLocation(message: MessageType, at indexPath: IndexPath, in messageCollectionView: MessagesCollectionView) -> MKAnnotationView? {
-  let annotationView = MKAnnotationView(annotation: nil, reuseIdentifier: nil)
-  let pinImage = #imageLiteral(resourceName: "ic_block_36pt").withRenderingMode(.alwaysTemplate)
-  annotationView.image = pinImage
-  annotationView.centerOffset = CGPoint(x: 0, y: -pinImage.size.height / 2)
-  return annotationView
-  }
-  func animationBlockForLocation(message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> ((UIImageView) -> Void)? {
-  return { view in
-  view.layer.transform = CATransform3DMakeScale(0, 0, 0)
-  view.alpha = 0.0
-  UIView.animate(withDuration: 0.6, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 0, options: [], animations: {
-  view.layer.transform = CATransform3DIdentity
-  view.alpha = 1.0
-  }, completion: nil)
-  }
-  }
-  }
+   extension ChatViewController: LocationMessageDisplayDelegate {
+   func annotationViewForLocation(message: MessageType, at indexPath: IndexPath, in messageCollectionView: MessagesCollectionView) -> MKAnnotationView? {
+   let annotationView = MKAnnotationView(annotation: nil, reuseIdentifier: nil)
+   let pinImage = #imageLiteral(resourceName: "ic_block_36pt").withRenderingMode(.alwaysTemplate)
+   annotationView.image = pinImage
+   annotationView.centerOffset = CGPoint(x: 0, y: -pinImage.size.height / 2)
+   return annotationView
+   }
+   func animationBlockForLocation(message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> ((UIImageView) -> Void)? {
+   return { view in
+   view.layer.transform = CATransform3DMakeScale(0, 0, 0)
+   view.alpha = 0.0
+   UIView.animate(withDuration: 0.6, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 0, options: [], animations: {
+   view.layer.transform = CATransform3DIdentity
+   view.alpha = 1.0
+   }, completion: nil)
+   }
+   }
+   }
   */
 
  // MARK: - MessageInputBarDelegate
@@ -1919,8 +1919,8 @@ extension MessageCollectionViewCell {
  }
 
  /*
-  extension ChatViewController: MessageInputBarDelegate {
-  }
+   extension ChatViewController: MessageInputBarDelegate {
+   }
   */
 
  // MARK: - MessageCollectionViewCell

+ 1 - 1
deltachat-ios/Controller/NewProfileViewController.swift

@@ -217,7 +217,7 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
                     if chatId != 0 {
                         self.coordinator?.showChat(chatId: chatId)
                     } else if errorString != nil {
-                       self.showErrorAlert(error: errorString!)
+                        self.showErrorAlert(error: errorString!)
                     }
                 }
             }

+ 2 - 2
deltachat-ios/Controller/ProfileViewController.swift

@@ -77,8 +77,8 @@ class ProfileViewController: UITableViewController {
         if indexPath.section == 0 {
             if row == 0 {
                 if let fingerprint = self.fingerprint {
-					//FIXME: this formatting is not correct for r-t-l languages
-					//keeping it simple for now as it is not clear if we will show the FP this way
+                    //FIXME: this formatting is not correct for r-t-l languages
+                    //keeping it simple for now as it is not clear if we will show the FP this way
                     cell.textLabel?.text = String.localized("qrscan_fingerprint_label") + ": \(fingerprint)"
                     cell.textLabel?.textAlignment = .center
                 }

+ 13 - 13
deltachat-ios/Controller/QrCodeReaderController.swift

@@ -18,12 +18,12 @@ class QrCodeReaderController: UIViewController {
         title = String.localized("qrscan_title")
 
         guard let captureDevice = AVCaptureDevice.DiscoverySession.init(
-			deviceTypes: [AVCaptureDevice.DeviceType.builtInWideAngleCamera],
-			mediaType: .video,
-			position: .back).devices.first else {
-				print("Failed to get the camera device")
-				return
-		}
+            deviceTypes: [AVCaptureDevice.DeviceType.builtInWideAngleCamera],
+            mediaType: .video,
+            position: .back).devices.first else {
+            print("Failed to get the camera device")
+            return
+        }
 
         do {
             let input = try AVCaptureDeviceInput(device: captureDevice)
@@ -64,12 +64,12 @@ class QrCodeReaderController: UIViewController {
     }
 
 
-	override func viewWillAppear(_ animated: Bool) {
-		captureSession.startRunning()
-	}
-	override func viewWillDisappear(_ animated: Bool) {
-		captureSession.stopRunning()
-	}
+    override func viewWillAppear(_ animated: Bool) {
+        captureSession.startRunning()
+    }
+    override func viewWillDisappear(_ animated: Bool) {
+        captureSession.stopRunning()
+    }
 
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
@@ -84,7 +84,7 @@ extension QrCodeReaderController: AVCaptureMetadataOutputObjectsDelegate {
 
         if supportedCodeTypes.contains(metadataObj.type) {
             if metadataObj.stringValue != nil {
-				self.delegate?.handleQrCode(metadataObj.stringValue!)
+                self.delegate?.handleQrCode(metadataObj.stringValue!)
             }
         }
     }

+ 16 - 16
deltachat-ios/Controller/SettingsController.swift

@@ -14,14 +14,14 @@ internal final class SettingsViewController: QuickTableViewController {
         return hudHandler
     }()
 
-	static let e2eeEnabled: Int = 1
-	static let readReceipts: Int = 2
-	static let watchInbox: Int = 3
-	static let watchSentbox: Int = 4
-	static let watchMvBox: Int = 5
-	static let MvToMvbox: Int = 6
-	static let SaveMimeHeaders: Int = 7
-	private typealias SVC = SettingsViewController
+    static let e2eeEnabled: Int = 1
+    static let readReceipts: Int = 2
+    static let watchInbox: Int = 3
+    static let watchSentbox: Int = 4
+    static let watchMvBox: Int = 5
+    static let MvToMvbox: Int = 6
+    static let SaveMimeHeaders: Int = 7
+    private typealias SVC = SettingsViewController
 
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -103,13 +103,13 @@ internal final class SettingsViewController: QuickTableViewController {
             Section(
                 title: String.localized("user_details"),
                 rows: [
-					//FIXME: fix action callback!
+                    //FIXME: fix action callback!
                     NavigationRow(text: String.localized("display_name"), detailText: .value1(DCConfig.displayname ?? ""), action: {
-						[weak self] in self?.editNameAndStatus($0, option: SettingsEditOption.DISPLAYNAME)
-					}),
-					NavigationRow(text: String.localized("status"), detailText: .value1(DCConfig.selfstatus ?? ""), action: {
-						[weak self] in self?.editNameAndStatus($0, option: SettingsEditOption.STATUS)
-					}),
+                        [weak self] in self?.editNameAndStatus($0, option: SettingsEditOption.DISPLAYNAME)
+                    }),
+                    NavigationRow(text: String.localized("status"), detailText: .value1(DCConfig.selfstatus ?? ""), action: {
+                        [weak self] in self?.editNameAndStatus($0, option: SettingsEditOption.STATUS)
+                    }),
                     TapActionRow(text: String.localized("configure_my_account"), action: { [weak self] in self?.presentAccountSetup($0) }),
                 ]
             ),
@@ -138,7 +138,7 @@ internal final class SettingsViewController: QuickTableViewController {
     }
 
     // FIXME: simplify this method
-	private func editCell(key: Int) -> (Row) -> Void {
+    private func editCell(key: Int) -> (Row) -> Void {
         return { sender in
             logger.info("row edit", sender.text)
 
@@ -224,7 +224,7 @@ internal final class SettingsViewController: QuickTableViewController {
         coordinator?.showAccountSetupController()
     }
 
-	private func editNameAndStatus(_ row: Row, option: SettingsEditOption) {
+    private func editNameAndStatus(_ row: Row, option: SettingsEditOption) {
         coordinator?.showEditSettingsController(option: option)
     }
 }

+ 8 - 8
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -19,7 +19,7 @@ class AppCoordinator: NSObject, Coordinator {
         // put viewControllers here
         tabBarController.delegate = self
         tabBarController.tabBar.tintColor = DCColors.primary
-		tabBarController.tabBar.backgroundColor = .white
+        tabBarController.tabBar.backgroundColor = .white
         return tabBarController
     }()
 
@@ -189,9 +189,9 @@ class MailboxCoordinator: ChatViewCoordinator {
 }
 
 class ProfileCoordinator: Coordinator {
-	var navigationController: UINavigationController
-	init(navigationController: UINavigationController) {
-		self.navigationController = navigationController
+    var navigationController: UINavigationController
+    init(navigationController: UINavigationController) {
+        self.navigationController = navigationController
     }
 
     func showChat(chatId: Int) {
@@ -283,8 +283,8 @@ class AccountSetupCoordinator: Coordinator {
         let currentSecurityOption = DCConfig.getImapSecurity()
         let convertedOption = SecurityConverter.convertHexToString(type: .IMAPSecurity, hex: currentSecurityOption)
         let securitySettingsController = SecuritySettingsController(title: String.localized("login_imap_security"),
-																	options: ["Automatic", "SSL / TLS", "STARTTLS", "OFF"],
-																	selectedOption: convertedOption)
+                                                                    options: ["Automatic", "SSL / TLS", "STARTTLS", "OFF"],
+                                                                    selectedOption: convertedOption)
         securitySettingsController.onDismiss = {
             option in
             if let secValue = SecurityValue(rawValue: option) {
@@ -310,8 +310,8 @@ class AccountSetupCoordinator: Coordinator {
         let currentSecurityOption = DCConfig.getSmtpSecurity()
         let convertedOption = SecurityConverter.convertHexToString(type: .SMTPSecurity, hex: currentSecurityOption)
         let securitySettingsController = SecuritySettingsController(title: String.localized("login_imap_security"),
-																	options: ["Automatic", "SSL / TLS", "STARTTLS", "OFF"],
-																	selectedOption: convertedOption)
+                                                                    options: ["Automatic", "SSL / TLS", "STARTTLS", "OFF"],
+                                                                    selectedOption: convertedOption)
         securitySettingsController.onDismiss = {
             option in
             if let secValue = SecurityValue(rawValue: option) {

+ 46 - 46
deltachat-ios/DC/Wrapper.swift

@@ -98,31 +98,31 @@ class DCContact {
 }
 
 class DcContext {
-	let contextPointer: OpaquePointer
+    let contextPointer: OpaquePointer
 
-	init() {
-		contextPointer = dc_context_new(callback_ios, nil, "iOS")
-	}
+    init() {
+        contextPointer = dc_context_new(callback_ios, nil, "iOS")
+    }
 
-	deinit {
-		dc_context_unref(contextPointer)
-	}
+    deinit {
+        dc_context_unref(contextPointer)
+    }
 
 
-	func getSecurejoinQr (chatId: Int) -> String? {
-		if let cString = dc_get_securejoin_qr(self.contextPointer,  UInt32(chatId)) {
-			return String(cString: cString)
-		}
-		return nil
-	}
+    func getSecurejoinQr (chatId: Int) -> String? {
+        if let cString = dc_get_securejoin_qr(self.contextPointer,  UInt32(chatId)) {
+            return String(cString: cString)
+        }
+        return nil
+    }
 
-	func joinSecurejoin (qrCode: String) -> Int {
-		return Int(dc_join_securejoin(contextPointer, qrCode))
-	}
+    func joinSecurejoin (qrCode: String) -> Int {
+        return Int(dc_join_securejoin(contextPointer, qrCode))
+    }
 
-	func checkQR(qrCode: String) -> DcLot {
-		return DcLot(dc_check_qr(contextPointer, qrCode))
-	}
+    func checkQR(qrCode: String) -> DcLot {
+        return DcLot(dc_check_qr(contextPointer, qrCode))
+    }
 
     func stopOngoingProcess() {
         dc_stop_ongoing_process(contextPointer)
@@ -138,41 +138,41 @@ class DcContext {
 }
 
 class DcLot {
-	private var dcLotPointer: OpaquePointer
+    private var dcLotPointer: OpaquePointer
 
-	init(_ dcLotPointer: OpaquePointer) {
-		self.dcLotPointer = dcLotPointer
-	}
+    init(_ dcLotPointer: OpaquePointer) {
+        self.dcLotPointer = dcLotPointer
+    }
 
-	deinit {
-		dc_lot_unref(dcLotPointer)
-	}
+    deinit {
+        dc_lot_unref(dcLotPointer)
+    }
 
-	var text1: String {
-		guard let result = dc_lot_get_text1(dcLotPointer) else { return "" }
-		return String(cString: result)
-	}
+    var text1: String {
+        guard let result = dc_lot_get_text1(dcLotPointer) else { return "" }
+        return String(cString: result)
+    }
 
-	var text1Meaning: Int {
-		return Int(dc_lot_get_text1_meaning(dcLotPointer))
-	}
+    var text1Meaning: Int {
+        return Int(dc_lot_get_text1_meaning(dcLotPointer))
+    }
 
-	var getText2: String {
-		guard let result = dc_lot_get_text2(dcLotPointer) else { return "" }
-		return String(cString: result)
-	}
+    var getText2: String {
+        guard let result = dc_lot_get_text2(dcLotPointer) else { return "" }
+        return String(cString: result)
+    }
 
-	var timestamp: Int64 {
-		return Int64(dc_lot_get_timestamp(dcLotPointer))
-	}
+    var timestamp: Int64 {
+        return Int64(dc_lot_get_timestamp(dcLotPointer))
+    }
 
-	var state: Int {
-		return Int(dc_lot_get_state(dcLotPointer))
-	}
+    var state: Int {
+        return Int(dc_lot_get_state(dcLotPointer))
+    }
 
-	var id: Int {
-		return Int(dc_lot_get_id(dcLotPointer))
-	}
+    var id: Int {
+        return Int(dc_lot_get_id(dcLotPointer))
+    }
 }
 
 class DCMessage: MessageType {

+ 18 - 18
deltachat-ios/Helper/Extensions.swift

@@ -47,24 +47,24 @@ extension String {
         return attributedText
     }
 
-	static func localized(_ stringID: String) -> String {
-		let value = NSLocalizedString(stringID, comment: "")
-		if value != stringID || NSLocale.preferredLanguages.first == "en" {
-			return value
-		}
-
-		guard
-			let path = Bundle.main.path(forResource: "en", ofType: "lproj"),
-			let bundle = Bundle(path: path)
-			else { return value }
-		return NSLocalizedString(stringID, bundle: bundle, comment: "")
-	}
-
-	static func localized(stringID: String, count: Int) -> String {
-		let formatString: String = localized(stringID)
-		let resultString: String = String.localizedStringWithFormat(formatString, count)
-		return resultString;
-	}
+    static func localized(_ stringID: String) -> String {
+        let value = NSLocalizedString(stringID, comment: "")
+        if value != stringID || NSLocale.preferredLanguages.first == "en" {
+            return value
+        }
+
+        guard
+            let path = Bundle.main.path(forResource: "en", ofType: "lproj"),
+            let bundle = Bundle(path: path)
+        else { return value }
+        return NSLocalizedString(stringID, bundle: bundle, comment: "")
+    }
+
+    static func localized(stringID: String, count: Int) -> String {
+        let formatString: String = localized(stringID)
+        let resultString: String = String.localizedStringWithFormat(formatString, count)
+        return resultString;
+    }
 }
 
 extension URL {

+ 17 - 17
deltachat-ios/Helper/UIImage+Extension.swift

@@ -24,26 +24,26 @@ extension UIImage {
         self.init(cgImage: cgImage)
     }
 
-	func resizeImage(targetSize: CGSize) -> UIImage {
-		let size = self.size
+    func resizeImage(targetSize: CGSize) -> UIImage {
+        let size = self.size
 
-		let widthRatio  = targetSize.width  / size.width
-		let heightRatio = targetSize.height / size.height
+        let widthRatio  = targetSize.width  / size.width
+        let heightRatio = targetSize.height / size.height
 
-		var newSize: CGSize
-		if(widthRatio > heightRatio) {
-			newSize = CGSize(width: size.width * heightRatio, height: size.height * heightRatio)
-		} else {
-			newSize = CGSize(width: size.width * widthRatio, height: size.height *      widthRatio)
-		}
+        var newSize: CGSize
+        if(widthRatio > heightRatio) {
+            newSize = CGSize(width: size.width * heightRatio, height: size.height * heightRatio)
+        } else {
+            newSize = CGSize(width: size.width * widthRatio, height: size.height *      widthRatio)
+        }
 
-		let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)
+        let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)
 
-		UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0)
-		draw(in: rect)
-		let newImage = UIGraphicsGetImageFromCurrentImageContext()
-		UIGraphicsEndImageContext()
+        UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0)
+        draw(in: rect)
+        let newImage = UIGraphicsGetImageFromCurrentImageContext()
+        UIGraphicsEndImageContext()
 
-		return newImage!
-	}
+        return newImage!
+    }
 }

+ 2 - 2
deltachat-ios/Helper/Utils.swift

@@ -155,8 +155,8 @@ struct Utils {
 }
 
 class DateUtils {
-	// TODO: refactor that, it's an improper way for localizations, use stringsdict instead
-	// blocked by: converting androids plurals xml entries to stringsdict
+    // TODO: refactor that, it's an improper way for localizations, use stringsdict instead
+    // blocked by: converting androids plurals xml entries to stringsdict
     static func getBriefRelativeTimeSpanString(timeStamp: Int) -> String {
         let unixTime = Int(Date().timeIntervalSince1970)
         let seconds = unixTime - timeStamp

+ 2 - 2
deltachat-ios/View/ProgressHud.swift

@@ -34,8 +34,8 @@ class ProgressHud {
 
     func progress(_ progress: Int) {
         hud.progress = Float(progress) / 1000.0
-		hud.detailTextLabel.text = "\(progress / 10)% \(String.localized("complete"))"
-	}
+        hud.detailTextLabel.text = "\(progress / 10)% \(String.localized("complete"))"
+    }
 
     init(_ text: String, in view: UIView) {
         hud = JGProgressHUD(style: .dark)

+ 7 - 7
deltachat-ios/View/TextFieldCell.swift

@@ -26,10 +26,10 @@ class TextFieldCell: UITableViewCell {
         setupViews()
         textField.delegate = delegate
     }
-	
-	convenience init(descriptionID: String, placeholder: String, delegate: UITextFieldDelegate? = nil) {
-		self.init(description: String.localized(descriptionID), placeholder: placeholder, delegate: delegate)
-	}
+
+    convenience init(descriptionID: String, placeholder: String, delegate: UITextFieldDelegate? = nil) {
+        self.init(description: String.localized(descriptionID), placeholder: placeholder, delegate: delegate)
+    }
 
     required init?(coder _: NSCoder) {
         fatalError("init(coder:) has not been implemented")
@@ -76,7 +76,7 @@ class TextFieldCell: UITableViewCell {
     }
 
     static func makeEmailCell(delegate: UITextFieldDelegate? = nil) -> TextFieldCell {
-		let cell = TextFieldCell(description: String.localized("email_address"), placeholder: "you@example.com")
+        let cell = TextFieldCell(description: String.localized("email_address"), placeholder: "you@example.com")
         cell.textField.keyboardType = .emailAddress
         // switch off quicktype
         cell.textField.autocorrectionType = .no
@@ -86,7 +86,7 @@ class TextFieldCell: UITableViewCell {
     }
 
     static func makePasswordCell(delegate _: UITextFieldDelegate? = nil) -> TextFieldCell {
-		let cell = TextFieldCell(description: String.localized("password"), placeholder: String.localized("imap_password"))
+        let cell = TextFieldCell(description: String.localized("password"), placeholder: String.localized("imap_password"))
         cell.textField.textContentType = UITextContentType.password
         cell.textField.isSecureTextEntry = true
         return cell
@@ -106,7 +106,7 @@ class TextFieldCell: UITableViewCell {
     }
 
     static func makeConfigCell(labelID: String, placeholderID: String, delegate: UITextFieldDelegate? = nil) -> TextFieldCell {
-		let cell = TextFieldCell(description: String.localized(labelID), placeholder: String.localized(placeholderID))
+        let cell = TextFieldCell(description: String.localized(labelID), placeholder: String.localized(placeholderID))
         cell.textField.autocapitalizationType = .words
         cell.textField.autocorrectionType = .no
         // .namePhonePad doesn't support autocapitalization