Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ extension GmailService: DraftGateway {
}
}

func getDraft(with identifier: String) async throws -> GTLRGmail_Draft {
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<GTLRGmail_Draft, Error>) in

let query = GTLRGmailQuery_UsersDraftsGet.query(withUserId: .me, identifier: identifier)

gmailService.executeQuery(query) { _, object, error in
if let error = error {
continuation.resume(throwing: GmailServiceError.providerError(error))
} else if let draft = object as? GTLRGmail_Draft {
continuation.resume(returning: (draft))
} else {
continuation.resume(throwing: GmailServiceError.failedToParseData(nil))
}
}
}
}

private func createQueryForDraftAction(raw: String, threadId: String?, draft: GTLRGmail_Draft?) -> GTLRGmailQuery {
guard
let createdDraft = draft,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ protocol MessageGateway {

protocol DraftGateway {
func saveDraft(input: MessageGatewayInput, draft: GTLRGmail_Draft?) async throws -> GTLRGmail_Draft
func getDraft(with identifier: String) async throws -> GTLRGmail_Draft
func deleteDraft(with identifier: String) async
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,7 @@ final class ComposeMessageService {
throw ComposeMessageError.gatewayError(error)
}
}

func getDraft(with identifier: String) {
Task {
// tom - unsure what this does? the result is unused
let draft = try await draftGateway?.getDraft(with: identifier)
}
}


// MARK: - Encrypt and Send
func encryptAndSend(message: SendableMsg, threadId: String?, progressHandler: ((Float) -> Void)?) async throws {
do {
Expand Down
4 changes: 0 additions & 4 deletions FlowCryptAppTests/Mocks/DraftGatewayMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,5 @@ class DraftGatewayMock: DraftGateway {
return GTLRGmail_Draft()
}

func getDraft(with identifier: String) async throws -> GTLRGmail_Draft {
return GTLRGmail_Draft()
}

func deleteDraft(with identifier: String) async {}
}