Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PurchaseTesterSwiftUI: added ProxyView to iOS #2531

Merged
merged 1 commit into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import Foundation

#if os(macOS) || targetEnvironment(macCatalyst)

enum ProxyStatus {

enum Mode: String, Decodable, CaseIterable {
Expand Down Expand Up @@ -105,5 +103,3 @@ private struct ProxyChangeModeResponse: Decodable {
let mode: ProxyStatus.Mode

}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import Foundation
import SwiftUI

#if os(macOS) || targetEnvironment(macCatalyst)

struct ProxyView: View {

@StateObject
Expand Down Expand Up @@ -53,9 +51,8 @@ struct ProxyView: View {
} label: {
Text(mode.description)
}
.buttonStyle(.borderedProminent)
.disabled(self.changingMode)
}

}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import Foundation

#if os(macOS) || targetEnvironment(macCatalyst)

@MainActor
final class ProxyViewModel: NSObject, ObservableObject {

Expand All @@ -30,5 +28,3 @@ final class ProxyViewModel: NSObject, ObservableObject {
}

}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,21 @@ struct PurchaseTesterApp: App {
ContentView(configuration: configuration)
.environmentObject(self.revenueCatCustomerData)
.toolbar {
ToolbarItem(placement: .principal) {
ToolbarItemGroup(placement: Self.toolbarPlacement) {
Button {
self.configuration = nil
} label: {
Text("Reconfigure")
}

#if os(iOS)
NavigationLink {
ProxyView(proxyURL: self.configuration?.proxyURL)
.navigationTitle("Proxy Status")
} label: {
Text("Proxy")
}
#endif
}
}
}
Expand All @@ -126,4 +135,12 @@ struct PurchaseTesterApp: App {
return self.configuration != nil
}

private static var toolbarPlacement: ToolbarItemPlacement {
#if os(iOS)
return .navigation
#else
return .principal
#endif
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ struct HomeView: View {
Text(policy.label).tag(policy)
}
}
#if os(iOS)
.pickerStyle(WheelPickerStyle())
.frame(height: 80)
#endif
Comment on lines +81 to +84
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly opening this PR because this wasn't working on iOS.


Spacer()

Button {
Task<Void, Never> {
do {
Expand Down