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

UI/connectivity warning #1412

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check connectivity
R0drig0-P committed Dec 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 2bfa9fa768eabd3129085c60ab41e7b417140409
25 changes: 25 additions & 0 deletions packages/uni_app/lib/utils/connectivity_service.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:connectivity_plus/connectivity_plus.dart';

class ConnectivityService {
Future<String> getConnectivityStatus() async {
final connectivityResult = await Connectivity().checkConnectivity();

// Returns the type of connection of the device
switch (connectivityResult) {
case ConnectivityResult.mobile:
return 'Mobile Data';
case ConnectivityResult.wifi:
return 'WiFi';
case ConnectivityResult.ethernet:
return 'Ethernet';
case ConnectivityResult.vpn:
return 'VPN';
case ConnectivityResult.bluetooth:
return 'Bluetooth';
case ConnectivityResult.other:
return 'Other';
case ConnectivityResult.none:
return 'No Connection';
}
}
}