mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-06 01:06:28 +08:00
fix(onboarding): also ask OS for X-Plane, not just 'other'
X-Plane runs on Windows/Mac/Linux same as any non-MSFS sim, so it should trigger the OS follow-up too.
This commit is contained in:
@@ -13,9 +13,11 @@ describe('sanitizeOnboardingUpdate', () => {
|
||||
assert.equal('simulator' in result, false)
|
||||
})
|
||||
|
||||
it('only keeps os when simulator is other', () => {
|
||||
it('keeps os for non-Windows-only simulators (other, xplane12)', () => {
|
||||
const withOther = sanitizeOnboardingUpdate({ simulator: 'other', os: 'linux' })
|
||||
assert.equal(withOther.os, 'linux')
|
||||
const withXplane = sanitizeOnboardingUpdate({ simulator: 'xplane12', os: 'mac' })
|
||||
assert.equal(withXplane.os, 'mac')
|
||||
const withMsfs = sanitizeOnboardingUpdate({ simulator: 'msfs2024', os: 'linux' })
|
||||
assert.equal('os' in withMsfs, false)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
SIMULATOR_OPTIONS, OS_OPTIONS, HARDWARE_OPTIONS, RADIO_PAIN_POINT_OPTIONS,
|
||||
NETWORK_OPTIONS, TOOLKIT_OPTIONS, PAID_TOOLKIT_VALUES, TOOLKIT_DURATION_OPTIONS,
|
||||
FEATURE_WISH_OPTIONS, PRICING_PREFERENCE_OPTIONS, MAX_FEATURE_WISHES,
|
||||
FEATURE_WISH_OPTIONS, PRICING_PREFERENCE_OPTIONS, MAX_FEATURE_WISHES, SIMULATORS_REQUIRING_OS,
|
||||
} from '~~/shared/onboarding/config'
|
||||
import type {
|
||||
FeatureWish, HardwareItem, NetworkExperience, OperatingSystem, PricingPreference,
|
||||
@@ -54,7 +54,7 @@ export interface SanitizedOnboardingUpdate {
|
||||
skipped?: boolean
|
||||
}
|
||||
|
||||
/** WHY: os is only meaningful when simulator === 'other' — MSFS/X-Plane imply Windows/cross-platform already. */
|
||||
/** WHY: os is only meaningful for non-Windows-only sims (X-Plane, Other) — MSFS implies Windows already. */
|
||||
export function sanitizeOnboardingUpdate(body: OnboardingUpdateInput): SanitizedOnboardingUpdate {
|
||||
const result: SanitizedOnboardingUpdate = {}
|
||||
|
||||
@@ -62,7 +62,12 @@ export function sanitizeOnboardingUpdate(body: OnboardingUpdateInput): Sanitized
|
||||
result.simulator = body.simulator as Simulator
|
||||
}
|
||||
|
||||
if (result.simulator === 'other' && typeof body.os === 'string' && OS_VALUES.has(body.os as OperatingSystem)) {
|
||||
if (
|
||||
result.simulator &&
|
||||
(SIMULATORS_REQUIRING_OS as Simulator[]).includes(result.simulator) &&
|
||||
typeof body.os === 'string' &&
|
||||
OS_VALUES.has(body.os as OperatingSystem)
|
||||
) {
|
||||
result.os = body.os as OperatingSystem
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user