Skip to content

Fix/losing email after reopening - #228

Merged
JuliusCaesarCrypto merged 3 commits into
devfrom
fix/losing-email-after-reopening
Jul 16, 2026
Merged

Fix/losing email after reopening#228
JuliusCaesarCrypto merged 3 commits into
devfrom
fix/losing-email-after-reopening

Conversation

@JuliusCaesarCrypto

Copy link
Copy Markdown
Contributor

Change Description

Briefly describe what this PR does and why. Keep it short and clear.


Related Platforms

Which platforms are affected by your changes? Check only the ones you actually tested.

  • Android
  • iOS
  • iPad
  • Windows
  • Linux
  • Android TV
  • OpenWrt

Verification Checklist

Make sure the things you checked actually work. It's okay if you didn't test everything.

  • Project builds successfully
  • App runs without crashes on tested platforms
  • VPN connection works correctly
  • No obvious regressions observed
  • Documentation updated (if needed)

Optional (for bigger changes)

  • Added or updated unit / E2E tests
  • Checked security and edge cases

Related Links

Closes #ID.

@JuliusCaesarCrypto JuliusCaesarCrypto self-assigned this Jul 10, 2026
Copilot AI review requested due to automatic review settings July 10, 2026 10:33
@JuliusCaesarCrypto JuliusCaesarCrypto added the bug Something isn't working label Jul 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 aims to prevent the premium user email from being lost after app restart/reopen by persisting the email alongside the premium token in secure storage and restoring it when the auth provider rebuilds.

Changes:

  • Persist premium_email to secure storage on login and delete it on logout.
  • Restore the persisted email in AuthNotifier.build() when initializing auth state.
  • Add the premiumEmailKey storage constant and pass the stored email into the premium trouble dialog (currently with a compile-time issue).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lib/modules/settings/providers/auth_provider.dart Reads/writes/deletes the premium email in secure storage and restores it on provider build.
lib/modules/settings/presentation/widgets/settings_premium_widget.dart Uses the auth provider email when opening the premium trouble dialog (currently references a non-existent field).
lib/core/data/local/secure_storage/secure_storage_const.dart Adds the premiumEmailKey constant used for secure storage persistence.

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

Comment thread lib/modules/settings/presentation/widgets/settings_premium_widget.dart Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 10:59
@JuliusCaesarCrypto
JuliusCaesarCrypto force-pushed the fix/losing-email-after-reopening branch from a677d8b to 51c8593 Compare July 10, 2026 10:59

Copilot AI left a comment

Copy link
Copy Markdown

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 2 out of 2 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 13, 2026 09:10

Copilot AI left a comment

Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines 21 to 25
final token = await storage.read(premiumTokenKey);
final email = await storage.read(premiumEmailKey) ?? '';

return AuthData(email: '', isLoggedIn: token?.isNotEmpty ?? false);
return AuthData(email: email, isLoggedIn: token?.isNotEmpty ?? false);
}
Copilot AI review requested due to automatic review settings July 16, 2026 14:11
@JuliusCaesarCrypto
JuliusCaesarCrypto merged commit 3d17475 into dev Jul 16, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines 21 to 25
final token = await storage.read(premiumTokenKey);
final email = await storage.read(premiumEmailKey) ?? '';

return AuthData(email: '', isLoggedIn: token?.isNotEmpty ?? false);
return AuthData(email: email, isLoggedIn: token?.isNotEmpty ?? false);
}
Comment on lines 27 to 34
Future<void> login(String email, String token) async {
final storage = ref.read(secureStorageProvider);

await storage.write(premiumTokenKey, token);
await storage.write(premiumEmailKey, email);

state = AsyncData(AuthData(email: email, isLoggedIn: true));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants