diff --git a/Sources/Scenarios/BaseScenariosManager.swift b/Sources/Scenarios/BaseScenariosManager.swift index 67f6da8..50f0fd1 100644 --- a/Sources/Scenarios/BaseScenariosManager.swift +++ b/Sources/Scenarios/BaseScenariosManager.swift @@ -132,7 +132,11 @@ open class BaseScenariosManager { } @objc public func reset() { - activeScenarioId = nil + select(nil) + } + + public func select(_ scenarioId: ScenarioId?) { + activeScenarioId = scenarioId } // MARK: Private helpers @@ -163,7 +167,7 @@ open class BaseScenariosManager { BaseScenarioSelectorAppController( targetAudience: targetAudience ) { [weak self] id in - self?.activeScenarioId = id + self?.select(id) } } @@ -171,7 +175,7 @@ open class BaseScenariosManager { let previousScenarioId = activeScenarioId DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - self.activeScenarioId = previousScenarioId + self.select(previousScenarioId) } } diff --git a/Sources/Scenarios/ScenariosManager.swift b/Sources/Scenarios/ScenariosManager.swift index 50e6231..31dabff 100644 --- a/Sources/Scenarios/ScenariosManager.swift +++ b/Sources/Scenarios/ScenariosManager.swift @@ -64,7 +64,7 @@ open class ScenariosManager: BaseScenariosManager { innerAppController = ScenarioSelectorSplitAppController( targetAudience: targetAudience ) { [weak self] id in - self?.activeScenarioId = id + self?.select(id) } } else { innerAppController = ScenarioSelectorAppController( @@ -72,7 +72,7 @@ open class ScenariosManager: BaseScenariosManager { favouriteScenarios: $favouriteScenarios.eraseToAnyPublisher(), layout: scenarioListLayout ) { [weak self] id in - self?.activeScenarioId = id + self?.select(id) } } } else { @@ -81,7 +81,7 @@ open class ScenariosManager: BaseScenariosManager { favouriteScenarios: $favouriteScenarios.eraseToAnyPublisher(), layout: scenarioListLayout ) { [weak self] id in - self?.activeScenarioId = id + self?.select(id) } }