mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #1358 from meshtastic/testflight_bool
Add isTestFlight bundle extension, set environments for datadog
This commit is contained in:
commit
5baf0ad4ac
3 changed files with 26 additions and 8 deletions
|
|
@ -19,4 +19,8 @@ extension Bundle {
|
|||
// public var appVersionShort: String { getInfo("CFBundleShortVersion") }
|
||||
|
||||
fileprivate func getInfo(_ str: String) -> String { infoDictionary?[str] as? String ?? "⚠️" }
|
||||
|
||||
public var isTestFlight: Bool {
|
||||
return appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,13 @@ struct MeshtasticAppleApp: App {
|
|||
#if !targetEnvironment(macCatalyst)
|
||||
|
||||
#if DEBUG
|
||||
environment = "TestFlight"
|
||||
environment = "Local"
|
||||
#else
|
||||
if Bundle.main.isTestFlight {
|
||||
environment = "TestFlight"
|
||||
}
|
||||
#endif
|
||||
|
||||
Datadog.initialize(
|
||||
with: Datadog.Configuration(
|
||||
clientToken: clientToken,
|
||||
|
|
@ -99,10 +104,10 @@ struct MeshtasticAppleApp: App {
|
|||
|
||||
// Initialize map data manager
|
||||
MapDataManager.shared.initialize()
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
// Show tips in development
|
||||
try? Tips.resetDatastore()
|
||||
#endif
|
||||
#endif
|
||||
if !UserDefaults.firstLaunch {
|
||||
// If this is first launch, we will show onboarding screens which
|
||||
// Step through the authorization process. Do not start discovery
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ struct AppSettings: View {
|
|||
@State private var isPresentingCoreDataResetConfirm = false
|
||||
@State private var isPresentingDeleteMapTilesConfirm = false
|
||||
@State private var purgeStaleNodes: Bool = false
|
||||
@State private var showAutoConnect: Bool = false
|
||||
@AppStorage("purgeStaleNodeDays") private var purgeStaleNodeDays: Double = 0
|
||||
@AppStorage("environmentEnableWeatherKit") private var environmentEnableWeatherKit: Bool = true
|
||||
@AppStorage("enableAdministration") private var enableAdministration: Bool = false
|
||||
|
|
@ -47,12 +48,13 @@ struct AppSettings: View {
|
|||
Text("Provide anonymous usage statistics and crash reports.")
|
||||
.foregroundStyle(.secondary)
|
||||
.font(.caption)
|
||||
#if DEBUG
|
||||
Toggle(isOn: autoconnectBinding) {
|
||||
Label("Automatically Connect", systemImage: "app.connected.to.app.below.fill")
|
||||
|
||||
if showAutoConnect {
|
||||
Toggle(isOn: autoconnectBinding) {
|
||||
Label("Automatically Connect", systemImage: "app.connected.to.app.below.fill")
|
||||
}
|
||||
.tint(.accentColor)
|
||||
}
|
||||
.tint(.accentColor)
|
||||
#endif
|
||||
}
|
||||
Section(header: Text("environment")) {
|
||||
VStack(alignment: .leading) {
|
||||
|
|
@ -73,6 +75,13 @@ struct AppSettings: View {
|
|||
.onFirstAppear {
|
||||
purgeStaleNodes = purgeStaleNodeDays > 0
|
||||
Logger.services.info("ℹ️ Purge Stale Nodes toggle initialized to \(purgeStaleNodes)")
|
||||
#if DEBUG
|
||||
showAutoConnect = true
|
||||
#else
|
||||
if Bundle.main.isTestFlight {
|
||||
showAutoConnect = true
|
||||
}
|
||||
#endif
|
||||
}
|
||||
.onChange(of: purgeStaleNodes) { _, newValue in
|
||||
purgeStaleNodeDays = purgeStaleNodeDays > 0 ? purgeStaleNodeDays : 7
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue