Skip to content

Commit

Permalink
Simplify local syncs (#1587)
Browse files Browse the repository at this point in the history
  • Loading branch information
beastoin authored Dec 26, 2024
2 parents e9af260 + 6ce6e7c commit 785e7bb
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 61 deletions.
78 changes: 39 additions & 39 deletions app/lib/pages/conversation_detail/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -510,45 +510,45 @@ class EditSegmentWidget extends StatelessWidget {
],
),
),
!provider.hasAudioRecording ? const SizedBox(height: 12) : const SizedBox(),
!provider.hasAudioRecording
? GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (c) => getDialog(
context,
() => Navigator.pop(context),
() {
Navigator.pop(context);
routeToPage(context, const RecordingsStoragePermission());
},
'Can\'t be used for speech training',
'This segment can\'t be used for speech training as there is no audio recording available. Check if you have the required permissions for future memories.',
okButtonText: 'View',
),
);
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text('Can\'t be used for speech training',
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(decoration: TextDecoration.underline)),
const Padding(
padding: EdgeInsets.only(right: 12),
child: Icon(Icons.info, color: Colors.grey, size: 20),
),
],
),
),
)
: const SizedBox(),
// !provider.hasAudioRecording ? const SizedBox(height: 12) : const SizedBox(),
// !provider.hasAudioRecording
// ? GestureDetector(
// onTap: () {
// showDialog(
// context: context,
// builder: (c) => getDialog(
// context,
// () => Navigator.pop(context),
// () {
// Navigator.pop(context);
// routeToPage(context, const RecordingsStoragePermission());
// },
// 'Can\'t be used for speech training',
// 'This segment can\'t be used for speech training as there is no audio recording available. Check if you have the required permissions for future memories.',
// okButtonText: 'View',
// ),
// );
// },
// child: Padding(
// padding: const EdgeInsets.symmetric(horizontal: 16.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text('Can\'t be used for speech training',
// style: Theme.of(context)
// .textTheme
// .bodyMedium!
// .copyWith(decoration: TextDecoration.underline)),
// const Padding(
// padding: EdgeInsets.only(right: 12),
// child: Icon(Icons.info, color: Colors.grey, size: 20),
// ),
// ],
// ),
// ),
// )
// : const SizedBox(),
const SizedBox(height: 12),
CheckboxListTile(
title: const Text('Yours'),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/pages/conversations/conversations_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class _ConversationsPageState extends State<ConversationsPage> with AutomaticKee
const SliverToBoxAdapter(child: SizedBox(height: 26)),
const SliverToBoxAdapter(child: SpeechProfileCardWidget()),
const SliverToBoxAdapter(child: UpdateFirmwareCardWidget()),
const SliverToBoxAdapter(child: LocalSyncWidget()),
const SliverToBoxAdapter(child: ConversationCaptureWidget()),
const SliverToBoxAdapter(child: LocalSyncWidget()),
getProcessingConversationsWidget(convoProvider.processingConversations),
if (convoProvider.groupedConversations.isEmpty && !convoProvider.isLoadingConversations)
const SliverToBoxAdapter(
Expand Down
30 changes: 16 additions & 14 deletions app/lib/pages/conversations/widgets/local_sync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class _LocalSyncWidgetState extends State<LocalSyncWidget> {
margin: const EdgeInsets.fromLTRB(16, 16, 16, 16),
padding: const EdgeInsets.all(16),
child: Text(
'${convertToHHMMSS(_missSeconds)} of conversation locally',
style: const TextStyle(color: Colors.white, fontSize: 16),
'${secondsToHumanReadable(_missSeconds.toString())} On-Device Conversations',
style: Theme.of(context).textTheme.bodyMedium!.copyWith(fontSize: 16),
textAlign: TextAlign.center,
),
);
Expand All @@ -104,22 +104,24 @@ class _LocalSyncWidgetState extends State<LocalSyncWidget> {
color: Colors.grey.shade900,
borderRadius: const BorderRadius.all(Radius.circular(12)),
),
margin: const EdgeInsets.fromLTRB(16, 16, 16, 16),
padding: const EdgeInsets.all(16),
margin: const EdgeInsets.fromLTRB(16, 16, 16, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Row(
children: [
const Icon(Icons.download_rounded),
const SizedBox(width: 16),
Text(
'${secondsToHumanReadable(_missSeconds.toString())} available. Sync now?',
style: const TextStyle(color: Colors.white, fontSize: 16),
),
],
),
const Row(
children: [
Text(
'Stay in Sync',
style: TextStyle(color: Colors.white, fontSize: 16),
textAlign: TextAlign.center,
),
],
),
Text(
'${secondsToHumanReadable(_missSeconds.toString())} available',
style: Theme.of(context).textTheme.bodyMedium!.copyWith(decoration: TextDecoration.underline),
),
],
),
Expand Down
14 changes: 7 additions & 7 deletions app/lib/pages/conversations/widgets/processing_capture.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ class ConversationCaptureWidget extends StatefulWidget {
}

class _ConversationCaptureWidgetState extends State<ConversationCaptureWidget> {
bool _isReady = false;
bool _isReady = true;
Timer? _readyStateTimer;

@override
void initState() {
super.initState();

// Warn: Should ensure every deps has started before set ready
_readyStateTimer = Timer(const Duration(seconds: 3), () {
setState(() {
_isReady = true;
});
});
//// Warn: Should ensure every deps has started before set ready
//_readyStateTimer = Timer(const Duration(seconds: 3), () {
// setState(() {
// _isReady = true;
// });
//});
}

@override
Expand Down

0 comments on commit 785e7bb

Please sign in to comment.