Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial-functionality-of-permission-monitoring-machine #2

Merged
merged 8 commits into from
Mar 18, 2024

Conversation

technoplato
Copy link
Owner

No description provided.

Added xstate "^5.9.1" as a dependency in package.json for state management.
Added a permission monitoring machine with states for idle, checkingPermission, permissionGranted, permissionDenied, and permissionRevoked. The machine includes logic to check permissions asynchronously and update the permission state accordingly. This will help in monitoring and handling permission changes in the application.
…tate

- Replaced `createMachine` with `setup` for defining the permissionMonitoringMachine
- Updated the context and events types to include permissionStatuses and inc/dec events
- Added increment and decrement actions for handling count updates
- Changed the permissionState context to permissionStatuses using PermissionStatusMap
- Updated the machine on events to trigger inc and dec actions

This commit enhances the readability and organization of the permission monitoring machine by utilizing xstate's `setup` function.
Test is logging out the correct result but failing for some reason...

- Added initial test cases to check the starting state and permission checking functionality in the Permission Monitoring Machine.
- Introduced constants for permissions, permission statuses, and machine states.
- Defined context, events, and actions for the Permission Monitoring Machine setup.
- Implemented actors for subscribing to application lifecycle events and checking Bluetooth permission status.
…chine

Updated the test case in the Permission Monitoring Machine to include async/await
when checking permissions once invoked. This change was necessary to properly
handle the asynchronous nature of the permission check operation. This ensures
that the test case waits for the permission check to be completed before
continuing, providing accurate results.
@technoplato technoplato merged commit 0a7317f into main Mar 18, 2024
1 of 2 checks passed
@technoplato technoplato deleted the permissions-monitoring-machine branch March 18, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant