Skip to content

feat(sticker): add stickerId to StickerItem and related components#1885

Merged
crossle merged 4 commits intomainfrom
fix/sticker-url-expiration
Feb 6, 2026
Merged

feat(sticker): add stickerId to StickerItem and related components#1885
crossle merged 4 commits intomainfrom
fix/sticker-url-expiration

Conversation

@YeungKC
Copy link
Copy Markdown
Collaborator

@YeungKC YeungKC commented Jan 4, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds stickerId parameter to the StickerItem widget and related components to enable automatic refresh of sticker data when loading fails. It also refactors the UpdateStickerJob to include retry logic with exponential backoff.

Changes:

  • Added stickerId parameter to StickerItem and updated all call sites to pass this parameter
  • Implemented error recovery in StickerItem that triggers a refresh job when sticker loading fails
  • Refactored UpdateStickerJob to process jobs sequentially with retry logic and exponential backoff
  • Updated database queries to filter jobs with null blazeMessage and order by createdAt
  • Enhanced sticker_message.dart to immediately yield cached data while watching for updates
  • Added sticker data watching in quote_message.dart for up-to-date quoted stickers
  • Updated Xcode project configuration for Flutter compatibility

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
macos/Runner.xcodeproj/project.pbxproj Updated Xcode objectVersion and shell scripts for Flutter compatibility
lib/workers/job/update_sticker_job.dart Refactored to process jobs sequentially with retry logic and exponential backoff
lib/widgets/sticker_page/sticker_item.dart Added stickerId parameter and error handling to trigger refresh jobs
lib/widgets/sticker_page/sticker_store.dart Updated StickerItem usages to pass stickerId
lib/widgets/sticker_page/sticker_page.dart Updated StickerItem usage to pass stickerId
lib/widgets/sticker_page/sticker_album_page.dart Updated StickerItem usage to pass stickerId
lib/widgets/message/send_message_dialog/send_message_dialog.dart Updated StickerItem usage to pass stickerId
lib/widgets/message/item/sticker_message.dart Refactored stream to yield cached data immediately while watching for updates
lib/widgets/message/item/quote_message.dart Added sticker data watching and updated StickerItem to pass stickerId
lib/db/dao/job_dao.dart Updated query to filter null blazeMessage and order by createdAt

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


final now = DateTime.now();
final first = jobs.first;
final wait = first.createdAt.difference(now);
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The time difference calculation is incorrect. The code calculates first.createdAt.difference(now), which subtracts now from first.createdAt. This will produce a negative duration if first.createdAt is in the past (which is the typical case for a job that was created earlier). The check if (wait.inMilliseconds > 0) will be false for past timestamps, but the logic should be checking if the job is scheduled for the future. Consider using now.difference(first.createdAt) instead, or restructure the logic to check if first.createdAt.isAfter(now).

Copilot uses AI. Check for mistakes.
}

for (final job in jobs) {
final dueIn = job.createdAt.difference(DateTime.now());
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The time difference calculation has the same issue as line 47. This calculates job.createdAt.difference(DateTime.now()), which will be negative for jobs created in the past. The condition if (dueIn.inMilliseconds > 0) will never be true for past timestamps, making this check ineffective. The logic should be restructured to check if job.createdAt.isAfter(DateTime.now()) or use DateTime.now().difference(job.createdAt) with appropriate logic reversal.

Copilot uses AI. Check for mistakes.
@YeungKC YeungKC marked this pull request as ready for review February 5, 2026 05:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@crossle crossle merged commit 3606a36 into main Feb 6, 2026
9 checks passed
@crossle crossle deleted the fix/sticker-url-expiration branch February 6, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants