Skip to content

Commit

Permalink
Merge branch 'master' into refactoring/provider-entities
Browse files Browse the repository at this point in the history
  • Loading branch information
keeshux committed Jan 29, 2025
2 parents e115bfe + cb93ee8 commit 8e5a601
Show file tree
Hide file tree
Showing 34 changed files with 114 additions and 126 deletions.
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,3 @@ jobs:
with:
tag_name: "v${{ env.APP_VERSION }}"
body_path: ${{ env.RELEASE_NOTES }}
draft: true
3 changes: 3 additions & 0 deletions Packages/App/Sources/AppUIMain/Views/App/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ extension AppCoordinator {
if isUITesting {
return isBigDevice ? .grid : .list
}
guard isBigDevice else {
return .list
}
return layout
}

Expand Down
3 changes: 1 addition & 2 deletions Packages/App/Sources/AppUIMain/Views/App/AppToolbar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ struct AppToolbar: ToolbarContent, SizeClassProviding {
ToolbarItem(placement: .navigation) {
aboutButton
}
ToolbarItemGroup(placement: .primaryAction) {
ToolbarItem(placement: .primaryAction) {
addProfileMenu
layoutPicker
}
}
}
Expand Down
34 changes: 16 additions & 18 deletions Packages/App/Sources/AppUIMain/Views/App/ProfileListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,24 @@ struct ProfileListView: View, Routable, TunnelInstallationProviding {

var body: some View {
debugChanges()
return ScrollViewReader { scrollProxy in
Form {
if !isSearching {
headerView(scrollProxy: scrollProxy)
.unanimated()
}
Group {
ForEach(allPreviews, content: profileView)
.onDelete { offsets in
Task {
await profileManager.removeProfiles(at: offsets)
}
return Form {
if !isSearching {
headerView
.unanimated()
}
Group {
ForEach(allPreviews, content: profileView)
.onDelete { offsets in
Task {
await profileManager.removeProfiles(at: offsets)
}
}
.themeSection(header: Strings.Views.App.Folders.default)
}
}
.themeForm()
.themeAnimation(on: profileManager.isReady, category: .profiles)
.themeAnimation(on: profileManager.previews, category: .profiles)
.themeSection(header: Strings.Views.App.Folders.default)
}
.themeForm()
.themeAnimation(on: profileManager.isReady, category: .profiles)
.themeAnimation(on: profileManager.previews, category: .profiles)
}
}

Expand All @@ -82,7 +80,7 @@ private extension ProfileListView {
profileManager.previews
}

func headerView(scrollProxy: ScrollViewProxy) -> some View {
var headerView: some View {
InstalledProfileView(
layout: .list,
profileManager: profileManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ private extension Issue {
var list: [MailComposerView.Attachment] = []
let mimeType = Strings.Unlocalized.Issues.attachmentMimeType
if let appLog {
list.append(.init(data: appLog, mimeType: mimeType, fileName: Strings.Unlocalized.Issues.appLogFilename))
list.append(.init(data: appLog, mimeType: mimeType, fileName: Constants.shared.log.appPath))
}
if let tunnelLog {
list.append(.init(data: tunnelLog, mimeType: mimeType, fileName: Strings.Unlocalized.Issues.tunnelLogFilename))
list.append(.init(data: tunnelLog, mimeType: mimeType, fileName: Constants.shared.log.tunnelPath))
}
return list
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ private extension Issue {
var items: [Any] {
var list: [Any] = []
list.append(body)
if let appLog, let url = appLog.toTemporaryURL(withFilename: Strings.Unlocalized.Issues.appLogFilename) {
if let appLog, let url = appLog.toTemporaryURL(withFilename: Constants.shared.log.appPath) {
list.append(url)
}
if let tunnelLog, let url = tunnelLog.toTemporaryURL(withFilename: Strings.Unlocalized.Issues.tunnelLogFilename) {
if let tunnelLog, let url = tunnelLog.toTemporaryURL(withFilename: Constants.shared.log.tunnelPath) {
list.append(url)
}
return list
Expand Down
14 changes: 7 additions & 7 deletions Packages/App/Sources/AppUIMain/Views/Modules/OnDemandView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ private extension OnDemandView {

var networkSection: some View {
Group {
if Utils.hasCellularData() {
Toggle(Strings.Modules.OnDemand.mobile, isOn: draft.withMobileNetwork)
}
if Utils.hasEthernet() {
Toggle(Strings.Modules.OnDemand.ethernet, isOn: draft.withEthernetNetwork)
}
Toggle(Strings.Modules.OnDemand.mobile, isOn: draft.withMobileNetwork)
Toggle("\(Strings.Modules.OnDemand.ethernet) (Mac/TV)", isOn: draft.withEthernetNetwork)
}
.themeSection(header: Strings.Global.Nouns.networks)
.themeSection(
header: Strings.Global.Nouns.networks,
footer: Strings.Modules.OnDemand.Networks.footer,
forcesFooter: true
)
}

var wifiSection: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,24 @@ private extension ProviderServerView.ContentView {
.environmentObject(theme) // TODO: #873, Table loses environment
}

TableColumn(Strings.Global.Nouns.address, value: \.address)
TableColumn(Strings.Global.Nouns.address) { server in
Button {
onSelect(server)
} label: {
Text(server.address)
}
.cursor(.hand)
}
.width(min: 300.0)

TableColumn("􀋂") { server in
TableColumn("") { server in
FavoriteToggle(
value: server.serverId,
selection: providerPreferences.favoriteServers()
)
.environmentObject(theme) // TODO: #873, Table loses environment
}
.width(15.0)

TableColumn("") { server in
Button {
onSelect(server)
} label: {
Text(selectTitle)
.lineLimit(1)
.truncationMode(.tail)
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public actor FakeAppProductHelper: AppProductHelper {
didUpdateSubject.eraseToAnyPublisher()
}

public func fetchProducts() async throws -> [AppProduct: InAppProduct] {
public func fetchProducts(timeout: Int) async throws -> [AppProduct: InAppProduct] {
products = AppProduct.all.reduce(into: [:]) {
$0[$1] = InAppProduct(
productIdentifier: $1.rawValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"maxLevel": 3,
"maxSize": 500000,
"maxBufferedLines": 5000,
"maxAge": 259200
"maxAge": 86400
},
"formatter": {
"timestamp": "HH:mm:ss",
Expand Down
32 changes: 0 additions & 32 deletions Packages/App/Sources/CommonUtils/Extensions/Utils+Network.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,9 @@
import Foundation
#if os(iOS)
import NetworkExtension
#elseif os(macOS)
import CoreWLAN
#endif

extension Utils {
#if targetEnvironment(simulator)
public static func hasCellularData() -> Bool {
true
}
#else
// TODO: ###, move this check to kit, and try something similar for Ethernet
public static func hasCellularData() -> Bool {
var addrs: UnsafeMutablePointer<ifaddrs>?
guard getifaddrs(&addrs) == 0 else {
return false
}
var isFound = false
var cursor = addrs?.pointee
while let ifa = cursor {
let name = String(cString: ifa.ifa_name)
if name == "pdp_ip0" {
isFound = true
break
}
cursor = ifa.ifa_next?.pointee
}
freeifaddrs(addrs)
return isFound
}
#endif

public static func hasEthernet() -> Bool {
true
}

public static func currentWifiSSID() async -> String? {
#if targetEnvironment(simulator)
["My Home Network", "Safe Wi-Fi", "Friend's House"].randomElement()
Expand Down
8 changes: 7 additions & 1 deletion Packages/App/Sources/CommonUtils/IAP/InApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,19 @@ public protocol InAppHelper {

var didUpdate: AnyPublisher<Void, Never> { get }

func fetchProducts() async throws -> [ProductType: InAppProduct]
func fetchProducts(timeout: Int) async throws -> [ProductType: InAppProduct]

func purchase(_ inAppProduct: InAppProduct) async throws -> InAppPurchaseResult

func restorePurchases() async throws
}

extension InAppHelper {
public func fetchProducts() async throws -> [ProductType: InAppProduct] {
try await fetchProducts(timeout: 3)
}
}

public struct InAppReceipt: Sendable {
public struct PurchaseReceipt: Sendable {
public let productIdentifier: String?
Expand Down
16 changes: 14 additions & 2 deletions Packages/App/Sources/CommonUtils/IAP/StoreKitHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,20 @@ extension StoreKitHelper {
didUpdateSubject.eraseToAnyPublisher()
}

public func fetchProducts() async throws -> [ProductType: InAppProduct] {
let skProducts = try await Product.products(for: products.map(inAppIdentifier))
public func fetchProducts(timeout: Int) async throws -> [ProductType: InAppProduct] {
let skProducts = try await withThrowingTaskGroup(of: [Product].self) { group in
group.addTask {
try await Product.products(for: self.products.map(self.inAppIdentifier))
}
group.addTask {
try await Task.sleep(nanoseconds: UInt64(timeout) * 1_000_000_000)
throw URLError(.timedOut)
}
for try await result in group {
return result
}
throw URLError(.unknown)
}
return skProducts.reduce(into: [:]) {
guard let pid = ProductType(rawValue: $1.id) else {
return
Expand Down
4 changes: 0 additions & 4 deletions Packages/App/Sources/UILibrary/L10n/Strings+Unlocalized.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ extension Strings {
public static let subject = "\(appName) - Report issue"

public static let attachmentMimeType = "text/plain"

public static let appLogFilename = "app.log"

public static let tunnelLogFilename = "tunnel.log"
}

public static let appName = "Passepartout"
Expand Down
4 changes: 4 additions & 0 deletions Packages/App/Sources/UILibrary/L10n/SwiftGen+Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ public enum Strings {
public static let mobile = Strings.tr("Localizable", "modules.on_demand.mobile", fallback: "Mobile")
/// Policy
public static let policy = Strings.tr("Localizable", "modules.on_demand.policy", fallback: "Policy")
public enum Networks {
/// These rules will only apply on devices where the interface type is supported.
public static let footer = Strings.tr("Localizable", "modules.on_demand.networks.footer", fallback: "These rules will only apply on devices where the interface type is supported.")
}
public enum Policy {
/// Activate the VPN %@.
public static func footer(_ p1: Any) -> String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Eingeschlossene Routen";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Mobil";
"modules.on_demand.networks.footer" = "Diese Regeln gelten nur für Geräte, auf denen der Schnittstellentyp unterstützt wird.";
"modules.on_demand.policy" = "Richtlinie";
"modules.on_demand.policy.footer" = "Aktiviere den VPN %@.";
"modules.on_demand.policy.footer.any" = "in jedem Netzwerk";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Συμπεριλαμβανόμενες διαδρομές";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Κινητό";
"modules.on_demand.networks.footer" = "Αυτοί οι κανόνες θα ισχύουν μόνο σε συσκευές όπου υποστηρίζεται ο τύπος διεπαφής.";
"modules.on_demand.policy" = "Πολιτική";
"modules.on_demand.policy.footer" = "Ενεργοποιήστε το VPN %@.";
"modules.on_demand.policy.footer.any" = "σε οποιοδήποτε δίκτυο";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.on_demand.policy.footer.any" = "in any network";
"modules.on_demand.policy.footer.including" = "only in the networks below";
"modules.on_demand.policy.footer.excluding" = "except in the networks below";
"modules.on_demand.networks.footer" = "These rules will only apply on devices where the interface type is supported.";
"modules.on_demand.mobile" = "Mobile";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.ssid.add" = "Add SSID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Rutas incluidas";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Móvil";
"modules.on_demand.networks.footer" = "Estas reglas solo se aplicarán en dispositivos donde el tipo de interfaz sea compatible.";
"modules.on_demand.policy" = "Política";
"modules.on_demand.policy.footer" = "Activa la VPN %@.";
"modules.on_demand.policy.footer.any" = "en cualquier red";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Routes incluses";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Mobile";
"modules.on_demand.networks.footer" = "Ces règles s'appliqueront uniquement aux appareils où le type d'interface est pris en charge.";
"modules.on_demand.policy" = "Politique";
"modules.on_demand.policy.footer" = "Activez le VPN %@.";
"modules.on_demand.policy.footer.any" = "dans tous les réseaux";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Rotte incluse";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Mobile";
"modules.on_demand.networks.footer" = "Queste regole si applicheranno solo sui dispositivi in cui il tipo di interfaccia è supportato.";
"modules.on_demand.policy" = "Politica";
"modules.on_demand.policy.footer" = "Attiva la VPN %@.";
"modules.on_demand.policy.footer.any" = "in qualsiasi rete";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Opgenomen routes";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Mobiel";
"modules.on_demand.networks.footer" = "Deze regels zijn alleen van toepassing op apparaten waar het type interface wordt ondersteund.";
"modules.on_demand.policy" = "Beleid";
"modules.on_demand.policy.footer" = "Activeer de VPN %@.";
"modules.on_demand.policy.footer.any" = "in elk netwerk";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Uwzględnione trasy";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Mobilne";
"modules.on_demand.networks.footer" = "Te zasady będą obowiązywać tylko na urządzeniach, na których obsługiwany jest dany typ interfejsu.";
"modules.on_demand.policy" = "Polityka";
"modules.on_demand.policy.footer" = "Aktywuj VPN %@.";
"modules.on_demand.policy.footer.any" = "w każdej sieci";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Rotas incluídas";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Celular";
"modules.on_demand.networks.footer" = "Essas regras serão aplicadas apenas em dispositivos onde o tipo de interface seja suportado.";
"modules.on_demand.policy" = "Política";
"modules.on_demand.policy.footer" = "Ative o VPN %@.";
"modules.on_demand.policy.footer.any" = "em qualquer rede";
Expand Down
6 changes: 0 additions & 6 deletions Packages/App/Sources/UILibrary/Resources/replacez.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Включенные маршруты";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Мобильные";
"modules.on_demand.networks.footer" = "Эти правила будут применяться только на устройствах, где поддерживается данный тип интерфейса.";
"modules.on_demand.policy" = "Политика";
"modules.on_demand.policy.footer" = "Активировать VPN %@.";
"modules.on_demand.policy.footer.any" = "в любой сети";
Expand Down
6 changes: 0 additions & 6 deletions Packages/App/Sources/UILibrary/Resources/sortz.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Inkluderade rutter";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Mobil";
"modules.on_demand.networks.footer" = "Dessa regler gäller endast på enheter där gränssnittstypen stöds.";
"modules.on_demand.policy" = "Policy";
"modules.on_demand.policy.footer" = "Aktivera VPN %@.";
"modules.on_demand.policy.footer.any" = "i alla nätverk";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"modules.ip.routes.included" = "Включені маршрути";
"modules.on_demand.ethernet" = "Ethernet";
"modules.on_demand.mobile" = "Мобільний";
"modules.on_demand.networks.footer" = "Ці правила застосовуватимуться лише на пристроях, де підтримується тип інтерфейсу.";
"modules.on_demand.policy" = "Політика";
"modules.on_demand.policy.footer" = "Активуйте VPN %@.";
"modules.on_demand.policy.footer.any" = "у будь-якій мережі";
Expand Down
Loading

0 comments on commit 8e5a601

Please sign in to comment.