Files
iOS/Sources/App/TestFlightCommunication/TestFlightCommunicationModels.swift
Bruno Pantaleão Gonçalves 62f1a86adf Add TestFlight communication screen when app opens (#4711)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
<img width="1206" height="2622" alt="Simulator Screenshot - Daily tester
2 - 2026-06-08 at 11 49 31"
src="https://github.com/user-attachments/assets/f4e5e291-2377-46d5-8ac5-bc0c6279bba7"
/>

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2026-06-08 13:22:57 +02:00

46 lines
1.3 KiB
Swift

import Foundation
import Shared
/// Stable identifier for a TestFlight message used to track seen state.
/// Define message IDs as static constants on this type:
///
/// ```swift
/// extension TestFlightMessageId {
/// static let betaFeedbackRequest = TestFlightMessageId("beta-feedback-request-2026-06")
/// }
/// ```
struct TestFlightMessageId: RawRepresentable, Hashable {
let rawValue: String
init(_ rawValue: String) { self.rawValue = rawValue }
init(rawValue: String) { self.rawValue = rawValue }
}
struct TestFlightMessage: Identifiable, Equatable {
struct CallToAction: Equatable {
let title: String
let url: URL
}
let id: TestFlightMessageId
let title: String
let items: [WhatsNewItem]
let targetPlatforms: [WhatsNewTargetPlatform]
let callToAction: CallToAction?
init(
id: TestFlightMessageId,
title: String,
items: [WhatsNewItem],
targetPlatforms: [WhatsNewTargetPlatform] = [.iPhone, .iPad, .mac],
callToAction: CallToAction? = nil
) {
precondition(!items.isEmpty)
precondition(!targetPlatforms.isEmpty)
self.id = id
self.title = title
self.items = items
self.targetPlatforms = targetPlatforms
self.callToAction = callToAction
}
}