-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
136cea3
commit 273e577
Showing
9 changed files
with
215 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import SwiftUI | ||
|
||
struct HelpCommands: Commands { | ||
var body: some Commands { | ||
CommandGroup(replacing: .help) { | ||
HelpCommandsLinks() | ||
} | ||
} | ||
} | ||
|
||
private struct HelpCommandsLinks: View { | ||
@Environment(\.config) | ||
private var config | ||
|
||
var body: some View { | ||
Link(destination: config.app.info.website) { | ||
Text("App.Help.Website") | ||
} | ||
Link(destination: config.app.info.termsOfService) { | ||
Text("App.Help.TermsOfService") | ||
} | ||
Link(destination: config.app.info.privacyPolicy) { | ||
Text("App.Help.PrivacyPolicy") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import SwiftUI | ||
|
||
enum ServerEnvironment: String, CaseIterable, Identifiable { | ||
case main | ||
case dev | ||
case local | ||
|
||
var id: String { rawValue } | ||
|
||
var description: String { | ||
switch self { | ||
case .main: | ||
.init(localized: "Environment.Main") | ||
case .dev: | ||
.init(localized: "Environment.Dev") | ||
case .local: | ||
.init(localized: "Environment.Local") | ||
} | ||
} | ||
|
||
static var `default`: ServerEnvironment { | ||
#if DEBUG | ||
.local | ||
#else | ||
switch Config.default.version.environment { | ||
case "dev": | ||
.dev | ||
default: | ||
.main | ||
} | ||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import SwiftUI | ||
|
||
struct EnvironmentPicker: View { | ||
let namespace: Namespace.ID | ||
|
||
@Environment(\.config) | ||
private var config | ||
|
||
@AppStorage("connection.environment") | ||
private var selection = ServerEnvironment.default | ||
|
||
var body: some View { | ||
Picker("Environment.Title", selection: $selection) { | ||
ForEach(ServerEnvironment.allCases.filter { config.app.api.url(for: $0) != nil }) { environment in | ||
let suffix = environment == .default | ||
? " " + .init(localized: "Environment.Default") | ||
: "" | ||
|
||
Text(verbatim: environment.description + suffix) | ||
.tag(environment) | ||
} | ||
} | ||
.help("Environment.Help") | ||
.matchedGeometryEffect(id: "environment-picker", in: namespace) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters