Skip to content

Commit

Permalink
Merge pull request #273 from omise/feature/MIT-1554_v5
Browse files Browse the repository at this point in the history
Network Layer and Models Refactoring (v5)
  • Loading branch information
Andrei Solovev authored Mar 6, 2024
2 parents 4d54f21 + 10cd9e0 commit a2b256d
Show file tree
Hide file tree
Showing 263 changed files with 8,589 additions and 14,191 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Run linting
uses: norio-nomura/[email protected]
with:
Expand All @@ -21,7 +21,7 @@ jobs:
env:
BUILD_WRAPPER_OUT_DIR: buildwrapper # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Run xcodebuild with tests
run: xcodebuild -project dev.xcodeproj/ -scheme OmiseSDK -derivedDataPath Build/ -destination 'platform=iOS Simulator,name=iPhone 11,OS=16.2' -enableCodeCoverage YES clean build test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
Expand All @@ -33,7 +33,7 @@ jobs:
run: xattr -w com.apple.xcode.CreatedByBuildSystem true ./build

- name: Upload coverage report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
path: sonarqube-generic-coverage.xml
retention-days: 5 # Artifact will be available only for 5 days.
Expand All @@ -51,7 +51,7 @@ jobs:
needs: test
steps:
- name: Checkout repository on branch
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.HEAD_REF }}
fetch-depth: 0
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.inlayHints.fontSize": 12
}
2 changes: 1 addition & 1 deletion ExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/omise/omise-ios.git";
requirement = {
branch = feature/v5.0.0_improvements;
branch = "feature/MIT-2251_v5_AdaptableTableView";
kind = branch;
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/omise/omise-ios.git",
"state" : {
"branch" : "feature/v5.0.0_improvements",
"revision" : "6ff5a91c43fb163949ffc0369eb4a471fe0edba6"
"branch" : "feature/MIT-2251_v5_AdaptableTableView",
"revision" : "bf2e8840edf4cd937fdb1daf2d8e1d3a030b96bb"
}
}
],
Expand Down
1 change: 1 addition & 0 deletions ExampleApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window?.tintColor = UIColor(named: "App Tint") ?? UIColor.blue

return true
}
}
8 changes: 4 additions & 4 deletions ExampleApp/Models/LocalConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ struct LocalConfig: Codable {
devVaultBaseURL = nil
devApiBaseURL = nil
}
var env: Environment {

var configuration: Configuration? {
if devMode,
let vaultBaseURLString = devVaultBaseURL,
let vaultBaseURL = URL(string: vaultBaseURLString),
let apiBaseURLString = devApiBaseURL,
let apiBaseURL = URL(string: apiBaseURLString) {
return .dev(vaultURL: vaultBaseURL, apiURL: apiBaseURL)
return .init(vaultURL: vaultBaseURL, apiURL: apiBaseURL)
} else {
return .production
return nil
}
}

Expand Down
30 changes: 20 additions & 10 deletions ExampleApp/Models/Tools.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,60 @@ import OmiseSDK
struct PaymentPreset {
var paymentAmount: Int64
var paymentCurrency: Currency
var allowedPaymentMethods: [SourceTypeValue]
var allowedPaymentMethods: [SourceType]

static let allPreset = PaymentPreset(
paymentAmount: 5_000_00,
paymentCurrency: .thb,
allowedPaymentMethods: SourceType.allCases
)

static let thailandPreset = PaymentPreset(
paymentAmount: 5_000_00,
paymentCurrency: .thb,
allowedPaymentMethods: PaymentCreatorController.thailandDefaultAvailableSourceMethods
allowedPaymentMethods: SourceType.availableByDefaultInThailand
)

static let japanPreset = PaymentPreset(
paymentAmount: 5_000,
paymentCurrency: .jpy,
allowedPaymentMethods: PaymentCreatorController.japanDefaultAvailableSourceMethods
allowedPaymentMethods: SourceType.availableByDefaultInJapan
)

static let singaporePreset = PaymentPreset(
paymentAmount: 5_000_00,
paymentCurrency: .sgd,
allowedPaymentMethods: PaymentCreatorController.singaporeDefaultAvailableSourceMethods
allowedPaymentMethods: SourceType.availableByDefaultSingapore
)

static let malaysiaPreset = PaymentPreset(
paymentAmount: 5_000_00,
paymentCurrency: .myr,
allowedPaymentMethods: PaymentCreatorController.malaysiaDefaultAvailableSourceMethods
allowedPaymentMethods: SourceType.availableByDefaultMalaysia
)
}

class Tool: NSObject {

static let allPaymentAmount: Int64 = PaymentPreset.allPreset.paymentAmount
static let allPaymentCurrency: String = PaymentPreset.allPreset.paymentCurrency.code
static let allAllowedPaymentMethods: [SourceType] = PaymentPreset.allPreset.allowedPaymentMethods

static let thailandPaymentAmount: Int64 = PaymentPreset.thailandPreset.paymentAmount
static let thailandPaymentCurrency: String = PaymentPreset.thailandPreset.paymentCurrency.code
static let thailandAllowedPaymentMethods: [SourceTypeValue] = PaymentPreset.thailandPreset.allowedPaymentMethods
static let thailandAllowedPaymentMethods: [SourceType] = PaymentPreset.thailandPreset.allowedPaymentMethods

static let japanPaymentAmount: Int64 = PaymentPreset.japanPreset.paymentAmount
static let japanPaymentCurrency: String = PaymentPreset.japanPreset.paymentCurrency.code
static let japanAllowedPaymentMethods: [SourceTypeValue] = PaymentPreset.japanPreset.allowedPaymentMethods
static let japanAllowedPaymentMethods: [SourceType] = PaymentPreset.japanPreset.allowedPaymentMethods

static let singaporePaymentAmount: Int64 = PaymentPreset.singaporePreset.paymentAmount
static let singaporePaymentCurrency: String = PaymentPreset.singaporePreset.paymentCurrency.code
static let singaporeAllowedPaymentMethods: [SourceTypeValue] = PaymentPreset.singaporePreset.allowedPaymentMethods
static let singaporeAllowedPaymentMethods: [SourceType] = PaymentPreset.singaporePreset.allowedPaymentMethods

static let malaysiaPaymentAmount: Int64 = PaymentPreset.malaysiaPreset.paymentAmount
static let malaysiaPaymentCurrency: String = PaymentPreset.malaysiaPreset.paymentCurrency.code
static let malaysiaAllowedPaymentMethods: [SourceTypeValue] = PaymentPreset.malaysiaPreset.allowedPaymentMethods
static let malaysiaAllowedPaymentMethods: [SourceType] = PaymentPreset.malaysiaPreset.allowedPaymentMethods

static func imageWith(size: CGSize, color: UIColor) -> UIImage? {
return Tool.imageWith(size: size) { (context) in
Expand Down
Loading

0 comments on commit a2b256d

Please sign in to comment.