SMS Screen Modifiaction
This commit is contained in:
@@ -41,42 +41,68 @@
|
||||
while (!hasPermission) {
|
||||
final status = await _smsService.handleSmsPermission();
|
||||
|
||||
switch (status) {
|
||||
case PermissionStatusResult.granted:
|
||||
_showSnackBar("Permissions Granted! Proceeding...");
|
||||
hasPermission = true; // This will break the loop
|
||||
break;
|
||||
case PermissionStatusResult.denied:
|
||||
_showSnackBar("SMS and Phone permissions are required. Please try again.");
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
break;
|
||||
case PermissionStatusResult.permanentlyDenied:
|
||||
if (mounted) {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text("Permission Required"),
|
||||
content: const Text("SMS and Phone permissions are required for device verification. Please enable them in your app settings to continue."),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text("Cancel"),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text("Open Settings"),
|
||||
onPressed: () {
|
||||
openAppSettings(); // Opens the phone's settings screen for this app
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
// Wait for user to return from settings
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
break;
|
||||
}
|
||||
switch (status) {
|
||||
case PermissionStatusResult.granted:
|
||||
_showSnackBar("Permissions Granted! Proceeding...");
|
||||
hasPermission = true; // This will break the loop
|
||||
break;
|
||||
case PermissionStatusResult.denied:
|
||||
_showSnackBar("SMS and Phone permissions are required. Please try again.");
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
break;
|
||||
case PermissionStatusResult.permanentlyDenied:
|
||||
if (mounted) {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text("Permission Required"),
|
||||
content: const Text("SMS and Phone permissions are required for device verification. Please enable them in your app settings to continue."),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text("Cancel"),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text("Open Settings"),
|
||||
onPressed: () {
|
||||
openAppSettings(); // Opens the phone's settings screen for this app
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
// Wait for user to return from settings
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
break;
|
||||
case PermissionStatusResult.restricted:
|
||||
if (mounted) {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text("Permission Restricted"),
|
||||
content: const Text(
|
||||
"SMS and Phone permissions are restricted on this device. Please check your device settings or parental controls and enable them for this app."),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text("Cancel"),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text("Open Settings"),
|
||||
onPressed: () {
|
||||
openAppSettings();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// --- SMS SENDING LOOP ---
|
||||
|
||||
@@ -37,7 +37,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
final storage = getIt<SecureStorage>();
|
||||
final isEnabled = await storage.read('biometric_enabled');
|
||||
setState(() {
|
||||
_isBiometricEnabled = isEnabled == 'true';
|
||||
_isBiometricEnabled = isEnabled == true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user