From 859399017be70418ade0dbf06bc07e579b69a800 Mon Sep 17 00:00:00 2001 From: gladius Date: Tue, 4 Feb 2025 00:01:05 +0100 Subject: [PATCH] style(iOS): swiftlint lint --fix --- ios/implementation/EventManager.swift | 14 +++++------ .../OrientationDirectorImpl.swift | 24 +++++++++---------- ios/implementation/SensorListener.swift | 2 +- ios/implementation/Utils.swift | 10 ++++---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ios/implementation/EventManager.swift b/ios/implementation/EventManager.swift index 656ebe7..e24baa9 100644 --- a/ios/implementation/EventManager.swift +++ b/ios/implementation/EventManager.swift @@ -7,15 +7,15 @@ import Foundation -@objc public class EventManager : NSObject { - @objc public weak var delegate: OrientationEventEmitterDelegate? = nil +@objc public class EventManager: NSObject { + @objc public weak var delegate: OrientationEventEmitterDelegate? func sendDeviceOrientationDidChange(orientationValue: Int) { guard let delegate = delegate else { return } - if (!delegate.isJsListening) { + if !delegate.isJsListening { return } @@ -28,20 +28,20 @@ import Foundation return } - if (!delegate.isJsListening) { + if !delegate.isJsListening { return } let params = Dictionary(dictionaryLiteral: ("orientation", orientationValue)) delegate.sendEvent(name: Event.InterfaceOrientationDidChange.rawValue, params: params as NSDictionary) } - + func sendLockDidChange(value: Bool) { guard let delegate = delegate else { return } - if (!delegate.isJsListening) { + if !delegate.isJsListening { return } @@ -65,6 +65,6 @@ public extension EventManager { } @objc static var supportedEvents: [String] { - return Event.allCases.map(\.rawValue); + return Event.allCases.map(\.rawValue) } } diff --git a/ios/implementation/OrientationDirectorImpl.swift b/ios/implementation/OrientationDirectorImpl.swift index ac9bdf1..d3859f2 100644 --- a/ios/implementation/OrientationDirectorImpl.swift +++ b/ios/implementation/OrientationDirectorImpl.swift @@ -8,7 +8,7 @@ import Foundation import UIKit -@objc public class OrientationDirectorImpl : NSObject { +@objc public class OrientationDirectorImpl: NSObject { private static let TAG = "OrientationDirectorImpl" private let bundleManager: BundleManager = BundleManager() @@ -62,16 +62,16 @@ import UIKit updateIsLockedTo(value: true) - let orientationCanBeUpdatedDirectly = jsOrientation != Orientation.LANDSCAPE; - if (orientationCanBeUpdatedDirectly) { + let orientationCanBeUpdatedDirectly = jsOrientation != Orientation.LANDSCAPE + if orientationCanBeUpdatedDirectly { updateLastInterfaceOrientationTo(value: jsOrientation) return } let lastInterfaceOrientationIsAlreadyInLandscape = lastInterfaceOrientation == Orientation.LANDSCAPE_RIGHT || lastInterfaceOrientation == Orientation.LANDSCAPE_LEFT - if (lastInterfaceOrientationIsAlreadyInLandscape) { + if lastInterfaceOrientationIsAlreadyInLandscape { updateLastInterfaceOrientationTo(value: lastInterfaceOrientation) - return; + return } let systemDefaultLandscapeOrientation = Orientation.LANDSCAPE_RIGHT @@ -92,20 +92,20 @@ import UIKit let lastMask = utils.convertToMaskFrom(jsOrientation: lastInterfaceOrientation) let isLastMaskSupported = self.supportedInterfaceOrientations.contains(lastMask) - if (isLastMaskSupported) { + if isLastMaskSupported { return } let supportedInterfaceOrientations = bundleManager.getSupportedInterfaceOrientations() - if (supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.portrait)) { + if supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.portrait) { self.updateLastInterfaceOrientationTo(value: Orientation.PORTRAIT) return } - if (supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.landscapeRight)) { + if supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.landscapeRight) { self.updateLastInterfaceOrientationTo(value: Orientation.LANDSCAPE_RIGHT) return } - if (supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.landscapeLeft)) { + if supportedInterfaceOrientations.contains(UIInterfaceOrientationMask.landscapeLeft) { self.updateLastInterfaceOrientationTo(value: Orientation.LANDSCAPE_LEFT) return } @@ -128,7 +128,7 @@ import UIKit private func initIsLocked() -> Bool { let supportedOrientations = bundleManager.getSupportedInterfaceOrientations() - if (supportedOrientations.count > 1) { + if supportedOrientations.count > 1 { return false } @@ -169,11 +169,11 @@ import UIKit private func adaptInterfaceTo(deviceOrientation: Orientation) { let supportsLandscape = self.supportedInterfaceOrientations.contains(.landscape) - if (isLocked && !supportsLandscape) { + if isLocked && !supportsLandscape { return } - if (deviceOrientation == Orientation.FACE_UP || deviceOrientation == Orientation.FACE_DOWN) { + if deviceOrientation == Orientation.FACE_UP || deviceOrientation == Orientation.FACE_DOWN { return } diff --git a/ios/implementation/SensorListener.swift b/ios/implementation/SensorListener.swift index 8925bb9..d79e8d1 100644 --- a/ios/implementation/SensorListener.swift +++ b/ios/implementation/SensorListener.swift @@ -8,7 +8,7 @@ import Foundation public class SensorListener { - private var onOrientationDidChangeCallback: ((_ deviceOrientation: UIDeviceOrientation) -> Void)? = nil + private var onOrientationDidChangeCallback: ((_ deviceOrientation: UIDeviceOrientation) -> Void)? init() { NotificationCenter.default.addObserver( diff --git a/ios/implementation/Utils.swift b/ios/implementation/Utils.swift index 5cc0fe1..ea57db2 100644 --- a/ios/implementation/Utils.swift +++ b/ios/implementation/Utils.swift @@ -13,7 +13,7 @@ class Utils { // TODO: Add .unknown public func convertToOrientationFrom(uiInterfaceOrientation: UIInterfaceOrientation) -> Orientation { - switch(uiInterfaceOrientation) { + switch uiInterfaceOrientation { case .landscapeRight: return .LANDSCAPE_RIGHT case .portraitUpsideDown: @@ -26,7 +26,7 @@ class Utils { } public func convertToOrientationFrom(deviceOrientation: UIDeviceOrientation) -> Orientation { - switch(deviceOrientation) { + switch deviceOrientation { case .landscapeRight: return .LANDSCAPE_RIGHT case .portraitUpsideDown: @@ -43,7 +43,7 @@ class Utils { } public func convertToOrientationFrom(jsValue: NSNumber) -> Orientation { - switch(jsValue) { + switch jsValue { case 2: return .LANDSCAPE_RIGHT case 3: @@ -62,7 +62,7 @@ class Utils { https://developer.apple.com/documentation/uikit/uiviewcontroller/1621435-supportedinterfaceorientations */ public func convertToMaskFrom(jsOrientation: Orientation) -> UIInterfaceOrientationMask { - switch(jsOrientation) { + switch jsOrientation { case .PORTRAIT: return .portrait case .LANDSCAPE_RIGHT: @@ -83,7 +83,7 @@ class Utils { return UIInterfaceOrientation.unknown } - return windowScene.interfaceOrientation; + return windowScene.interfaceOrientation } /* This function is needed to get the current available window.