// Cotton Calling's door into the deck: an app that places calls itself says // so here, and a card's handset and camera place the call through it instead // of handing the number to the phone's own dialler. import CottonValues import SwiftUI /// Place a call to a person in this copy: their id, whether it is a video /// call, and where the core's words go when it refuses (no number to call). public typealias PlacesCall = @MainActor (_ person: String, _ video: Bool, _ refused: @escaping @MainActor (String) -> Void) -> Void extension EnvironmentValues { /// Set by Cotton Calling (`CottonCalls.CallingShell`); nil in every other /// app, whose handset opens the phone's dialler (`ContactHandoff`). @Entry public var placesCall: PlacesCall? = nil /// Set by Cotton Calling: a `cottoncalling://call?…` link it takes /// (answers true), so the app's own links never say it opens nothing. @Entry public var opensCallLink: (@MainActor (URL) -> Bool)? = nil } enum DeckPlacesCall { /// The person a card calls: a call's own person (`person_id`, a Recents /// slip), else the card's record (a person's card). static func person(of record: TableRecord) -> String { if case .text(let person)? = record.values["person_id"], !person.isEmpty { return person } return record.id } }