Browse Source

Merge pull request #144 from deltachat/confirmChatDeletion

Confirm chat deletion / MR to DC prefix
cyBerta 6 years ago
parent
commit
f99eb49999

+ 7 - 6
deltachat-ios.xcodeproj/project.pbxproj

@@ -116,7 +116,7 @@
 		7AE0A5481FC42F65005ECB4B /* NewChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewChatViewController.swift; sourceTree = "<group>"; };
 		8DE110C607A0E4485C43B5FA /* Pods-deltachat-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.debug.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.debug.xcconfig"; sourceTree = "<group>"; };
 		A8615D4600859851E53CAA9C /* Pods-deltachat-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.release.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.release.xcconfig"; sourceTree = "<group>"; };
-		AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatListController.swift; sourceTree = "<group>"; };
+		AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = ChatListController.swift; sourceTree = "<group>"; tabWidth = 4; };
 		AE18F291228C17BC0007B1BE /* PortSettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PortSettingsController.swift; sourceTree = "<group>"; };
 		AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecuritySettingsController.swift; sourceTree = "<group>"; };
 		AE25F08F22807AD800CDEA66 /* GroupNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupNameCell.swift; sourceTree = "<group>"; };
@@ -141,7 +141,7 @@
 		AEACE2DE1FB3246400DCDD78 /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = "<group>"; };
 		AEACE2E21FB32B5C00DCDD78 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
 		AEACE2E41FB32E1900DCDD78 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
-		AEE56D752253431E007DC082 /* AccountSetupController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSetupController.swift; sourceTree = "<group>"; };
+		AEE56D752253431E007DC082 /* AccountSetupController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSetupController.swift; sourceTree = "<group>"; tabWidth = 4; };
 		AEE56D7C2253ADB4007DC082 /* HudHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HudHandler.swift; sourceTree = "<group>"; };
 		AEE56D7F225504DB007DC082 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
 		AEE6EC3E2282C59C00EDC689 /* GroupMembersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupMembersViewController.swift; sourceTree = "<group>"; };
@@ -182,9 +182,10 @@
 				7A9FB4F81FB084E6001FEA36 /* Frameworks */,
 				7DB2DC4CCB84D323E5130F99 /* Pods */,
 			);
-			indentWidth = 2;
+			indentWidth = 4;
 			sourceTree = "<group>";
-			tabWidth = 2;
+			tabWidth = 4;
+			usesTabs = 1;
 		};
 		7A9FB1411FB061E2001FEA36 /* Products */ = {
 			isa = PBXGroup;
@@ -818,7 +819,7 @@
 				CODE_SIGN_ENTITLEMENTS = "deltachat-ios/deltachat-ios.entitlements";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				DEVELOPMENT_TEAM = 8Y86453UA8;
+				DEVELOPMENT_TEAM = "";
 				ENABLE_BITCODE = NO;
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
@@ -889,7 +890,7 @@
 				CODE_SIGN_ENTITLEMENTS = "deltachat-ios/deltachat-ios.entitlements";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				DEVELOPMENT_TEAM = 8Y86453UA8;
+				DEVELOPMENT_TEAM = "";
 				ENABLE_BITCODE = NO;
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",

+ 2 - 2
deltachat-ios/AppDelegate.swift

@@ -192,7 +192,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             }
         }
 
-        if MRConfig.sentboxWatch {
+        if DCConfig.sentboxWatch {
             DispatchQueue.global(qos: .background).async {
                 while self.state == .running {
                     dc_perform_sentbox_fetch(mailboxPointer)
@@ -201,7 +201,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             }
         }
 
-        if MRConfig.mvboxWatch {
+        if DCConfig.mvboxWatch {
             DispatchQueue.global(qos: .background).async {
                 while self.state == .running {
                     dc_perform_mvbox_fetch(mailboxPointer)

+ 33 - 31
deltachat-ios/Controller/AccountSetupController.swift

@@ -43,7 +43,7 @@ class AccountSetupController: UITableViewController {
         let cell = TextFieldCell.makeEmailCell(delegate: self)
         cell.textField.tag = 0
         cell.textField.accessibilityIdentifier = "emailTextField" // will be used to eventually show oAuth-Dialogue when pressing return key
-        cell.setText(text: MRConfig.addr ?? nil)
+        cell.setText(text: DCConfig.addr ?? nil)
         cell.textField.delegate = self
         return cell
     }()
@@ -52,7 +52,7 @@ class AccountSetupController: UITableViewController {
         let cell = TextFieldCell.makePasswordCell(delegate: self)
         cell.textField.tag = 1
         cell.accessibilityIdentifier = "passwordCell" // will be used to eventually show oAuth-Dialogue when selecting
-        cell.setText(text: MRConfig.mailPw ?? nil)
+        cell.setText(text: DCConfig.mailPw ?? nil)
         return cell
     }()
 
@@ -64,14 +64,14 @@ class AccountSetupController: UITableViewController {
     }()
 
     lazy var imapServerCell: TextFieldCell = {
-        let cell = TextFieldCell(description: "IMAP Server", placeholder: MRConfig.mailServer ?? MRConfig.configuredMailServer, delegate: self)
+        let cell = TextFieldCell(description: "IMAP Server", placeholder: DCConfig.mailServer ?? DCConfig.configuredMailServer, delegate: self)
         cell.accessibilityIdentifier = "IMAPServerCell"
         cell.textField.tag = 2
         return cell
     }()
 
     lazy var imapUserCell: TextFieldCell = {
-        let cell = TextFieldCell(description: "IMAP User", placeholder: MRConfig.mailUser ?? MRConfig.configuredMailUser, delegate: self)
+        let cell = TextFieldCell(description: "IMAP User", placeholder: DCConfig.mailUser ?? DCConfig.configuredMailUser, delegate: self)
         cell.accessibilityIdentifier = "IMAPUserCell"
         cell.textField.tag = 3
         return cell
@@ -81,33 +81,33 @@ class AccountSetupController: UITableViewController {
         let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
         cell.textLabel?.text = "IMAP Port"
         cell.accessoryType = .disclosureIndicator
-        cell.detailTextLabel?.text = MRConfig.mailPort ?? MRConfig.configuredMailPort
+        cell.detailTextLabel?.text = DCConfig.mailPort ?? DCConfig.configuredMailPort
         cell.accessibilityIdentifier = "IMAPPortCell"
         cell.selectionStyle = .none
         return cell
     }()
 
     lazy var imapSecurityCell: UITableViewCell = {
-        let text = "\(MRConfig.getImapSecurity())"
+        let text = "\(DCConfig.getImapSecurity())"
         let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
         cell.textLabel?.text = "IMAP Security"
         // let cell = TextFieldCell(description: "IMAP Security", placeholder: text, delegate: self)
         cell.accessibilityIdentifier = "IMAPSecurityCell"
         cell.accessoryType = .disclosureIndicator
-        cell.detailTextLabel?.text = "\(MRConfig.getImapSecurity())"
+        cell.detailTextLabel?.text = "\(DCConfig.getImapSecurity())"
         cell.selectionStyle = .none
         return cell
     }()
 
     lazy var smtpServerCell: TextFieldCell = {
-        let cell = TextFieldCell(description: "SMTP Server", placeholder: MRConfig.sendServer ?? MRConfig.configuredSendServer, delegate: self)
+        let cell = TextFieldCell(description: "SMTP Server", placeholder: DCConfig.sendServer ?? DCConfig.configuredSendServer, delegate: self)
         cell.accessibilityIdentifier = "SMTPServerCell"
         cell.textField.tag = 4
         return cell
     }()
 
     lazy var smtpUserCell: TextFieldCell = {
-        let cell = TextFieldCell(description: "SMTP User", placeholder: MRConfig.sendUser ?? MRConfig.configuredSendUser, delegate: self)
+        let cell = TextFieldCell(description: "SMTP User", placeholder: DCConfig.sendUser ?? DCConfig.configuredSendUser, delegate: self)
         cell.accessibilityIdentifier = "SMTPUserCell"
         cell.textField.tag = 5
         return cell
@@ -117,7 +117,7 @@ class AccountSetupController: UITableViewController {
         let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
         cell.textLabel?.text = "SMTP Port"
         cell.accessoryType = .disclosureIndicator
-        cell.detailTextLabel?.text = MRConfig.sendPort ?? MRConfig.configuredSendPort
+        cell.detailTextLabel?.text = DCConfig.sendPort ?? DCConfig.configuredSendPort
         cell.accessibilityIdentifier = "SMTPPortCell"
         cell.selectionStyle = .none
         return cell
@@ -125,13 +125,15 @@ class AccountSetupController: UITableViewController {
 
     lazy var smtpPasswordCell: TextFieldCell = {
         let cell = TextFieldCell(description: "SMTP Password", placeholder: "*************", delegate: self)
+		cell.textField.textContentType = UITextContentType.password
+		cell.textField.isSecureTextEntry = true
         cell.accessibilityIdentifier = "SMTPPasswordCell"
         cell.textField.tag = 6
         return cell
     }()
 
     lazy var smtpSecurityCell: UITableViewCell = {
-        let security = "\(MRConfig.getSmtpSecurity())"
+        let security = "\(DCConfig.getSmtpSecurity())"
         let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
         cell.textLabel?.text = "SMTP Security"
         cell.detailTextLabel?.text = security
@@ -183,10 +185,10 @@ class AccountSetupController: UITableViewController {
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
         // needs to be changed if returning from portSettingsController
-        smtpPortCell.detailTextLabel?.text = MRConfig.sendPort ?? MRConfig.configuredSendPort
-        imapPortCell.detailTextLabel?.text = MRConfig.mailPort ?? MRConfig.configuredMailPort
-        smtpSecurityCell.detailTextLabel?.text = SecurityConverter.convertHexToString(type: .SMTPSecurity, hex: MRConfig.getSmtpSecurity())
-        imapSecurityCell.detailTextLabel?.text  = SecurityConverter.convertHexToString(type: .IMAPSecurity, hex: MRConfig.getImapSecurity())
+        smtpPortCell.detailTextLabel?.text = DCConfig.sendPort ?? DCConfig.configuredSendPort
+        imapPortCell.detailTextLabel?.text = DCConfig.mailPort ?? DCConfig.configuredMailPort
+        smtpSecurityCell.detailTextLabel?.text = SecurityConverter.convertHexToString(type: .SMTPSecurity, hex: DCConfig.getSmtpSecurity())
+        imapSecurityCell.detailTextLabel?.text  = SecurityConverter.convertHexToString(type: .IMAPSecurity, hex: DCConfig.getImapSecurity())
     }
 
     override func viewDidAppear(_ animated: Bool) {
@@ -350,14 +352,14 @@ class AccountSetupController: UITableViewController {
 
     private func login(emailAddress: String, password: String, skipAdvanceSetup: Bool = false) {
         resignFirstResponderOnAllCells()	// this will resign focus from all textFieldCells so the keyboard wont pop up anymore
-        MRConfig.addr = emailAddress
-        MRConfig.mailPw = password
+        DCConfig.addr = emailAddress
+        DCConfig.mailPw = password
 
         if !skipAdvanceSetup {
             evaluateAdvancedSetup() // this will set MRConfig related to advanced fields
         }
 
-        print("oAuth-Flag when loggin in: \(MRConfig.getAuthFlags())")
+        print("oAuth-Flag when loggin in: \(DCConfig.getAuthFlags())")
         dc_configure(mailboxPointer)
         showProgressHud()
     }
@@ -419,7 +421,7 @@ class AccountSetupController: UITableViewController {
             return
         }
         passwordCell.setText(text: token)
-        MRConfig.setAuthFlags(flags: Int(DC_LP_AUTH_OAUTH2))
+        DCConfig.setAuthFlags(flags: Int(DC_LP_AUTH_OAUTH2))
         login(emailAddress: emailAddress, password: token, skipAdvanceSetup: true)
     }
 
@@ -470,25 +472,25 @@ class AccountSetupController: UITableViewController {
             if let textFieldCell = cell as? TextFieldCell {
                 switch cell.accessibilityIdentifier {
                 case "IMAPServerCell":
-                    MRConfig.mailServer = textFieldCell.getText() ?? nil
+                    DCConfig.mailServer = textFieldCell.getText() ?? nil
                 case "IMAPUserCell":
-                    MRConfig.mailUser = textFieldCell.getText() ?? nil
+                    DCConfig.mailUser = textFieldCell.getText() ?? nil
                 case "IMAPPortCell":
-                    MRConfig.mailPort = textFieldCell.getText() ?? nil
+                    DCConfig.mailPort = textFieldCell.getText() ?? nil
                 case "IMAPSecurityCell":
                     let flag = 0
-                    MRConfig.setImapSecurity(imapFlags: flag)
+                    DCConfig.setImapSecurity(imapFlags: flag)
                 case "SMTPServerCell":
-                    MRConfig.sendServer = textFieldCell.getText() ?? nil
+                    DCConfig.sendServer = textFieldCell.getText() ?? nil
                 case "SMTPUserCell":
-                    MRConfig.sendUser = textFieldCell.getText() ?? nil
+                    DCConfig.sendUser = textFieldCell.getText() ?? nil
                 case "SMTPPortCell":
-                    MRConfig.sendPort = textFieldCell.getText() ?? nil
+                    DCConfig.sendPort = textFieldCell.getText() ?? nil
                 case "SMTPPasswordCell":
-                    MRConfig.sendPw = textFieldCell.getText() ?? nil
+                    DCConfig.sendPw = textFieldCell.getText() ?? nil
                 case "SMTPSecurityCell":
                     let flag = 0
-                    MRConfig.setSmtpSecurity(smptpFlags: flag)
+                    DCConfig.setSmtpSecurity(smptpFlags: flag)
                 default:
                     logger.info("unknown identifier", cell.accessibilityIdentifier ?? "")
                 }
@@ -498,7 +500,7 @@ class AccountSetupController: UITableViewController {
 
     private func restoreBackup() {
         logger.info("restoring backup")
-        if MRConfig.configured {
+        if DCConfig.configured {
             return
         }
         let documents = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
@@ -670,8 +672,8 @@ extension AccountSetupController {
     }
 
     func loginCancelled(_ action: UIAlertAction) {
-        MRConfig.addr = nil
-        MRConfig.mailPw = nil
+        DCConfig.addr = nil
+        DCConfig.mailPw = nil
         DispatchQueue.global(qos: .background).async {
             dc_stop_ongoing_process(mailboxPointer)		// this function freezes UI so execute in background thread
         }

+ 25 - 8
deltachat-ios/Controller/ChatListController.swift

@@ -2,7 +2,7 @@ import UIKit
 
 class ChatListController: UIViewController {
     weak var coordinator: ChatListCoordinator?
-    var chatList: MRChatList?
+    var chatList: DCChatList?
 
     lazy var chatTable: UITableView = {
         let chatTable = UITableView()
@@ -102,7 +102,7 @@ class ChatListController: UIViewController {
             fatalError("chatlistPointer was nil")
         }
         // ownership of chatlistPointer transferred here to ChatList object
-        chatList = MRChatList(chatListPointer: chatlistPointer)
+        chatList = DCChatList(chatListPointer: chatlistPointer)
         chatTable.reloadData()
     }
 }
@@ -130,7 +130,7 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
         }
 
         let chatId = chatList.getChatId(index: row)
-        let chat = MRChat(id: chatId)
+        let chat = DCChat(id: chatId)
         let summary = chatList.summary(index: row)
 
         cell.nameLabel.text = chat.name
@@ -164,9 +164,7 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
         }
     }
 
-
     func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
-        let section = indexPath.section
         let row = indexPath.row
         guard let chatList = chatList else {
             return nil
@@ -175,11 +173,30 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
         // assigning swipe by delete to chats
         let delete = UITableViewRowAction(style: .destructive, title: "Delete") { [unowned self] _, indexPath in
             let chatId = chatList.getChatId(index: row)
-            dc_delete_chat(mailboxPointer, UInt32(chatId))
-            self.getChatList()
-
+			self.showDeleteChatConfirmationAlert(chatId: chatId)
         }
         delete.backgroundColor = UIColor.red
         return [delete]
     }
 }
+
+extension ChatListController {
+	private func showDeleteChatConfirmationAlert(chatId: Int) {
+		let alert = UIAlertController(
+			title: "Do you want to delete the chat?",
+			message: nil,
+			preferredStyle: .alert
+		)
+		alert.addAction(UIAlertAction(title: "Delete", style: .default, handler: { action in
+			self.deleteChat(chatId: chatId)
+		}))
+		alert.addAction(UIAlertAction(title: "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()
+	}
+
+}

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

@@ -22,7 +22,7 @@ class ChatViewController: MessagesViewController {
 
     let chatId: Int
     let refreshControl = UIRefreshControl()
-    var messageList: [MRMessage] = []
+    var messageList: [DCMessage] = []
 
     var msgChangedObserver: Any?
     var incomingMsgObserver: Any?
@@ -63,7 +63,7 @@ class ChatViewController: MessagesViewController {
         navigationItem.titleView = titleView
 
         view.backgroundColor = DCColors.chatBackgroundColor
-        if !MRConfig.configured {
+        if !DCConfig.configured {
             // TODO: display message about nothing being configured
             return
         }
@@ -84,7 +84,7 @@ class ChatViewController: MessagesViewController {
         // this will be removed in viewWillDisappear
         navigationController?.navigationBar.addGestureRecognizer(navBarTap)
 
-        let chat = MRChat(id: chatId)
+        let chat = DCChat(id: chatId)
         titleView.updateTitleView(title: chat.name, subtitle: chat.subtitle)
 
         if let image = chat.profileImage {
@@ -128,7 +128,7 @@ class ChatViewController: MessagesViewController {
                 if self.chatId == ui["chat_id"] as! Int {
                     let id = ui["message_id"] as! Int
                     if id > 0 {
-                        self.insertMessage(MRMessage(id: id))
+                        self.insertMessage(DCMessage(id: id))
                     }
                 }
             }
@@ -213,7 +213,7 @@ class ChatViewController: MessagesViewController {
         return nil
     }
 
-    private func getMessageIds(_ count: Int, from: Int? = nil) -> [MRMessage] {
+    private func getMessageIds(_ count: Int, from: Int? = nil) -> [DCMessage] {
         let cMessageIds = dc_get_chat_msgs(mailboxPointer, UInt32(chatId), 0, 0)
 
         let ids: [Int]
@@ -227,7 +227,7 @@ class ChatViewController: MessagesViewController {
         dc_markseen_msgs(mailboxPointer, UnsafePointer(markIds), Int32(ids.count))
 
         return ids.map {
-            MRMessage(id: $0)
+            DCMessage(id: $0)
         }
     }
 
@@ -588,7 +588,7 @@ extension ChatViewController: MessagesDataSource {
         if let index = messageList.firstIndex(where: { $0.id == messageId }) {
             dc_markseen_msgs(mailboxPointer, UnsafePointer([UInt32(messageId)]), 1)
 
-            messageList[index] = MRMessage(id: messageId)
+            messageList[index] = DCMessage(id: messageId)
             // Reload section to update header/footer labels
             messagesCollectionView.performBatchUpdates({
                 messagesCollectionView.reloadSections([index])
@@ -604,14 +604,14 @@ extension ChatViewController: MessagesDataSource {
                 }
             })
         } else {
-            let msg = MRMessage(id: messageId)
+            let msg = DCMessage(id: messageId)
             if msg.chatId == chatId {
                 insertMessage(msg)
             }
         }
     }
 
-    func insertMessage(_ message: MRMessage) {
+    func insertMessage(_ message: DCMessage) {
         dc_markseen_msgs(mailboxPointer, UnsafePointer([UInt32(message.id)]), 1)
         messageList.append(message)
         // Reload last section to update header/footer labels and insert a new one
@@ -789,7 +789,7 @@ extension ChatViewController: MessageCellDelegate {
 
                 var prev: Int = Int(dc_get_next_media(mailboxPointer, UInt32(message.id), -1, Int32(message.type), 0, 0))
                 while prev != 0 {
-                    let prevMessage = MRMessage(id: prev)
+                    let prevMessage = DCMessage(id: prev)
                     if let url = prevMessage.fileURL {
                         previousUrls.insert(url, at: 0)
                     }
@@ -798,7 +798,7 @@ extension ChatViewController: MessageCellDelegate {
 
                 var next: Int = Int(dc_get_next_media(mailboxPointer, UInt32(message.id), 1, Int32(message.type), 0, 0))
                 while next != 0 {
-                    let nextMessage = MRMessage(id: next)
+                    let nextMessage = DCMessage(id: next)
                     if let url = nextMessage.fileURL {
                         nextUrls.insert(url, at: 0)
                     }

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

@@ -13,8 +13,8 @@ class ContactDetailViewController: UITableViewController {
 
     private let contactId: Int
 
-    private var contact: MRContact {
-        return MRContact(id: contactId)
+    private var contact: DCContact {
+        return DCContact(id: contactId)
     }
 
     private var notificationsCell: UITableViewCell = {

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

@@ -16,7 +16,7 @@ class ContactListController: UITableViewController {
 
     // contactWithSearchResults.indexesToHightLight empty by default
     var contacts: [ContactWithSearchResults] {
-        return contactIds.map { ContactWithSearchResults(contact: MRContact(id: $0), indexesToHighlight: []) }
+        return contactIds.map { ContactWithSearchResults(contact: DCContact(id: $0), indexesToHighlight: []) }
     }
 
     // used when seachbar is active

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

@@ -9,7 +9,7 @@ class EditContactController: NewContactController {
         super.init()
         title = "Edit Contact"
 
-        let contact = MRContact(id: contactIdForUpdate)
+        let contact = DCContact(id: contactIdForUpdate)
         nameCell.textField.text = contact.name
         emailCell.textField.text = contact.email
         emailCell.textField.isEnabled = false

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

@@ -4,7 +4,7 @@ class EditGroupViewController: UITableViewController {
 
     weak var coordinator: EditGroupCoordinator?
 
-    private let chat: MRChat
+    private let chat: DCChat
 
     lazy var groupNameCell: GroupLabelCell = {
         let cell = GroupLabelCell(style: .default, reuseIdentifier: nil)
@@ -23,7 +23,7 @@ class EditGroupViewController: UITableViewController {
         return button
     }()
 
-    init(chat: MRChat) {
+    init(chat: DCChat) {
         self.chat = chat
         super.init(style: .grouped)
         groupNameCell.inputField.text = chat.name

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

@@ -7,13 +7,13 @@ class EditSettingsController: UITableViewController {
 
     private lazy var displayNameCell: TextFieldCell = {
         let cell = TextFieldCell(description: "Display Name", placeholder: "Display Name")
-        cell.setText(text: MRConfig.displayname ?? nil)
+        cell.setText(text: DCConfig.displayname ?? nil)
         return cell
     }()
 
     private lazy var statusCell: TextFieldCell = {
         let cell = TextFieldCell(description: "Status", placeholder: "Your Status")
-        cell.setText(text: MRConfig.selfstatus ?? nil)
+        cell.setText(text: DCConfig.selfstatus ?? nil)
         return cell
     }()
 
@@ -35,14 +35,14 @@ class EditSettingsController: UITableViewController {
     }
 
     override func viewWillAppear(_ animated: Bool) {
-        displayNameBackup = MRConfig.displayname
-        statusCellBackup = MRConfig.selfstatus
+        displayNameBackup = DCConfig.displayname
+        statusCellBackup = DCConfig.selfstatus
     }
 
     override func viewWillDisappear(_ animated: Bool) {
         if displayNameBackup != displayNameCell.getText() || statusCellBackup != displayNameCell.getText() {
-            MRConfig.selfstatus = statusCell.getText()
-            MRConfig.displayname = displayNameCell.getText()	
+            DCConfig.selfstatus = statusCell.getText()
+            DCConfig.displayname = displayNameCell.getText()	
             dc_configure(mailboxPointer)
         }
     }

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

@@ -1,13 +1,13 @@
 import UIKit
 
 class GroupChatDetailViewController: UIViewController {
-    private var currentUser: MRContact? {
-        return groupMembers.filter { $0.email == MRConfig.addr }.first
+    private var currentUser: DCContact? {
+        return groupMembers.filter { $0.email == DCConfig.addr }.first
     }
 
     weak var coordinator: GroupChatDetailCoordinator?
 
-    fileprivate var chat: MRChat
+    fileprivate var chat: DCChat
 
     var chatDetailTable: UITableView = {
         let table = UITableView(frame: .zero, style: .grouped)
@@ -20,7 +20,7 @@ class GroupChatDetailViewController: UIViewController {
     }()
 
     init(chatId: Int) {
-        chat = MRChat(id: chatId)
+        chat = DCChat(id: chatId)
         super.init(nibName: nil, bundle: nil)
         setupSubviews()
     }
@@ -50,7 +50,7 @@ class GroupChatDetailViewController: UIViewController {
         UIBarButtonItem(title: "Edit", style: .plain, target: self, action: #selector(editButtonPressed))
     }()
 
-    private var groupMembers: [MRContact] = []
+    private var groupMembers: [DCContact] = []
 
     private let staticCellCountMemberSection = 1 //
 
@@ -71,7 +71,7 @@ class GroupChatDetailViewController: UIViewController {
 
     private func updateGroupMembers() {
         let ids = chat.contactIds
-        groupMembers = ids.map { MRContact(id: $0) }
+        groupMembers = ids.map { DCContact(id: $0) }
         chatDetailTable.reloadData()
     }
 

+ 3 - 3
deltachat-ios/Controller/GroupMembersViewController.swift

@@ -36,9 +36,9 @@ class AddGroupMembersViewController: GroupMembersViewController {
         }
     }
 
-    private lazy var chat: MRChat? = {
+    private lazy var chat: DCChat? = {
         if let chatId = chatId {
-            return MRChat(id: chatId)
+            return DCChat(id: chatId)
         }
         return nil
     }()
@@ -130,7 +130,7 @@ class GroupMembersViewController: UITableViewController {
         let row = indexPath.row
         let contactRow = row
 
-        let contact = MRContact(id: contactIds[contactRow])
+        let contact = DCContact(id: contactIds[contactRow])
         cell.nameLabel.text = contact.name
         cell.emailLabel.text = contact.email
         cell.initialsLabel.text = Utils.getInitials(inputName: contact.name)

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

@@ -68,7 +68,7 @@ class GroupNameController: UITableViewController {
         } else {
             let cell = tableView.dequeueReusableCell(withIdentifier: "contactCell", for: indexPath) as! ContactCell
 
-            let contact = MRContact(id: groupContactIds[row])
+            let contact = DCContact(id: groupContactIds[row])
             cell.nameLabel.text = contact.name
             cell.emailLabel.text = contact.email
             cell.initialsLabel.text = Utils.getInitials(inputName: contact.name)

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

@@ -1,9 +1,9 @@
 import UIKit
 
 class MessageInfoViewController: UITableViewController {
-    var message: MRMessage
+    var message: DCMessage
 
-    init(message: MRMessage) {
+    init(message: DCMessage) {
         self.message = message
 
         super.init(style: .plain)

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

@@ -21,7 +21,7 @@ class NewChatViewController: UITableViewController {
 
     // contactWithSearchResults.indexesToHightLight empty by default
     var contacts: [ContactWithSearchResults] {
-        return contactIds.map { ContactWithSearchResults(contact: MRContact(id: $0), indexesToHighlight: []) }
+        return contactIds.map { ContactWithSearchResults(contact: DCContact(id: $0), indexesToHighlight: []) }
     }
 
     // used when seachbar is active
@@ -384,6 +384,6 @@ enum ContactDetail {
 }
 
 struct ContactWithSearchResults {
-    let contact: MRContact
+    let contact: DCContact
     let indexesToHighlight: [ContactHighlights]
 }

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

@@ -3,16 +3,16 @@ import UIKit
 class ProfileViewController: UITableViewController {
     weak var coordinator: ProfileCoordinator?
 
-    var contact: MRContact? {
+    var contact: DCContact? {
         // This is nil if we do not have an account setup yet
-        if !MRConfig.configured {
+        if !DCConfig.configured {
             return nil
         }
-        return MRContact(id: Int(DC_CONTACT_ID_SELF))
+        return DCContact(id: Int(DC_CONTACT_ID_SELF))
     }
 
     var fingerprint: String? {
-        if !MRConfig.configured {
+        if !DCConfig.configured {
             return nil
         }
 
@@ -132,7 +132,7 @@ class ProfileViewController: UITableViewController {
         if section == 0 {
             let contactCell = ContactCell()
             if let contact = self.contact {
-                let name = MRConfig.displayname ?? contact.name
+                let name = DCConfig.displayname ?? contact.name
                 contactCell.backgroundColor = bg
                 contactCell.nameLabel.text = name
                 contactCell.emailLabel.text = contact.email

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

@@ -94,21 +94,21 @@ internal final class SettingsViewController: QuickTableViewController {
             Section(
                 title: "User Details",
                 rows: [
-                    NavigationRow(text: "Display Name", detailText: .value1(MRConfig.displayname ?? ""), action: { [weak self] in self?.editNameAndStatus($0)}),
-                    NavigationRow(text: "Status", detailText: .value1(MRConfig.selfstatus ?? ""), action: { [weak self] in self?.editNameAndStatus($0)}),
+                    NavigationRow(text: "Display Name", detailText: .value1(DCConfig.displayname ?? ""), action: { [weak self] in self?.editNameAndStatus($0)}),
+                    NavigationRow(text: "Status", detailText: .value1(DCConfig.selfstatus ?? ""), action: { [weak self] in self?.editNameAndStatus($0)}),
                     TapActionRow(text: "Configure my Account", action: { [weak self] in self?.presentAccountSetup($0) }),
                 ]
             ),
             Section(
                 title: "Flags",
                 rows: [
-                    SwitchRow(text: "E2EE enabled", switchValue: MRConfig.e2eeEnabled, action: editCell()),
-                    SwitchRow(text: "Read Receipts", switchValue: MRConfig.mdnsEnabled, action: editCell()),
-                    SwitchRow(text: "Watch Inbox", switchValue: MRConfig.inboxWatch, action: editCell()),
-                    SwitchRow(text: "Watch Sentbox", switchValue: MRConfig.sentboxWatch, action: editCell()),
-                    SwitchRow(text: "Watch Mvbox", switchValue: MRConfig.mvboxWatch, action: editCell()),
-                    SwitchRow(text: "Move to Mvbox", switchValue: MRConfig.mvboxMove, action: editCell()),
-                    SwitchRow(text: "Save Mime Headers", switchValue: MRConfig.saveMimeHeaders, action: editCell()),
+                    SwitchRow(text: "E2EE enabled", switchValue: DCConfig.e2eeEnabled, action: editCell()),
+                    SwitchRow(text: "Read Receipts", switchValue: DCConfig.mdnsEnabled, action: editCell()),
+                    SwitchRow(text: "Watch Inbox", switchValue: DCConfig.inboxWatch, action: editCell()),
+                    SwitchRow(text: "Watch Sentbox", switchValue: DCConfig.sentboxWatch, action: editCell()),
+                    SwitchRow(text: "Watch Mvbox", switchValue: DCConfig.mvboxWatch, action: editCell()),
+                    SwitchRow(text: "Move to Mvbox", switchValue: DCConfig.mvboxMove, action: editCell()),
+                    SwitchRow(text: "Save Mime Headers", switchValue: DCConfig.saveMimeHeaders, action: editCell()),
                 ]
             ),
 
@@ -139,19 +139,19 @@ internal final class SettingsViewController: QuickTableViewController {
 
                 switch title {
                 case "E2EE enabled":
-                    MRConfig.e2eeEnabled = value
+                    DCConfig.e2eeEnabled = value
                 case "Read Receipts":
-                    MRConfig.mdnsEnabled = value
+                    DCConfig.mdnsEnabled = value
                 case "Watch Inbox":
-                    MRConfig.inboxWatch = value
+                    DCConfig.inboxWatch = value
                 case "Watch Sentbox":
-                    MRConfig.sentboxWatch = value
+                    DCConfig.sentboxWatch = value
                 case "Watch Mvbox":
-                    MRConfig.mvboxWatch = value
+                    DCConfig.mvboxWatch = value
                 case "Move to Mvbox":
-                    MRConfig.mvboxMove = value
+                    DCConfig.mvboxMove = value
                 case "Save Mime Headers":
-                    MRConfig.saveMimeHeaders = value
+                    DCConfig.saveMimeHeaders = value
                 default:
                     logger.info("unknown title", title)
                 }

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

@@ -249,50 +249,50 @@ class AccountSetupCoordinator: Coordinator {
     }
 
     func showImapPortOptions() {
-        let currentMailPort = MRConfig.mailPort ?? MRConfig.configuredMailPort
+        let currentMailPort = DCConfig.mailPort ?? DCConfig.configuredMailPort
         let currentPort = Int(currentMailPort)
         let portSettingsController = PortSettingsController(sectionTitle: "IMAP Port", ports: [143, 993], currentPort: currentPort)
         portSettingsController.onDismiss = {
             port in
-            MRConfig.mailPort = port
+            DCConfig.mailPort = port
         }
         navigationController.pushViewController(portSettingsController, animated: true)
     }
 
     func showImapSecurityOptions() {
-        let currentSecurityOption = MRConfig.getImapSecurity()
+        let currentSecurityOption = DCConfig.getImapSecurity()
         let convertedOption = SecurityConverter.convertHexToString(type: .IMAPSecurity, hex: currentSecurityOption)
         let securitySettingsController = SecuritySettingsController(title: "IMAP Security", options: ["Automatic", "SSL / TLS", "STARTTLS", "OFF"], selectedOption: convertedOption)
         securitySettingsController.onDismiss = {
             option in
             if let secValue = SecurityValue(rawValue: option) {
                 let value = SecurityConverter.convertValueToInt(type: .IMAPSecurity, value: secValue)
-                MRConfig.setImapSecurity(imapFlags: value)
+                DCConfig.setImapSecurity(imapFlags: value)
             }
         }
         navigationController.pushViewController(securitySettingsController, animated: true)
     }
 
     func showSmtpPortsOptions() {
-        let currentMailPort = MRConfig.sendPort ?? MRConfig.configuredSendPort
+        let currentMailPort = DCConfig.sendPort ?? DCConfig.configuredSendPort
         let currentPort = Int(currentMailPort)
         let portSettingsController = PortSettingsController(sectionTitle: "SMTP Port", ports: [25, 465, 587], currentPort: currentPort)
         portSettingsController.onDismiss = {
             port in
-            MRConfig.sendPort = port
+            DCConfig.sendPort = port
         }
         navigationController.pushViewController(portSettingsController, animated: true)
     }
 
     func showSmptpSecurityOptions() {
-        let currentSecurityOption = MRConfig.getSmtpSecurity()
+        let currentSecurityOption = DCConfig.getSmtpSecurity()
         let convertedOption = SecurityConverter.convertHexToString(type: .SMTPSecurity, hex: currentSecurityOption)
         let securitySettingsController = SecuritySettingsController(title: "IMAP Security", options: ["Automatic", "SSL / TLS", "STARTTLS", "OFF"], selectedOption: convertedOption)
         securitySettingsController.onDismiss = {
             option in
             if let secValue = SecurityValue(rawValue: option) {
                 let value = SecurityConverter.convertValueToInt(type: .SMTPSecurity, value: secValue)
-                MRConfig.setSmtpSecurity(smptpFlags: value)
+                DCConfig.setSmtpSecurity(smptpFlags: value)
             }
         }
         navigationController.pushViewController(securitySettingsController, animated: true)
@@ -367,7 +367,7 @@ class GroupChatDetailCoordinator: Coordinator {
         navigationController.pushViewController(groupMemberViewController, animated: true)
     }
 
-    func showGroupChatEdit(chat: MRChat) {
+    func showGroupChatEdit(chat: DCChat) {
         let editGroupViewController = EditGroupViewController(chat: chat)
         let coordinator = EditGroupCoordinator(navigationController: navigationController)
         childCoordinators.append(coordinator)
@@ -389,7 +389,7 @@ class ChatViewCoordinator: NSObject, Coordinator {
     }
 
     func showChatDetail(chatId: Int) {
-        let chat = MRChat(id: chatId)
+        let chat = DCChat(id: chatId)
         switch chat.chatType {
         case .SINGLE:
             if let contactId = chat.contactIds.first {

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

@@ -25,7 +25,7 @@ enum MessageViewType: CustomStringConvertible {
     }
 }
 
-class MRContact {
+class DCContact {
     private var contactPointer: OpaquePointer
 
     var name: String {
@@ -93,7 +93,7 @@ class MRContact {
     }
 }
 
-class MRMessage: MessageType {
+class DCMessage: MessageType {
     private var messagePointer: OpaquePointer
 
     lazy var sender: SenderType = {
@@ -156,8 +156,8 @@ class MRMessage: MessageType {
         return Int(dc_msg_get_from_id(messagePointer))
     }
 
-    lazy var fromContact: MRContact = {
-        MRContact(id: fromContactId)
+    lazy var fromContact: DCContact = {
+        DCContact(id: fromContactId)
     }()
 
     var chatId: Int {
@@ -253,12 +253,12 @@ class MRMessage: MessageType {
         return Int(dc_msg_get_filebytes(messagePointer))
     }
 
-    // MR_MSG_*
+    // DC_MSG_*
     var type: Int {
         return Int(dc_msg_get_viewtype(messagePointer))
     }
 
-    // MR_STATE_*
+    // DC_STATE_*
     var state: Int {
         return Int(dc_msg_get_state(messagePointer))
     }
@@ -304,9 +304,9 @@ class MRMessage: MessageType {
         return String(cString: result)
     }
 
-    func createChat() -> MRChat {
+    func createChat() -> DCChat {
         let chatId = dc_create_chat_by_msg_id(mailboxPointer, UInt32(id))
-        return MRChat(id: Int(chatId))
+        return DCChat(id: Int(chatId))
     }
 
     deinit {
@@ -320,7 +320,7 @@ enum ChatType: Int {
     case VERYFIEDGROUP = 130
 }
 
-class MRChat {
+class DCChat {
     var chatPointer: OpaquePointer
 
     var id: Int {
@@ -393,7 +393,7 @@ class MRChat {
     }
 }
 
-class MRPoorText {
+class DCPoorText {
     private var poorTextPointer: OpaquePointer
 
     var text1: String? {
@@ -434,7 +434,7 @@ class MRPoorText {
     }
 }
 
-class MRChatList {
+class DCChatList {
     private var chatListPointer: OpaquePointer
 
     var length: Int {
@@ -455,11 +455,11 @@ class MRChatList {
         return Int(dc_chatlist_get_msg_id(chatListPointer, index))
     }
 
-    func summary(index: Int) -> MRPoorText {
+    func summary(index: Int) -> DCPoorText {
         guard let poorTextPointer = dc_chatlist_get_summary(self.chatListPointer, index, nil) else {
             fatalError("poor text pointer was nil")
         }
-        return MRPoorText(poorTextPointer: poorTextPointer)
+        return DCPoorText(poorTextPointer: poorTextPointer)
     }
 
     deinit {
@@ -478,7 +478,7 @@ func strToBool(_ value: String?) -> Bool {
     return false
 }
 
-class MRConfig {
+class DCConfig {
     private class func getOptStr(_ key: String) -> String? {
         let p = dc_get_config(mailboxPointer, key)
 

+ 1 - 1
deltachat-ios/DC/events.swift

@@ -108,7 +108,7 @@ public func callbackSwift(event: CInt, data1: CUnsignedLong, data2: CUnsignedLon
                     userInfo: userInfo)
 
             let content = UNMutableNotificationContent()
-            let msg = MRMessage(id: Int(data2))
+            let msg = DCMessage(id: Int(data2))
             content.title = msg.fromContact.name
             content.body = msg.summary(chars: 40) ?? ""
             content.badge = 1

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

@@ -104,7 +104,7 @@ extension URLSession {
     }
 }
 
-extension MRContact {
+extension DCContact {
     func contains(searchText text: String) -> [ContactHighlights] {
         var nameIndexes = [Int]()
         var emailIndexes = [Int]()