feat: WiFi BSSID based alarm cancellation (Addition to Smart Controls)
Description
This PR adds a new condition, WiFi Based alarm cancellation, to the Smart Controls.
By using this feature, the user will be able to auto-cancel the alarm when their device is connected to the specified Wi-Fi network.
There may occur three different conditions when alarm is about to ring (when this feature is turned ON):
- Device connected to the same Wi-Fi Network.
- Device connected to a different Wi-Fi Network.
- Device not connected to any Wi-Fi Network.
Proposed Changes
-
To the
Alarm Model&Profile Model
isWifiEnabled INTEGER NOT NULL DEFAULT 0,
wifiName TEXT,
wifiBSSID TEXT
- A new file
wifi_based_tile.dart - A new Service
WifiManagerService.kt
Fixes #802
Screenshots
Checklist
- [ ] Tests have been added or updated to cover the changes
- [ ] Documentation has been updated to reflect the changes
- [x] Code follows the established coding style guidelines
- [x] All tests are passing
Hey @MarkisDev, can you please review this. And lemme know if anything is out of its place :)
Hii @kushchoudhary98 i have tested the wifi SSID based in my device iam getting an issue
https://github.com/user-attachments/assets/dcab3eef-535b-408a-973f-4a0b821cd267
the issue is when clicking on the WiFi SSID smart control, it's calling the controller's checkAndRequestPermission() method which is designed for location permissions, not WiFi permissions. This is why the dialog isn't properly opening.
@mahendra-918 as a matter of fact, this is also an issue with Location-Based & Weather-Based conditions.
I think it's an issue with the checkAndRequestPermission(), right? I used this function since the wifi state permissions are the same as those for location.
In the below video I denied Location access and it still allows me to select the Weather Types and opens the menu for Location Selection.
https://github.com/user-attachments/assets/374e1dd6-b4b5-4c2b-8197-b2ea2c1d78d5
And If I go ahead with it, the app crashes...
I will soon be raising a PR for this. Great find @mahendra-918.