Commit ec6b4100 authored by Jose Blaya's avatar Jose Blaya
Browse files

Update to work with swiftgen 6.x version

parent 8a24c8df
// swiftlint:disable all
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
#if os(OSX)
import AppKit.NSImage
internal typealias AssetColorTypeAlias = NSColor
internal typealias Image = NSImage
internal typealias AssetImageTypeAlias = NSImage
#elseif os(iOS) || os(tvOS) || os(watchOS)
import UIKit.UIImage
internal typealias AssetColorTypeAlias = UIColor
internal typealias Image = UIImage
internal typealias AssetImageTypeAlias = UIImage
#endif
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
@available(*, deprecated, renamed: "ImageAsset")
internal typealias AssetType = ImageAsset
internal struct ImageAsset {
internal fileprivate(set) var name: String
internal var image: Image {
let bundle = Bundle(for: BundleToken.self)
#if os(iOS) || os(tvOS)
let image = Image(named: name, in: bundle, compatibleWith: nil)
#elseif os(OSX)
let image = bundle.image(forResource: NSImage.Name(name))
#elseif os(watchOS)
let image = Image(named: name)
#endif
guard let result = image else { fatalError("Unable to load image named \(name).") }
return result
}
}
internal struct ColorAsset {
internal fileprivate(set) var name: String
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *)
internal var color: AssetColorTypeAlias {
return AssetColorTypeAlias(asset: self)
}
}
// MARK: - Asset Catalogs
// swiftlint:disable identifier_name line_length nesting type_body_length type_name
internal enum Asset {
......@@ -54,52 +28,86 @@ internal enum Asset {
internal static let imageRedeemSuccess = ImageAsset(name: "image-redeem-success")
internal static let navLogo = ImageAsset(name: "nav-logo")
internal static let qrCode = ImageAsset(name: "qr-code")
// swiftlint:disable trailing_comma
internal static let allColors: [ColorAsset] = [
]
internal static let allImages: [ImageAsset] = [
closeIcon,
imageAccountFailed,
imageNoInternet,
imagePurchaseSuccess,
imageReceiptBackground,
imageRedeemClaimed,
imageRedeemInvalid,
imageRedeemSuccess,
navLogo,
qrCode,
]
// swiftlint:enable trailing_comma
@available(*, deprecated, renamed: "allImages")
internal static let allValues: [AssetType] = allImages
}
// swiftlint:enable identifier_name line_length nesting type_body_length type_name
internal extension Image {
@available(iOS 1.0, tvOS 1.0, watchOS 1.0, *)
@available(OSX, deprecated,
message: "This initializer is unsafe on macOS, please use the ImageAsset.image property")
convenience init!(asset: ImageAsset) {
#if os(iOS) || os(tvOS)
// MARK: - Implementation Details
internal struct ColorAsset {
internal fileprivate(set) var name: String
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *)
internal var color: AssetColorTypeAlias {
return AssetColorTypeAlias(asset: self)
}
}
internal extension AssetColorTypeAlias {
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *)
convenience init!(asset: ColorAsset) {
let bundle = Bundle(for: BundleToken.self)
#if os(iOS) || os(tvOS)
self.init(named: asset.name, in: bundle, compatibleWith: nil)
#elseif os(OSX)
self.init(named: NSImage.Name(asset.name))
self.init(named: NSColor.Name(asset.name), bundle: bundle)
#elseif os(watchOS)
self.init(named: asset.name)
#endif
}
}
internal extension AssetColorTypeAlias {
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *)
convenience init!(asset: ColorAsset) {
internal struct DataAsset {
internal fileprivate(set) var name: String
#if os(iOS) || os(tvOS) || os(OSX)
@available(iOS 9.0, tvOS 9.0, OSX 10.11, *)
internal var data: NSDataAsset {
return NSDataAsset(asset: self)
}
#endif
}
#if os(iOS) || os(tvOS) || os(OSX)
@available(iOS 9.0, tvOS 9.0, OSX 10.11, *)
internal extension NSDataAsset {
convenience init!(asset: DataAsset) {
let bundle = Bundle(for: BundleToken.self)
#if os(iOS) || os(tvOS)
self.init(name: asset.name, bundle: bundle)
#elseif os(OSX)
self.init(name: NSDataAsset.Name(asset.name), bundle: bundle)
#endif
}
}
#endif
internal struct ImageAsset {
internal fileprivate(set) var name: String
internal var image: AssetImageTypeAlias {
let bundle = Bundle(for: BundleToken.self)
#if os(iOS) || os(tvOS)
let image = AssetImageTypeAlias(named: name, in: bundle, compatibleWith: nil)
#elseif os(OSX)
let image = bundle.image(forResource: NSImage.Name(name))
#elseif os(watchOS)
let image = AssetImageTypeAlias(named: name)
#endif
guard let result = image else { fatalError("Unable to load image named \(name).") }
return result
}
}
internal extension AssetImageTypeAlias {
@available(iOS 1.0, tvOS 1.0, watchOS 1.0, *)
@available(OSX, deprecated,
message: "This initializer is unsafe on macOS, please use the ImageAsset.image property")
convenience init!(asset: ImageAsset) {
#if os(iOS) || os(tvOS)
let bundle = Bundle(for: BundleToken.self)
self.init(named: asset.name, in: bundle, compatibleWith: nil)
#elseif os(OSX)
self.init(named: NSColor.Name(asset.name), bundle: bundle)
self.init(named: NSImage.Name(asset.name))
#elseif os(watchOS)
self.init(named: asset.name)
#endif
......
// swiftlint:disable all
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
// swiftlint:disable sorted_imports
......@@ -7,6 +8,31 @@ import UIKit
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// MARK: - Storyboard Scenes
// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name
internal enum StoryboardScene {
internal enum Signup: StoryboardType {
internal static let storyboardName = "Signup"
internal static let initialScene = InitialSceneType<UIKit.UINavigationController>(storyboard: Signup.self)
}
internal enum Welcome: StoryboardType {
internal static let storyboardName = "Welcome"
internal static let initialScene = InitialSceneType<UIKit.UINavigationController>(storyboard: Welcome.self)
internal static let loginViewController = SceneType<PIALibrary.LoginViewController>(storyboard: Welcome.self, identifier: "LoginViewController")
internal static let purchaseViewController = SceneType<PIALibrary.PurchaseViewController>(storyboard: Welcome.self, identifier: "PurchaseViewController")
internal static let redeemViewController = SceneType<PIALibrary.RedeemViewController>(storyboard: Welcome.self, identifier: "RedeemViewController")
}
}
// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name
// MARK: - Implementation Details
internal protocol StoryboardType {
static var storyboardName: String { get }
}
......@@ -18,7 +44,7 @@ internal extension StoryboardType {
}
}
internal struct SceneType<T: Any> {
internal struct SceneType<T: UIViewController> {
internal let storyboard: StoryboardType.Type
internal let identifier: String
......@@ -31,7 +57,7 @@ internal struct SceneType<T: Any> {
}
}
internal struct InitialSceneType<T: Any> {
internal struct InitialSceneType<T: UIViewController> {
internal let storyboard: StoryboardType.Type
internal func instantiate() -> T {
......@@ -42,51 +68,4 @@ internal struct InitialSceneType<T: Any> {
}
}
internal protocol SegueType: RawRepresentable { }
internal extension UIViewController {
func perform<S: SegueType>(segue: S, sender: Any? = nil) where S.RawValue == String {
let identifier = segue.rawValue
performSegue(withIdentifier: identifier, sender: sender)
}
}
// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name
internal enum StoryboardScene {
internal enum Signup: StoryboardType {
internal static let storyboardName = "Signup"
internal static let initialScene = InitialSceneType<UINavigationController>(storyboard: Signup.self)
}
internal enum Welcome: StoryboardType {
internal static let storyboardName = "Welcome"
internal static let initialScene = InitialSceneType<UINavigationController>(storyboard: Welcome.self)
internal static let loginViewController = SceneType<PIALibrary.LoginViewController>(storyboard: Welcome.self, identifier: "LoginViewController")
internal static let purchaseViewController = SceneType<PIALibrary.PurchaseViewController>(storyboard: Welcome.self, identifier: "PurchaseViewController")
internal static let redeemViewController = SceneType<PIALibrary.RedeemViewController>(storyboard: Welcome.self, identifier: "RedeemViewController")
}
}
internal enum StoryboardSegue {
internal enum Signup: String, SegueType {
case failureSegueIdentifier = "FailureSegueIdentifier"
case internetUnreachableSegueIdentifier = "InternetUnreachableSegueIdentifier"
case successSegueIdentifier = "SuccessSegueIdentifier"
case unwindFailureSegueIdentifier = "UnwindFailureSegueIdentifier"
case unwindInternetUnreachableSegueIdentifier = "UnwindInternetUnreachableSegueIdentifier"
}
internal enum Welcome: String, SegueType {
case signupQRCameraScannerSegue = "SignupQRCameraScannerSegue"
case signupViaPurchaseSegue = "SignupViaPurchaseSegue"
case signupViaRecoverSegue = "SignupViaRecoverSegue"
case signupViaRedeemSegue = "SignupViaRedeemSegue"
case signupViaRestoreSegue = "SignupViaRestoreSegue"
}
}
// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name
private final class BundleToken {}
// swiftlint:disable all
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
import Foundation
......@@ -5,14 +6,101 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable explicit_type_interface identifier_name line_length nesting type_body_length type_name
// MARK: - Strings
// swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:disable nesting type_body_length type_name
internal enum L10n {
internal enum Signup {
internal enum Failure {
/// We're unable to create an account at this time. Please try again later. Reopening the app will re-attempt to create an account.
internal static let message = L10n.tr("Signup", "failure.message")
/// GO BACK
internal static let submit = L10n.tr("Signup", "failure.submit")
/// Account creation failed
internal static let title = L10n.tr("Signup", "failure.title")
/// Sign-up failed
internal static let vcTitle = L10n.tr("Signup", "failure.vc_title")
internal enum Redeem {
internal enum Claimed {
/// Looks like this card has already been claimed by another account. You can try entering a different PIN.
internal static let message = L10n.tr("Signup", "failure.redeem.claimed.message")
/// Card claimed already
internal static let title = L10n.tr("Signup", "failure.redeem.claimed.title")
}
internal enum Invalid {
/// Looks like you entered an invalid card PIN. Please try again.
internal static let message = L10n.tr("Signup", "failure.redeem.invalid.message")
/// Invalid card PIN
internal static let title = L10n.tr("Signup", "failure.redeem.invalid.title")
}
}
}
internal enum InProgress {
/// We're confirming your purchase with our system. It could take a moment so hang in there.
internal static let message = L10n.tr("Signup", "in_progress.message")
/// Confirm sign-up
internal static let title = L10n.tr("Signup", "in_progress.title")
internal enum Redeem {
/// We're confirming your card PIN with our system. It could take a moment so hang in there.
internal static let message = L10n.tr("Signup", "in_progress.redeem.message")
}
}
internal enum Success {
/// Thank you for signing up with us. We have sent your account username and password at your email address at %@
internal static func messageFormat(_ p1: String) -> String {
return L10n.tr("Signup", "success.message_format", p1)
}
/// GET STARTED
internal static let submit = L10n.tr("Signup", "success.submit")
/// Purchase complete
internal static let title = L10n.tr("Signup", "success.title")
internal enum Password {
/// Password
internal static let caption = L10n.tr("Signup", "success.password.caption")
}
internal enum Redeem {
/// You will also receive an email shortly with your username and password.
internal static let message = L10n.tr("Signup", "success.redeem.message")
/// Completed!
internal static let title = L10n.tr("Signup", "success.redeem.title")
}
internal enum Username {
/// Username
internal static let caption = L10n.tr("Signup", "success.username.caption")
}
}
internal enum Unreachable {
/// No internet connection found. Please confirm that you have an internet connection and hit retry below.\n\nYou can come back to the app later to finish the process.
internal static let message = L10n.tr("Signup", "unreachable.message")
/// TRY AGAIN
internal static let submit = L10n.tr("Signup", "unreachable.submit")
/// Whoops!
internal static let title = L10n.tr("Signup", "unreachable.title")
/// Error
internal static let vcTitle = L10n.tr("Signup", "unreachable.vc_title")
}
}
internal enum Ui {
internal enum Global {
/// Cancel
internal static let cancel = L10n.tr("UI", "global.cancel")
/// Close
internal static let close = L10n.tr("UI", "global.close")
/// OK
internal static let ok = L10n.tr("UI", "global.ok")
internal enum Version {
/// Version %@ (%@)
internal static func format(_ p1: String, _ p2: String) -> String {
return L10n.tr("UI", "global.version.format", p1, p2)
}
}
}
}
internal enum Welcome {
internal enum Agreement {
/// Signing up constitutes acceptance of the $1 and the $2.
internal static let message = L10n.tr("Welcome", "agreement.message")
internal enum Message {
/// Privacy Policy
internal static let privacy = L10n.tr("Welcome", "agreement.message.privacy")
......@@ -20,16 +108,12 @@ internal enum L10n {
internal static let tos = L10n.tr("Welcome", "agreement.message.tos")
}
}
internal enum Camera {
internal enum Access {
internal enum Denied {
/// Enable camera access so you can scan QR codes to redeem a gift card.
internal static let message = L10n.tr("Welcome", "camera.access.denied.message")
}
internal enum Error {
/// Your device does not support scanning QR codes. Please use a device with a camera.
internal static let message = L10n.tr("Welcome", "camera.access.error.message")
......@@ -38,26 +122,21 @@ internal enum L10n {
}
}
}
internal enum Iap {
internal enum Error {
/// Error
internal static let title = L10n.tr("Welcome", "iap.error.title")
internal enum Message {
/// Apple servers currently unavailable. Please try again later.
internal static let unavailable = L10n.tr("Welcome", "iap.error.message.unavailable")
}
}
}
internal enum Login {
/// LOGIN
internal static let submit = L10n.tr("Welcome", "login.submit")
/// Sign in to your account
internal static let title = L10n.tr("Welcome", "login.title")
internal enum Error {
/// Too many failed login attempts with this username. Please try again later.
internal static let throttled = L10n.tr("Welcome", "login.error.throttled")
......@@ -68,37 +147,31 @@ internal enum L10n {
/// You must enter a username and password.
internal static let validation = L10n.tr("Welcome", "login.error.validation")
}
internal enum Password {
/// Password
internal static let placeholder = L10n.tr("Welcome", "login.password.placeholder")
}
internal enum Purchase {
/// Buy now
internal static let button = L10n.tr("Welcome", "login.purchase.button")
/// Don’t have an account?
internal static let footer = L10n.tr("Welcome", "login.purchase.footer")
}
internal enum Redeem {
/// Redeem now
internal static let button = L10n.tr("Welcome", "login.redeem.button")
/// Have a gift card or trial card?
internal static let footer = L10n.tr("Welcome", "login.redeem.footer")
}
internal enum Restore {
/// Couldn't get your plan?
internal static let button = L10n.tr("Welcome", "login.restore.button")
}
internal enum Username {
/// Username (p1234567)
internal static let placeholder = L10n.tr("Welcome", "login.username.placeholder")
}
}
internal enum Plan {
/// Best value
internal static let bestValue = L10n.tr("Welcome", "plan.best_value")
......@@ -106,17 +179,14 @@ internal enum L10n {
internal static func priceFormat(_ p1: String) -> String {
return L10n.tr("Welcome", "plan.price_format", p1)
}
internal enum Accessibility {
/// per month
internal static let perMonth = L10n.tr("Welcome", "plan.accessibility.per_month")
}
internal enum Monthly {
/// Monthly
internal static let title = L10n.tr("Welcome", "plan.monthly.title")
}
internal enum Yearly {
/// %@%@ per year
internal static func detailFormat(_ p1: String, _ p2: String) -> String {
......@@ -126,7 +196,6 @@ internal enum L10n {
internal static let title = L10n.tr("Welcome", "plan.yearly.title")
}
}
internal enum Purchase {
/// BUY NOW
internal static let submit = L10n.tr("Welcome", "purchase.submit")
......@@ -134,18 +203,15 @@ internal enum L10n {
internal static let subtitle = L10n.tr("Welcome", "purchase.subtitle")
/// Select a VPN plan
internal static let title = L10n.tr("Welcome", "purchase.title")
internal enum Email {
/// Email address
internal static let placeholder = L10n.tr("Welcome", "purchase.email.placeholder")
}
internal enum Error {
/// Purchase
internal static let title = L10n.tr("Welcome", "purchase.error.title")
/// You must enter an email address.
internal static let validation = L10n.tr("Welcome", "purchase.error.validation")
internal enum Connectivity {
/// We are unable to reach Private Internet Access. This may due to poor internet or our service is blocked in your country.
internal static let description = L10n.tr("Welcome", "purchase.error.connectivity.description")
......@@ -153,7 +219,6 @@ internal enum L10n {
internal static let title = L10n.tr("Welcome", "purchase.error.connectivity.title")
}
}
internal enum Login {
/// Sign in
internal static let button = L10n.tr("Welcome", "purchase.login.button")
......@@ -161,7 +226,6 @@ internal enum L10n {
internal static let footer = L10n.tr("Welcome", "purchase.login.footer")
}
}
internal enum Redeem {
/// SUBMIT
internal static let submit = L10n.tr("Welcome", "redeem.submit")
......@@ -171,12 +235,10 @@ internal enum L10n {
}
/// Redeem gift card
internal static let title = L10n.tr("Welcome", "redeem.title")
internal enum Email {
/// Email address
internal static let placeholder = L10n.tr("Welcome", "redeem.email.placeholder")
}
internal enum Error {
/// Code must be %lu numeric digits.
internal static func code(_ p1: Int) -> String {
......@@ -184,14 +246,12 @@ internal enum L10n {
}
/// Redeem
internal static let title = L10n.tr("Welcome", "redeem.error.title")
internal enum Qrcode {
/// Invalid QR code sequence. Please try again.
internal static let invalid = L10n.tr("Welcome", "redeem.error.qrcode.invalid")
}
}
}
internal enum Restore {
/// CONFIRM
internal static let submit = L10n.tr("Welcome", "restore.submit")
......@@ -199,114 +259,17 @@ internal enum L10n {
internal static let subtitle = L10n.tr("Welcome", "restore.subtitle")
/// Restore uncredited purchase
internal static let title = L10n.tr("Welcome", "restore.title")
internal enum Email {
/// Email address
internal static let placeholder = L10n.tr("Welcome", "restore.email.placeholder")
}
}
}
internal enum Ui {
internal enum Global {
/// Cancel
internal static let cancel = L10n.tr("UI", "global.cancel")
/// Close
internal static let close = L10n.tr("UI", "global.close")
/// OK
internal static let ok = L10n.tr("UI", "global.ok")
internal enum Version {
/// Version %@ (%@)
internal static func format(_ p1: String, _ p2: String) -> String {
return L10n.tr("UI", "global.version.format", p1, p2)
}
}
}
}
internal enum Signup {
internal enum Failure {
/// We're unable to create an account at this time. Please try again later. Reopening the app will re-attempt to create an account.
internal static let message = L10n.tr("Signup", "failure.message")
/// GO BACK
internal static let submit = L10n.tr("Signup", "failure.submit")
/// Account creation failed
internal static let title = L10n.tr("Signup", "failure.title")
/// Sign-up failed
internal static let vcTitle = L10n.tr("Signup", "failure.vc_title")
internal enum Redeem {
internal enum Claimed {
/// Looks like this card has already been claimed by another account. You can try entering a different PIN.
internal static let message = L10n.tr("Signup", "failure.redeem.claimed.message")
/// Card claimed already
internal static let title = L10n.tr("Signup", "failure.redeem.claimed.title")
}
internal enum Invalid {
/// Looks like you entered an invalid card PIN. Please try again.