Skip to content

Commit

Permalink
fix: Prevent some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed Apr 24, 2024
1 parent 20e5a8b commit 7de8f10
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Mail/Helpers/PreviewHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import SwiftUI

enum PreviewHelper {
class MockSelectedThreadOwner: SelectedThreadOwnable {
var selectedThread: Thread? = nil
var selectedThread: Thread?
}

static var mockSelectedThreadOwner = MockSelectedThreadOwner()
Expand Down
2 changes: 1 addition & 1 deletion MailCore/Cache/AccountManager/AccountManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public final class AccountManager: RefreshTokenDelegate, ObservableObject {
logError(.missingAPIFetcher)
return
}
try await apiFetcher.detachMailbox(mailbox: mailbox)
_ = try await apiFetcher.detachMailbox(mailbox: mailbox)
try await updateUser(for: currentAccount)
}

Expand Down
2 changes: 1 addition & 1 deletion MailCore/Models/ComposeMessageIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public struct ComposeMessageIntent: Codable, Identifiable, Hashable {
switch type {
case .new(let fromExtension) where fromExtension:
return true
case .mailTo(let mailToURLComponents):
case .mailTo:
return true
default:
return false
Expand Down
4 changes: 2 additions & 2 deletions MailCore/Models/Draft.swift
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public extension Draft {
public extension Draft {
/// Compute if the draft has external recipients
func displayExternalTag(mailboxManager: MailboxManager) -> DisplayExternalRecipientStatus.State {
var recipientsList = List<Recipient>()
let recipientsList = List<Recipient>()
recipientsList.append(objectsIn: cc)
recipientsList.append(objectsIn: bcc)
recipientsList.append(objectsIn: to)
Expand Down Expand Up @@ -370,7 +370,7 @@ public extension Draft {

let itemsToExtract = removeAllElements ? Self.appendedHTMLElements : [Constants.signatureHTMLClass]
for itemToExtract in itemsToExtract {
let _ = try? document.getElementsByClass(itemToExtract).remove()
_ = try? document.getElementsByClass(itemToExtract).remove()
}

return !document.hasText()
Expand Down
2 changes: 1 addition & 1 deletion MailCore/Utils/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public enum DeeplinkConstants {
}
}

@MainActor
public enum DesktopWindowIdentifier {
public static let settingsWindowIdentifier = "settings"
public static let composeWindowIdentifier = "compose"
public static let threadWindowIdentifier = "thread"

@MainActor
public static func mainWindowIdentifier(currentViewState: RootViewState) -> String {
if case .mainView(let mainViewState) = currentViewState.state {
return "Main-\(mainViewState.mailboxManager.mailbox.objectId)"
Expand Down
2 changes: 1 addition & 1 deletion MailCore/Utils/Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public enum Logging {
try FileManager.default.removeItem(at: fileURL)
}
} catch {
DDLogError(error)
DDLogError("resetAppForUITestsIfNeeded \(error)")
}
}
#endif
Expand Down
14 changes: 5 additions & 9 deletions MailUITests/MailUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class MailUITests: XCTestCase {
continueAfterFailure = false
}

override func tearDownWithError() throws {
try super.tearDownWithError()
}

func launchAppFromScratch(resetData: Bool = true) {
if resetData {
app.launchArguments += ["resetData"]
Expand Down Expand Up @@ -181,7 +177,7 @@ class MailUITests: XCTestCase {

func swipeFirstCell() {
let testMailCell = app.collectionViews.cells.element(boundBy: 1)
let _ = testMailCell.waitForExistence(timeout: 10)
_ = testMailCell.waitForExistence(timeout: 10)
testMailCell.firstMatch.swipeLeft()
}

Expand Down Expand Up @@ -212,12 +208,12 @@ class MailUITests: XCTestCase {
app.buttons[MailResourcesStrings.Localizable.contentDescriptionButtonNext].firstMatch.tap()

let loginButton = app.buttons[MailResourcesStrings.Localizable.buttonLogin].firstMatch
let _ = loginButton.waitForExistence(timeout: 2)
_ = loginButton.waitForExistence(timeout: 2)
loginButton.tap()
let loginWebview = app.webViews.firstMatch

let emailField = loginWebview.textFields.firstMatch
let _ = emailField.waitForExistence(timeout: 5)
_ = emailField.waitForExistence(timeout: 5)
emailField.tap()
emailField.typeText(Env.testAccountEmail)

Expand All @@ -229,14 +225,14 @@ class MailUITests: XCTestCase {
let nextButton = app.buttons[MailResourcesStrings.Localizable.contentDescriptionButtonNext]
let permissionApp = XCUIApplication(bundleIdentifier: "com.apple.springboard")

let _ = nextButton.waitForExistence(timeout: 3)
_ = nextButton.waitForExistence(timeout: 3)
if nextButton.exists {
nextButton.tap()

permissionApp.alerts.firstMatch.buttons.firstMatch.tap()
}

let _ = nextButton.waitForExistence(timeout: 3)
_ = nextButton.waitForExistence(timeout: 3)
if nextButton.exists {
app.buttons.firstMatch.tap()

Expand Down

0 comments on commit 7de8f10

Please sign in to comment.