Repository navigation
Description
Summary
Add a ControlWidget to the existing BatteryWidget extension so users can toggle mute/unmute directly from Control Center— no need to open the app.
The infrastructure is already in place. This request only requires one new Swift file and a one-line registration change.
Motivation
To check or toggle mute today, users must unlock → open Omi → tap mute. A Control Center toggle would reduce this to a single swipe + tap, which is far less disruptive during meetings or conversations.
Control Center widgets (introduced in iOS 18) are now standard on iOS 26 and available to all current Omi users.
Existing Infrastructure (already shipped)
Component | Status | Location -- | -- | -- App Group UserDefaults | ✅ | group.com.friend-app-with-wearable.ios12 widget_is_muted key | ✅ | SharedDefaults.swift → BatteryWidgetKeys.isMuted updateMuteState() Flutter → native | ✅ | AppDelegate.swift L147-152 WidgetCenter.reloadAllTimelines() on mute change | ✅ | AppDelegate.swift L151 Widget Extension target (BatteryWidget) | ✅ | app/ios/BatteryWidget/ DeviceBatteryInfo.fromSharedDefaults() | ✅ | SharedDefaults.swiftProposed Implementation
1. New file: app/ios/BatteryWidget/OmiControlWidget.swift
import WidgetKit import SwiftUI import AppIntents@available(iOS 18.0, *)
struct ToggleOmiMuteIntent: SetValueIntent {
static var title: LocalizedStringResource = "Toggle Omi Mute"
static var description: IntentDescription = "Mute or unmute your Omi device"@Parameter(title: "Muted") var value: Bool func perform() async throws -> some IntentResult { let defaults = UserDefaults(suiteName: appGroupIdentifier) defaults?.set(value, forKey: BatteryWidgetKeys.isMuted) let name = value ? "com.omi.widget.mute" : "com.omi.widget.unmute" CFNotificationCenterPostNotification( CFNotificationCenterGetDarwinNotifyCenter(), CFNotificationName(name as CFString), nil, nil, true ) return .result() }}
@available(iOS 18.0, *)
struct OmiMuteValueProvider: ControlValueProvider {
var previewValue: Bool { false }func currentValue() async throws -> Bool { DeviceBatteryInfo.fromSharedDefaults().isMuted }}
@available(iOS 18.0, *)
struct OmiMuteControlWidget: ControlWidget {
var body: some ControlWidgetConfiguration {
AppIntentControlConfiguration(
kind: "com.omi.control.mute",
provider: OmiMuteValueProvider()
) { isMuted in
ControlWidgetToggle(
"Omi Mic",
isOn: isMuted,
action: ToggleOmiMuteIntent()
) { isOn in
Label(
isOn ? "Muted" : "Live",
systemImage: isOn ? "mic.slash.fill" : "mic.fill"
)
}
}
.displayName("Omi Mic")
.description("Mute or unmute your Omi device microphone.")
}
}
2. One-line change: app/ios/BatteryWidget/BatteryWidgetBundle.swift
@main
struct BatteryWidgetBundle: WidgetBundle {
var body: some Widget {
OmiBatteryWidget()
if #available(iOS 18.0, *) {
OmiMuteControlWidget()
}
}
}
3. (Optional) Darwin notification listener in AppDelegate.swift
To handle toggle requests when the app is backgrounded, add a CFNotificationCenterAddObserver for "com.omi.widget.mute" / "com.omi.widget.unmute" that forwards to Flutter via a MethodChannel. Happy to detail this if helpful.
User Experience
- Open Control Center
- Long press → "Add a Control" → find Omi Mic
- Toggle mute/unmute with one tap — without leaving the current app
Scope
- 1 new file + 1 line change in the existing Widget Extension
- No changes to Flutter/Dart layer or firmware
- Gracefully unavailable on iOS < 18 via
@available - Zero impact on existing
OmiBatteryWidgetlock screen functionality
Activity