Skip to content

Feat: Add Lock Screen Permission for Xiaomi Devices#1

Merged
cavin-macwan merged 2 commits into
meticha:feature/alarm-wake-screenfrom
bhavikmaradiya:feature/xiaomi-permission
Jun 4, 2025
Merged

Feat: Add Lock Screen Permission for Xiaomi Devices#1
cavin-macwan merged 2 commits into
meticha:feature/alarm-wake-screenfrom
bhavikmaradiya:feature/xiaomi-permission

Conversation

@bhavikmaradiya

Copy link
Copy Markdown
Contributor

This commit introduces support for requesting the "Show on Lock Screen" permission, specifically for Xiaomi devices. This permission is often required for apps that need to display information or trigger actions while the device is locked.

Key changes:

  • TriggerXPermissionManager.kt:

    • Added isShowOnLockScreenPermissionEnable(): Checks if the "Show on Lock Screen" permission is granted for Xiaomi devices using AppOpsManager.
    • Updated isGranted(): Now includes a check for PermissionType.LOCK_SCREEN.
    • Updated getPermissionIntent(): Provides the specific intent to navigate users to the permission settings screen for "Show on Lock Screen" on Xiaomi devices.
    • Added LOCK_SCREEN to the PermissionType enum.
  • TriggerXPermissionComposable.kt:

    • Modified rememberAppPermissionState(): Conditionally adds PermissionType.LOCK_SCREEN to the list of permissions to be checked if the device manufacturer is "Xiaomi".
    • Minor formatting adjustments.

This enhancement ensures that applications using the TriggerX library can correctly prompt users for necessary lock screen permissions on Xiaomi devices, improving the reliability of features that depend on this capability.

This commit introduces support for requesting the "Show on Lock Screen" permission, specifically for Xiaomi devices. This permission is often required for apps that need to display information or trigger actions while the device is locked.

Key changes:

- **TriggerXPermissionManager.kt**:
    - Added `isShowOnLockScreenPermissionEnable()`: Checks if the "Show on Lock Screen" permission is granted for Xiaomi devices using `AppOpsManager`.
    - Updated `isGranted()`: Now includes a check for `PermissionType.LOCK_SCREEN`.
    - Updated `getPermissionIntent()`: Provides the specific intent to navigate users to the permission settings screen for "Show on Lock Screen" on Xiaomi devices.
    - Added `LOCK_SCREEN` to the `PermissionType` enum.

- **TriggerXPermissionComposable.kt**:
    - Modified `rememberAppPermissionState()`: Conditionally adds `PermissionType.LOCK_SCREEN` to the list of permissions to be checked if the device manufacturer is "Xiaomi".
    - Minor formatting adjustments.

This enhancement ensures that applications using the TriggerX library can correctly prompt users for necessary lock screen permissions on Xiaomi devices, improving the reliability of features that depend on this capability.
@meticha-admin meticha-admin added the enhancement New feature or request label Jun 4, 2025
This commit removes extra whitespace in the `TriggerXPermissionComposable.kt` file.

Key changes:

- **triggerx/src/main/java/com/meticha/triggerx/permission/TriggerXPermissionComposable.kt**:
    - Removed extraneous whitespace in an `else` branch of a `when` statement.

This change improves code formatting and readability without affecting functionality.

@cavin-macwan cavin-macwan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cavin-macwan
cavin-macwan merged commit d0045a2 into meticha:feature/alarm-wake-screen Jun 4, 2025
cavin-macwan added a commit that referenced this pull request Jun 4, 2025
* Refactor: Introduce TriggerX library for scheduling alarms and managi…

* Feat: Add Lock Screen Permission for Xiaomi Devices

* Refactor: Remove Unnecessary Whitespace in TriggerXPermissionComposable

* Merge pull request #1 from bhavikmaradiya/feature/xiaomi-permission

* Feat: Launch TriggerActivity via ForegroundService

* Feat: Introduce Configurable Logger for TriggerX Library

* Feat: Base implementation of the whole library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants