mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-02-16 12:52:11 +00:00
Share configuration l10n in Descriptible
This commit is contained in:
parent
0b0a95d6df
commit
9fa40f6ec6
@ -21,6 +21,8 @@
|
||||
0E1D72B4213C118500BA1586 /* ConfigurationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E1D72B3213C118500BA1586 /* ConfigurationViewController.swift */; };
|
||||
0E24273A225950450064A1A3 /* About.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0E24273C225950450064A1A3 /* About.storyboard */; };
|
||||
0E242742225956AC0064A1A3 /* DonationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E242741225956AC0064A1A3 /* DonationViewController.swift */; };
|
||||
0E294AA125AE2B0A00CB4908 /* Descriptible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E294A8225AE29D100CB4908 /* Descriptible.swift */; };
|
||||
0E294AA225AE2B0B00CB4908 /* Descriptible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E294A8225AE29D100CB4908 /* Descriptible.swift */; };
|
||||
0E2AC24522EC3AC10037B4B0 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 0E2AC24422EC3AC10037B4B0 /* Settings.bundle */; };
|
||||
0E2B494020FCFF990094784C /* Theme+Titles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2B493F20FCFF990094784C /* Theme+Titles.swift */; };
|
||||
0E2EB063236D8E1E0079DB53 /* AppConstants+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2EB062236D8E1E0079DB53 /* AppConstants+App.swift */; };
|
||||
@ -367,6 +369,7 @@
|
||||
0E23B4A12298559800304C30 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
|
||||
0E24273B225950450064A1A3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/About.storyboard; sourceTree = "<group>"; };
|
||||
0E242741225956AC0064A1A3 /* DonationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DonationViewController.swift; sourceTree = "<group>"; };
|
||||
0E294A8225AE29D100CB4908 /* Descriptible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Descriptible.swift; sourceTree = "<group>"; };
|
||||
0E2AC24422EC3AC10037B4B0 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
|
||||
0E2B493F20FCFF990094784C /* Theme+Titles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+Titles.swift"; sourceTree = "<group>"; };
|
||||
0E2B494120FD16540094784C /* TransientStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransientStore.swift; sourceTree = "<group>"; };
|
||||
@ -969,6 +972,7 @@
|
||||
children = (
|
||||
0E57F63A20C83FC5008323CF /* iOS */,
|
||||
0E569F58259F41690022DFB8 /* macOS */,
|
||||
0E294A8225AE29D100CB4908 /* Descriptible.swift */,
|
||||
);
|
||||
path = App;
|
||||
sourceTree = "<group>";
|
||||
@ -1889,6 +1893,7 @@
|
||||
0E520320259F58BF00CBAB56 /* AppDelegate.swift in Sources */,
|
||||
0E520344259F58FE00CBAB56 /* TrustedNetworksAddViewController.swift in Sources */,
|
||||
0E52033A259F58F500CBAB56 /* AccountViewController.swift in Sources */,
|
||||
0E294AA225AE2B0B00CB4908 /* Descriptible.swift in Sources */,
|
||||
0E520356259F590600CBAB56 /* PreferencesGeneralViewController.swift in Sources */,
|
||||
0E520348259F58FE00CBAB56 /* MTUViewController.swift in Sources */,
|
||||
0E52037E259F593B00CBAB56 /* SwiftGen+Segues.swift in Sources */,
|
||||
@ -1986,6 +1991,7 @@
|
||||
0ECC60DE2256B68A0020BEAC /* SwiftGen+Assets.swift in Sources */,
|
||||
0E242742225956AC0064A1A3 /* DonationViewController.swift in Sources */,
|
||||
0ED38AEC2141260D0004D387 /* ConfigurationModificationDelegate.swift in Sources */,
|
||||
0E294AA125AE2B0A00CB4908 /* Descriptible.swift in Sources */,
|
||||
0E776642229D0DAE0023FA76 /* Intents.intentdefinition in Sources */,
|
||||
0ECEE45020E1182E00A6BB43 /* Theme+Cells.swift in Sources */,
|
||||
0E6268942369AD0600355F75 /* PurchaseTableViewCell.swift in Sources */,
|
||||
|
125
Passepartout/App/Descriptible.swift
Normal file
125
Passepartout/App/Descriptible.swift
Normal file
@ -0,0 +1,125 @@
|
||||
//
|
||||
// Descriptible.swift
|
||||
// Passepartout
|
||||
//
|
||||
// Created by Davide De Rosa on 1/12/21.
|
||||
// Copyright (c) 2021 Davide De Rosa. All rights reserved.
|
||||
//
|
||||
// https://github.com/passepartoutvpn
|
||||
//
|
||||
// This file is part of Passepartout.
|
||||
//
|
||||
// Passepartout is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Passepartout is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import TunnelKit
|
||||
|
||||
public protocol UIDescriptible {
|
||||
var uiDescription: String { get }
|
||||
}
|
||||
|
||||
extension OpenVPN.Cipher: UIDescriptible {
|
||||
public var uiDescription: String {
|
||||
return description
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenVPN.Digest: UIDescriptible {
|
||||
public var uiDescription: String {
|
||||
return description
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenVPN.CompressionFraming: UIDescriptible {
|
||||
public var uiDescription: String {
|
||||
let V = L10n.Core.Configuration.Cells.self
|
||||
switch self {
|
||||
case .disabled:
|
||||
return L10n.Core.Global.Values.disabled
|
||||
|
||||
case .compLZO:
|
||||
return V.CompressionFraming.Value.lzo
|
||||
|
||||
case .compress:
|
||||
return V.CompressionFraming.Value.compress
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenVPN.CompressionAlgorithm: UIDescriptible {
|
||||
public var uiDescription: String {
|
||||
let V = L10n.Core.Configuration.Cells.self
|
||||
switch self {
|
||||
case .disabled:
|
||||
return L10n.Core.Global.Values.disabled
|
||||
|
||||
case .LZO:
|
||||
return V.CompressionAlgorithm.Value.lzo
|
||||
|
||||
case .other:
|
||||
return V.CompressionAlgorithm.Value.other
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenVPN.ConfigurationBuilder {
|
||||
public var uiDescriptionForTLSWrap: String {
|
||||
let V = L10n.Core.Configuration.Cells.self
|
||||
if let strategy = tlsWrap?.strategy {
|
||||
switch strategy {
|
||||
case .auth:
|
||||
return V.TlsWrapping.Value.auth
|
||||
|
||||
case .crypt:
|
||||
return V.TlsWrapping.Value.crypt
|
||||
}
|
||||
} else {
|
||||
return L10n.Core.Global.Values.disabled
|
||||
}
|
||||
}
|
||||
|
||||
public var uiDescriptionForKeepAlive: String {
|
||||
let V = L10n.Core.Configuration.Cells.self
|
||||
if let keepAlive = keepAliveInterval, keepAlive > 0 {
|
||||
return V.KeepAlive.Value.seconds(Int(keepAlive))
|
||||
} else {
|
||||
return L10n.Core.Global.Values.disabled
|
||||
}
|
||||
}
|
||||
|
||||
public var uiDescriptionForClientCertificate: String {
|
||||
let V = L10n.Core.Configuration.Cells.Client.Value.self
|
||||
return (clientCertificate != nil) ? V.enabled : V.disabled
|
||||
}
|
||||
|
||||
public var uiDescriptionForEKU: String {
|
||||
let V = L10n.Core.Global.Values.self
|
||||
return (checksEKU ?? false) ? V.enabled : V.disabled
|
||||
}
|
||||
|
||||
public var uiDescriptionForRenegotiatesAfter: String {
|
||||
let V = L10n.Core.Configuration.Cells.self
|
||||
if let reneg = renegotiatesAfter, reneg > 0 {
|
||||
return V.RenegotiationSeconds.Value.after(TimeInterval(reneg).localized)
|
||||
} else {
|
||||
return L10n.Core.Global.Values.disabled
|
||||
}
|
||||
}
|
||||
|
||||
public var uiDescriptionForRandomizeEndpoint: String {
|
||||
let V = L10n.Core.Global.Values.self
|
||||
return (randomizeEndpoint ?? false) ? V.enabled : V.disabled
|
||||
}
|
||||
}
|
2
Podfile
2
Podfile
@ -8,7 +8,7 @@ $tunnelkit_specs = ['Protocols/OpenVPN', 'Extra/LZO']
|
||||
|
||||
def shared_pods
|
||||
#pod_version $tunnelkit_name, $tunnelkit_specs, '~> 3.1.0'
|
||||
pod_git $tunnelkit_name, $tunnelkit_specs, 'c15d6f5'
|
||||
pod_git $tunnelkit_name, $tunnelkit_specs, 'e388842'
|
||||
#pod_path $tunnelkit_name, $tunnelkit_specs, '..'
|
||||
pod 'SSZipArchive'
|
||||
pod 'Kvitto', :git => 'https://github.com/keeshux/Kvitto', :branch => 'enable-macos-spec'
|
||||
|
10
Podfile.lock
10
Podfile.lock
@ -52,8 +52,8 @@ DEPENDENCIES:
|
||||
- Kvitto (from `https://github.com/keeshux/Kvitto`, branch `enable-macos-spec`)
|
||||
- MBProgressHUD
|
||||
- SSZipArchive
|
||||
- TunnelKit/Extra/LZO (from `https://github.com/passepartoutvpn/tunnelkit`, commit `c15d6f5`)
|
||||
- TunnelKit/Protocols/OpenVPN (from `https://github.com/passepartoutvpn/tunnelkit`, commit `c15d6f5`)
|
||||
- TunnelKit/Extra/LZO (from `https://github.com/passepartoutvpn/tunnelkit`, commit `e388842`)
|
||||
- TunnelKit/Protocols/OpenVPN (from `https://github.com/passepartoutvpn/tunnelkit`, commit `e388842`)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
@ -71,7 +71,7 @@ EXTERNAL SOURCES:
|
||||
:branch: enable-macos-spec
|
||||
:git: https://github.com/keeshux/Kvitto
|
||||
TunnelKit:
|
||||
:commit: c15d6f5
|
||||
:commit: e388842
|
||||
:git: https://github.com/passepartoutvpn/tunnelkit
|
||||
|
||||
CHECKOUT OPTIONS:
|
||||
@ -82,7 +82,7 @@ CHECKOUT OPTIONS:
|
||||
:commit: e263fcd1f40a6a482a0f1e424ba98009c4ad2b96
|
||||
:git: https://github.com/keeshux/Kvitto
|
||||
TunnelKit:
|
||||
:commit: c15d6f5
|
||||
:commit: e388842
|
||||
:git: https://github.com/passepartoutvpn/tunnelkit
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
@ -95,6 +95,6 @@ SPEC CHECKSUMS:
|
||||
SwiftyBeaver: 2e8acd6fc90c6d0a27055867a290794926d57c02
|
||||
TunnelKit: 2a6aadea2d772a2760b153aee27d1c334c9ca6db
|
||||
|
||||
PODFILE CHECKSUM: 9751a898e23369673b1dfb0c7c7fde9834a55d53
|
||||
PODFILE CHECKSUM: d6449ccbaad5d2ca50f6a27a651baaa17ef9db1a
|
||||
|
||||
COCOAPODS: 1.10.0
|
||||
|
Loading…
Reference in New Issue
Block a user