Skip to content

Comments

Show Snackbar when server is queuing#409

Merged
kamiya4047 merged 4 commits intomainfrom
fix/notify-page
Oct 27, 2025
Merged

Show Snackbar when server is queuing#409
kamiya4047 merged 4 commits intomainfrom
fix/notify-page

Conversation

@lowrt
Copy link
Contributor

@lowrt lowrt commented Sep 19, 2025

這是什麼類型的 PR?

選擇所有符合的項目

  • 重構
  • 新功能
  • 錯誤修復
  • 最佳化
  • 技術文件更新

描述

增加提示字樣
當下伺服器塞車時,避免新安裝使用者以為當機/閃退。

相關 issue

  • 相關問題 #
  • closes #

QA 指南、截圖、錄像

圖片 圖片

UI 無障礙清單

如果您的 PR 包含 UI 更改,請使用此清單:

  • 變數名稱實現語意化命名?
  • 測試通過 AA 顏色對比?

@kamiya4047
Copy link
Member

@claude @codex review

@claude
Copy link

claude bot commented Sep 24, 2025

Claude finished @kamiya4047's task —— View job


Code Review Complete ✅

Todo List:

  • Gather repository context and guidelines
  • Read the modified file to understand changes
  • Review the UI screenshot
  • Analyze code quality and best practices
  • Provide comprehensive review feedback

Review Summary

This PR adds a helpful user-facing hint message while the notification settings are loading from the server. The change is straightforward and addresses a valid UX concern where users might think the app is frozen during server congestion.

Changes Review

The modification in lib/app/settings/notify/page.dart:124-140 replaces a simple loading indicator with a more informative UI:

Before: Only showed a progress bar
After: Shows both a progress bar and explanatory text "伺服器排隊中,請稍候…" (Server queuing, please wait...)

✅ Positive Aspects

  1. Improved User Experience: Clear communication prevents user confusion during server delays
  2. Proper Implementation: Uses existing i18n system for text localization
  3. Consistent Styling: Follows theme-aware color system (context.colors.onSurface)
  4. Clean Structure: Wraps components in a Column with appropriate spacing

🔍 Suggestions for Improvement

1. Consider Extracting Magic Numbers

The font size (16) and spacing (4) are hardcoded. Consider using theme constants:

// Consider using theme values
fontSize: context.textTheme.bodyLarge?.fontSize,
// or define as constants
static const double _loadingTextSize = 16.0;
static const double _loadingSpacing = 4.0;

2. Animation Optimization

The AnimatedOpacity wraps the entire loading widget. Since the content is only shown when loading, consider if animation is necessary for both elements or just the text.

3. Accessibility Considerations

While the text provides visual feedback, consider:

  • Adding semantics labels for screen readers
  • Ensuring sufficient color contrast (current implementation uses theme colors which should be fine)

📋 PR Checklist Review

  • Variable Naming: ✅ The implementation uses semantic naming
  • AA Color Contrast: ⚠️ Using context.colors.onSurface should ensure proper contrast, but manual verification recommended
  • UI Testing: The screenshot shows the feature working as intended

Conclusion

The change successfully addresses the stated goal of preventing user confusion during server congestion. The implementation is clean and follows the project's patterns. Minor improvements suggested above are optional enhancements.

--- |

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

@lowrt lowrt added this to the v3.1.2 milestone Sep 24, 2025
@lowrt
Copy link
Contributor Author

lowrt commented Oct 24, 2025

@claude review

@claude
Copy link

claude bot commented Oct 24, 2025

Claude finished @lowrt's task —— View job


Code Review Complete ✅

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Read the modified file to understand changes
  • View UI screenshots
  • Analyze code quality and best practices
  • Provide comprehensive review feedback

Review Summary

This PR improves the user experience by adding a Snackbar notification during server loading, preventing users from thinking the app has frozen during server congestion. The implementation is well-structured and follows Flutter best practices.

Changes Overview

File: lib/app/settings/notify/page.dart

The PR adds two key improvements:

  1. Snackbar Notification (lines 80-90): Displays "伺服器排隊中,請稍候…" (Server queuing, please wait...) when loading starts
  2. Progress Bar Condition (line 135): Refines the loading indicator visibility to only show when enabled is true

✅ Strengths

  1. Excellent UX Improvement: Addresses a real user pain point by providing clear feedback during server delays
  2. Proper Widget Lifecycle Management:
    • Uses addPostFrameCallback to ensure the Snackbar is shown after the widget is built
    • Checks mounted before accessing context to avoid errors
    • Clears existing snackbars before showing the new one
  3. i18n Integration: Uses .i18n for localization, maintaining consistency with the codebase
  4. Logical Progress Bar Fix: The condition opacity: isLoading && enabled ? 1 : 0 correctly prevents showing the loading indicator when location is not configured

🔍 Observations & Suggestions

1. Snackbar Duration

The Snackbar will auto-dismiss after the default duration (usually 4 seconds), but the loading might take longer during server congestion. Consider:

SnackBar(
  content: Text('伺服器排隊中,請稍候…'.i18n),
  duration: const Duration(seconds: 10), // or Duration.zero for manual dismiss
)

However, this may be intentional to avoid blocking the UI permanently.

2. Success/Error Feedback

The Snackbar shows when loading starts, but there's no corresponding notification when:

  • Loading completes successfully
  • Loading fails (except for 401 errors which are handled)

Consider adding completion feedback:

.then((value) {
  GlobalProviders.notification.apply(value);
  setState(() => isLoading = false);
  if (mounted) {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(content: Text('設定載入完成'.i18n)),
    );
  }
})

3. Minor: Snackbar Dismissal

The loading could complete while the Snackbar is still visible. You might want to clear it when loading completes:

.then((value) {
  GlobalProviders.notification.apply(value);
  setState(() => isLoading = false);
  if (mounted) {
    ScaffoldMessenger.of(context).clearSnackBars();
  }
})

4. Code Consistency

The error handling in .catchError() at line 97 could also benefit from showing user-friendly error messages via Snackbar instead of silent failures (though this is outside the scope of this PR).

📋 PR Checklist Review

  • Variable Naming: The implementation uses existing semantic naming conventions
  • AA Color Contrast: Using Material Design Snackbar with default styling should ensure proper contrast
  • UI Testing: The screenshots clearly show the feature working as intended

Screenshots Analysis

Both screenshots show the Snackbar appearing at the bottom with the message "伺服器排隊中,請稍候…" while the page is loading. The UI looks clean and the message is clearly visible.

Conclusion

Recommendation: Approve with minor suggestions

The changes successfully address the stated goal and are implemented correctly. The suggestions above are optional enhancements that could further improve the UX, but the current implementation is solid and ready to merge.

The code follows Flutter best practices, integrates well with the existing codebase, and provides meaningful value to users during server congestion.


@lowrt lowrt requested a review from kamiya4047 October 24, 2025 12:39
@kamiya4047
Copy link
Member

@claude rename title

@claude
Copy link

claude bot commented Oct 27, 2025

Claude finished @kamiya4047's task —— View job


PR Title Rename Request

Todo List:

  • Understand the current PR title and changes
  • Determine the appropriate new title
  • Attempt to rename the PR title (unable to complete - permissions required)

Unable to Complete

I don't have the necessary permissions to rename the PR title directly. PR title changes require GitHub API permissions that aren't available to me in this context.

Current Situation

Current Title: feat: notify hint

What the PR Actually Does:

  • Uses Snackbar to show a loading message ("伺服器排隊中,請稍候…") when fetching notification settings
  • Prevents users from thinking the app has crashed during server congestion
  • Improves the UX by providing clear feedback during server delays

Suggested Titles

Based on the implementation and commit messages, here are better title options:

  1. fix(notify): show loading message via Snackbar(Recommended)

    • Follows conventional commit format with scope
    • "fix" is more accurate than "feat" since this improves existing functionality
    • Specific about what was changed and where
  2. fix(notify/settings): add server queuing message

    • Describes what was added
    • Mentions the specific context
  3. fix: use Snackbar to show server loading message

    • Matches the latest commit message style
    • Simple and clear
  4. feat(notify): add loading hint with Snackbar

    • If you prefer to keep it as a feature

How to Rename

You'll need to rename it manually. Here are two ways:

Option 1: GitHub Web UI

  1. Go to the PR page
  2. Click "Edit" next to the PR title at the top
  3. Enter your preferred title
  4. Click "Save"

Option 2: GitHub CLI

gh pr edit 409 --title "fix(notify): show loading message via Snackbar"

Recommendation

I recommend using: fix(notify): show loading message via Snackbar

This better reflects the actual changes and follows the conventional commit format used in the repository.


@kamiya4047 kamiya4047 changed the title feat: notify hint Show Snackbar when server is queuing Oct 27, 2025
@kamiya4047 kamiya4047 merged commit 84b5cb2 into main Oct 27, 2025
5 checks passed
@kamiya4047 kamiya4047 deleted the fix/notify-page branch October 27, 2025 02:28
@claude claude bot mentioned this pull request Nov 4, 2025
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants