Skip to content
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

CW-782: Show error report popup without cooldown #1739

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MrCyjaneK
Copy link
Collaborator

Description

improve exception throwing on broken wallets

  • put _lastOpenedWallet to avoid issues on windows (file is currently open by)
  • don't throw corruptedWalletsSeed - instead store it inside of secureStorage
  • await ExceptionHandler.onError calls where possible to makse sure that popup won't be canceled by some UI element
  • adjust BaseAlertDialog to be scrollable if the text is too long
  • add ExceptionHandler.resetLastPopupDate - that can be called when we want to show error report screen (bypassing cooldown)

Pull Request - Checklist

  • Initial Manual Tests Passed
  • Double check modified code and verify it with the feature/task requirements
  • Format code
  • Look for code duplication
  • Clear naming for variables and methods

- put _lastOpenedWallet to avoid issues on windows (file is currently open by)
- don't throw corruptedWalletsSeed - instead store it inside of secureStorage
- await ExceptionHandler.onError calls where possible to makse sure that popup won't be canceled by some UI element
- adjust BaseAlertDialog to be scrollable if the text is too long
- add ExceptionHandler.resetLastPopupDate - that can be called when we want to show error report screen (bypassing cooldown)
@MrCyjaneK MrCyjaneK force-pushed the CW-782-show-error-report-popup-without-cooldown branch from e40177e to 212e59b Compare October 10, 2024 15:54
@MrCyjaneK MrCyjaneK force-pushed the CW-782-show-error-report-popup-without-cooldown branch from 8fa3993 to d7327ce Compare October 14, 2024 10:06
lib/core/backup_service.dart Outdated Show resolved Hide resolved
}
}

// if all user's wallets are corrupted throw exception
throw error.toString() + "\n\n" + corruptedWalletsSeeds;
secureStorageShared.write(key: "corruptedWalletsSeed", value: corruptedWalletsSeeds);
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you write them to secure storage? it will propagate already,
so like this you will add it twice, once from the error string and once more from the secure storage

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Otherwise the error report may contain the seed - which wouldn't be ideal

lib/utils/exception_handler.dart Outdated Show resolved Hide resolved
final shouldCopy = await showPopUp<bool?>(
context: navigatorKey.currentContext!,
builder: (context) {
return AlertWithTwoActions(
isDividerExist: true,
alertTitle: S.of(context).error,
alertContent: content,
alertContent: content+"\n"+(seeds??""),
Copy link
Contributor

Choose a reason for hiding this comment

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

here I believe it would be duplicated, as the content is the error message, which contains the seeds as well

Comment on lines +459 to +462
await ExceptionHandler.resetLastPopupDate();
final err = e.toString() + ((await secureStorageShared.read(key: "corruptedWalletsSeed"))??"unable to retrieve seeds");
await secureStorageShared.delete(key: "corruptedWalletsSeed");
await ExceptionHandler.onError(FlutterErrorDetails(exception: err));
Copy link
Contributor

Choose a reason for hiding this comment

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

same,
same

lib/di.dart Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

haven't reviewed this file yet, but double check it as well please

@MrCyjaneK MrCyjaneK force-pushed the CW-782-show-error-report-popup-without-cooldown branch from 5b72be3 to 159f433 Compare October 17, 2024 10:41
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.

2 participants