Skip to content

Commit

Permalink
chore: Show new version dialog on shell context
Browse files Browse the repository at this point in the history
This will show the dialog on the wallet / trade screen instead of the onboarding screen. Giving the user more time to react on the message.
  • Loading branch information
holzeis committed Mar 15, 2024
1 parent 589616d commit fe8c3e6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mobile/lib/util/compare_coordinator_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ Future<void> compareCoordinatorVersion(bridge.Config config) async {

if (coordinatorVersion.version > clientVersion) {
logger.w("Client out of date. Current version: ${clientVersion.toString()}");
while (shellNavigatorKey.currentContext == null) {
await Future.delayed(const Duration(milliseconds: 100)); // Adjust delay as needed
}
showDialog(
context: rootNavigatorKey.currentContext!,
context: shellNavigatorKey.currentContext!,
builder: (context) => AlertDialog(
title: const Text("Update available"),
content: Text("A new version of 10101 is available: "
Expand All @@ -41,16 +44,19 @@ Future<void> compareCoordinatorVersion(bridge.Config config) async {
),
]));
} else if (coordinatorVersion.version < clientVersion) {
logger.w("10101 is newer than LSP: ${coordinatorVersion.version.toString()}");
logger.w("10101 is newer than coordinator: ${coordinatorVersion.version.toString()}");
} else {
logger.i("Client is up to date: ${clientVersion.toString()}");
}
} catch (e) {
logger.e("Error getting coordinator version: ${e.toString()}");
while (shellNavigatorKey.currentContext == null) {
await Future.delayed(const Duration(milliseconds: 100)); // Adjust delay as needed
}
showDialog(
context: rootNavigatorKey.currentContext!,
context: shellNavigatorKey.currentContext!,
builder: (context) => AlertDialog(
title: const Text("Cannot reach LSP"),
title: const Text("Cannot reach coordinator"),
content: const Text("Please check your Internet connection.\n"
"Please note that without Internet access, the app "
"functionality is severely limited."),
Expand Down

0 comments on commit fe8c3e6

Please sign in to comment.