Files
notes/Notes/Services/InstallIdentity.swift
T
rzen 86d74806c9 Add voice notes: on-device transcription, multi-language, watch capture
- Schema v2: Note.AudioInfo, .m4a sidecar next to the note JSON in iCloud
- AudioRecorderService (iOS/macOS) + SpeechAnalyzer transcription pipeline
  with enabled-language set and confidence-based auto-pick, re-transcribe menu
- Settings > Transcription > Languages with asset download/reserve handling
- watchOS app + accessory complication: one-button recorder, WCSession
  transferFile to phone, WatchInbox staging, direct-upsert ingestion
- Player UI, transcription status chips, quick-capture mic in notes list
- Version 0.2, changelog + README updated
2026-07-15 13:30:43 -04:00

25 lines
1.0 KiB
Swift

import Foundation
/// Stable per-install identifier — a UUID minted once on first access and kept
/// in UserDefaults for the life of the install. Distinct from the iCloud
/// account: two devices signed into the same account get different install IDs.
///
/// It answers "which device owns a pending transcription?" A voice note stamps
/// the recording device's `installID` into `AudioInfo.transcriberDeviceID`; only
/// the device whose `installID` matches transcribes it, while the others render
/// status only. Re-transcribing on any device reassigns the id to itself, which
/// is also the recovery path when the original recording device is gone.
enum InstallIdentity {
private static let key = "Notes.installID"
/// The per-install UUID, created lazily on first read and reused forever.
static var installID: String {
if let existing = UserDefaults.standard.string(forKey: key) {
return existing
}
let fresh = UUID().uuidString
UserDefaults.standard.set(fresh, forKey: key)
return fresh
}
}