Compare commits
2 Commits
b79bb410c4
...
8254c378fe
| Author | SHA1 | Date | |
|---|---|---|---|
| 8254c378fe | |||
|
|
b3c8c12047 |
@@ -44,11 +44,11 @@ void main() async {
|
||||
prefs.setString('token',token.toString()); */
|
||||
Globalwait.principalid = prefs.getString("iam_principal_id").toString();
|
||||
token = prefs.getString('token').toString();
|
||||
bool? notificationstatus=prefs.getBool('notificationstatus');
|
||||
bool? agreepolicy=prefs.getBool("agreepolicy");
|
||||
Globalwait.token=token;
|
||||
Globalwait.notificationstatus=notificationstatus;
|
||||
Globalwait.agreeforprivacy=agreepolicy;
|
||||
bool? notificationstatus = prefs.getBool('notificationstatus');
|
||||
bool? agreepolicy = prefs.getBool("agreepolicy");
|
||||
Globalwait.token = token;
|
||||
Globalwait.notificationstatus = notificationstatus;
|
||||
Globalwait.agreeforprivacy = agreepolicy;
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ class MyApp extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
ConnectivityResult _connectionStatus = ConnectivityResult.none;
|
||||
final Connectivity _connectivity = Connectivity();
|
||||
ConnectivityResult _connectionStatus = ConnectivityResult.none;
|
||||
final Connectivity _connectivity = Connectivity();
|
||||
late StreamSubscription<ConnectivityResult> _connectivitySubscription;
|
||||
Future<void> checkInternet() async {
|
||||
final connectivityResult = await (Connectivity().checkConnectivity());
|
||||
@@ -70,18 +70,18 @@ class _MyAppState extends State<MyApp> {
|
||||
connectivityResult == ConnectivityResult.mobile) {
|
||||
setState(() {
|
||||
_connectionStatus = connectivityResult;
|
||||
print("has internet");
|
||||
|
||||
print("has internet");
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_connectionStatus = connectivityResult;
|
||||
print("no internet");
|
||||
print("no internet");
|
||||
// Navigator.pushReplacementNamed(context, "/noInternet");
|
||||
});
|
||||
}
|
||||
}
|
||||
Future<void> initConnectivity() async {
|
||||
|
||||
Future<void> initConnectivity() async {
|
||||
late ConnectivityResult result;
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
try {
|
||||
@@ -89,7 +89,7 @@ class _MyAppState extends State<MyApp> {
|
||||
print("initconnectivitity");
|
||||
} on PlatformException catch (e) {
|
||||
print("errrror");
|
||||
print( e);
|
||||
print(e);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,40 +107,33 @@ class _MyAppState extends State<MyApp> {
|
||||
setState(() {
|
||||
print("//////////////");
|
||||
_connectionStatus = result;
|
||||
if(_connectionStatus==ConnectivityResult.none){
|
||||
if (_connectionStatus == ConnectivityResult.none) {
|
||||
Get.to(NoInternet());
|
||||
}else{
|
||||
} else {
|
||||
Get.back(result: true);
|
||||
}
|
||||
//_connectionStatus==ConnectivityResult.none?RouteName.nointernet:
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
//checkInternet();
|
||||
// print(_connectionStatus.toString());
|
||||
//checkInternet();
|
||||
// print(_connectionStatus.toString());
|
||||
initConnectivity();
|
||||
|
||||
_connectivitySubscription =
|
||||
_connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
|
||||
/* Future.delayed(Duration(seconds: 2), () async {
|
||||
if (_connectionStatus == ConnectivityResult.none) {
|
||||
await Get.to(NoInternet());
|
||||
print("aaaaaaaaaaa");
|
||||
} else {
|
||||
print("rrrr");
|
||||
}
|
||||
});
|
||||
*/ // TODO: implement initState
|
||||
print("minor change for git");
|
||||
super.initState();
|
||||
}
|
||||
@override
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_connectivitySubscription.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
//String? token="//";
|
||||
// This widget is the root of your application.
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("////////////////connectionstring///////////");
|
||||
@@ -153,7 +146,7 @@ class _MyAppState extends State<MyApp> {
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
useMaterial3: true,
|
||||
),
|
||||
initialRoute:'/',
|
||||
initialRoute: '/',
|
||||
/* token == "null" || token!.isEmpty || token == null
|
||||
? '/'
|
||||
: RouteName.entryPoint, */
|
||||
|
||||
Reference in New Issue
Block a user