-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
491 additions
and
380 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// Configuration.swift | ||
// Vault | ||
// | ||
// Created by Charles Lanier on 18/06/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
enum AppConfiguration { | ||
enum Error: Swift.Error { | ||
case missingKey, invalidValue | ||
} | ||
|
||
static func value<T>(for key: String) throws -> T where T: LosslessStringConvertible { | ||
guard let object = Bundle.main.object(forInfoDictionaryKey: key) else { | ||
throw Error.missingKey | ||
} | ||
|
||
switch object { | ||
case let value as T: | ||
return value | ||
case let string as String: | ||
guard let value = T(string) else { fallthrough } | ||
return value | ||
default: | ||
throw Error.invalidValue | ||
} | ||
} | ||
|
||
enum API { | ||
static var baseURL: URL? { | ||
do { | ||
let base: String = try AppConfiguration.value(for: "API_BASE_URL") | ||
|
||
return URL(string: "https://" + base) | ||
} catch { | ||
return nil | ||
} | ||
} | ||
} | ||
} |
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
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,23 @@ | ||
// | ||
// ErrorView.swift | ||
// Vault | ||
// | ||
// Created by Charles Lanier on 18/06/2024. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ErrorView: View { | ||
var body: some View { | ||
VStack { | ||
Text("An error has occurred").textTheme(.headlineLarge) | ||
Text("Please contact our support.").textTheme(.subtitle) | ||
} | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.defaultBackground() | ||
} | ||
} | ||
|
||
#Preview { | ||
ErrorView() | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Deployment.swift | ||
// Vault | ||
// | ||
// Created by Charles Lanier on 17/06/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct Deployment: Decodable { | ||
public let contract_address: String | ||
} | ||
|
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,10 @@ | ||
// | ||
// Empty.swift | ||
// Vault | ||
// | ||
// Created by Charles Lanier on 17/06/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct Empty: Decodable {} |
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,13 @@ | ||
// | ||
// Error.swift | ||
// Vault | ||
// | ||
// Created by Charles Lanier on 14/06/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct ErrorResponse: Decodable { | ||
/// Message that usually gives more information about some error | ||
public let message: String? | ||
} |
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,12 @@ | ||
// | ||
// Execution.swift | ||
// Vault | ||
// | ||
// Created by Charles Lanier on 16/06/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct Execution: Decodable { | ||
public let transaction_hash: String | ||
} |
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.
Oops, something went wrong.