-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes the local sync timer #1011
Conversation
WalkthroughThis change introduces a UI layout adjustment using Changes
Uplevel your code reviews with Entelligence.AI ProEntelligence.AI ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, Entelligence.AI Pro is free for open source projects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files selected (2)
- app/lib/pages/memories/page.dart (1)
- app/lib/pages/memories/widgets/local_sync.dart (1)
Files skipped from review due to trivial changes (1)
- app/lib/pages/memories/page.dart
Review comments generated (1)
- Review: 1
- LGTM: 0
Tips
Chat with Entelligence.AI Bot (@Entelligence.AI
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@Entelligence.AI
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@Entelligence.AI: ignore
anywhere in the PR description to pause further reviews from the bot.
var previousStatus = _status; | ||
if (provider.missingWalsInSeconds > 120) { | ||
_status = LocalSyncStatus.flush; | ||
_missSeconds = max(_missSeconds, provider.missingWalsInSeconds); // est. good for ux | ||
} else if (!captureProvider.isWalSupported) { | ||
_status = LocalSyncStatus.disabled; | ||
_missSecondsInEstTimer?.cancel(); | ||
} else if ((!captureProvider.transcriptServiceReady && captureProvider.recordingDeviceServiceReady) || | ||
provider.missingWalsInSeconds > 0) { | ||
var previousStatus = _status; | ||
} else if (provider.missingWalsInSeconds > 0) { | ||
_status = LocalSyncStatus.inProgress; | ||
} else { | ||
_status = LocalSyncStatus.disabled; | ||
} | ||
|
||
// Change state to in progress | ||
if (previousStatus != LocalSyncStatus.inProgress) { | ||
_missSecondsInEstTimer?.cancel(); | ||
// miss seconds | ||
if (_status == LocalSyncStatus.inProgress || _status == LocalSyncStatus.flush) { | ||
if (previousStatus != _status) { | ||
_missSeconds = provider.missingWalsInSeconds; | ||
_missSecondsInEstTimer = Timer.periodic(const Duration(seconds: 1), (t) { | ||
setState(() { | ||
_missSeconds++; | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
// timer | ||
if ((_status == LocalSyncStatus.inProgress || _status == LocalSyncStatus.flush) && | ||
(!captureProvider.transcriptServiceReady && captureProvider.recordingDeviceServiceReady)) { | ||
_missSecondsInEstTimer ??= Timer.periodic(const Duration(seconds: 1), (t) { | ||
setState(() { | ||
_missSeconds++; | ||
}); | ||
}); | ||
} else { | ||
_missSecondsInEstTimer?.cancel(); | ||
_missSecondsInEstTimer = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refactoring of the timer and status logic seems to have introduced a potential issue. In the new code, _missSeconds
is only updated when the status changes from another status to LocalSyncStatus.inProgress
or LocalSyncStatus.flush
. However, in the old code, _missSeconds
was updated every time the build method was called and the status was LocalSyncStatus.inProgress
or LocalSyncStatus.flush
, regardless of whether the status had just changed.
This could lead to _missSeconds
not being updated correctly if the build method is called multiple times without the status changing, which could happen due to various reasons such as other state changes in the widget triggering a rebuild.
Here's a suggested fix:
if (_status == LocalSyncStatus.inProgress || _status == LocalSyncStatus.flush) {
if (previousStatus != _status) {
_missSeconds = provider.missingWalsInSeconds;
}
}
Replace with:
+ 53: if (_status == LocalSyncStatus.inProgress || _status == LocalSyncStatus.flush) {
+ 54: _missSeconds = provider.missingWalsInSeconds;
+ 55: }
This will ensure that _missSeconds
is always updated correctly when the status is LocalSyncStatus.inProgress
or LocalSyncStatus.flush
, even if the status hasn't just changed.
Summary by Entelligence.AI
SliverToBoxAdapter
with aSizedBox
widget to create additional space in the UI layout for a cleaner look and feel.