remove backend dependency from iOS demo reveal
This commit is contained in:
@@ -329,7 +329,20 @@ struct RoundView: View {
|
||||
return
|
||||
}
|
||||
|
||||
guard let selectedOutcomeID, let session = repository.currentSession else {
|
||||
guard let selectedOutcomeID else {
|
||||
actionMessage = localization.string(for: "errors.session_expired")
|
||||
return
|
||||
}
|
||||
|
||||
if isDemoMode {
|
||||
analytics.track("selection_submitted", attributes: baseSelectionAttributes(selectedOutcomeID))
|
||||
analytics.track("selection_accepted", attributes: baseSelectionAttributes(selectedOutcomeID))
|
||||
analytics.track("market_locked", attributes: baseSelectionAttributes(selectedOutcomeID).merging(["lock_reason": "swipe_selection"]) { _, new in new })
|
||||
beginRevealTransition(for: round, selectedOutcomeID: selectedOutcomeID)
|
||||
return
|
||||
}
|
||||
|
||||
guard let session = repository.currentSession else {
|
||||
actionMessage = localization.string(for: "errors.session_expired")
|
||||
return
|
||||
}
|
||||
@@ -371,7 +384,17 @@ struct RoundView: View {
|
||||
analytics.track("selection_submitted", attributes: baseSelectionAttributes(selectedOutcomeID))
|
||||
analytics.track("selection_accepted", attributes: baseSelectionAttributes(selectedOutcomeID))
|
||||
analytics.track("market_locked", attributes: baseSelectionAttributes(selectedOutcomeID).merging(["lock_reason": "swipe_selection"]) { _, new in new })
|
||||
beginRevealTransition(for: round, selectedOutcomeID: selectedOutcomeID)
|
||||
} catch {
|
||||
actionMessage = hermesUserFacingErrorMessage(localization: localization, localeCode: localization.localeCode, error: error) ?? localization.string(for: "errors.generic")
|
||||
phase = .preview
|
||||
}
|
||||
|
||||
isSubmitting = false
|
||||
}
|
||||
}
|
||||
|
||||
private func beginRevealTransition(for round: HermesRound, selectedOutcomeID: String) {
|
||||
phase = .locked
|
||||
playerCoordinator.play(rate: 2.0)
|
||||
|
||||
@@ -386,13 +409,6 @@ struct RoundView: View {
|
||||
playerCoordinator.play(url: revealMediaURL(for: round), startTimeMs: revealStartTimeMs(for: round), rate: 1.0)
|
||||
analytics.track("reveal_started", attributes: roundAnalyticsAttributes(round).merging(baseSelectionAttributes(selectedOutcomeID)) { _, new in new })
|
||||
}
|
||||
} catch {
|
||||
actionMessage = hermesUserFacingErrorMessage(localization: localization, localeCode: localization.localeCode, error: error) ?? localization.string(for: "errors.generic")
|
||||
phase = .preview
|
||||
}
|
||||
|
||||
isSubmitting = false
|
||||
}
|
||||
}
|
||||
|
||||
private func showResult() {
|
||||
@@ -431,6 +447,10 @@ struct RoundView: View {
|
||||
repository.currentSession?.deviceModel == "Demo Device" ? MockHermesData.revealMediaURL() : round.media.hlsMasterUrl
|
||||
}
|
||||
|
||||
private var isDemoMode: Bool {
|
||||
repository.currentSession?.deviceModel == "Demo Device"
|
||||
}
|
||||
|
||||
private func revealStartTimeMs(for round: HermesRound) -> Int {
|
||||
repository.currentSession?.deviceModel == "Demo Device" ? 0 : round.media.revealStartMs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user