use local example clips for iOS demo flow
This commit is contained in:
@@ -173,8 +173,9 @@ final class HermesRepository: ObservableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum MockHermesData {
|
enum MockHermesData {
|
||||||
static let roundCount = 3
|
static let roundCount = 3
|
||||||
|
private static let fallbackMediaURL = URL(string: "https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8")!
|
||||||
|
|
||||||
static func session(localeCode: String, appVersion: String) -> HermesSessionResponse {
|
static func session(localeCode: String, appVersion: String) -> HermesSessionResponse {
|
||||||
HermesSessionResponse(
|
HermesSessionResponse(
|
||||||
@@ -240,7 +241,7 @@ private enum MockHermesData {
|
|||||||
) -> HermesRound {
|
) -> HermesRound {
|
||||||
let lockAt = now.addingTimeInterval(15)
|
let lockAt = now.addingTimeInterval(15)
|
||||||
let settleAt = lockAt.addingTimeInterval(6)
|
let settleAt = lockAt.addingTimeInterval(6)
|
||||||
let mediaURL = URL(string: "https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8")!
|
let mediaURL = localMediaURL(named: "example-round.mov") ?? fallbackMediaURL
|
||||||
|
|
||||||
let event = HermesEvent(
|
let event = HermesEvent(
|
||||||
id: UUID(uuidString: eventID) ?? UUID(),
|
id: UUID(uuidString: eventID) ?? UUID(),
|
||||||
@@ -319,4 +320,20 @@ private enum MockHermesData {
|
|||||||
|
|
||||||
return HermesRound(event: event, media: media, market: market, oddsVersion: oddsVersion, settlement: settlement)
|
return HermesRound(event: event, media: media, market: market, oddsVersion: oddsVersion, settlement: settlement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func revealMediaURL() -> URL {
|
||||||
|
localMediaURL(named: "example-reveal.mov") ?? fallbackMediaURL
|
||||||
|
}
|
||||||
|
|
||||||
|
private static func localMediaURL(named fileName: String) -> URL? {
|
||||||
|
let sourceFileURL = URL(fileURLWithPath: #filePath)
|
||||||
|
let repoRoot = sourceFileURL
|
||||||
|
.deletingLastPathComponent()
|
||||||
|
.deletingLastPathComponent()
|
||||||
|
.deletingLastPathComponent()
|
||||||
|
.deletingLastPathComponent()
|
||||||
|
|
||||||
|
let candidate = repoRoot.appendingPathComponent(fileName)
|
||||||
|
return FileManager.default.fileExists(atPath: candidate.path) ? candidate : nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ struct RoundView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
phase = .reveal
|
phase = .reveal
|
||||||
playerCoordinator.play(url: round.media.hlsMasterUrl, startTimeMs: round.media.revealStartMs, rate: 1.0)
|
playerCoordinator.play(url: revealMediaURL(for: round), startTimeMs: round.media.revealStartMs, rate: 1.0)
|
||||||
analytics.track("reveal_started", attributes: roundAnalyticsAttributes(round).merging(baseSelectionAttributes(selectedOutcomeID)) { _, new in new })
|
analytics.track("reveal_started", attributes: roundAnalyticsAttributes(round).merging(baseSelectionAttributes(selectedOutcomeID)) { _, new in new })
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -426,6 +426,10 @@ struct RoundView: View {
|
|||||||
round.market.outcomes.sorted(by: { $0.sortOrder < $1.sortOrder })
|
round.market.outcomes.sorted(by: { $0.sortOrder < $1.sortOrder })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func revealMediaURL(for round: HermesRound) -> URL {
|
||||||
|
repository.currentSession?.deviceModel == "Demo Device" ? MockHermesData.revealMediaURL() : round.media.hlsMasterUrl
|
||||||
|
}
|
||||||
|
|
||||||
private func promptTitle(for round: HermesRound?) -> String {
|
private func promptTitle(for round: HermesRound?) -> String {
|
||||||
guard let round else {
|
guard let round else {
|
||||||
return localization.string(for: "common.loading")
|
return localization.string(for: "common.loading")
|
||||||
|
|||||||
Reference in New Issue
Block a user