Small fixes

This commit is contained in:
Stephen B 2025-12-03 14:12:50 -05:00
parent 9800b3be5d
commit 524143ffa0
5 changed files with 32 additions and 11 deletions

View file

@ -0,0 +1,6 @@
import Foundation
enum FeatureFlags {
/// Global toggle for exposing location spoofing UI/logic.
static let isLocationSpoofingEnabled = false
}

View file

@ -3,7 +3,14 @@ import Foundation
enum TabConfiguration {
static let storageKey = "enabledTabIdentifiers"
static let maxSelectableTabs = 4
static let allowedIDs: [String] = ["home", "console", "scripts", "profiles", "processes", "deviceinfo", "location"]
private static let baseAllowedIDs: [String] = ["home", "console", "scripts", "profiles", "processes", "deviceinfo"]
static var allowedIDs: [String] {
var ids = baseAllowedIDs
if FeatureFlags.isLocationSpoofingEnabled {
ids.append("location")
}
return ids
}
static let defaultIDs: [String] = ["home", "console", "scripts", "profiles"]
static let defaultRawValue = serialize(defaultIDs)

View file

@ -61,7 +61,7 @@ struct MainTabView: View {
private var availableTabs: [TabDescriptor] {
configurableTabs.filter { descriptor in
descriptor.id != "location" || !isAppStoreBuild
descriptor.id != "location" || (FeatureFlags.isLocationSpoofingEnabled && !isAppStoreBuild)
}
}

View file

@ -359,17 +359,25 @@ struct ProfileView: View {
}
func loadProfiles() async {
working = true
await MainActor.run { working = true }
do {
let profileDatas = try JITEnableContext.shared.fetchAllProfiles()
self.profiles = profileDatas.map { Profile(data: $0) }
let profileDatas = try await Task.detached(priority: .userInitiated) {
try JITEnableContext.shared.fetchAllProfiles()
}.value
let parsedProfiles = profileDatas.map { Profile(data: $0) }
await MainActor.run {
self.profiles = parsedProfiles
self.working = false
}
} catch {
alertMsg = error.localizedDescription
alertTitle = "Failed to Fetch Profiles"
alertSuccess = false
alert = true
await MainActor.run {
alertMsg = error.localizedDescription
alertTitle = "Failed to Fetch Profiles"
alertSuccess = false
alert = true
working = false
}
}
working = false
}
func saveProfile(profile: Profile) {

View file

@ -94,7 +94,7 @@ struct SettingsView: View {
TabOption(id: "processes", title: "Processes", detail: "Inspect running apps", icon: "rectangle.stack.person.crop", isBeta: true),
TabOption(id: "deviceinfo", title: "Device Info", detail: "View detailed device metadata", icon: "iphone.and.arrow.forward", isBeta: false)
]
if !isAppStoreBuild {
if FeatureFlags.isLocationSpoofingEnabled && !isAppStoreBuild {
options.append(TabOption(id: "location", title: "Location Sim", detail: "Sideload only", icon: "location", isBeta: true))
}
return options