mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-12 08:13:26 +01:00
Add Advanced Settings in-app
This commit is contained in:
71
AltStore/Views/Settings/AdvancedSettingsView.swift
Normal file
71
AltStore/Views/Settings/AdvancedSettingsView.swift
Normal file
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// AdvancedSettingsView.swift
|
||||
// SideStore
|
||||
//
|
||||
// Created by naturecodevoid on 2/19/23.
|
||||
// Copyright © 2023 SideStore. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
private struct Server: Identifiable {
|
||||
var id: String { value }
|
||||
var display: String
|
||||
var value: String
|
||||
}
|
||||
|
||||
struct AdvancedSettingsView: View {
|
||||
@ObservedObject private var iO = Inject.observer
|
||||
|
||||
private let anisetteServers = [
|
||||
Server(display: "SideStore", value: "http://ani.sidestore.io"),
|
||||
Server(display: "Macley (US)", value: "http://us1.sternserv.tech"),
|
||||
Server(display: "Macley (DE)", value: "http://de1.sternserv.tech"),
|
||||
Server(display: "DrPudding", value: "https://sign.rheaa.xyz"),
|
||||
Server(display: "jkcoxson (AltServer)", value: "http://jkcoxson.com:2095"),
|
||||
Server(display: "jkcoxson (Provision)", value: "http://jkcoxson.com:2052"),
|
||||
Server(display: "Sideloadly", value: "https://sideloadly.io/anisette/irGb3Quww8zrhgqnzmrx"),
|
||||
Server(display: "Nick", value: "http://45.33.29.114"),
|
||||
Server(display: "Jawshoeadan", value: "https://anisette.jawshoeadan.me"),
|
||||
Server(display: "crystall1nedev", value: "https://anisette.crystall1ne.software/"),
|
||||
]
|
||||
|
||||
@AppStorage("textServer")
|
||||
var usePreferred: Bool = true
|
||||
|
||||
@AppStorage("textInputAnisetteURL")
|
||||
var anisetteURL: String = ""
|
||||
|
||||
@AppStorage("customAnisetteURL")
|
||||
var selectedAnisetteServer: String = ""
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
Section {
|
||||
Picker(L10n.AdvancedSettingsView.anisette, selection: $selectedAnisetteServer) {
|
||||
ForEach(anisetteServers) { server in
|
||||
Text(server.display)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
Toggle(L10n.AdvancedSettingsView.DangerZone.usePreferred, isOn: $usePreferred)
|
||||
|
||||
TextField(L10n.AdvancedSettingsView.DangerZone.anisetteURL, text: $anisetteURL)
|
||||
} header: {
|
||||
Text(L10n.AdvancedSettingsView.dangerZone)
|
||||
} footer: {
|
||||
Text(L10n.AdvancedSettingsView.dangerZoneInfo)
|
||||
}
|
||||
}
|
||||
.navigationTitle(L10n.AdvancedSettingsView.title)
|
||||
.enableInjection()
|
||||
}
|
||||
}
|
||||
|
||||
struct AdvancedSettingsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
AdvancedSettingsView()
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,7 @@ class AppIconsData: ObservableObject {
|
||||
|
||||
struct AppIconsView: View {
|
||||
@ObservedObject private var iO = Inject.observer
|
||||
|
||||
@ObservedObject private var data = AppIconsData.shared
|
||||
|
||||
private let artists = [
|
||||
|
||||
@@ -14,6 +14,7 @@ import AltStoreCore
|
||||
import Intents
|
||||
|
||||
struct SettingsView: View {
|
||||
@ObservedObject private var iO = Inject.observer
|
||||
|
||||
var connectedAppleID: Team? {
|
||||
DatabaseManager.shared.activeTeam()
|
||||
@@ -174,8 +175,10 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
SwiftUI.Button(L10n.SettingsView.switchToUIKit, action: self.switchToUIKit)
|
||||
|
||||
SwiftUI.Button("Advanced Settings", action: self.showAdvancedSettings)
|
||||
|
||||
NavigationLink(L10n.AdvancedSettingsView.title) {
|
||||
AdvancedSettingsView()
|
||||
}.foregroundColor(.accentColor)
|
||||
|
||||
SwiftUI.Button(L10n.SettingsView.resetImageCache, action: self.resetImageCache)
|
||||
.foregroundColor(.red)
|
||||
@@ -194,8 +197,7 @@ struct SettingsView: View {
|
||||
if isDevModeEnabled {
|
||||
NavigationLink(L10n.DevModeView.title, isActive: self.$isShowingDevModeMenu) {
|
||||
DevModeMenu()
|
||||
}
|
||||
.foregroundColor(.red)
|
||||
}.foregroundColor(.red)
|
||||
} else {
|
||||
SwiftUI.Button(L10n.DevModeView.title) {
|
||||
self.isShowingDevModePrompt = true
|
||||
@@ -234,6 +236,7 @@ struct SettingsView: View {
|
||||
.sheet(item: $externalURLToShow) { url in
|
||||
SafariView(url: url)
|
||||
}
|
||||
.enableInjection()
|
||||
}
|
||||
|
||||
|
||||
@@ -316,16 +319,6 @@ struct SettingsView: View {
|
||||
exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
func showAdvancedSettings() {
|
||||
// Create the URL that deep links to our app's custom settings.
|
||||
guard let url = URL(string: UIApplication.openSettingsURLString) else {
|
||||
return
|
||||
}
|
||||
|
||||
// Ask the system to open that URL.
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
|
||||
struct SettingsView_Previews: PreviewProvider {
|
||||
|
||||
Reference in New Issue
Block a user