From 1799601be9851cf56e74120fe5cb9d5133b47d9a Mon Sep 17 00:00:00 2001 From: Ivan Ushakov Date: Sun, 20 Feb 2022 19:27:54 +0300 Subject: [PATCH] Use missing instead of missed in variable/type names --- .../Controllers/Inbox/InboxRenderable.swift | 4 ++-- .../Threads/ThreadDetailsViewController.swift | 4 ++-- .../Backup Provider/Gmail+Backup.swift | 4 ++-- .../Backup Provider/Imap+Backup.swift | 12 ++++++------ .../Gmail/GmailServiceError.swift | 18 +++++++++--------- .../Mail Provider/Imap/ImapError.swift | 4 ++-- .../Message Provider/Gmail+Message.swift | 8 ++++---- .../Gmail+MessageOperations.swift | 4 ++-- .../Imap+MessageOperations.swift | 14 +++++++------- .../MessagesThreadOperationsProvider.swift | 4 ++-- .../Threads/MessagesThreadProvider.swift | 8 ++++---- .../GmailService+folders.swift | 2 +- .../Services/GoogleUserService.swift | 4 ++-- .../Resources/en.lproj/Localizable.strings | 4 ++-- .../Mail Provider/GmailServiceTest.swift | 2 +- 15 files changed, 48 insertions(+), 48 deletions(-) diff --git a/FlowCrypt/Controllers/Inbox/InboxRenderable.swift b/FlowCrypt/Controllers/Inbox/InboxRenderable.swift index 4ca7f84ee..7fe2e499f 100644 --- a/FlowCrypt/Controllers/Inbox/InboxRenderable.swift +++ b/FlowCrypt/Controllers/Inbox/InboxRenderable.swift @@ -39,7 +39,7 @@ extension InboxRenderable { init(message: Message) { self.title = message.sender ?? "message_unknown_sender".localized self.messageCount = 1 - self.subtitle = message.subject ?? "message_missed_subject".localized + self.subtitle = message.subject ?? "message_missing_subject".localized self.dateString = DateFormatter().formatDate(message.date) self.isRead = message.isMessageRead self.date = message.date @@ -51,7 +51,7 @@ extension InboxRenderable { self.title = InboxRenderable.messageTitle(activeUserEmail: activeUserEmail, with: thread, and: folderPath) self.messageCount = thread.messages.count - self.subtitle = thread.subject ?? "message_missed_subject".localized + self.subtitle = thread.subject ?? "message_missing_subject".localized self.isRead = !thread.messages .map(\.isMessageRead) .contains(false) diff --git a/FlowCrypt/Controllers/Threads/ThreadDetailsViewController.swift b/FlowCrypt/Controllers/Threads/ThreadDetailsViewController.swift index 2a638a9b7..135394ec8 100644 --- a/FlowCrypt/Controllers/Threads/ThreadDetailsViewController.swift +++ b/FlowCrypt/Controllers/Threads/ThreadDetailsViewController.swift @@ -349,7 +349,7 @@ extension ThreadDetailsViewController { switch error as? MessageServiceError { case let .missingPassPhrase(rawMimeData): - handleMissedPassPhrase(for: rawMimeData, at: indexPath) + handleMissingPassPhrase(for: rawMimeData, at: indexPath) case let .wrongPassPhrase(rawMimeData, passPhrase): handleWrongPassPhrase(for: rawMimeData, with: passPhrase, at: indexPath) default: @@ -390,7 +390,7 @@ extension ThreadDetailsViewController { present(alertController, animated: true) } - private func handleMissedPassPhrase(for rawMimeData: Data, at indexPath: IndexPath) { + private func handleMissingPassPhrase(for rawMimeData: Data, at indexPath: IndexPath) { let alert = AlertsFactory.makePassPhraseAlert( onCancel: { [weak self] in self?.navigationController?.popViewController(animated: true) diff --git a/FlowCrypt/Functionality/Mail Provider/Backup Provider/Gmail+Backup.swift b/FlowCrypt/Functionality/Mail Provider/Backup Provider/Gmail+Backup.swift index 19ac72710..563d3c8fe 100644 --- a/FlowCrypt/Functionality/Mail Provider/Backup Provider/Gmail+Backup.swift +++ b/FlowCrypt/Functionality/Mail Provider/Backup Provider/Gmail+Backup.swift @@ -36,7 +36,7 @@ extension GmailService: BackupProvider { logger.logVerbose("downloaded \(attachments.count) attachments that contain \(data.count / 1024)kB of data") return data } catch { - throw GmailServiceError.missedBackupQuery(error) + throw GmailServiceError.missingBackupQuery(error) } } @@ -52,7 +52,7 @@ extension GmailService: BackupProvider { return continuation.resume(throwing: GmailServiceError.providerError(error)) } guard let attachmentPart = data as? GTLRGmail_MessagePartBody else { - return continuation.resume(throwing: GmailServiceError.missedMessageInfo("findAttachment data")) + return continuation.resume(throwing: GmailServiceError.missingMessageInfo("findAttachment data")) } guard let data = GTLRDecodeBase64(attachmentPart.data) else { return continuation.resume(throwing: GmailServiceError.messageEncode) diff --git a/FlowCrypt/Functionality/Mail Provider/Backup Provider/Imap+Backup.swift b/FlowCrypt/Functionality/Mail Provider/Backup Provider/Imap+Backup.swift index bbe1912d3..110338872 100644 --- a/FlowCrypt/Functionality/Mail Provider/Backup Provider/Imap+Backup.swift +++ b/FlowCrypt/Functionality/Mail Provider/Backup Provider/Imap+Backup.swift @@ -11,13 +11,13 @@ import MailCore enum BackupError: Error { /// "Error while fetching folders" no folders on account - case missedFolders + case missingFolders /// "Error while fetching uids" - case missedUIDS + case missingUIDS /// "Error while fetching messages" - case missedMessages + case missingMessages /// "Error while fetching attributes" - case missedAttributes + case missingAttributes } extension Imap: BackupProvider { @@ -25,7 +25,7 @@ extension Imap: BackupProvider { var folderPaths = (try await fetchFolders()).map(\.path) guard folderPaths.isNotEmpty else { - throw BackupError.missedFolders + throw BackupError.missingFolders } if let inbox = folderPaths.firstCaseInsensitive("inbox") { @@ -42,7 +42,7 @@ extension Imap: BackupProvider { } guard uidsForFolders.isNotEmpty else { - throw BackupError.missedUIDS + throw BackupError.missingUIDS } var messageContexts: [MsgContext] = [] diff --git a/FlowCrypt/Functionality/Mail Provider/Gmail/GmailServiceError.swift b/FlowCrypt/Functionality/Mail Provider/Gmail/GmailServiceError.swift index 5c4038fc7..161864fa7 100644 --- a/FlowCrypt/Functionality/Mail Provider/Gmail/GmailServiceError.swift +++ b/FlowCrypt/Functionality/Mail Provider/Gmail/GmailServiceError.swift @@ -11,16 +11,16 @@ import Foundation enum GmailServiceError: Error { /// Gmail API response parsing case failedToParseData(Any?) - /// can't get GTLREncodeBase64 data + /// Can't get GTLREncodeBase64 data case messageEncode - /// message doesn't have any payload - case missedMessagePayload - /// Missed message part - case missedMessageInfo(String) + /// Message doesn't have any payload + case missingMessagePayload + /// Missing message part + case missingMessageInfo(String) /// Provider Error case providerError(Error) /// Empty or invalid backup search query - case missedBackupQuery(Error) + case missingBackupQuery(Error) } extension GmailServiceError: LocalizedError { @@ -30,13 +30,13 @@ extension GmailServiceError: LocalizedError { return "gmail_service_failed_to_parse_data_error_message".localized case .messageEncode: return "gmail_service_message_encode_error_message".localized - case .missedMessagePayload: + case .missingMessagePayload: return "gmail_service_missing_message_payload_error_message".localized - case .missedMessageInfo(let info): + case .missingMessageInfo(let info): return "gmail_service_missing_message_info_error_message".localizeWithArguments(info) case .providerError(let error): return "gmail_service_provider_error_error_message".localizeWithArguments(error.localizedDescription) - case .missedBackupQuery(let error): + case .missingBackupQuery(let error): return "gmail_service_missing_back_query_error_message".localizeWithArguments(error.localizedDescription) } } diff --git a/FlowCrypt/Functionality/Mail Provider/Imap/ImapError.swift b/FlowCrypt/Functionality/Mail Provider/Imap/ImapError.swift index fa0141924..8438fbad2 100644 --- a/FlowCrypt/Functionality/Mail Provider/Imap/ImapError.swift +++ b/FlowCrypt/Functionality/Mail Provider/Imap/ImapError.swift @@ -11,7 +11,7 @@ import Foundation enum ImapError: Error { case noSession case providerError(Error) - case missedMessageInfo(String) + case missingMessageInfo(String) } extension ImapError: CustomStringConvertible { @@ -21,7 +21,7 @@ extension ImapError: CustomStringConvertible { return "imap_error_no_session".localized case .providerError(let error): return "imap_error_provider".localizeWithArguments(error.localizedDescription) - case .missedMessageInfo(let message): + case .missingMessageInfo(let message): return "imap_error_msg_info".localizeWithArguments(message) } } diff --git a/FlowCrypt/Functionality/Mail Provider/Message Provider/Gmail+Message.swift b/FlowCrypt/Functionality/Mail Provider/Message Provider/Gmail+Message.swift index 2f52e5d0a..645b41e76 100644 --- a/FlowCrypt/Functionality/Mail Provider/Message Provider/Gmail+Message.swift +++ b/FlowCrypt/Functionality/Mail Provider/Message Provider/Gmail+Message.swift @@ -16,7 +16,7 @@ extension GmailService: MessageProvider { progressHandler: ((MessageFetchState) -> Void)?) async throws -> Data { try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in guard let identifier = message.identifier.stringId else { - return continuation.resume(throwing: GmailServiceError.missedMessageInfo("id")) + return continuation.resume(throwing: GmailServiceError.missingMessageInfo("id")) } Task { @@ -36,13 +36,13 @@ extension GmailService: MessageProvider { let dictionary = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any], let raw = dictionary["raw"] as? String else { - return continuation.resume(throwing: GmailServiceError.missedMessageInfo("raw")) + return continuation.resume(throwing: GmailServiceError.missingMessageInfo("raw")) } progressHandler?(.decrypt) guard let data = GTLRDecodeWebSafeBase64(raw) else { - return continuation.resume(throwing: GmailServiceError.missedMessageInfo("data")) + return continuation.resume(throwing: GmailServiceError.missingMessageInfo("data")) } return continuation.resume(returning: data) @@ -64,7 +64,7 @@ extension GmailService: MessageProvider { } guard let sizeEstimate = gmailMessage.sizeEstimate?.floatValue else { - return continuation.resume(throwing: GmailServiceError.missedMessageInfo("sizeEstimate")) + return continuation.resume(throwing: GmailServiceError.missingMessageInfo("sizeEstimate")) } // google returns smaller estimated size diff --git a/FlowCrypt/Functionality/Mail Provider/MessageOperations Provider/Gmail+MessageOperations.swift b/FlowCrypt/Functionality/Mail Provider/MessageOperations Provider/Gmail+MessageOperations.swift index 16552026e..f4930ce88 100644 --- a/FlowCrypt/Functionality/Mail Provider/MessageOperations Provider/Gmail+MessageOperations.swift +++ b/FlowCrypt/Functionality/Mail Provider/MessageOperations Provider/Gmail+MessageOperations.swift @@ -25,7 +25,7 @@ extension GmailService: MessageOperationsProvider { func delete(message: Message, form folderPath: String?) async throws { try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in guard let identifier = message.identifier.stringId else { - return continuation.resume(throwing: GmailServiceError.missedMessageInfo("id")) + return continuation.resume(throwing: GmailServiceError.missingMessageInfo("id")) } let query = GTLRGmailQuery_UsersMessagesDelete.query( @@ -59,7 +59,7 @@ extension GmailService: MessageOperationsProvider { ) async throws { try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in guard let identifier = message.identifier.stringId else { - return continuation.resume(throwing: GmailServiceError.missedMessageInfo("id")) + return continuation.resume(throwing: GmailServiceError.missingMessageInfo("id")) } let request = GTLRGmail_ModifyMessageRequest() request.addLabelIds = labelsToAdd.map(\.value) diff --git a/FlowCrypt/Functionality/Mail Provider/MessageOperations Provider/Imap+MessageOperations.swift b/FlowCrypt/Functionality/Mail Provider/MessageOperations Provider/Imap+MessageOperations.swift index 52e183894..9bfa3f9ea 100644 --- a/FlowCrypt/Functionality/Mail Provider/MessageOperations Provider/Imap+MessageOperations.swift +++ b/FlowCrypt/Functionality/Mail Provider/MessageOperations Provider/Imap+MessageOperations.swift @@ -13,7 +13,7 @@ extension Imap: MessageOperationsProvider { func markAsUnread(message: Message, folder: String) async throws { guard let identifier = message.identifier.intId else { - throw ImapError.missedMessageInfo("intId") + throw ImapError.missingMessageInfo("intId") } try await executeVoid("markAsUnread", { sess, respond in sess.storeFlagsOperation( @@ -27,7 +27,7 @@ extension Imap: MessageOperationsProvider { func markAsRead(message: Message, folder: String) async throws { guard let identifier = message.identifier.intId else { - throw ImapError.missedMessageInfo("intId") + throw ImapError.missingMessageInfo("intId") } var flags: MCOMessageFlag = [] let imapFlagValues = message.labels.map(\.type.imapFlagValue) @@ -49,10 +49,10 @@ extension Imap: MessageOperationsProvider { func moveMessageToTrash(message: Message, trashPath: String?, from folder: String) async throws { guard let identifier = message.identifier.intId else { - throw ImapError.missedMessageInfo("intId") + throw ImapError.missingMessageInfo("intId") } guard let trashPath = trashPath else { - throw ImapError.missedMessageInfo("trashPath") + throw ImapError.missingMessageInfo("trashPath") } try await moveMsg(with: identifier, folder: folder, destFolder: trashPath) } @@ -69,10 +69,10 @@ extension Imap: MessageOperationsProvider { func delete(message: Message, form folderPath: String?) async throws { guard let identifier = message.identifier.intId else { - throw ImapError.missedMessageInfo("intId") + throw ImapError.missingMessageInfo("intId") } guard let folderPath = folderPath else { - throw ImapError.missedMessageInfo("folderPath") + throw ImapError.missingMessageInfo("folderPath") } try await pushUpdatedMsgFlags(with: identifier, folder: folderPath, flags: MCOMessageFlag.deleted) try await expungeMsgs(folder: folderPath) @@ -99,7 +99,7 @@ extension Imap: MessageOperationsProvider { func archiveMessage(message: Message, folderPath: String) async throws { guard let identifier = message.identifier.intId else { - throw ImapError.missedMessageInfo("intId") + throw ImapError.missingMessageInfo("intId") } try await pushUpdatedMsgFlags(with: identifier, folder: folderPath, flags: MCOMessageFlag.deleted) } diff --git a/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadOperationsProvider.swift b/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadOperationsProvider.swift index 53cd92d89..e549cc4f6 100644 --- a/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadOperationsProvider.swift +++ b/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadOperationsProvider.swift @@ -22,7 +22,7 @@ extension GmailService: MessagesThreadOperationsProvider { func delete(thread: MessageThread) async throws { try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in guard let identifier = thread.identifier else { - return continuation.resume(throwing: GmailServiceError.missedMessageInfo("id")) + return continuation.resume(throwing: GmailServiceError.missingMessageInfo("id")) } let query = GTLRGmailQuery_UsersThreadsDelete.query( @@ -76,7 +76,7 @@ extension GmailService: MessagesThreadOperationsProvider { ) async throws { try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in guard let identifier = thread.identifier else { - return continuation.resume(throwing: GmailServiceError.missedMessageInfo("id")) + return continuation.resume(throwing: GmailServiceError.missingMessageInfo("id")) } let request = GTLRGmail_ModifyThreadRequest() diff --git a/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadProvider.swift b/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadProvider.swift index 7ea744222..0cbc95cdb 100644 --- a/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadProvider.swift +++ b/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadProvider.swift @@ -126,19 +126,19 @@ extension Message { draftIdentifier: String? = nil ) throws { guard let payload = message.payload else { - throw GmailServiceError.missedMessagePayload + throw GmailServiceError.missingMessagePayload } guard let messageHeaders = payload.headers else { - throw GmailServiceError.missedMessageInfo("headers") + throw GmailServiceError.missingMessageInfo("headers") } guard let internalDate = message.internalDate as? Double else { - throw GmailServiceError.missedMessageInfo("date") + throw GmailServiceError.missingMessageInfo("date") } guard let identifier = message.identifier else { - throw GmailServiceError.missedMessageInfo("id") + throw GmailServiceError.missingMessageInfo("id") } let attachmentsIds = payload.parts?.compactMap { $0.body?.attachmentId } ?? [] diff --git a/FlowCrypt/Functionality/Services/Folders Services/RemoteFoldersProviderType/GmailService+folders.swift b/FlowCrypt/Functionality/Services/Folders Services/RemoteFoldersProviderType/GmailService+folders.swift index a2e6f08ee..c9e6c3a06 100644 --- a/FlowCrypt/Functionality/Services/Folders Services/RemoteFoldersProviderType/GmailService+folders.swift +++ b/FlowCrypt/Functionality/Services/Folders Services/RemoteFoldersProviderType/GmailService+folders.swift @@ -55,7 +55,7 @@ private extension Folder { assertionFailure("Gmail folder \(gmailFolder) doesn't have identifier") return nil } - // folder.identifier is missed for hidden GTLRGmail_Labels + // folder.identifier is missing for hidden GTLRGmail_Labels if path.isEmpty { return nil } diff --git a/FlowCrypt/Functionality/Services/GoogleUserService.swift b/FlowCrypt/Functionality/Services/GoogleUserService.swift index b69176411..5fb574b3e 100644 --- a/FlowCrypt/Functionality/Services/GoogleUserService.swift +++ b/FlowCrypt/Functionality/Services/GoogleUserService.swift @@ -178,11 +178,11 @@ extension GoogleUserService: UserServiceType { } let authorization = GTMAppAuthFetcherAuthorization(authState: authState) guard let email = authorization.userEmail else { - throw GoogleUserServiceError.inconsistentState("Missed email") + throw GoogleUserServiceError.inconsistentState("Missing email") } self.saveAuth(state: authState, for: email) guard let token = authState.lastTokenResponse?.accessToken else { - throw GoogleUserServiceError.inconsistentState("Missed token") + throw GoogleUserServiceError.inconsistentState("Missing token") } let user = try await self.fetchGoogleUser(with: authorization) return SessionType.google(email, name: user.name, token: token) diff --git a/FlowCrypt/Resources/en.lproj/Localizable.strings b/FlowCrypt/Resources/en.lproj/Localizable.strings index 20cd613d8..a32d8ee7d 100644 --- a/FlowCrypt/Resources/en.lproj/Localizable.strings +++ b/FlowCrypt/Resources/en.lproj/Localizable.strings @@ -43,7 +43,7 @@ "message_compose_secure" = "Compose Secure Message"; "message_unknown_sender" = "(unknown sender)"; "message_no_recipients" = "(no recipients)"; -"message_missed_subject" = "No subject"; +"message_missing_subject" = "No subject"; "message_attachment_saved_successfully_title" = "Attachment Saved"; "message_attachment_saved_successfully_message" = "Your attachment was saved in Files. Would you like to open it?"; "message_attachment_saved_with_error" = "Attachment could not be saved. %@"; @@ -308,7 +308,7 @@ "gmail_service_missing_message_payload_error_message" = "Missing message payload"; "gmail_service_missing_message_info_error_message" = "Missing message info: %@"; "gmail_service_provider_error_error_message" = "Gmail provider error: %@"; -"gmail_service_missing_back_query_error_message" = "Missed backup query: %@"; +"gmail_service_missing_back_query_error_message" = "Missing backup query: %@"; "gmail_service_no_access_to_account_message" = "Google login successful.\n Now connect your inbox on the next screen. The grant is stored locally on your device, never shared with anyone."; // Files picking diff --git a/FlowCryptAppTests/Functionality/Mail Provider/GmailServiceTest.swift b/FlowCryptAppTests/Functionality/Mail Provider/GmailServiceTest.swift index 1e071767c..963cb1893 100644 --- a/FlowCryptAppTests/Functionality/Mail Provider/GmailServiceTest.swift +++ b/FlowCryptAppTests/Functionality/Mail Provider/GmailServiceTest.swift @@ -33,7 +33,7 @@ class GmailServiceTest: XCTestCase { _ = try await sut.searchBackups(for: "james.bond@gmail.com") } catch { switch error as? GmailServiceError { - case .missedBackupQuery(let underliningError): + case .missingBackupQuery(let underliningError): XCTAssertTrue(underliningError is MockError) default: XCTFail()