Skip to content

Commit

Permalink
Merge branch 'fix-swiftlint-warnings-ios-289'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrej Mihajlov committed Aug 29, 2023
2 parents 90d15e4 + fe27d80 commit 9ac934e
Show file tree
Hide file tree
Showing 22 changed files with 582 additions and 591 deletions.
12 changes: 12 additions & 0 deletions ios/MullvadVPN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@
F0C2AEFD2A0BB5CC00986207 /* NotificationProviderIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0C2AEFC2A0BB5CC00986207 /* NotificationProviderIdentifier.swift */; };
F0C6FA812A66E23300F521F0 /* DeleteAccountOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0C6FA802A66E23300F521F0 /* DeleteAccountOperation.swift */; };
F0C6FA852A6A733700F521F0 /* InAppPurchaseInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0C6FA842A6A733700F521F0 /* InAppPurchaseInteractor.swift */; };
F0DA87472A9CB9A2006044F1 /* AccountExpiryRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DA87462A9CB9A2006044F1 /* AccountExpiryRow.swift */; };
F0DA87492A9CBA9F006044F1 /* AccountDeviceRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DA87482A9CBA9F006044F1 /* AccountDeviceRow.swift */; };
F0DA874B2A9CBACB006044F1 /* AccountNumberRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DA874A2A9CBACB006044F1 /* AccountNumberRow.swift */; };
F0E3618B2A4ADD2F00AEEF2B /* WelcomeContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0E3618A2A4ADD2F00AEEF2B /* WelcomeContentView.swift */; };
F0E8CC032A4C753B007ED3B4 /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0E8CC022A4C753B007ED3B4 /* WelcomeViewController.swift */; };
F0E8CC0A2A4EE127007ED3B4 /* SetupAccountCompletedContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0E8CC092A4EE127007ED3B4 /* SetupAccountCompletedContentView.swift */; };
Expand Down Expand Up @@ -1380,6 +1383,9 @@
F0C6FA802A66E23300F521F0 /* DeleteAccountOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteAccountOperation.swift; sourceTree = "<group>"; };
F0C6FA822A6A729500F521F0 /* InAppPurchaseCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppPurchaseCoordinator.swift; sourceTree = "<group>"; };
F0C6FA842A6A733700F521F0 /* InAppPurchaseInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppPurchaseInteractor.swift; sourceTree = "<group>"; };
F0DA87462A9CB9A2006044F1 /* AccountExpiryRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountExpiryRow.swift; sourceTree = "<group>"; };
F0DA87482A9CBA9F006044F1 /* AccountDeviceRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountDeviceRow.swift; sourceTree = "<group>"; };
F0DA874A2A9CBACB006044F1 /* AccountNumberRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountNumberRow.swift; sourceTree = "<group>"; };
F0E3618A2A4ADD2F00AEEF2B /* WelcomeContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeContentView.swift; sourceTree = "<group>"; };
F0E8CC022A4C753B007ED3B4 /* WelcomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = "<group>"; };
F0E8CC092A4EE127007ED3B4 /* SetupAccountCompletedContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetupAccountCompletedContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1911,6 +1917,9 @@
7A1A26422A2612AE00B978AA /* PaymentAlertPresenter.swift */,
5867771329097BCD006F721F /* PaymentState.swift */,
5867771529097C5B006F721F /* ProductState.swift */,
F0DA87462A9CB9A2006044F1 /* AccountExpiryRow.swift */,
F0DA87482A9CBA9F006044F1 /* AccountDeviceRow.swift */,
F0DA874A2A9CBACB006044F1 /* AccountNumberRow.swift */,
);
path = Account;
sourceTree = "<group>";
Expand Down Expand Up @@ -3780,6 +3789,7 @@
7A9CCCB92A96302800DD6A34 /* SelectLocationCoordinator.swift in Sources */,
58FB865A26EA214400F188BC /* RelayCacheTrackerObserver.swift in Sources */,
58ACF64D26567A5000ACE4B7 /* CustomSwitch.swift in Sources */,
F0DA874B2A9CBACB006044F1 /* AccountNumberRow.swift in Sources */,
58F2E14C276A61C000A79513 /* RotateKeyOperation.swift in Sources */,
5871FB96254ADE4E0051A0A4 /* ConsolidatedApplicationLog.swift in Sources */,
F0E8E4C52A60499100ED26A3 /* AccountDeletionViewController.swift in Sources */,
Expand Down Expand Up @@ -3818,6 +3828,7 @@
587CBFE322807F530028DED3 /* UIColor+Helpers.swift in Sources */,
7A9CCCBE2A96302800DD6A34 /* AccountDeletionCoordinator.swift in Sources */,
588527B4276B4F2F00BAA373 /* SetAccountOperation.swift in Sources */,
F0DA87472A9CB9A2006044F1 /* AccountExpiryRow.swift in Sources */,
585CA70F25F8C44600B47C62 /* UIMetrics.swift in Sources */,
E1187ABD289BBB850024E748 /* OutOfTimeContentView.swift in Sources */,
58CC40EF24A601900019D96E /* ObserverList.swift in Sources */,
Expand Down Expand Up @@ -3879,6 +3890,7 @@
58B93A1326C3F13600A55733 /* TunnelState.swift in Sources */,
58B26E262943522400D5980C /* NotificationProvider.swift in Sources */,
58CE5E64224146200008646E /* AppDelegate.swift in Sources */,
F0DA87492A9CBA9F006044F1 /* AccountDeviceRow.swift in Sources */,
5878A27329091D6D0096FC88 /* TunnelBlockObserver.swift in Sources */,
58E0A98827C8F46300FE6BDD /* Tunnel.swift in Sources */,
58ACF64F26567A7100ACE4B7 /* CustomSwitchContainer.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPN/Classes/AppPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

protocol AppPreferencesDataSource {
var isShownOnboarding: Bool { set get }
var isShownOnboarding: Bool { get set }
var isAgreedToTermsOfService: Bool { get set }
var lastSeenChangeLogVersion: String { get set }
}
Expand Down
6 changes: 4 additions & 2 deletions ios/MullvadVPN/Coordinators/AccountCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,13 @@ final class AccountCoordinator: Coordinator, Presentable, Presenting {
"DEVICE_INFO_DIALOG_MESSAGE_PART_1",
tableName: "Account",
value: """
This is the name assigned to the device. Each device logged in on a Mullvad account gets a unique name that helps you identify it when you manage your devices in the app or on the website.
This is the name assigned to the device. Each device logged in on a Mullvad account gets a unique name \
that helps you identify it when you manage your devices in the app or on the website.
You can have up to 5 devices logged in on one Mullvad account.
If you log out, the device and the device name is removed. When you log back in again, the device will get a new name.
If you log out, the device and the device name is removed. When \
you log back in again, the device will get a new name.
""",
comment: ""
)
Expand Down
30 changes: 15 additions & 15 deletions ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,9 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
making payment. It will dismiss itself once done.
*/
if dismissedRoute.route == .outOfTime {
let coordinator = dismissedRoute.coordinator as! OutOfTimeCoordinator

guard let coordinator = dismissedRoute.coordinator as? OutOfTimeCoordinator else {
return false
}
return !coordinator.isMakingPayment
}

Expand All @@ -254,8 +255,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
) {
switch context.route {
case let .settings(subRoute):
let coordinator = context.presentedRoute.coordinator as! SettingsCoordinator

guard let coordinator = context.presentedRoute.coordinator as? SettingsCoordinator else { return }
if let subRoute {
coordinator.navigate(
to: subRoute,
Expand Down Expand Up @@ -501,7 +501,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
private func presentTOS(animated: Bool, completion: @escaping (Coordinator) -> Void) {
let coordinator = TermsOfServiceCoordinator(navigationController: horizontalFlowController)

coordinator.didFinish = { [weak self] coordinator in
coordinator.didFinish = { [weak self] _ in
self?.appPreferences.isAgreedToTermsOfService = true
self?.continueFlow(animated: true)
}
Expand All @@ -517,7 +517,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
private func presentChangeLog(animated: Bool, completion: @escaping (Coordinator) -> Void) {
let coordinator = ChangeLogCoordinator(interactor: ChangeLogInteractor())

coordinator.didFinish = { [weak self] coordinator in
coordinator.didFinish = { [weak self] _ in
self?.appPreferences.markChangeLogSeen()
self?.router.dismiss(.changelog)
}
Expand Down Expand Up @@ -552,7 +552,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
tunnelManager: tunnelManager
)

coordinator.didFinish = { [weak self] coordinator in
coordinator.didFinish = { [weak self] _ in
self?.logoutRevokedDevice()
}

Expand All @@ -571,7 +571,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
tunnelManager: tunnelManager
)

coordinator.didFinishPayment = { [weak self] coordinator in
coordinator.didFinishPayment = { [weak self] _ in
guard let self else { return }

if shouldDismissOutOfTime() {
Expand All @@ -596,7 +596,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
tunnelManager: tunnelManager
)

coordinator.didFinish = { [weak self] coordinator in
coordinator.didFinish = { [weak self] _ in
guard let self else { return }
appPreferences.isShownOnboarding = true
router.dismiss(.welcome, animated: false)
Expand Down Expand Up @@ -634,7 +634,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
devicesProxy: devicesProxy
)

coordinator.didFinish = { [weak self] coordinator in
coordinator.didFinish = { [weak self] _ in
self?.continueFlow(animated: true)
}
coordinator.didCreateAccount = { [weak self] in
Expand Down Expand Up @@ -670,7 +670,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
relayCacheTracker: relayCacheTracker
)

selectLocationCoordinator.didFinish = { [weak self] coordinator, relay in
selectLocationCoordinator.didFinish = { [weak self] _, _ in
if isModalPresentation {
self?.router.dismiss(.selectLocation, animated: true)
}
Expand All @@ -690,7 +690,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
interactor: accountInteractor
)

coordinator.didFinish = { [weak self] coordinator, reason in
coordinator.didFinish = { [weak self] _, reason in
self?.didDismissAccount(reason)
}

Expand Down Expand Up @@ -732,11 +732,11 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
interactorFactory: interactorFactory
)

coordinator.didFinish = { [weak self] coordinator in
coordinator.didFinish = { [weak self] _ in
self?.router.dismissAll(.settings, animated: true)
}

coordinator.willNavigate = { [weak self] coordinator, from, to in
coordinator.willNavigate = { [weak self] _, _, to in
if to == .root {
self?.onShowSettings?()
}
Expand All @@ -758,7 +758,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo

private func addTunnelObserver() {
let tunnelObserver =
TunnelBlockObserver(didUpdateDeviceState: { [weak self] manager, deviceState, previousDeviceState in
TunnelBlockObserver(didUpdateDeviceState: { [weak self] _, deviceState, previousDeviceState in
self?.deviceStateDidChange(deviceState, previousDeviceState: previousDeviceState)
})

Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPN/Coordinators/InAppPurchaseCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class InAppPurchaseCoordinator: Coordinator, Presentable {

func start(accountNumber: String, product: SKProduct) {
interactor.purchase(accountNumber: accountNumber, product: product)
interactor.didFinishPayment = { [weak self] interactor, paymentEvent in
interactor.didFinishPayment = { [weak self] _, paymentEvent in
guard let self else { return }
switch paymentEvent {
case let .finished(value):
Expand Down
4 changes: 2 additions & 2 deletions ios/MullvadVPN/Extensions/NSRegularExpression+IPAddress.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension NSRegularExpression {
(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.
(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\b
"""#

// swiftlint:disable:next force_try
return try! NSRegularExpression(pattern: pattern, options: [.allowCommentsAndWhitespace])
}

Expand Down Expand Up @@ -46,7 +46,7 @@ extension NSRegularExpression {
(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]) # 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33 (IPv4-Embedded IPv6 Address)
)
"""#

// swiftlint:disable:next force_try
return try! NSRegularExpression(pattern: pattern, options: [.allowCommentsAndWhitespace])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class AccountExpiryInAppNotificationProvider: NotificationProvider, InAppN
didLoadConfiguration: { [weak self] tunnelManager in
self?.invalidate(deviceState: tunnelManager.deviceState)
},
didUpdateDeviceState: { [weak self] tunnelManager, deviceState, previousDeviceState in
didUpdateDeviceState: { [weak self] _, deviceState, _ in
self?.invalidate(deviceState: deviceState)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class AccountExpirySystemNotificationProvider: NotificationProvider, Syste
didLoadConfiguration: { [weak self] tunnelManager in
self?.invalidate(deviceState: tunnelManager.deviceState)
},
didUpdateDeviceState: { [weak self] tunnelManager, deviceState, previousDeviceState in
didUpdateDeviceState: { [weak self] _, deviceState, _ in
self?.invalidate(deviceState: deviceState)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class FormSheetPresentationController: UIPresentationController {
}

if let transitionCoordinator = presentingViewController.transitionCoordinator {
transitionCoordinator.animate { context in
transitionCoordinator.animate { _ in
revealDimmingView()
}
} else {
Expand All @@ -137,7 +137,7 @@ class FormSheetPresentationController: UIPresentationController {
}

if let transitionCoordinator = presentingViewController.transitionCoordinator {
transitionCoordinator.animate { context in
transitionCoordinator.animate { _ in
fadeDimmingView()
}
} else {
Expand Down Expand Up @@ -167,7 +167,7 @@ class FormSheetPresentationController: UIPresentationController {
NotificationCenter.default.post(
name: Self.willChangeFullScreenPresentation,
object: presentedViewController,
userInfo: [Self.isFullScreenUserInfoKey: NSNumber(booleanLiteral: currentIsInFullScreen)]
userInfo: [Self.isFullScreenUserInfoKey: NSNumber(value: currentIsInFullScreen)]
)
}

Expand Down
Loading

0 comments on commit 9ac934e

Please sign in to comment.