Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
0xChqrles committed Sep 13, 2024
1 parent a53b24b commit 2adb364
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 21 deletions.
26 changes: 26 additions & 0 deletions app/App/Components/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,33 @@ struct WebView: UIViewRepresentable {
}

func updateUIView(_ webView: WKWebView, context: Context) {
webView.uiDelegate = context.coordinator
let request = URLRequest(url: url)
webView.load(request)
}

func makeCoordinator() -> Coordinator {
Coordinator(self)
}
}

class Coordinator: NSObject, WKUIDelegate {
var parent: WebView

init(_ parent: WebView) {
self.parent = parent
}

// Delegate methods go here

@available(iOS 15, *)
func webView(
_ webView: WKWebView,
requestMediaCapturePermissionFor origin: WKSecurityOrigin,
initiatedByFrame frame: WKFrameInfo,
type: WKMediaCaptureType,
decisionHandler: @escaping (WKPermissionDecision) -> Void
) {
decisionHandler(.grant)
}
}
4 changes: 3 additions & 1 deletion app/App/Models/Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Model: ObservableObject {
@Published var onRampQuoteId: String?
@Published var onRampTotalUsd: String?
@Published var estSubtotalUsd: Double = 0
@Published var paymentTokenAmount: Double = 0
@Published var stripeRedirectUrl: URL? = nil

// Sending USDC
Expand Down Expand Up @@ -496,6 +497,7 @@ extension Model {
self.onRampQuoteId = response.quoteId
self.onRampTotalUsd = response.totalUsd
self.estSubtotalUsd = response.estSubtotalUsd
self.paymentTokenAmount = response.paymentTokenAmount
}
}

Expand All @@ -505,7 +507,7 @@ extension Model {
VaultService.shared.send(
CreateFunkitStripeCheckout(
quoteId: quoteId,
parsedAmount: self.parsedAmount,
paymentTokenAmount: self.paymentTokenAmount,
estSubtotalUsd: self.estSubtotalUsd
)
) { result in
Expand Down
5 changes: 0 additions & 5 deletions app/App/Services/VaultAPI/Models/FunkitStripeCheckout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,3 @@ public struct FunkitStripeCheckout: Decodable {
public let stripeRedirectUrl: String
public let funkitDepositAddress: String
}


//"stripeCheckoutId": "cos_1PVjoJCLFtXbeHljSqENG8EX",
//"stripeRedirectUrl": "https://crypto.link.com?session_hash=CCwQARoXChVhY2N0XzFQMUM1aENMRnRYYmVIbGoo_8PtswYyBvLEArs-lzotpIVcOo5xRizqxo51f_a6heze3V8sZAGkN1KRsvkFrKnhSf084RfpQ4-Iws7u",
//"funkitDepositAddress": "0
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import Foundation
public struct FunkitStripeCheckoutQuote: Decodable {
public let quoteId: String
public let estSubtotalUsd: Double
public let paymentTokenAmount: String
public let paymentTokenChain: String
public let paymentTokenSymbol: String
public let paymentTokenAmount: Double
public let networkFees: String
public let cardFees: String
public let totalUsd: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ public struct CreateFunkitStripeCheckout: APIRequest {
public let paymentTokenAmount: Double
public let estSubtotalUsd: Double
public let isNy: Bool
public let isEu: Bool

public init(quoteId: String, parsedAmount: Double, estSubtotalUsd: Double) {
public init(quoteId: String, paymentTokenAmount: Double, estSubtotalUsd: Double) {
self.quoteId = quoteId
self.paymentTokenAmount = parsedAmount
self.paymentTokenAmount = paymentTokenAmount
self.estSubtotalUsd = estSubtotalUsd
self.isNy = false
self.isEu = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ public struct GetFunkitStripeCheckoutQuote: APIRequest {
public let address: String
public let tokenAmount: String
public let isNy: Bool
public let isEu: Bool

public init(address: String, amount: String) {
self.address = address
// self.address = address
self.address = "0x0171eaf72B36Dd904509297A51c4744Dcaf2E20E327dd1e7b08808DC0283f0A3"
self.tokenAmount = amount
self.isNy = false
self.isEu = true
}
}
10 changes: 3 additions & 7 deletions app/App/Services/VaultAPI/VaultAPIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,15 @@ class VaultService {
public func send<T: APIRequest>(_ request: T, completion: @escaping ResultCallback<T.Response>) {
let urlRequest = self.endpoint(for: request)

// #if DEBUG
// print(urlRequest.url?.absoluteURL)
// #endif

let task = session.dataTask(with: urlRequest) { data, response, error in
if
let data = data,
let httpResponse = response as? HTTPURLResponse
{

//#if DEBUG
// print(data.base64EncodedString())
//#endif
#if DEBUG
print(data.base64EncodedString())
#endif

if httpResponse.isSuccessful {
// request is successful
Expand Down
10 changes: 6 additions & 4 deletions app/Vault-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SN_NETWORK</key>
<string>$(SN_NETWORK)</string>
<key>PRIVATE_KEY_LABEL</key>
<string>$(PRIVATE_KEY_LABEL)</string>
<key>API_BASE_URL</key>
<string>$(API_BASE_URL)</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -21,6 +19,10 @@
</array>
</dict>
</array>
<key>PRIVATE_KEY_LABEL</key>
<string>$(PRIVATE_KEY_LABEL)</string>
<key>SN_NETWORK</key>
<string>$(SN_NETWORK)</string>
<key>UIAppFonts</key>
<array>
<string>Sofia Pro Medium.otf</string>
Expand Down
3 changes: 3 additions & 0 deletions app/Vault.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@
INFOPLIST_FILE = "Vault-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = Vault;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
INFOPLIST_KEY_NSCameraUsageDescription = "We need access to the camera for the KYC process during the onramp";
INFOPLIST_KEY_NSContactsUsageDescription = "We need access to your contacts to show them in the app.";
INFOPLIST_KEY_NSFaceIDUsageDescription = "Authenticate to access your secure data.";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down Expand Up @@ -1233,6 +1234,7 @@
INFOPLIST_FILE = "Vault-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = Vault;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
INFOPLIST_KEY_NSCameraUsageDescription = "We need access to the camera for the KYC process during the onramp";
INFOPLIST_KEY_NSContactsUsageDescription = "We need access to your contacts to show them in the app.";
INFOPLIST_KEY_NSFaceIDUsageDescription = "Authenticate to access your secure data.";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down Expand Up @@ -1269,6 +1271,7 @@
INFOPLIST_FILE = "Vault-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = Vault;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
INFOPLIST_KEY_NSCameraUsageDescription = "We need access to the camera for the KYC process during the onramp";
INFOPLIST_KEY_NSContactsUsageDescription = "We need access to your contacts to show them in the app.";
INFOPLIST_KEY_NSFaceIDUsageDescription = "Authenticate to access your secure data.";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down

0 comments on commit 2adb364

Please sign in to comment.