Full rename ahead of App Store submission: project, targets, bundle identifiers (dev.bchen.Severed -> dev.bchen.OpenAppLock), entitlements file, app entry point, user-facing onboarding strings, test helpers, and docs. Verified: all 62 unit tests pass. Co-Authored-By: Claude <noreply@anthropic.com>
46 lines
1.7 KiB
Swift
46 lines
1.7 KiB
Swift
//
|
|
// LaunchConfiguration.swift
|
|
// OpenAppLock
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// Launch-argument configuration used by UI tests: in-memory storage, mocked
|
|
/// Screen Time authorization, forced onboarding state, and seeded scenarios.
|
|
struct LaunchConfiguration: Equatable {
|
|
enum SeedScenario: String {
|
|
/// One actively blocking rule ("Work Time") and one upcoming rule ("Sleep").
|
|
case standard
|
|
/// An actively blocking Hard Mode rule ("Locked In") plus an upcoming rule.
|
|
case hardModeActive = "hard-mode-active"
|
|
}
|
|
|
|
var isUITesting = false
|
|
/// Forces the onboarding-completed flag at launch. Nil leaves stored state alone.
|
|
var onboardingCompleted: Bool?
|
|
var seedScenario: SeedScenario?
|
|
|
|
static let uiTestingFlag = "-ui-testing"
|
|
static let onboardingCompletedFlag = "-onboarding-completed"
|
|
static let onboardingRequiredFlag = "-onboarding-required"
|
|
static let seedScenarioPrefix = "-seed-scenario="
|
|
|
|
static func parse(arguments: [String]) -> LaunchConfiguration {
|
|
var config = LaunchConfiguration()
|
|
config.isUITesting = arguments.contains(uiTestingFlag)
|
|
if arguments.contains(onboardingCompletedFlag) {
|
|
config.onboardingCompleted = true
|
|
} else if arguments.contains(onboardingRequiredFlag) {
|
|
config.onboardingCompleted = false
|
|
}
|
|
if let seedArgument = arguments.first(where: { $0.hasPrefix(seedScenarioPrefix) }) {
|
|
config.seedScenario = SeedScenario(
|
|
rawValue: String(seedArgument.dropFirst(seedScenarioPrefix.count))
|
|
)
|
|
}
|
|
return config
|
|
}
|
|
|
|
static let current = parse(arguments: ProcessInfo.processInfo.arguments)
|
|
}
|