跳转至

UI thru Apple Watch

Yes, you can make the Apple Watch the primary input device. In fact, for an oral history app, the Apple Watch is arguably better than the iPhone because it removes the friction of pulling a device out of your pocket. It enables "Stream of Consciousness" recording while walking, driving, or cooking.

However, Flutter does not support Apple Watch.

To achieve this, you must adopt a Hybrid Architecture: 1. iPhone App: Built in Flutter (The "Brain" & "Reader"). 2. Watch App: Built in SwiftUI (The "Microphone" & "Prompter"). 3. Bridge: They talk via Watch Connectivity.

Here is how to structure the project to make the Watch do the "Heavy Leg Work."


1. The Architecture: "The Tethered Satellite"

We will treat the Watch as a high-fidelity input satellite. To save Watch battery and simplify authentication, we won't upload to Firebase directly from the Watch. We will record on the Watch and "fling" the file to the iPhone, which handles the heavy lifting (Upload + AI Processing).

The Workflow

  1. Notification: Watch vibrates. "Question: Who was your best friend in 4th grade?"
  2. Action: You tap the notification (or a complication).
  3. Record: You speak into your wrist for 5 minutes.
  4. Transfer: When you hit "Stop," the Watch immediately transfers the .m4a file to the paired iPhone in your pocket via Bluetooth/WiFi.
  5. Processing: The iPhone (in the background) catches the file, uploads it to Firebase, and triggers Gemini.

2. Implementation Strategy

You need to add a "Watch Target" to your Xcode project.

Step A: Create the Watch App (SwiftUI)

In Xcode: File > New > Target > watchOS > App. * Note: You must write this part in Swift, not Dart.

The Watch UI (SwiftUI): It needs three screens: 1. The "Big Red Button": A massive record button. 2. The "Prompt" Card: Displays the current AI question. 3. The "Status" Ring: Shows "Daily Goal: 10 mins" or "Childhood Era: 45% Complete."

Step B: The Audio Recorder (Watch)

WatchOS has a specific audio engine. You need to record high-quality audio that Gemini can understand.

// Swift (Watch App)
import AVFoundation

func startRecording() {
    let audioSession = AVAudioSession.sharedInstance()
    try? audioSession.setCategory(.playAndRecord, mode: .default)
    try? audioSession.setActive(true)

    // Use M4A (AAC) for Gemini compatibility
    let settings = [
        AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
        AVSampleRateKey: 44100,
        AVNumberOfChannelsKey: 1,
        AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
    ]

    // Save to temporary Watch directory
    recorder = try? AVAudioRecorder(url: tempURL, settings: settings)
    recorder?.record()
}

Step C: The Bridge (Watch Connectivity)

This is the magic link. You need to send the file from Watch -> Flutter.

1. On the Watch (Swift):

import WatchConnectivity

func transferFileToPhone(url: URL) {
    if WCSession.default.isReachable {
        // This sends the file in the background
        WCSession.default.transferFile(url, metadata: ["type": "memory_audio"])
    }
}

2. On the iPhone (Flutter Side): You need a plugin to listen to the Watch. Use flutter_watch_os_connectivity or write a simple MethodChannel.

Swift Code in ios/Runner/AppDelegate.swift:

// When a file arrives from the Watch...
func session(_ session: WCSession, didReceive file: WCSessionFile) {
    // 1. Move file to permanent storage
    let newLocation = moveFileToDocuments(file.fileURL)

    // 2. Alert Flutter via MethodChannel
    let channel = FlutterMethodChannel(name: "com.yourapp.watch", binaryMessenger: controller.binaryMessenger)
    channel.invokeMethod("fileReceived", arguments: newLocation.path)
}

Dart Code in Flutter:

// Listen for the Watch file
MethodChannel('com.yourapp.watch').setMethodCallHandler((call) async {
  if (call.method == 'fileReceived') {
    String path = call.arguments;
    // Trigger the exact same Upload Logic you built for the iPhone recorder
    await uploadService.uploadAudio(path);
  }
});


3. Can the Watch do the "Active Interviewing"? (Yes)

This is the killer feature. Instead of reading questions on a phone screen, the Watch interacts with you.

A. The "Prompt" Notification

When your Cloud Function generates a "Critical Question" (Phase 3 of your plan), send a Push Notification specifically formatted for the Watch. * Payload: {"category": "INTERVIEW_QUESTION", "text": "Tell me about the first time you felt like an adult."} * Watch Action: Tapping the notification opens the Watch App directly to the Recorder screen with that text displayed at the top.

B. The "Audio" Prompt (Siri-like)

You can make the Watch speak the question using the built-in Synthesizer so you don't even have to look at the screen.

// Swift (Watch App)
import AVFoundation

let synthesizer = AVSpeechSynthesizer()
let utterance = AVSpeechUtterance(string: "Tell me about your first car.")
synthesizer.speak(utterance)

4. What the Watch CANNOT do (Limitations)

While the Watch can handle the Input (Recording) and Prompting (Questions), it cannot handle the Output (Reading the book).

  1. Visualizing the "Timeline": The Watch screen is too small to show the complex "Gap Analysis" tree or the "Fog of War" timeline. Keep a simple "Progress Ring" on the Watch (e.g., "Childhood: 30% Covered") but leave the complex graphs for the iPhone.
  2. Editing Text: You cannot edit the transcripts or the final book chapters on the Watch.
  3. Heavy AI Processing: The Watch should never talk to Gemini directly. It kills the battery. Always relay through the iPhone or Cloud.

5. Revised "Watch-First" User Journey

  1. Morning: You put on your Watch. It shows a complication: "Autobiography: 3 Questions Pending."
  2. Walking the Dog: You tap the complication.
    • Watch: "Good morning. We are still missing details about your college years. specifically, who was your roommate?"
  3. The Dictation: You walk and talk for 15 minutes. The Watch records in the background (screen off).
  4. Completion: You tap "Stop." The Watch says "Saved."
  5. Sync: By the time you get home, the file has transferred to your iPhone, uploaded to Cloud, transcribed by Gemini, and added to your Timeline.
  6. Evening: You open the iPad/iPhone app to see the new entry slotted into your "College" era and read the summary.

Summary

  • Feasibility: High.
  • Tech Stack: Flutter (iOS) + SwiftUI (WatchOS).
  • Primary Benefit: Removes friction. Dramatically increases the amount of content you will actually record.
  • Primary Cost: You must learn a little bit of SwiftUI (Apple's native language) for the Watch interface, as Flutter cannot render there.