forked from omise/omise-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request omise#277 from omise/feature/v5_refactoring
Release V5.0.0
- Loading branch information
Showing
342 changed files
with
11,298 additions
and
19,659 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -21,10 +21,10 @@ 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 OmiseSDK.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 | ||
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 | ||
|
||
- name: Convert Xcode coverage to SonarCloud format | ||
run: bash xccov-to-sonarqube-generic.sh build/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
Config.local.plist | ||
sonarqube-generic-coverage.xml | ||
!default.mode1v3 | ||
!default.mode2v3 | ||
|
453 changes: 453 additions & 0 deletions
453
ExampleApp.xcodeproj/ExampleApp.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
....xcodeproj/ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "omise-ios", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/omise/omise-ios.git", | ||
"state" : { | ||
"branch" : "feature/MIT-1520", | ||
"revision" : "11ab4094210feacb4e42ec29e49a8df41528b54e" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ject.xcworkspace/contents.xcworkspacedata → ...ject.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
14 changes: 14 additions & 0 deletions
14
ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "omise-ios", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/omise/omise-ios.git", | ||
"state" : { | ||
"branch" : "feature/v5_refactoring", | ||
"revision" : "a59269f3d734ebc17d8e717b5c03b17d5d67a679" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Foundation | ||
|
||
enum AppDeeplink: String { | ||
case threeDSChallenge = "3ds_challenge" | ||
|
||
var scheme: String { | ||
"omiseExampleApp" | ||
} | ||
|
||
var urlString: String { | ||
"\(scheme)://\(rawValue)" | ||
} | ||
|
||
var url: URL? { | ||
URL(string: urlString) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
import UIKit | ||
import OmiseSDK | ||
|
||
@UIApplicationMain | ||
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
var window: UIWindow? | ||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
window?.tintColor = UIColor(named: "App Tint") ?? UIColor.blue | ||
|
||
return true | ||
} | ||
|
||
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { | ||
// Determine who sent the URL. | ||
print("App open url '\(url)'") | ||
|
||
let sendingAppID = options[.sourceApplication] | ||
print("source application = \(sendingAppID ?? "Unknown")") | ||
|
||
// Process the URL. | ||
guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true) else { | ||
print("Invalid url") | ||
return false | ||
} | ||
|
||
switch components.host { | ||
case AppDeeplink.threeDSChallenge.rawValue: | ||
print("Omise 3DS Challenge Callback") | ||
let result = OmiseSDK.shared.handleURLCallback(url) | ||
if result { | ||
OmiseSDK.shared.dismiss() | ||
} | ||
return result | ||
default: | ||
print("Unknown deeplink params \(url.host ?? "nil")") | ||
return false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 8 additions & 13 deletions
21
ExampleApp/Shared/LocalConfig.swift → ExampleApp/Models/LocalConfig.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import UIKit | ||
import OmiseSDK | ||
|
||
struct PaymentPreset { | ||
var paymentAmount: Int64 | ||
var paymentCurrency: Currency | ||
var allowedPaymentMethods: [SourceType] | ||
|
||
static let allPreset = PaymentPreset( | ||
paymentAmount: 3_500_00, | ||
paymentCurrency: .thb, | ||
allowedPaymentMethods: SourceType.allCases | ||
) | ||
|
||
static let thailandPreset = PaymentPreset( | ||
paymentAmount: 3_500_00, | ||
paymentCurrency: .thb, | ||
allowedPaymentMethods: SourceType.availableByDefaultInThailand | ||
) | ||
|
||
static let japanPreset = PaymentPreset( | ||
paymentAmount: 3_500, | ||
paymentCurrency: .jpy, | ||
allowedPaymentMethods: SourceType.availableByDefaultInJapan | ||
) | ||
|
||
static let singaporePreset = PaymentPreset( | ||
paymentAmount: 3_500_00, | ||
paymentCurrency: .sgd, | ||
allowedPaymentMethods: SourceType.availableByDefaultSingapore | ||
) | ||
|
||
static let malaysiaPreset = PaymentPreset( | ||
paymentAmount: 3_500_00, | ||
paymentCurrency: .myr, | ||
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: [SourceType] = PaymentPreset.thailandPreset.allowedPaymentMethods | ||
|
||
static let japanPaymentAmount: Int64 = PaymentPreset.japanPreset.paymentAmount | ||
static let japanPaymentCurrency: String = PaymentPreset.japanPreset.paymentCurrency.code | ||
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: [SourceType] = PaymentPreset.singaporePreset.allowedPaymentMethods | ||
|
||
static let malaysiaPaymentAmount: Int64 = PaymentPreset.malaysiaPreset.paymentAmount | ||
static let malaysiaPaymentCurrency: String = PaymentPreset.malaysiaPreset.paymentCurrency.code | ||
static let malaysiaAllowedPaymentMethods: [SourceType] = PaymentPreset.malaysiaPreset.allowedPaymentMethods | ||
|
||
static func imageWith(size: CGSize, color: UIColor) -> UIImage? { | ||
return Tool.imageWith(size: size) { (context) in | ||
context.setFillColor(color.cgColor) | ||
context.fill(CGRect(origin: .zero, size: size)) | ||
} | ||
} | ||
|
||
static func imageWith(size: CGSize, actions: (CGContext) -> Void) -> UIImage? { | ||
let renderer = UIGraphicsImageRenderer(size: size) | ||
return renderer.image { context in | ||
actions(context.cgContext) | ||
} | ||
} | ||
} |
Oops, something went wrong.