Эх сурвалжийг харах

Merge pull request #170 from deltachat/cleanup

cleanup
björn petersen 6 жил өмнө
parent
commit
f15345b461
27 өөрчлөгдсөн 411 нэмэгдсэн , 403 устгасан
  1. 3 2
      .swiftlint.yml
  2. 3 2
      deltachat-ios/AppDelegate.swift
  3. 1 3
      deltachat-ios/Controller/AccountSetup/PortSettingsController.swift
  4. 2 2
      deltachat-ios/Controller/AccountSetup/SecuritySettingsController.swift
  5. 16 12
      deltachat-ios/Controller/AccountSetupController.swift
  6. 18 18
      deltachat-ios/Controller/ChatListController.swift
  7. 154 140
      deltachat-ios/Controller/ChatViewController.swift
  8. 6 3
      deltachat-ios/Controller/ContactDetailViewController.swift
  9. 1 1
      deltachat-ios/Controller/DCNavigationController.swift
  10. 1 1
      deltachat-ios/Controller/EditSettingsController.swift
  11. 3 1
      deltachat-ios/Controller/GroupChatDetailViewController.swift
  12. 4 1
      deltachat-ios/Controller/GroupMembersViewController.swift
  13. 3 1
      deltachat-ios/Controller/NewChatViewController.swift
  14. 3 4
      deltachat-ios/Controller/NewProfileViewController.swift
  15. 2 2
      deltachat-ios/Controller/ProfileViewController.swift
  16. 13 13
      deltachat-ios/Controller/QrCodeReaderController.swift
  17. 41 25
      deltachat-ios/Controller/SettingsController.swift
  18. 18 14
      deltachat-ios/Coordinator/AppCoordinator.swift
  19. 62 100
      deltachat-ios/DC/Wrapper.swift
  20. 3 2
      deltachat-ios/Helper/Constants.swift
  21. 18 19
      deltachat-ios/Helper/Extensions.swift
  22. 17 17
      deltachat-ios/Helper/UIImage+Extension.swift
  23. 6 6
      deltachat-ios/Helper/Utils.swift
  24. 1 1
      deltachat-ios/View/ContactCell.swift
  25. 0 2
      deltachat-ios/View/CustomMessageCell.swift
  26. 2 2
      deltachat-ios/View/ProgressHud.swift
  27. 10 9
      deltachat-ios/View/TextFieldCell.swift

+ 3 - 2
.swiftlint.yml

@@ -5,6 +5,7 @@ opt_in_rules:
 disabled_rules:
 - trailing_comma
 - large_tuple
+- todo
 
 excluded:
 - Carthage
@@ -39,8 +40,8 @@ function_parameter_count:
   error: 8
 
 type_body_length:
-  warning: 300
-  error: 500
+  warning: 600
+  error: 800
 
 file_length:
   warning: 1000

+ 3 - 2
deltachat-ios/AppDelegate.swift

@@ -210,7 +210,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             }
         }
 
-        NotificationCenter.default.addObserver(self, selector: #selector(reachabilityChanged(note:)), name: .reachabilityChanged, object: reachability)
+        NotificationCenter.default.addObserver(self, selector: #selector(reachabilityChanged(note:)),
+                                               name: .reachabilityChanged, object: reachability)
         do {
             try reachability.startNotifier()
         } catch {
@@ -268,7 +269,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
     // MARK: - PushNotifications
 
-	func registerForPushNotifications() {
+    func registerForPushNotifications() {
         UNUserNotificationCenter.current().delegate = self
 
         UNUserNotificationCenter.current()

+ 1 - 3
deltachat-ios/Controller/AccountSetup/PortSettingsController.swift

@@ -8,7 +8,7 @@ class PortSettingsController: UITableViewController {
 
     var resetButton: UIBarButtonItem!
 
-    var onDismiss:((String)->Void)?
+    var onDismiss: ((String) -> Void)?
 
     var currentPort: Int {
         didSet {
@@ -159,5 +159,3 @@ class PortSettingsController: UITableViewController {
     }
 
 }
-
-

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

@@ -117,7 +117,7 @@ class SecurityConverter {
                 return 0x400
             }
         case .SMTPSecurity:
-            switch value{
+            switch value {
             case .AUTO:
                 return 0x00000
             case .STARTTLS:
@@ -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:

+ 16 - 12
deltachat-ios/Controller/AccountSetupController.swift

@@ -58,13 +58,15 @@ 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
     }()
 
     lazy var imapServerCell: TextFieldCell = {
-        let cell = TextFieldCell(descriptionID: "login_imap_server", placeholder: DCConfig.mailServer ?? DCConfig.configuredMailServer, delegate: self)
+        let cell = TextFieldCell(descriptionID: "login_imap_server",
+                                 placeholder: DCConfig.mailServer ?? DCConfig.configuredMailServer,
+                                 delegate: self)
         cell.accessibilityIdentifier = "IMAPServerCell"
         cell.textField.tag = 2
         cell.textField.autocorrectionType = .no
@@ -103,7 +105,9 @@ class AccountSetupController: UITableViewController {
     }()
 
     lazy var smtpServerCell: TextFieldCell = {
-        let cell = TextFieldCell(descriptionID: "login_smtp_server", placeholder: DCConfig.sendServer ?? DCConfig.configuredSendServer, delegate: self)
+        let cell = TextFieldCell(descriptionID: "login_smtp_server",
+                                 placeholder: DCConfig.sendServer ?? DCConfig.configuredSendServer,
+                                 delegate: self)
         cell.accessibilityIdentifier = "SMTPServerCell"
         cell.textField.tag = 4
         cell.textField.autocorrectionType = .no
@@ -131,8 +135,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 +297,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 +333,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)
@@ -377,7 +381,7 @@ class AccountSetupController: UITableViewController {
 
     // returns true if needed
     private func showOAuthAlertIfNeeded(emailAddress: String, handleCancel: (() -> Void)?) -> Bool {
-        return false;
+        return false
 
         // disable oauth2 for now as not yet supported by deltachat-rust.
         /*
@@ -451,7 +455,7 @@ class AccountSetupController: UITableViewController {
                 } else if ui["done"] as! Bool {
                     self.updateProgressHudSuccess(callback: self.handleLoginSuccess)
                 } else {
-                    self.updateProgressHudValue(value: ui["progress"] as! Int)
+                    self.updateProgressHudValue(value: ui["progress"] as? Int)
                 }
             }
         }
@@ -468,7 +472,7 @@ class AccountSetupController: UITableViewController {
                 } else if ui["done"] as! Bool {
                     self.updateProgressHudSuccess(callback: self.handleLoginSuccess)
                 } else {
-                    self.updateProgressHudValue(value: ui["progress"] as! Int)
+                    self.updateProgressHudValue(value: ui["progress"] as? Int)
                 }
             }
         }
@@ -663,7 +667,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: {
@@ -673,7 +677,7 @@ extension AccountSetupController {
         })
     }
 
-    func updateProgressHudValue(value: Int?) {
+    private func updateProgressHudValue(value: Int?) {
         if let value = value {
             print("progress hud: \(value)")
             configProgressIndicator.value = CGFloat(value / 10)

+ 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()
+    }
 
 }

+ 154 - 140
deltachat-ios/Controller/ChatViewController.swift

@@ -244,14 +244,12 @@ class ChatViewController: MessagesViewController {
         }
     }
 
-
-
     private func configureMessageMenu() {
         var menuItems: [UIMenuItem]
 
         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(_:))),
             ]
@@ -279,14 +277,19 @@ class ChatViewController: MessagesViewController {
 
         // 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)))
+        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
-        layout?.setMessageIncomingMessageTopLabelAlignment(LabelAlignment(textAlignment: .left, textInsets: UIEdgeInsets(top: 0, left: 18, bottom: outgoingAvatarOverlap, right: 0)))
+        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)))
+        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)))
 
         layout?.setMessageIncomingAccessoryViewSize(CGSize(width: 30, height: 30))
         layout?.setMessageIncomingAccessoryViewPadding(HorizontalEdgeInsets(left: 8, right: 0))
@@ -330,7 +333,8 @@ class ChatViewController: MessagesViewController {
         messageInputBar.sendButton.title = nil
         messageInputBar.sendButton.tintColor = UIColor(white: 1, alpha: 1)
         messageInputBar.sendButton.layer.cornerRadius = 15
-        messageInputBar.middleContentViewPadding = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 10)	// this adds a padding between textinputfield and send button
+        messageInputBar.middleContentViewPadding = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 10)
+        // this adds a padding between textinputfield and send button
         messageInputBar.sendButton.contentEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5)
         messageInputBar.sendButton.setSize(CGSize(width: 30, height: 30), animated: false)
 
@@ -655,7 +659,9 @@ extension ChatViewController: MessagesDisplayDelegate {
                 view.style = .none
                 view.backgroundColor = UIColor(alpha: 10, red: 0, green: 0, blue: 0)
                 let radius: CGFloat = 16
-                let path = UIBezierPath(roundedRect: view.bounds, byRoundingCorners: UIRectCorner.allCorners, cornerRadii: CGSize(width: radius, height: radius))
+                let path = UIBezierPath(roundedRect: view.bounds,
+                                        byRoundingCorners: UIRectCorner.allCorners,
+                                        cornerRadii: CGSize(width: radius, height: radius))
                 let mask = CAShapeLayer()
                 mask.path = path.cgPath
                 view.layer.mask = mask
@@ -907,7 +913,9 @@ extension MessageCollectionViewCell {
             // Get indexPath
             if let indexPath = collectionView.indexPath(for: self) {
                 // Trigger action
-                collectionView.delegate?.collectionView?(collectionView, performAction: #selector(MessageCollectionViewCell.messageInfo(_:)), forItemAt: indexPath, withSender: sender)
+                collectionView.delegate?.collectionView?(collectionView,
+                    performAction: #selector(MessageCollectionViewCell.messageInfo(_:)),
+                    forItemAt: indexPath, withSender: sender)
             }
         }
     }
@@ -918,7 +926,9 @@ extension MessageCollectionViewCell {
             // Get indexPath
             if let indexPath = collectionView.indexPath(for: self) {
                 // Trigger action
-                collectionView.delegate?.collectionView?(collectionView, performAction: #selector(MessageCollectionViewCell.messageBlock(_:)), forItemAt: indexPath, withSender: sender)
+                collectionView.delegate?.collectionView?(collectionView,
+                    performAction: #selector(MessageCollectionViewCell.messageBlock(_:)),
+                    forItemAt: indexPath, withSender: sender)
             }
         }
     }
@@ -929,7 +939,9 @@ extension MessageCollectionViewCell {
             // Get indexPath
             if let indexPath = collectionView.indexPath(for: self) {
                 // Trigger action
-                collectionView.delegate?.collectionView?(collectionView, performAction: #selector(MessageCollectionViewCell.messageDismiss(_:)), forItemAt: indexPath, withSender: sender)
+                collectionView.delegate?.collectionView?(collectionView,
+                    performAction: #selector(MessageCollectionViewCell.messageDismiss(_:)),
+                    forItemAt: indexPath, withSender: sender)
             }
         }
     }
@@ -940,7 +952,9 @@ extension MessageCollectionViewCell {
             // Get indexPath
             if let indexPath = collectionView.indexPath(for: self) {
                 // Trigger action
-                collectionView.delegate?.collectionView?(collectionView, performAction: #selector(MessageCollectionViewCell.messageStartChat(_:)), forItemAt: indexPath, withSender: sender)
+                collectionView.delegate?.collectionView?(collectionView,
+                    performAction: #selector(MessageCollectionViewCell.messageStartChat(_:)),
+                    forItemAt: indexPath, withSender: sender)
             }
         }
     }
@@ -1212,35 +1226,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 +1311,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 +1680,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 +1714,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 +1901,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 +1933,8 @@ extension MessageCollectionViewCell {
  }
 
  /*
-  extension ChatViewController: MessageInputBarDelegate {
-  }
+   extension ChatViewController: MessageInputBarDelegate {
+   }
   */
 
  // MARK: - MessageCollectionViewCell

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

@@ -56,7 +56,9 @@ class ContactDetailViewController: UITableViewController {
 
     override func viewDidLoad() {
         super.viewDidLoad()
-        navigationItem.rightBarButtonItem = UIBarButtonItem(title: String.localized("global_menu_edit_desktop"), style: .plain, target: self, action: #selector(editButtonPressed))
+        navigationItem.rightBarButtonItem = UIBarButtonItem(
+            title: String.localized("global_menu_edit_desktop"),
+            style: .plain, target: self, action: #selector(editButtonPressed))
         self.title = String.localized("contact_detail_title_desktop")
     }
 
@@ -137,7 +139,9 @@ class ContactDetailViewController: UITableViewController {
     }
 
     private func showNotificationSetup() {
-        let notificationSetupAlert = UIAlertController(title: "Notifications Setup is not implemented yet", message: "But you get an idea where this is going", preferredStyle: .actionSheet)
+        let notificationSetupAlert = UIAlertController(title: "Notifications Setup is not implemented yet",
+                                                       message: "But you get an idea where this is going",
+                                                       preferredStyle: .actionSheet)
         let cancelAction = UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil)
         notificationSetupAlert.addAction(cancelAction)
         present(notificationSetupAlert, animated: true, completion: nil)
@@ -147,4 +151,3 @@ class ContactDetailViewController: UITableViewController {
         coordinator?.showEditContact(contactId: contactId)
     }
 }
-

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

@@ -12,7 +12,7 @@ final class DCNavigationController: UINavigationController {
         } else {
             navigationBar.setBackgroundImage(UIImage(), for: .default)
         }
-        navigationBar.backgroundColor = .white;
+        navigationBar.backgroundColor = .white
         setShadow(nil)
     }
 

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

@@ -42,7 +42,7 @@ class EditSettingsController: UITableViewController {
     override func viewWillDisappear(_ animated: Bool) {
         if displayNameBackup != displayNameCell.getText() || statusCellBackup != displayNameCell.getText() {
             DCConfig.selfstatus = statusCell.getText()
-            DCConfig.displayname = displayNameCell.getText()	
+            DCConfig.displayname = displayNameCell.getText()
             dc_configure(mailboxPointer)
         }
     }

+ 3 - 1
deltachat-ios/Controller/GroupChatDetailViewController.swift

@@ -40,7 +40,9 @@ class GroupChatDetailViewController: UIViewController {
     }
 
     private func showNotificationSetup() {
-        let notificationSetupAlert = UIAlertController(title: "Notifications Setup is not implemented yet", message: "But you get an idea where this is going", preferredStyle: .actionSheet)
+        let notificationSetupAlert = UIAlertController(title: "Notifications Setup is not implemented yet",
+                                                       message: "But you get an idea where this is going",
+                                                       preferredStyle: .actionSheet)
         let cancelAction = UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil)
         notificationSetupAlert.addAction(cancelAction)
         present(notificationSetupAlert, animated: true, completion: nil)

+ 4 - 1
deltachat-ios/Controller/GroupMembersViewController.swift

@@ -7,7 +7,10 @@ class NewGroupViewController: GroupMembersViewController {
         super.viewDidLoad()
         title = String.localized("menu_new_group")
         navigationController?.navigationBar.prefersLargeTitles = false
-        let groupCreationNextButton = UIBarButtonItem(title: String.localized("next"), style: .done, target: self, action: #selector(nextButtonPressed))
+        let groupCreationNextButton = UIBarButtonItem(title: String.localized("next"),
+                                                      style: .done,
+                                                      target: self,
+                                                      action: #selector(nextButtonPressed))
         navigationItem.rightBarButtonItem = groupCreationNextButton
         contactIds = Utils.getContactIds()
     }

+ 3 - 1
deltachat-ios/Controller/NewChatViewController.swift

@@ -104,7 +104,9 @@ class NewChatViewController: UITableViewController {
     }
 
     override func viewWillDisappear(_: Bool) {
-        title = String.localized("pref_chats") /* hack: when navigating to chatView (removing this viewController), there was a delayed backButton update (showing 'New Chat' for a moment) */
+        title = String.localized("pref_chats")
+        /* hack: when navigating to chatView (removing this viewController),
+        there was a delayed backButton update (showing 'New Chat' for a moment) */
     }
 
     override func viewDidDisappear(_ animated: Bool) {

+ 3 - 4
deltachat-ios/Controller/NewProfileViewController.swift

@@ -196,7 +196,7 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
         }
 
         let qrParsed: DcLot = self.dcContext.checkQR(qrCode: code)
-        let nameAndAddress = DCContact(id: qrParsed.id).nameNAddr;
+        let nameAndAddress = DCContact(id: qrParsed.id).nameNAddr
         let alert = UIAlertController(title: String.localizedStringWithFormat(String.localized("qrscan_ask_fingerprint_ask_oob"), nameAndAddress),
                                       message: nil,
                                       preferredStyle: .alert)
@@ -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!)
                     }
                 }
             }
@@ -241,7 +241,7 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
         let btn = UIButton.init(type: UIButton.ButtonType.system)
         btn.translatesAutoresizingMaskIntoConstraints = false
         btn.setTitle(String.localized("qrscan_title"), for: .normal)
-        btn.addTarget(self, action:#selector(self.openQRCodeScanner), for: .touchUpInside)
+        btn.addTarget(self, action: #selector(self.openQRCodeScanner), for: .touchUpInside)
         return btn
     }
 
@@ -305,4 +305,3 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
         navigationController?.pushViewController(chatVC, animated: true)
     }
 }
-

+ 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!)
             }
         }
     }

+ 41 - 25
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()
@@ -93,7 +93,7 @@ internal final class SettingsViewController: QuickTableViewController {
     }
 
     private func setTable() {
-        var backupRows = [
+        let backupRows = [
             TapActionRow(text: String.localized("create_backup"), action: { [weak self] in self?.createBackup($0) }),
         ]
 
@@ -103,26 +103,40 @@ 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) }),
                 ]
             ),
             Section(
                 title: String.localized("flags"),
                 rows: [
-                    SwitchRow(text: String.localized("autocrypt_prefer_e2ee"), switchValue: DCConfig.e2eeEnabled, action: editCell(key: SVC.e2eeEnabled)),
-                    SwitchRow(text: String.localized("pref_read_receipts"), switchValue: DCConfig.mdnsEnabled, action: editCell(key: SVC.readReceipts)),
-                    SwitchRow(text: String.localized("pref_watch_inbox_folder"), switchValue: DCConfig.inboxWatch, action: editCell(key: SVC.watchMvBox)),
-                    SwitchRow(text: String.localized("pref_watch_sent_folder"), switchValue: DCConfig.sentboxWatch, action: editCell(key: SVC.watchSentbox)),
-                    SwitchRow(text: String.localized("pref_watch_mvbox_folder"), switchValue: DCConfig.mvboxWatch, action: editCell(key: SVC.watchMvBox)),
-                    SwitchRow(text: String.localized("pref_auto_folder_moves"), switchValue: DCConfig.mvboxMove, action: editCell(key: SVC.MvToMvbox)),
-                    SwitchRow(text: String.localized("save_mime_headers"), switchValue: DCConfig.saveMimeHeaders, action: editCell(key: SVC.SaveMimeHeaders))
+                    SwitchRow(text: String.localized("autocrypt_prefer_e2ee"),
+                              switchValue: DCConfig.e2eeEnabled,
+                              action: editCell(key: SVC.e2eeEnabled)),
+                    SwitchRow(text: String.localized("pref_read_receipts"),
+                              switchValue: DCConfig.mdnsEnabled,
+                              action: editCell(key: SVC.readReceipts)),
+                    SwitchRow(text: String.localized("pref_watch_inbox_folder"),
+                              switchValue: DCConfig.inboxWatch,
+                              action: editCell(key: SVC.watchMvBox)),
+                    SwitchRow(text: String.localized("pref_watch_sent_folder"),
+                              switchValue: DCConfig.sentboxWatch,
+                              action: editCell(key: SVC.watchSentbox)),
+                    SwitchRow(text: String.localized("pref_watch_mvbox_folder"),
+                              switchValue: DCConfig.mvboxWatch,
+                              action: editCell(key: SVC.watchMvBox)),
+                    SwitchRow(text: String.localized("pref_auto_folder_moves"),
+                              switchValue: DCConfig.mvboxMove,
+                              action: editCell(key: SVC.MvToMvbox)),
+                    SwitchRow(text: String.localized("save_mime_headers"),
+                              switchValue: DCConfig.saveMimeHeaders,
+                              action: editCell(key: SVC.SaveMimeHeaders))
                 ]
             ),
 
@@ -138,7 +152,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)
 
@@ -196,7 +210,9 @@ internal final class SettingsViewController: QuickTableViewController {
 
         let dbfile = appDelegate.dbfile()
         let dburl = URL(fileURLWithPath: dbfile, isDirectory: false)
-        let alert = UIAlertController(title: String.localized("delete_account"), message: String.localized("delete_account_message"), preferredStyle: .actionSheet)
+        let alert = UIAlertController(title: String.localized("delete_account"),
+                                      message: String.localized("delete_account_message"),
+                                      preferredStyle: .actionSheet)
 
         alert.addAction(UIAlertAction(title: String.localized("delete"), style: .destructive, handler: { _ in
             appDelegate.stop()
@@ -224,7 +240,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)
     }
 }

+ 18 - 14
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
     }()
 
@@ -121,9 +121,9 @@ extension AppCoordinator: UITabBarControllerDelegate {
     func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
         if let dcNav = viewController as? DCNavigationController {
             switch tabBarController.selectedIndex {
-            case 0,3,4:
+            case 0, 3, 4:
                 dcNav.navigationBar.prefersLargeTitles = true
-            case 1,2:
+            case 1, 2:
                 dcNav.navigationBar.prefersLargeTitles = false
             default:
                 // should never get here
@@ -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) {
@@ -231,7 +231,7 @@ class ChatListCoordinator: Coordinator {
 class SettingsCoordinator: Coordinator {
     let navigationController: UINavigationController
 
-    var childCoordinators:[Coordinator] = []
+    var childCoordinators: [Coordinator] = []
 
     init(navigationController: UINavigationController) {
         self.navigationController = navigationController
@@ -271,7 +271,9 @@ class AccountSetupCoordinator: Coordinator {
     func showImapPortOptions() {
         let currentMailPort = DCConfig.mailPort ?? DCConfig.configuredMailPort
         let currentPort = Int(currentMailPort)
-        let portSettingsController = PortSettingsController(sectionTitle: String.localized("login_imap_port"), ports: [143, 993], currentPort: currentPort)
+        let portSettingsController = PortSettingsController(sectionTitle: String.localized("login_imap_port"),
+                                                            ports: [143, 993],
+                                                            currentPort: currentPort)
         portSettingsController.onDismiss = {
             port in
             DCConfig.mailPort = port
@@ -283,8 +285,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) {
@@ -298,7 +300,9 @@ class AccountSetupCoordinator: Coordinator {
     func showSmtpPortsOptions() {
         let currentMailPort = DCConfig.sendPort ?? DCConfig.configuredSendPort
         let currentPort = Int(currentMailPort)
-        let portSettingsController = PortSettingsController(sectionTitle: String.localized("login_smtp_port"), ports: [25, 465, 587], currentPort: currentPort)
+        let portSettingsController = PortSettingsController(sectionTitle: String.localized("login_smtp_port"),
+                                                            ports: [25, 465, 587],
+                                                            currentPort: currentPort)
         portSettingsController.onDismiss = {
             port in
             DCConfig.sendPort = port
@@ -310,8 +314,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) {
@@ -449,7 +453,7 @@ class ChatViewCoordinator: NSObject, Coordinator {
         // navigationController.present(nav, animated: true, completion: nil)
     }
 
-    private func sendImage(_ image:UIImage) {
+    private func sendImage(_ image: UIImage) {
         DispatchQueue.global().async {
             if let compressedImage = image.dcCompress() {
                 // at this point image is compressed by 85% by default

+ 62 - 100
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 {
@@ -305,7 +305,7 @@ class DCMessage: MessageType {
         if let cStr = dc_msg_get_file(messagePointer) {
             let str = String(cString: cStr)
 
-            return str == "" ? nil : str
+            return str.isEmpty ? nil : str
         }
 
         return nil
@@ -315,7 +315,7 @@ class DCMessage: MessageType {
         if let cStr = dc_msg_get_filemime(messagePointer) {
             let str = String(cString: cStr)
 
-            return str == "" ? nil : str
+            return str.isEmpty ? nil : str
         }
 
         return nil
@@ -325,7 +325,7 @@ class DCMessage: MessageType {
         if let cStr = dc_msg_get_filename(messagePointer) {
             let str = String(cString: cStr)
 
-            return str == "" ? nil : str
+            return str.isEmpty ? nil : str
         }
 
         return nil
@@ -457,7 +457,7 @@ class DCChat {
     var subtitle: String? {
         if let cString = dc_chat_get_subtitle(chatPointer) {
             let str = String(cString: cString)
-            return str == "" ? nil : str
+            return str.isEmpty ? nil : str
         }
         return nil
     }
@@ -578,8 +578,7 @@ class DCConfig {
     private class func setOptStr(_ key: String, _ value: String?) {
         if let v = value {
             dc_set_config(mailboxPointer, key, v)
-        }
-        else {
+        } else {
             dc_set_config(mailboxPointer, key, nil)
         }
     }
@@ -912,83 +911,46 @@ class DCConfig {
     }
 
     class var configuredEmail: String {
-        get {
-            return getOptStr("configured_addr") ?? ""
-        }
-        set {}
+        return getOptStr("configured_addr") ?? ""
     }
 
     class var configuredMailServer: String {
-        get {
-            return getOptStr("configured_mail_server") ?? ""
-        }
-        set {}
+        return getOptStr("configured_mail_server") ?? ""
     }
 
     class var configuredMailUser: String {
-        get {
-            return getOptStr("configured_mail_user") ?? ""
-        }
-        set {}
+        return getOptStr("configured_mail_user") ?? ""
     }
 
     class var configuredMailPw: String {
-        get {
-            return getOptStr("configured_mail_pw") ?? ""
-        }
-        set {}
+        return getOptStr("configured_mail_pw") ?? ""
     }
 
     class var configuredMailPort: String {
-        get {
-            return getOptStr("configured_mail_port") ?? ""
-        }
-        set {}
+        return getOptStr("configured_mail_port") ?? ""
     }
 
     class var configuredSendServer: String {
-        get {
-            return getOptStr("configured_send_server") ?? ""
-        }
-        set {}
+        return getOptStr("configured_send_server") ?? ""
     }
 
     class var configuredSendUser: String {
-        get {
-            return getOptStr("configured_send_user") ?? ""
-        }
-        set {}
+        return getOptStr("configured_send_user") ?? ""
     }
 
     class var configuredSendPw: String {
-        get {
-            return getOptStr("configured_send_pw") ?? ""
-        }
-        set {}
+        return getOptStr("configured_send_pw") ?? ""
     }
 
     class var configuredSendPort: String {
-        get {
-            return getOptStr("configured_send_port") ?? ""
-        }
-        set {}
+        return getOptStr("configured_send_port") ?? ""
     }
 
     class var configuredServerFlags: String {
-        get {
-            return getOptStr("configured_server_flags") ?? ""
-        }
-        set {}
+        return getOptStr("configured_server_flags") ?? ""
     }
 
-    /**
-     * Was configured executed beforeß
-     */
     class var configured: Bool {
-        get {
-            return getBool("configured")
-        }
-        set {}
+        return getBool("configured")
     }
 }
-

+ 3 - 2
deltachat-ios/Helper/Constants.swift

@@ -2,7 +2,9 @@ import UIKit
 
 struct Constants {
     // see: https://core.telegram.org/blackberry/chat
-    static let chatColors: [UIColor] = ["#ee4928", "#41a903", "#e09602", "#0f94ed", "#8f3bf7", "#fc4380", "#00a1c4", "#eb7002"].map { s in UIColor(hexString: s) }
+    static let chatColors: [UIColor] = [
+        "#ee4928", "#41a903", "#e09602", "#0f94ed",
+        "#8f3bf7", "#fc4380", "#00a1c4", "#eb7002"].map { s in UIColor(hexString: s) }
     struct Color {
         static let bubble = UIColor(netHex: 0xEFFFDE)
     }
@@ -18,4 +20,3 @@ struct Constants {
 
     static let notificationIdentifier = "deltachat-ios-local-notifications"
 }
-

+ 18 - 19
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 {
@@ -238,4 +238,3 @@ extension UIColor {
 
 
 }
-

+ 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!
+    }
 }

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

@@ -102,7 +102,8 @@ struct Utils {
     }
 
     static func saveImage(image: UIImage) -> String? {
-        guard let directory = try? FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false) as NSURL else {
+        guard let directory = try? FileManager.default.url(for: .documentDirectory, in: .userDomainMask,
+            appropriateFor: nil, create: false) as NSURL else {
             return nil
         }
 
@@ -155,8 +156,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
@@ -165,10 +166,10 @@ class DateUtils {
             return String.localized("now")	// under one minute
         } else if seconds < 3600 {
             let mins = seconds / 60
-            return String.localized(stringID: "n_minutes", count: mins);
+            return String.localized(stringID: "n_minutes", count: mins)
         } else if seconds < 86400 {
             let hours = seconds / 3600
-            return String.localized(stringID: "n_hours", count: hours);
+            return String.localized(stringID: "n_hours", count: hours)
         } else {
             let date = Date(timeIntervalSince1970: Double(timeStamp))
             let dateFormatter = DateFormatter()
@@ -180,4 +181,3 @@ class DateUtils {
         }
     }
 }
-

+ 1 - 1
deltachat-ios/View/ContactCell.swift

@@ -184,7 +184,7 @@ class ContactCell: UITableViewCell {
             return
         }
 
-        var indicatorImage:UIImage?
+        var indicatorImage: UIImage?
         switch status {
         case .OUTPENDING, .OUTPAIRING:
             indicatorImage = #imageLiteral(resourceName: "ic_delivery_status_sending").withRenderingMode(.alwaysTemplate)

+ 0 - 2
deltachat-ios/View/CustomMessageCell.swift

@@ -36,5 +36,3 @@ open class CustomMessageCell: UICollectionViewCell {
         }
     }
 }
-
-

+ 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)

+ 10 - 9
deltachat-ios/View/TextFieldCell.swift

@@ -3,7 +3,7 @@ import UIKit
 class TextFieldCell: UITableViewCell {
     private let placeholder: String
 
-    var onTextFieldChange:((_:UITextField)->Void)?	// set this from outside to get notified about textfield changes
+    var onTextFieldChange:((_:UITextField) -> Void)?	// set this from outside to get notified about textfield changes
 
     lazy var textField: UITextField = {
         let textField = UITextField()
@@ -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")
@@ -43,7 +43,8 @@ class TextFieldCell: UITableViewCell {
         textField.trailingAnchor.constraint(equalTo: trailing).isActive = true
         textField.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true
         if let label = self.textLabel {
-            textField.leadingAnchor.constraint(equalTo: label.trailingAnchor, constant: 20).isActive = true // this will prevent the textfield from growing over the textLabel while typing
+            textField.leadingAnchor.constraint(equalTo: label.trailingAnchor, constant: 20).isActive = true
+            // this will prevent the textfield from growing over the textLabel while typing
         } else {
             textField.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20).isActive = true
         }
@@ -76,7 +77,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 +87,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 +107,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