mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-02-16 12:52:11 +00:00
Make App/Core iOS/Catalyst only
- Drop macOS target from Package.swift - Drop @available attributes - UI idiom - Intents API - Swipe actions in ProviderLocationView - Review os(iOS) - DebugLog, append idiom to tell Mac from iPad - Drop redundant canImport
This commit is contained in:
parent
a6c7305528
commit
f1aa192c9c
@ -37,7 +37,6 @@ extension Color {
|
||||
}
|
||||
|
||||
extension View {
|
||||
@available(iOS 14, *)
|
||||
var themeIdiom: UIUserInterfaceIdiom {
|
||||
UIDevice.current.userInterfaceIdiom
|
||||
}
|
||||
|
@ -132,7 +132,6 @@ extension IntentDispatcher {
|
||||
}
|
||||
|
||||
private static func handleCellularNetwork(_ trust: Bool, _ vpnManager: VPNManager) {
|
||||
#if os(iOS)
|
||||
Task {
|
||||
do {
|
||||
try await vpnManager.modifyActiveProfile {
|
||||
@ -142,7 +141,6 @@ extension IntentDispatcher {
|
||||
pp_log.error("Unable to modify cellular trust: \(error)")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private static func handleCurrentNetwork(_ trust: Bool, _ vpnManager: VPNManager) {
|
||||
|
@ -25,9 +25,7 @@
|
||||
|
||||
import Foundation
|
||||
import Intents
|
||||
#if canImport(IntentsUI)
|
||||
import IntentsUI
|
||||
#endif
|
||||
import Combine
|
||||
|
||||
@MainActor
|
||||
@ -65,7 +63,6 @@ class IntentsManager: NSObject, ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 12, macOS 12, *)
|
||||
extension IntentsManager: INUIAddVoiceShortcutViewControllerDelegate {
|
||||
func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) {
|
||||
guard let vs = voiceShortcut else {
|
||||
@ -81,7 +78,6 @@ extension IntentsManager: INUIAddVoiceShortcutViewControllerDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 12, macOS 12, *)
|
||||
extension IntentsManager: INUIEditVoiceShortcutViewControllerDelegate {
|
||||
func editVoiceShortcutViewController(_ controller: INUIEditVoiceShortcutViewController, didUpdate voiceShortcut: INVoiceShortcut?, error: Error?) {
|
||||
guard let vs = voiceShortcut else {
|
||||
|
@ -23,7 +23,6 @@
|
||||
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#if canImport(StoreKit)
|
||||
import Foundation
|
||||
import StoreKit
|
||||
|
||||
@ -222,4 +221,3 @@ extension SKProduct {
|
||||
return localizedCurrencyFormatter.string(from: price)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -23,7 +23,6 @@
|
||||
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#if os(iOS) && canImport(StoreKit)
|
||||
import UIKit
|
||||
import StoreKit
|
||||
|
||||
@ -93,4 +92,3 @@ public class Reviewer: ObservableObject {
|
||||
return URL(string: "https://apps.apple.com/app/id\(appId)?action=write-review")!
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -25,11 +25,8 @@
|
||||
|
||||
import SwiftUI
|
||||
import Intents
|
||||
#if canImport(IntentsUI)
|
||||
import IntentsUI
|
||||
#endif
|
||||
|
||||
@available(iOS 12, macOS 12, *)
|
||||
struct IntentAddView: UIViewControllerRepresentable {
|
||||
let shortcut: INShortcut
|
||||
|
||||
|
@ -25,11 +25,8 @@
|
||||
|
||||
import SwiftUI
|
||||
import Intents
|
||||
#if canImport(IntentsUI)
|
||||
import IntentsUI
|
||||
#endif
|
||||
|
||||
@available(iOS 12, macOS 12, *)
|
||||
struct IntentEditView: UIViewControllerRepresentable {
|
||||
let shortcut: Shortcut
|
||||
|
||||
|
@ -23,9 +23,7 @@
|
||||
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#if canImport(MessageUI)
|
||||
import SwiftUI
|
||||
import Combine
|
||||
import MessageUI
|
||||
|
||||
struct MailComposerView: UIViewControllerRepresentable {
|
||||
@ -76,4 +74,3 @@ struct MailComposerView: UIViewControllerRepresentable {
|
||||
Coordinator(self)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@ struct AboutView: View {
|
||||
|
||||
private let readmeURL = Constants.URLs.readme
|
||||
|
||||
private let changelogURL = Constants.URLs.iOS.changelog
|
||||
private let changelogURL = Constants.URLs.changelog
|
||||
|
||||
private let homeURL = Constants.URLs.website
|
||||
|
||||
|
@ -122,7 +122,7 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
|
||||
|
||||
@ViewBuilder
|
||||
private func toolbar() -> some View {
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
if #available(iOS 15, *) {
|
||||
Button {
|
||||
withAnimation {
|
||||
isShowingFavorites.toggle()
|
||||
@ -144,7 +144,7 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
|
||||
header: !category.name.isEmpty ? Text(category.name) : nil
|
||||
) {
|
||||
ForEach(filteredLocations(for: category)) { location in
|
||||
if isEditable, #available(iOS 15, macOS 12, *) {
|
||||
if isEditable, #available(iOS 15, *) {
|
||||
locationRow(location)
|
||||
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
||||
favoriteActions(location)
|
||||
@ -197,7 +197,7 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 15, macOS 12, *)
|
||||
@available(iOS 15, *)
|
||||
private func favoriteActions(_ location: ProviderLocation) -> some View {
|
||||
Button {
|
||||
withAnimation {
|
||||
|
@ -144,12 +144,10 @@ struct ShortcutsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 12, macOS 12, *)
|
||||
private func presentEditShortcut(_ shortcut: Shortcut) {
|
||||
modalType = .edit(shortcut: shortcut)
|
||||
}
|
||||
|
||||
@available(iOS 12, macOS 12, *)
|
||||
private func presentAddShortcut(_ shortcut: INShortcut) {
|
||||
isNavigationPresented = false
|
||||
modalType = .add(shortcut: shortcut)
|
||||
|
@ -20,34 +20,6 @@
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "PassepartoutUtilsTests"
|
||||
BuildableName = "PassepartoutUtilsTests"
|
||||
BlueprintName = "PassepartoutUtilsTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "PassepartoutServicesTests"
|
||||
BuildableName = "PassepartoutServicesTests"
|
||||
BlueprintName = "PassepartoutServicesTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
|
@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1330"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "PassepartoutProfilesTests"
|
||||
BuildableName = "PassepartoutProfilesTests"
|
||||
BlueprintName = "PassepartoutProfilesTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -23,34 +23,22 @@
|
||||
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if os(iOS)
|
||||
import Foundation
|
||||
import UIKit
|
||||
#else
|
||||
import Cocoa
|
||||
#endif
|
||||
|
||||
extension DebugLog {
|
||||
public func decoratedString(_ appName: String, _ appVersion: String) -> String {
|
||||
var metadata: [String] = []
|
||||
let osVersion: String
|
||||
let deviceType: String?
|
||||
let device: UIDevice = .current
|
||||
let osVersion = "\(device.systemName) \(device.systemVersion)"
|
||||
let deviceModel = device.model
|
||||
let deviceIdiom = device.userInterfaceIdiom
|
||||
|
||||
#if os(iOS)
|
||||
let device = UIDevice.current
|
||||
osVersion = "\(device.systemName) \(device.systemVersion)"
|
||||
deviceType = device.model
|
||||
#else
|
||||
let os = ProcessInfo().operatingSystemVersion
|
||||
osVersion = "macOS \(os.majorVersion).\(os.minorVersion).\(os.patchVersion)"
|
||||
deviceType = nil
|
||||
#endif
|
||||
|
||||
metadata.append("App: \(appName) \(appVersion)")
|
||||
metadata.append("OS: \(osVersion)")
|
||||
if let deviceType = deviceType {
|
||||
metadata.append("Device: \(deviceType)")
|
||||
}
|
||||
let metadata = [
|
||||
"App: \(appName) \(appVersion)",
|
||||
"OS: \(osVersion)",
|
||||
"Device: \(deviceModel) (\(deviceIdiom))"
|
||||
]
|
||||
|
||||
var fullText = metadata.joined(separator: "\n")
|
||||
fullText += "\n\n"
|
||||
@ -66,3 +54,4 @@ extension DebugLog {
|
||||
return data
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -50,11 +50,13 @@ extension Profile.OnDemand {
|
||||
|
||||
var rules: [NEOnDemandRule] = []
|
||||
if withCustomRules {
|
||||
#if os(iOS)
|
||||
if withMobileNetwork {
|
||||
let rule = policyRule
|
||||
rule.interfaceTypeMatch = .cellular
|
||||
rules.append(rule)
|
||||
}
|
||||
#endif
|
||||
if withEthernetNetwork {
|
||||
if let compatibleEthernet = NEOnDemandRuleInterfaceType.compatibleEthernet {
|
||||
let rule = policyRule
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit ba2b959d493b00359f1f3e2040e35ce6a31e2c74
|
||||
Subproject commit 9e4db9da5a3216b51624bb1726972e7443cabbe0
|
@ -25,7 +25,6 @@
|
||||
|
||||
import Foundation
|
||||
import StoreKit
|
||||
|
||||
#if os(iOS)
|
||||
import UIKit
|
||||
#else
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4602f7cb05f5b907ee5e5a9309964cb335db9b59
|
||||
Subproject commit c8422d9313e8f2dc69b44d19909464e82d7f6b37
|
Loading…
Reference in New Issue
Block a user