Skip to content

Commit

Permalink
Merge pull request #436 from Adyen/refactor_ios
Browse files Browse the repository at this point in the history
Reformat iOS code
  • Loading branch information
descorp authored May 3, 2024
2 parents 825a8cc + 71eef42 commit c7d135e
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ios/CSE/ActionModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
//

import Adyen
import Adyen3DS2
import Foundation
import React
import Adyen3DS2

@objc(AdyenAction)
internal final class ActionModule: BaseModule, ActionComponentDelegate {
Expand Down
2 changes: 1 addition & 1 deletion ios/Components/BaseModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ extension Error {

var is3DSCanceled: Bool {
(self as NSError).domain == "com.adyen.Adyen3DS2.ADYRuntimeError" &&
(self as NSError).code == ADYRuntimeErrorCode.challengeCancelled.rawValue
(self as NSError).code == ADYRuntimeErrorCode.challengeCancelled.rawValue
}
}

Expand Down
2 changes: 1 addition & 1 deletion ios/Components/DropInModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal final class DropInModule: BaseModule {
config.localizationParameters = LocalizationParameters(enforcedLocale: locale)
}
if let requestorAppUrl = ThreeDS2ConfigurationParser(configuration: configuration).requestorAppUrl,
let url = URL(string: requestorAppUrl) {
let url = URL(string: requestorAppUrl) {
config.actionComponent.threeDS.requestorAppURL = url
}

Expand Down
2 changes: 1 addition & 1 deletion ios/Components/InstantModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal final class InstantModule: BaseModule {

let style = AdyenAppearanceLoader.findStyle()?.actionComponent ?? .init()
var config = AdyenActionComponent.Configuration(style: style)
if let locale = BaseModule.session?.sessionContext.shopperLocale ?? parser.shopperLocale {
if let locale = BaseModule.session?.sessionContext.shopperLocale ?? parser.shopperLocale {
config.localizationParameters = LocalizationParameters(enforcedLocale: locale)
}

Expand Down
4 changes: 2 additions & 2 deletions ios/Configuration/AnalyticsParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public struct AnalyticsParser {
}

public var analyticsOn: Bool {
return dict[AnalyticsKeys.enabled] as? Bool == true
dict[AnalyticsKeys.enabled] as? Bool == true
}

public var verboseLogsOn: Bool {
return dict[AnalyticsKeys.verboseLogs] as? Bool == true
dict[AnalyticsKeys.verboseLogs] as? Bool == true
}

public var configuration: AnalyticsConfiguration {
Expand Down
2 changes: 1 addition & 1 deletion ios/Configuration/Parameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal enum Keys {
internal enum AnalyticsKeys: SubConfig {
static var rootKey = "analytics"
static var enabled = "enabled"
static var verboseLogs = "verboseLogs"
static var verboseLogs = "verboseLogs"
}

internal enum DropInKeys: SubConfig {
Expand Down
6 changes: 3 additions & 3 deletions ios/Configuration/RootConfigurationParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public struct RootConfigurationParser {

public var payment: Payment? {
guard let amount = self.amount,
let countryCode = countryCode
let countryCode
else {
return nil
}
Expand All @@ -55,7 +55,7 @@ public struct RootConfigurationParser {
}

public var shopperLocale: String? {
return configuration[Keys.locale] as? String
configuration[Keys.locale] as? String
}
}

Expand All @@ -70,7 +70,7 @@ extension RootConfigurationParser {
let analytics = AnalyticsParser(configuration: configuration).configuration

var payment: Payment?
if
if
let context = session?.sessionContext,
let countryCode = context.countryCode ?? self.countryCode {
payment = Payment(amount: context.amount, countryCode: countryCode)
Expand Down
4 changes: 2 additions & 2 deletions ios/Configuration/ThreeDSConfigurationParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Foundation

public struct ThreeDS2ConfigurationParser {

private var dict: [String:Any]
private var dict: [String: Any]

public init(configuration: NSDictionary) {
guard let configuration = configuration as? [String: Any] else {
Expand All @@ -23,6 +23,6 @@ public struct ThreeDS2ConfigurationParser {
}

var requestorAppUrl: String? {
return dict[ThreeDSKey.requestorAppUrl] as? String
dict[ThreeDSKey.requestorAppUrl] as? String
}
}

0 comments on commit c7d135e

Please sign in to comment.