Skip to content

feat(phase17): account & identity management - #68

Merged
grunch merged 3 commits into
mainfrom
007-mostro-p2p-client
Mar 31, 2026
Merged

feat(phase17): account & identity management#68
grunch merged 3 commits into
mainfrom
007-mostro-p2p-client

Conversation

@grunch

@grunch grunch commented Mar 31, 2026

Copy link
Copy Markdown
Member
  • lib/features/account/providers/privacy_mode_provider.dart: PrivacyModeNotifier StateNotifierProvider wrapping set_privacy_mode() with TODO(bridge) for Phase 18+ FFI
  • account_screen.dart: wire privacy mode options (remove Opacity/Coming-soon stub); tapping Reputation/Full-Privacy Mode updates provider; Generate New User dialog updated with correct warning and post-confirm flow (showBackupReminder → walkthrough navigation)
  • take_order_screen.dart: watch privacyModeProvider; hide creator reputation card (rating, trade count, days active) when privacy mode is active

Summary by CodeRabbit

Release Notes

  • New Features

    • Added privacy mode toggle to account settings.
    • Added "Generate New User" functionality to create new identities.
    • Added copy-to-clipboard confirmation feedback.
  • Improvements

    • Privacy mode now hides creator reputation details on trades.
    • Enhanced error handling for missing theme configuration.
  • Documentation

    • Updated task completion status.

grunch added 2 commits March 31, 2026 09:24
…enerate new user, reputation gating

- lib/features/account/providers/privacy_mode_provider.dart: PrivacyModeNotifier StateNotifierProvider wrapping set_privacy_mode() with TODO(bridge) for Phase 18+ FFI
- account_screen.dart: wire privacy mode options (remove Opacity/Coming-soon stub); tapping Reputation/Full-Privacy Mode updates provider; Generate New User dialog updated with correct warning and post-confirm flow (showBackupReminder → walkthrough navigation)
- take_order_screen.dart: watch privacyModeProvider; hide creator reputation card (rating, trade count, days active) when privacy mode is active
… feedback, web persistence warning, eventual-consistency doc
@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@grunch has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 6 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 0 minutes and 6 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f7909468-d940-405d-92af-fc2aeaa53cd4

📥 Commits

Reviewing files that changed from the base of the PR and between 8d8eec6 and 79104b4.

📒 Files selected for processing (2)
  • lib/features/account/screens/account_screen.dart
  • rust/src/api/settings.rs

Walkthrough

The PR introduces a privacy mode state provider and integrates it across the account and order screens with interactive UI controls. It systematically replaces debug-only assertions for missing AppColors theme extensions with runtime exceptions, and adds user feedback for clipboard actions. Documentation and Rust comments are updated accordingly.

Changes

Cohort / File(s) Summary
Privacy Mode Feature
lib/features/account/providers/privacy_mode_provider.dart, lib/features/account/screens/account_screen.dart, lib/features/order/screens/take_order_screen.dart
Introduced a new privacyModeProvider StateNotifierProvider and wired it into account screen UI (replaced static disabled options with interactive toggles calling setPrivacyMode). Updated account screen dialog to trigger backup reminder and navigate to walkthrough on "Generate New User". Order screen conditionally hides creator reputation details when privacy mode is enabled.
Theme Extension Null-Handling Refactor
lib/features/about/screens/about_screen.dart, lib/features/chat/screens/chat_room_screen.dart, lib/features/chat/screens/chat_rooms_screen.dart, lib/features/chat/widgets/chat_list_item.dart, lib/features/chat/widgets/encrypted_file_message.dart, lib/features/chat/widgets/encrypted_image_message.dart, lib/features/chat/widgets/info_panels.dart, lib/features/chat/widgets/message_bubble.dart, lib/features/chat/widgets/message_input.dart, lib/features/disputes/screens/dispute_chat_screen.dart, lib/features/disputes/widgets/dispute_list_item.dart, lib/features/disputes/widgets/dispute_message_input.dart, lib/features/disputes/widgets/dispute_messages_list.dart, lib/features/disputes/widgets/disputes_list.dart, lib/features/rate/screens/rate_counterpart_screen.dart, lib/features/settings/screens/log_report_screen.dart, lib/features/settings/screens/notification_settings_screen.dart, lib/features/settings/widgets/currency_selector_dialog.dart, lib/features/settings/widgets/language_selector.dart, lib/features/settings/widgets/relay_management_card.dart, lib/features/trades/screens/trades_screen.dart, lib/features/trades/widgets/trades_list_item.dart
Systematically replaced debug-only assert(colors != null) plus early-return fallbacks with unconditional runtime StateError throws when AppColors theme extension is missing, eliminating silent empty widget rendering and making theme misconfiguration failures observable in all builds.
User Feedback & Logging
lib/features/about/screens/about_screen.dart, lib/features/notifications/providers/notifications_provider.dart
Added snack bar confirmation "Link copied to clipboard" when docs link is copied. Added debugPrint warning on web platform about in-memory notification database and suggestion to add sembast_web for persistence.
Localization & Documentation
lib/l10n/app_localizations.dart, rust/src/api/settings.rs, specs/004-mostro-p2p-client/tasks.md
Reformatted localization constructor and delegates lists with trailing commas. Added inline comment in set_logging_enabled clarifying async vs. sync behavior. Marked tasks T116 and T117 as completed in spec tracker, reflecting privacy mode toggle and reputation suppression implementations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hopping through privacy with Riverpod's gleam,
A PrivacyModeNotifier fulfills Flutter's dream!
Theme extensions crash—no more silent fails,
While snackbars celebrate clipboard tales! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(phase17): account & identity management' accurately reflects the main changes: privacy mode provider implementation, account screen wiring, and user generation flow updates centered on account and identity management features.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 007-mostro-p2p-client

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
lib/features/account/screens/account_screen.dart (1)

294-302: Consider awaiting showBackupReminder() before navigation.

showBackupReminder() is async and persists to SharedPreferences. Navigating immediately via context.go() could race with the persistence operation, potentially causing the backup reminder to not appear if the user force-closes the app mid-navigation.

♻️ Suggested fix: await the reminder activation
           FilledButton(
-            onPressed: () {
+            onPressed: () async {
               Navigator.pop(context);
               // TODO(bridge): call create_identity() via FFI (Phase 18+).
-              ref
+              await ref
                   .read(backupReminderProvider.notifier)
                   .showBackupReminder();
-              context.go(AppRoute.walkthrough);
+              if (context.mounted) {
+                context.go(AppRoute.walkthrough);
+              }
             },
             child: const Text('Continue'),
           ),

Note: The existing walkthrough completion flow (walkthrough_screen.dart:161-167) also doesn't await showBackupReminder(), so this matches current patterns. However, generating a new identity is a more critical operation where ensuring persistence completes is valuable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/features/account/screens/account_screen.dart` around lines 294 - 302, The
onPressed handler for the FilledButton calls the async method
showBackupReminder() via
ref.read(backupReminderProvider.notifier).showBackupReminder() but does not
await it before navigating (Navigator.pop and context.go(AppRoute.walkthrough)),
risking a race with persistence; make the onPressed callback async, await the
call to showBackupReminder() (optionally with try/catch to surface failures) and
only then perform Navigator.pop(context) and context.go(AppRoute.walkthrough) so
persistence completes before navigation.
lib/features/chat/widgets/info_panels.dart (1)

36-37: Consider centralizing this null-guard pattern to reduce repetition.

The same Theme.of(context).extension<AppColors>() + StateError block is repeated in both widgets. A small BuildContext helper would keep this consistent and easier to maintain.

♻️ Suggested refactor
+extension AppColorsX on BuildContext {
+  AppColors get appColors =>
+      Theme.of(this).extension<AppColors>() ??
+      (throw StateError('AppColors theme extension must be registered'));
+}
-    final colors = Theme.of(context).extension<AppColors>();
-    if (colors == null) throw StateError('AppColors theme extension must be registered');
+    final colors = context.appColors;

Also applies to: 137-138

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/features/chat/widgets/info_panels.dart` around lines 36 - 37, Centralize
the repeated null-guard by adding a BuildContext extension (e.g., a getter like
requireAppColors or appColorsOrThrow) that calls
Theme.of(this).extension<AppColors>() and throws the StateError if null; then
replace the inline pattern in InfoPanel widgets (references:
Theme.of(context).extension<AppColors>() and the existing StateError usage in
info_panels.dart) with the new context extension to keep the check consistent
and DRY across both occurrences.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rust/src/api/settings.rs`:
- Around line 170-171: The sync-fallback in set_logging_enabled currently uses
try_write() and silently drops updates on contention; replace the
non-deterministic try_write() usage with a blocking write() (or an explicit loop
that waits for the RwLock write guard) so the flag update is always applied and
the broadcast behavior matches the documented “flag is always set” behavior;
apply the same change to the analogous sync-fallback update block(s) in this
file that currently use try_write() so no updates are silently discarded.

---

Nitpick comments:
In `@lib/features/account/screens/account_screen.dart`:
- Around line 294-302: The onPressed handler for the FilledButton calls the
async method showBackupReminder() via
ref.read(backupReminderProvider.notifier).showBackupReminder() but does not
await it before navigating (Navigator.pop and context.go(AppRoute.walkthrough)),
risking a race with persistence; make the onPressed callback async, await the
call to showBackupReminder() (optionally with try/catch to surface failures) and
only then perform Navigator.pop(context) and context.go(AppRoute.walkthrough) so
persistence completes before navigation.

In `@lib/features/chat/widgets/info_panels.dart`:
- Around line 36-37: Centralize the repeated null-guard by adding a BuildContext
extension (e.g., a getter like requireAppColors or appColorsOrThrow) that calls
Theme.of(this).extension<AppColors>() and throws the StateError if null; then
replace the inline pattern in InfoPanel widgets (references:
Theme.of(context).extension<AppColors>() and the existing StateError usage in
info_panels.dart) with the new context extension to keep the check consistent
and DRY across both occurrences.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fbc00db8-b6b9-4f6d-8daa-8a2011801462

📥 Commits

Reviewing files that changed from the base of the PR and between 2629a5e and 8d8eec6.

📒 Files selected for processing (29)
  • lib/features/about/screens/about_screen.dart
  • lib/features/account/providers/privacy_mode_provider.dart
  • lib/features/account/screens/account_screen.dart
  • lib/features/chat/screens/chat_room_screen.dart
  • lib/features/chat/screens/chat_rooms_screen.dart
  • lib/features/chat/widgets/chat_list_item.dart
  • lib/features/chat/widgets/encrypted_file_message.dart
  • lib/features/chat/widgets/encrypted_image_message.dart
  • lib/features/chat/widgets/info_panels.dart
  • lib/features/chat/widgets/message_bubble.dart
  • lib/features/chat/widgets/message_input.dart
  • lib/features/disputes/screens/dispute_chat_screen.dart
  • lib/features/disputes/widgets/dispute_list_item.dart
  • lib/features/disputes/widgets/dispute_message_input.dart
  • lib/features/disputes/widgets/dispute_messages_list.dart
  • lib/features/disputes/widgets/disputes_list.dart
  • lib/features/notifications/providers/notifications_provider.dart
  • lib/features/order/screens/take_order_screen.dart
  • lib/features/rate/screens/rate_counterpart_screen.dart
  • lib/features/settings/screens/log_report_screen.dart
  • lib/features/settings/screens/notification_settings_screen.dart
  • lib/features/settings/widgets/currency_selector_dialog.dart
  • lib/features/settings/widgets/language_selector.dart
  • lib/features/settings/widgets/relay_management_card.dart
  • lib/features/trades/screens/trades_screen.dart
  • lib/features/trades/widgets/trades_list_item.dart
  • lib/l10n/app_localizations.dart
  • rust/src/api/settings.rs
  • specs/004-mostro-p2p-client/tasks.md

Comment thread rust/src/api/settings.rs Outdated
…flag, await backup reminder before navigation
@grunch
grunch merged commit e5b8af4 into main Mar 31, 2026
1 check passed
@grunch
grunch deleted the 007-mostro-p2p-client branch March 31, 2026 12:52
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.

1 participant