@@ -28,14 +28,14 @@ import 'package:omi/widgets/header_circle_button.dart';
2828import '../fakes.dart' ;
2929import '../harness.dart' ;
3030
31- enum AuditLive { idle, pendant, pendantPaused, phone, phonePaused, phoneAfterPendant }
31+ enum AuditLive { idle, pendant, pendantPaused, pendantStopped, phone, phonePaused, phoneAfterPendant }
3232
3333/// A capture provider reporting one fixed live state, with a short transcript.
3434class AuditCaptureProvider extends ChangeNotifier implements CaptureProvider {
3535 AuditCaptureProvider (this .live);
3636 final AuditLive live;
3737
38- bool get _pendant => live == AuditLive .pendant || live == AuditLive .pendantPaused;
38+ bool get _pendant => live == AuditLive .pendant || live == AuditLive .pendantPaused || live == AuditLive .pendantStopped ;
3939 bool get _phone => ! _pendant && live != AuditLive .idle;
4040
4141 @override
@@ -44,15 +44,23 @@ class AuditCaptureProvider extends ChangeNotifier implements CaptureProvider {
4444 RecordingState get recordingState => switch (live) {
4545 AuditLive .idle => RecordingState .stop,
4646 AuditLive .pendant => RecordingState .deviceRecord,
47- AuditLive .pendantPaused || AuditLive .phonePaused => RecordingState .pause,
47+ AuditLive .pendantPaused || AuditLive .pendantStopped || AuditLive . phonePaused => RecordingState .pause,
4848 _ => RecordingState .record,
4949 };
5050 @override
5151 bool get havingRecordingDevice => _pendant || live == AuditLive .phoneAfterPendant;
5252 @override
5353 BtDevice ? get recordingDevice => havingRecordingDevice ? auditPendant : null ;
5454 @override
55- bool get isPaused => live == AuditLive .pendantPaused || live == AuditLive .phonePaused;
55+ bool get isPaused =>
56+ live == AuditLive .pendantPaused || live == AuditLive .pendantStopped || live == AuditLive .phonePaused;
57+ @override
58+ bool get isCaptureStopped => live == AuditLive .pendantStopped;
59+ @override
60+ bool get canMuteLiveSource => true ;
61+ @override
62+ Duration ? get captureElapsed =>
63+ live == AuditLive .idle || live == AuditLive .pendantStopped ? null : Duration (seconds: _phone ? 134 : 724 );
5664 @override
5765 bool get isPhoneMicPaused => live == AuditLive .phonePaused;
5866 @override
@@ -130,6 +138,10 @@ class AuditCaptureProvider extends ChangeNotifier implements CaptureProvider {
130138 @override
131139 Future <void > resumeCapture () async {}
132140 @override
141+ Future <bool > stopCapture () async => segments.isNotEmpty;
142+ @override
143+ Future <void > startCapture () async {}
144+ @override
133145 dynamic noSuchMethod (Invocation invocation) => super .noSuchMethod (invocation);
134146}
135147
@@ -159,17 +171,21 @@ final auditPendant = BtDevice(id: 'd1', name: 'Omi Device', type: DeviceType.omi
159171/// Home as HomePage lays it out (Rev 3): header (device chip; Search and Settings), content, and the
160172/// dock with the round Ask button.
161173class _HomeFrame extends StatelessWidget {
162- const _HomeFrame ({this .fetchSummaries});
174+ const _HomeFrame ({this .fetchSummaries, this .askable = false });
163175
164176 final DailySummariesFetcher ? fetchSummaries;
165177
178+ /// The dock's Ask opens its field (HomePage passes onAskSubmit) instead of going to Chat.
179+ final bool askable;
180+
166181 @override
167182 Widget build (BuildContext context) {
168183 return Scaffold (
169184 backgroundColor: OmiColors .surface0,
170185 appBar: AppBar (
171186 automaticallyImplyLeading: false ,
172187 backgroundColor: Theme .of (context).colorScheme.surface,
188+ clipBehavior: Clip .none,
173189 titleSpacing: NavigationToolbar .kMiddleSpacing - (kMinTapTarget - kHeaderCircleDiameter) / 2 ,
174190 title: Row (mainAxisAlignment: MainAxisAlignment .spaceBetween, children: [
175191 const Padding (
@@ -193,7 +209,7 @@ class _HomeFrame extends StatelessWidget {
193209 ),
194210 body: Stack (children: [
195211 HomeContentPage (fetchSummaries: fetchSummaries),
196- BottomNavBar (onTabTap: (_, __) {}, onAskTap: () {}),
212+ BottomNavBar (onTabTap: (_, __) {}, onAskTap: () {}, onAskSubmit : askable ? (_) {} : null ),
197213 ]),
198214 );
199215 }
@@ -209,8 +225,10 @@ Future<void> _runHome(
209225 String action = 'Home' ,
210226 bool withData = false ,
211227 bool scroll = false ,
228+ bool askable = false ,
212229}) async {
213- await a.pump (_HomeFrame (fetchSummaries: withData ? _seededRecap : null ), scaffold: false , providers: [
230+ await a
231+ .pump (_HomeFrame (fetchSummaries: withData ? _seededRecap : null , askable: askable), scaffold: false , providers: [
214232 if (withData) ...await _seededHomeData (a),
215233 ChangeNotifierProvider <DeviceProvider >.value (
216234 value: pendantConnected
@@ -233,7 +251,7 @@ Future<void> _runHome(
233251Future <void > _runLivePage (AuditRun a, AuditLive live) async {
234252 await a.pump (const ConversationCapturingPage (), scaffold: false , providers: [
235253 ChangeNotifierProvider <CaptureProvider >.value (value: AuditCaptureProvider (live)),
236- if (live == AuditLive .pendant || live == AuditLive .pendantPaused)
254+ if (live == AuditLive .pendant || live == AuditLive .pendantPaused || live == AuditLive .pendantStopped )
237255 ChangeNotifierProvider <DeviceProvider >.value (
238256 value: AuditDeviceProvider (connected: true , battery: 72 , device: auditPendant)),
239257 ]);
@@ -332,6 +350,20 @@ final captureScenarios = <AuditScenario>[
332350 state: 'An Omi pendant connected at 72% battery; nothing recording' ,
333351 run: (a) => _runHome (a, withData: true , AuditLive .idle, pendantConnected: true ),
334352 ),
353+ AuditScenario (
354+ id: 'home-ask-open' ,
355+ title: 'Ask open over Home' ,
356+ page: _home,
357+ state: 'The Omi mark was tapped: everything but the question blurs and dims, the header included' ,
358+ run: (a) => _runHome (
359+ a,
360+ withData: true ,
361+ AuditLive .pendant,
362+ pendantConnected: true ,
363+ askable: true ,
364+ tap: find.byKey (const Key ('bottom_nav_ask' )),
365+ action: 'Tap the Omi mark' ),
366+ ),
335367 AuditScenario (
336368 id: 'home-first-day' ,
337369 title: 'Home on the first day: Welcome, Not listening, Getting started, Good to know' ,
@@ -383,11 +415,18 @@ final captureScenarios = <AuditScenario>[
383415 ),
384416 AuditScenario (
385417 id: 'home-capture-pendant-paused' ,
386- title: 'Pendant paused ' ,
418+ title: 'Pendant muted ' ,
387419 page: _home,
388- state: 'The user paused the pendant' ,
420+ state: 'The user muted the pendant mid-conversation: Unmute and Stop ' ,
389421 run: (a) => _runHome (a, withData: true , AuditLive .pendantPaused, pendantConnected: true ),
390422 ),
423+ AuditScenario (
424+ id: 'home-capture-pendant-stopped' ,
425+ title: 'Pendant stopped' ,
426+ page: _home,
427+ state: 'The user pressed Stop: not listening, one Start that wakes the pendant' ,
428+ run: (a) => _runHome (a, withData: true , AuditLive .pendantStopped, pendantConnected: true ),
429+ ),
391430 AuditScenario (
392431 id: 'home-capture-pendant-tap' ,
393432 title: 'Switch to this phone while the pendant records' ,
0 commit comments