Skip to content

Commit

Permalink
Fix swiftLint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Grześkowiak committed Nov 7, 2024
1 parent af56512 commit fce5d35
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Sources/AccountSDKIOSWeb/Client/Client+AppTransfer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension Client {
case postTransfer(accessGroup: String?, completion: (Result<Void, Error>) -> Void)
case clear

// swiftlint:disable nesting
// swiftlint:disable:next nesting
public enum AppTransferError: Error {
case userSessionNotFound
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/AccountSDKIOSWeb/Extensions/Data+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ extension Data {
public func sha256Hexdigest() -> String {
return hexStringFromData(input: sha256Digest(input: self as NSData))
}

private func sha256Digest(input: NSData) -> NSData {
let digestLength = Int(CC_SHA256_DIGEST_LENGTH)
var hash = [UInt8](repeating: 0, count: digestLength)
CC_SHA256(input.bytes, UInt32(input.length), &hash)
return NSData(bytes: hash, length: digestLength)
}

func hexStringFromData(input: NSData) -> String {
var bytes = [UInt8](repeating: 0, count: input.length)
input.getBytes(&bytes, length: input.length)

var hexString = ""
for byte in bytes {
hexString += String(format:"%02x", UInt8(byte))
hexString += String(format: "%02x", UInt8(byte))
}

return hexString
}
}
2 changes: 1 addition & 1 deletion Sources/AccountSDKIOSWeb/Lib/API/APIRetryPolicy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class APIRetryPolicy: RetryPolicy {
if code >= 500 && code < 600 {
return true
}
case .unexpectedError(underlying: _):
case .unexpectedError:
// retry in case of intermittent connection problem
return true
case .noData:
Expand Down
2 changes: 1 addition & 1 deletion Sources/AccountSDKIOSWeb/Lib/IDToken/IdTokenClaims.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public struct IdTokenClaims: Codable, Equatable {
enum CodingKeys: String, CodingKey {
case iss
case sub
// swiftlint:disable identifier_name
// swiftlint:disable:next identifier_name
case legacy_user_id
case aud
case exp
Expand Down
3 changes: 2 additions & 1 deletion Sources/AccountSDKIOSWeb/Lib/JOSE/JWKS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ internal struct RSAJWK: Codable {
let n: String
let alg: String?
let use: String?
// swiftlint:enable identifier_name
}

internal struct JWKSResponse: Codable {
Expand Down Expand Up @@ -50,7 +51,7 @@ internal class RemoteJWKS: JWKS {

private func fetchJWKS(keyId: String, completion: @escaping (JWK?) -> Void) {
let request = URLRequest(url: jwksURI)
httpClient.execute(request: SchibstedAccountAPI.addingSDKHeaders(to: request)) { (result: Result<JWKSResponse, HTTPError>) -> Void in
httpClient.execute(request: SchibstedAccountAPI.addingSDKHeaders(to: request)) { (result: Result<JWKSResponse, HTTPError>) in
switch result {
case .success(let jwks):
for keyData in jwks.keys {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SafariServices
struct SimplifiedLoginUIFactory {

@available(iOS, deprecated: 13, message: "This function should not be used in iOS version 13 and above")
// swiftlint:disable function_body_length
// swiftlint:disable:next function_body_length
static func buildViewController(client: Client,
assertionFetcher: SimplifiedLoginFetching,
userContext: UserContextFromTokenResponse,
Expand Down Expand Up @@ -88,7 +88,7 @@ struct SimplifiedLoginUIFactory {
}

@available(iOS 13.0, *)
// swiftlint:disable function_parameter_count
// swiftlint:disable:next function_parameter_count function_body_length
static func buildViewController(client: Client,
contextProvider: ASWebAuthenticationPresentationContextProviding,
assertionFetcher: SimplifiedLoginFetching,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ class SimplifiedLoginViewController: UIViewController {
animateShowingOverlay()
}

override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
}

private func configureForIphone() {
guard viewModel.isPhone else {
return
Expand Down Expand Up @@ -152,7 +148,7 @@ class SimplifiedLoginViewController: UIViewController {
footerStackView.privacyURLButton.addTarget(self, action: privacyPolicySelector, for: .touchUpInside)
}

private func setupiPhoneConstraints() { // swiftlint:disable:this function_body_length
private func setupiPhoneConstraints() {
let margin = view.layoutMarginsGuide
let buttonWidth = continueButton.widthAnchor.constraint(equalToConstant: 343)
buttonWidth.priority = .defaultLow
Expand Down
2 changes: 1 addition & 1 deletion Sources/AccountSDKIOSWeb/User/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ extension User {
/// TokenRefreshRequestHandler is responsible for calling refresh once, and queuing subsequent requests to wait for the One refresh.
final class TokenRefreshRequestHandler {

// swiftlint:disable nesting
// swiftlint:disable:next nesting
private enum State {
case isRefreshing
case notRefreshing
Expand Down

0 comments on commit fce5d35

Please sign in to comment.