Browse Source

limit access to 'private' where sufficient

B. Petersen 5 years ago
parent
commit
4113cacbee

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

@@ -845,30 +845,30 @@ class AccountSetupController: UITableViewController, ProgressAlertHandler {
     }
 
     // MARK: - coordinator
-    func showCertCheckOptions() {
+    private func showCertCheckOptions() {
         let certificateCheckController = CertificateCheckController(dcContext: dcContext, sectionTitle: String.localized("login_certificate_checks"))
         navigationController?.pushViewController(certificateCheckController, animated: true)
     }
 
-    func showImapSecurityOptions() {
+    private func showImapSecurityOptions() {
         let securitySettingsController = SecuritySettingsController(dcContext: dcContext, title: String.localized("login_imap_security"),
                                                                       type: SecurityType.IMAPSecurity)
         navigationController?.pushViewController(securitySettingsController, animated: true)
     }
 
-    func showSmptpSecurityOptions() {
+    private func showSmptpSecurityOptions() {
         let securitySettingsController = SecuritySettingsController(dcContext: dcContext,
                                                                     title: String.localized("login_imap_security"),
                                                                     type: SecurityType.SMTPSecurity)
         navigationController?.pushViewController(securitySettingsController, animated: true)
     }
 
-    func openProviderInfo(provider: DcProvider) {
+    private func openProviderInfo(provider: DcProvider) {
         guard let url = URL(string: provider.getOverviewPage) else { return }
         UIApplication.shared.open(url)
     }
 
-    func navigateBack() {
+    private func navigateBack() {
         navigationController?.popViewController(animated: true)
     }
 }

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

@@ -361,7 +361,7 @@ class ChatListController: UITableViewController {
     }
 
     // MARK: - coordinator
-    func showNewChatController() {
+    private func showNewChatController() {
         let newChatVC = NewChatViewController(dcContext: dcContext)
         navigationController?.pushViewController(newChatVC, animated: true)
     }
@@ -371,13 +371,13 @@ class ChatListController: UITableViewController {
         navigationController?.pushViewController(chatVC, animated: true)
     }
 
-    func showArchive() {
+    private func showArchive() {
         let viewModel = ChatListViewModel(dcContext: dcContext, isArchive: true)
         let controller = ChatListController(dcContext: dcContext, viewModel: viewModel)
         navigationController?.pushViewController(controller, animated: true)
     }
 
-    func showNewChat(contactId: Int) {
+    private func showNewChat(contactId: Int) {
         let chatId = dcContext.createChatByContactId(contactId: contactId)
         showChat(chatId: Int(chatId))
     }

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

@@ -640,11 +640,11 @@ class ChatViewController: MessagesViewController {
     }
 
     // MARK: - coordinator
-    func navigateBack() {
+    private func navigateBack() {
         navigationController?.popViewController(animated: true)
     }
 
-    func showChatDetail(chatId: Int) {
+    private func showChatDetail(chatId: Int) {
         let chat = dcContext.getChat(chatId: chatId)
         switch chat.chatType {
         case .SINGLE:
@@ -659,7 +659,7 @@ class ChatViewController: MessagesViewController {
         }
     }
 
-    func showContactDetail(of contactId: Int, in chatOfType: ChatType, chatId: Int?) {
+    private func showContactDetail(of contactId: Int, in chatOfType: ChatType, chatId: Int?) {
         let viewModel = ContactDetailViewModel(contactId: contactId, chatId: chatId, context: dcContext )
         let contactDetailController = ContactDetailViewController(viewModel: viewModel)
         navigationController?.pushViewController(contactDetailController, animated: true)
@@ -672,23 +672,23 @@ class ChatViewController: MessagesViewController {
         }
     }
 
-    func showDocumentLibrary(delegate: MediaPickerDelegate) {
+    private func showDocumentLibrary(delegate: MediaPickerDelegate) {
         mediaPicker?.showDocumentLibrary(delegate: delegate)
     }
 
-    func showVoiceMessageRecorder(delegate: MediaPickerDelegate) {
+    private func showVoiceMessageRecorder(delegate: MediaPickerDelegate) {
         mediaPicker?.showVoiceRecorder(delegate: delegate)
     }
 
-    func showCameraViewController(delegate: MediaPickerDelegate) {
+    private func showCameraViewController(delegate: MediaPickerDelegate) {
         mediaPicker?.showCamera(delegate: delegate, allowCropping: false)
     }
 
-    func showPhotoVideoLibrary(delegate: MediaPickerDelegate) {
+    private func showPhotoVideoLibrary(delegate: MediaPickerDelegate) {
         mediaPicker?.showPhotoVideoLibrary(delegate: delegate)
     }
 
-    func showMediaGallery(currentIndex: Int, mediaUrls urls: [URL]) {
+    private func showMediaGallery(currentIndex: Int, mediaUrls urls: [URL]) {
         let betterPreviewController = PreviewController(currentIndex: currentIndex, urls: urls)
         let nav = UINavigationController(rootViewController: betterPreviewController)
         nav.modalPresentationStyle = .fullScreen

+ 5 - 7
deltachat-ios/Controller/ContactDetailViewController.swift

@@ -277,23 +277,23 @@ class ContactDetailViewController: UITableViewController {
     }
 
     // MARK: - coordinator
-    func showChat(chatId: Int) {
+    private func showChat(chatId: Int) {
         if let chatlistViewController = navigationController?.viewControllers[0] {
             let chatViewController = ChatViewController(dcContext: viewModel.context, chatId: chatId)
             navigationController?.setViewControllers([chatlistViewController, chatViewController], animated: true)
         }
     }
 
-    func showEditContact(contactId: Int) {
+    private func showEditContact(contactId: Int) {
         let editContactController = EditContactController(dcContext: viewModel.context, contactIdForUpdate: contactId)
         navigationController?.pushViewController(editContactController, animated: true)
     }
 
-    func showDocuments() {
+    private func showDocuments() {
         presentPreview(for: DC_MSG_FILE, messageType2: DC_MSG_AUDIO, messageType3: 0)
     }
 
-    func showGallery() {
+    private func showGallery() {
         presentPreview(for: DC_MSG_IMAGE, messageType2: DC_MSG_GIF, messageType3: DC_MSG_VIDEO)
     }
 
@@ -313,8 +313,7 @@ class ContactDetailViewController: UITableViewController {
         }
     }
 
-
-    func deleteChat() {
+    private func deleteChat() {
         guard let chatId = viewModel.chatId else {
             return
         }
@@ -341,5 +340,4 @@ class ContactDetailViewController: UITableViewController {
         }
         CATransaction.commit()
     }
-
 }

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

@@ -131,7 +131,7 @@ class EditGroupViewController: UITableViewController, MediaPickerDelegate {
     }
 
     // MARK: - coordinator
-    func navigateBack() {
+    private func navigateBack() {
         navigationController?.popViewController(animated: true)
     }
 }

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

@@ -190,37 +190,37 @@ class GroupChatDetailViewController: UIViewController {
     }
 
     // MARK: - coordinator
-    func showSingleChatEdit(contactId: Int) {
+    private func showSingleChatEdit(contactId: Int) {
         let editContactController = EditContactController(dcContext: dcContext, contactIdForUpdate: contactId)
         navigationController?.pushViewController(editContactController, animated: true)
     }
 
-    func showAddGroupMember(chatId: Int) {
+    private func showAddGroupMember(chatId: Int) {
         let groupMemberViewController = AddGroupMembersViewController(chatId: chatId)
         navigationController?.pushViewController(groupMemberViewController, animated: true)
     }
 
-    func showQrCodeInvite(chatId: Int) {
+    private func showQrCodeInvite(chatId: Int) {
         let qrInviteCodeController = QrInviteViewController(dcContext: dcContext, chatId: chatId)
         navigationController?.pushViewController(qrInviteCodeController, animated: true)
     }
 
-    func showGroupChatEdit(chat: DcChat) {
+    private func showGroupChatEdit(chat: DcChat) {
         let editGroupViewController = EditGroupViewController(dcContext: dcContext, chat: chat)
         navigationController?.pushViewController(editGroupViewController, animated: true)
     }
 
-    func showContactDetail(of contactId: Int) {
+    private func showContactDetail(of contactId: Int) {
         let viewModel = ContactDetailViewModel(contactId: contactId, chatId: nil, context: dcContext)
         let contactDetailController = ContactDetailViewController(viewModel: viewModel)
         navigationController?.pushViewController(contactDetailController, animated: true)
     }
 
-    func showDocuments() {
+    private func showDocuments() {
         presentPreview(for: DC_MSG_FILE, messageType2: DC_MSG_AUDIO, messageType3: 0)
     }
 
-    func showGallery() {
+    private func showGallery() {
         presentPreview(for: DC_MSG_IMAGE, messageType2: DC_MSG_GIF, messageType3: DC_MSG_VIDEO)
     }
 
@@ -237,7 +237,7 @@ class GroupChatDetailViewController: UIViewController {
         navigationController?.pushViewController(previewController, animated: true)
     }
 
-    func deleteChat() {
+    private func deleteChat() {
         /*
         app will navigate to chatlist or archive and delete the chat there
         notify chatList/archiveList to delete chat AFTER is is visible

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

@@ -219,7 +219,7 @@ class AddGroupMembersViewController: GroupMembersViewController {
     }
 
     // MARK: - coordinator
-    func showNewContactController() {
+    private func showNewContactController() {
         let newContactController = NewContactController(dcContext: dcContext)
         newContactController.openChatOnSave = false
         navigationController?.pushViewController(newContactController, animated: true)

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

@@ -328,28 +328,28 @@ class NewChatViewController: UITableViewController {
     }
 
     // MARK: - coordinator
-    func showNewGroupController(isVerified: Bool) {
+    private func showNewGroupController(isVerified: Bool) {
         let newGroupController = NewGroupController(dcContext: dcContext, isVerified: isVerified)
         navigationController?.pushViewController(newGroupController, animated: true)
     }
 
-    func showNewContactController() {
+    private func showNewContactController() {
         let newContactController = NewContactController(dcContext: dcContext)
         navigationController?.pushViewController(newContactController, animated: true)
     }
 
-    func showNewChat(contactId: Int) {
+    private func showNewChat(contactId: Int) {
         let chatId = dcContext.createChatByContactId(contactId: contactId)
         showChat(chatId: Int(chatId))
     }
 
-    func showChat(chatId: Int) {
+    private func showChat(chatId: Int) {
         let chatViewController = ChatViewController(dcContext: dcContext, chatId: chatId)
         navigationController?.pushViewController(chatViewController, animated: true)
         navigationController?.viewControllers.remove(at: 1)
     }
 
-    func showContactDetail(contactId: Int) {
+    private func showContactDetail(contactId: Int) {
         let viewModel = ContactDetailViewModel(contactId: contactId, chatId: nil, context: dcContext)
         let contactDetailController = ContactDetailViewController(viewModel: viewModel)
         navigationController?.pushViewController(contactDetailController, animated: true)

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

@@ -104,7 +104,7 @@ class NewContactController: UITableViewController {
         navigationController?.popViewController(animated: true)
     }
 
-    func showChat(chatId: Int) {
+    private func showChat(chatId: Int) {
         let chatViewController = ChatViewController(dcContext: dcContext, chatId: chatId)
         navigationController?.popToRootViewController(animated: false)
         navigationController?.pushViewController(chatViewController, animated: true)

+ 7 - 7
deltachat-ios/Controller/NewGroupController.swift

@@ -343,40 +343,40 @@ class NewGroupController: UITableViewController, MediaPickerDelegate {
     }
 
     // MARK: - coordinator
-    func showGroupChat(chatId: Int) {
+    private func showGroupChat(chatId: Int) {
         let chatViewController = ChatViewController(dcContext: dcContext, chatId: chatId)
         navigationController?.popToRootViewController(animated: false)
         navigationController?.pushViewController(chatViewController, animated: true)
     }
 
-    func showPhotoPicker(delegate: MediaPickerDelegate) {
+    private func showPhotoPicker(delegate: MediaPickerDelegate) {
         mediaPicker?.showPhotoGallery(delegate: delegate)
     }
 
-    func showCamera(delegate: MediaPickerDelegate) {
+    private func showCamera(delegate: MediaPickerDelegate) {
         mediaPicker?.showCamera(delegate: delegate)
     }
 
-    func showQrCodeInvite(chatId: Int) {
+    private func showQrCodeInvite(chatId: Int) {
         let qrInviteCodeController = QrInviteViewController(dcContext: dcContext, chatId: chatId)
         qrInviteCodeController.onDismissed = onQRInviteCodeControllerDismissed
         navigationController?.pushViewController(qrInviteCodeController, animated: true)
     }
 
-    func showAddMembers(preselectedMembers: Set<Int>, isVerified: Bool) {
+    private func showAddMembers(preselectedMembers: Set<Int>, isVerified: Bool) {
         let newGroupController = NewGroupAddMembersViewController(preselected: preselectedMembers,
                                                                   isVerified: isVerified)
         newGroupController.onMembersSelected = onGroupMembersSelected(_:)
         navigationController?.pushViewController(newGroupController, animated: true)
     }
 
-    func onQRInviteCodeControllerDismissed() {
+    private func onQRInviteCodeControllerDismissed() {
         if let groupNameController = navigationController?.topViewController as? NewGroupController {
             groupNameController.updateGroupContactIdsOnQRCodeInvite()
         }
     }
 
-    func onGroupMembersSelected(_ memberIds: Set<Int>) {
+    private func onGroupMembersSelected(_ memberIds: Set<Int>) {
         navigationController?.popViewController(animated: true)
         if let groupNameController = navigationController?.topViewController as? NewGroupController {
             groupNameController.updateGroupContactIdsOnListSelection(memberIds)

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

@@ -80,13 +80,13 @@ class QrPageController: UIPageViewController, ProgressAlertHandler {
     }
 
     // MARK: - coordinator
-    func showChats() {
+    private func showChats() {
         if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
             appDelegate.appCoordinator.showTab(index: appDelegate.appCoordinator.chatsTab)
         }
     }
 
-    func showChat(chatId: Int) {
+    private func showChat(chatId: Int) {
         if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
             appDelegate.appCoordinator.showChat(chatId: chatId)
         }

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

@@ -443,36 +443,36 @@ internal final class SettingsViewController: UITableViewController {
     }
 
     // MARK: - coordinator
-    func showEditSettingsController() {
+    private func showEditSettingsController() {
         let editController = EditSettingsController(dcContext: dcContext)
         navigationController?.pushViewController(editController, animated: true)
     }
 
-    func showClassicMail() {
+    private func showClassicMail() {
         let settingsClassicViewController = SettingsClassicViewController(dcContext: dcContext)
         navigationController?.pushViewController(settingsClassicViewController, animated: true)
     }
 
-    func showBlockedContacts() {
+    private func showBlockedContacts() {
         let blockedContactsController = BlockedContactsViewController()
         navigationController?.pushViewController(blockedContactsController, animated: true)
     }
 
-    func showAutodelOptions() {
+    private func showAutodelOptions() {
         let settingsAutodelOverviewController = SettingsAutodelOverviewController(dcContext: dcContext)
         navigationController?.pushViewController(settingsAutodelOverviewController, animated: true)
     }
 
-    func showContactRequests() {
+    private func showContactRequests() {
         let deaddropViewController = MailboxViewController(dcContext: dcContext, chatId: Int(DC_CHAT_ID_DEADDROP))
         navigationController?.pushViewController(deaddropViewController, animated: true)
     }
 
-    func showHelp() {
+    private func showHelp() {
         navigationController?.pushViewController(HelpViewController(), animated: true)
     }
 
-    func showDebugToolkit() {
+    private func showDebugToolkit() {
         DBDebugToolkit.setup(with: [])  // emtpy array will override default device shake trigger
         DBDebugToolkit.setupCrashReporting()
         let info: [DBCustomVariable] = dcContext.getInfo().map { kv in