Skip to content

Commit 524143f

Browse files
committed
Small fixes
1 parent 9800b3b commit 524143f

File tree

5 files changed

+32
-11
lines changed

5 files changed

+32
-11
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Foundation
2+
3+
enum FeatureFlags {
4+
/// Global toggle for exposing location spoofing UI/logic.
5+
static let isLocationSpoofingEnabled = false
6+
}

StikJIT/Utilities/TabConfiguration.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ import Foundation
33
enum TabConfiguration {
44
static let storageKey = "enabledTabIdentifiers"
55
static let maxSelectableTabs = 4
6-
static let allowedIDs: [String] = ["home", "console", "scripts", "profiles", "processes", "deviceinfo", "location"]
6+
private static let baseAllowedIDs: [String] = ["home", "console", "scripts", "profiles", "processes", "deviceinfo"]
7+
static var allowedIDs: [String] {
8+
var ids = baseAllowedIDs
9+
if FeatureFlags.isLocationSpoofingEnabled {
10+
ids.append("location")
11+
}
12+
return ids
13+
}
714
static let defaultIDs: [String] = ["home", "console", "scripts", "profiles"]
815
static let defaultRawValue = serialize(defaultIDs)
916

StikJIT/Views/MainTabView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct MainTabView: View {
6161

6262
private var availableTabs: [TabDescriptor] {
6363
configurableTabs.filter { descriptor in
64-
descriptor.id != "location" || !isAppStoreBuild
64+
descriptor.id != "location" || (FeatureFlags.isLocationSpoofingEnabled && !isAppStoreBuild)
6565
}
6666
}
6767

StikJIT/Views/ProfileView.swift

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,25 @@ struct ProfileView: View {
359359
}
360360

361361
func loadProfiles() async {
362-
working = true
362+
await MainActor.run { working = true }
363363
do {
364-
let profileDatas = try JITEnableContext.shared.fetchAllProfiles()
365-
self.profiles = profileDatas.map { Profile(data: $0) }
364+
let profileDatas = try await Task.detached(priority: .userInitiated) {
365+
try JITEnableContext.shared.fetchAllProfiles()
366+
}.value
367+
let parsedProfiles = profileDatas.map { Profile(data: $0) }
368+
await MainActor.run {
369+
self.profiles = parsedProfiles
370+
self.working = false
371+
}
366372
} catch {
367-
alertMsg = error.localizedDescription
368-
alertTitle = "Failed to Fetch Profiles"
369-
alertSuccess = false
370-
alert = true
373+
await MainActor.run {
374+
alertMsg = error.localizedDescription
375+
alertTitle = "Failed to Fetch Profiles"
376+
alertSuccess = false
377+
alert = true
378+
working = false
379+
}
371380
}
372-
working = false
373381
}
374382

375383
func saveProfile(profile: Profile) {

StikJIT/Views/SettingsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct SettingsView: View {
9494
TabOption(id: "processes", title: "Processes", detail: "Inspect running apps", icon: "rectangle.stack.person.crop", isBeta: true),
9595
TabOption(id: "deviceinfo", title: "Device Info", detail: "View detailed device metadata", icon: "iphone.and.arrow.forward", isBeta: false)
9696
]
97-
if !isAppStoreBuild {
97+
if FeatureFlags.isLocationSpoofingEnabled && !isAppStoreBuild {
9898
options.append(TabOption(id: "location", title: "Location Sim", detail: "Sideload only", icon: "location", isBeta: true))
9999
}
100100
return options

0 commit comments

Comments
 (0)