-
Notifications
You must be signed in to change notification settings - Fork 224
Description
Description
Description
There is a critical UX flaw in the Guardian Angel feature's permission handling. If a user toggles the feature "On" but subsequently denies the required system permissions (Phone and SMS), the application fails silently without providing any feedback. Furthermore, the UI switch remains in the "Active" (True) state, creating a false impression that the safety feature is armed when it actually lacks the necessary permissions to function.
Steps to Reproduce
- Navigate to the Add/Update Alarm screen.
- Scroll to the "Guardian Angel" toggle.
- Tap the switch to enable the feature.
- When the OS prompts for SMS and Phone permissions, select "Deny".
- Observe that the app provides no error message, and the switch remains in the active/green state.
Root Cause
In lib/app/modules/addOrUpdateAlarm/views/guardian_angel.dart, the showGuardianDialog() method requests permissions and uses an if (phonePerm && smsPerm) block to handle the success state. However, it lacks an else block to handle the denial state. Because the state update (toggling the switch) happens before the permission is fully granted, denying the permission leaves the controller's observable boolean in a mismatched state.
Proposed Solution
Implement an else block that programmatically reverts controller.isGuardian.value to false and triggers a Get.snackbar to inform the user why the action was aborted.
Proposed Implementation:
} else {
// Revert the toggle state to accurately reflect the disabled feature
controller.isGuardian.value = false;
Get.snackbar(
'Permission Required',
'Please enable Phone and SMS permissions in app settings to use the Guardian Angel feature.',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: themeController.secondaryBackgroundColor.value,
colorText: themeController.primaryTextColor.value,
duration: const Duration(seconds: 4),
);
}
### Screenshots
_No response_