Skip to content

Commit

Permalink
fix: Lack of connectivity toast not showing due to incorrect comparison
Browse files Browse the repository at this point in the history
Signed-off-by: validcube <[email protected]>
  • Loading branch information
validcube committed Aug 27, 2024
1 parent b769a66 commit 81f05e1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ui/views/home/home_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class HomeViewModel extends BaseViewModel {
AndroidFlutterLocalNotificationsPlugin>()
?.requestNotificationsPermission();
final bool isConnected =
await Connectivity().checkConnectivity() != ConnectivityResult.none;
await Connectivity().checkConnectivity() != [ConnectivityResult.none];
if (!isConnected) {
_toast.showBottom(t.homeView.noConnection);
}
Expand All @@ -106,7 +106,8 @@ class HomeViewModel extends BaseViewModel {
void navigateToAppInfo(PatchedApplication app, bool isLastPatchedApp) {
_navigationService.navigateTo(
Routes.appInfoView,
arguments: AppInfoViewArguments(app: app, isLastPatchedApp: isLastPatchedApp),
arguments:
AppInfoViewArguments(app: app, isLastPatchedApp: isLastPatchedApp),
);
}

Expand Down

3 comments on commit 81f05e1

@kitadai31
Copy link
Contributor

Choose a reason for hiding this comment

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

@validcube Is this really fixed?
I still don't get the toast 🤔

According to https://pub.dev/packages/connectivity_plus , it seems that you need to use .contains(ConnectivityResult.none)

final bool isConnected = !(await Connectivity().checkConnectivity()).contains(ConnectivityResult.none);

@validcube
Copy link
Member Author

Choose a reason for hiding this comment

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

@validcube Is this really fixed? I still don't get the toast 🤔

According to pub.dev/packages/connectivity_plus , it seems that you need to use .contains(ConnectivityResult.none)

final bool isConnected = !(await Connectivity().checkConnectivity()).contains(ConnectivityResult.none);

@kitadai31 👋 First of, sorry for very late response (to anyone I have ghosted for like past weeks now 😭) Anyway,

Hello! It's seems like you're right, unfortunately, my availability is very sparse so this problem is up for grab if you'd like to fix this.

@kitadai31
Copy link
Contributor

Choose a reason for hiding this comment

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

No problem👍 I've heard that you had had an exam.
I opened a PR.

Please sign in to comment.