-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5409d50
commit 7a23891
Showing
18 changed files
with
102 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const foo = 'bar'; | ||
export * from './lib/permissionMonitor.machine'; | ||
export * from './lib/permissionCheckAndRequestMachine'; | ||
export * from './lib/permission/monitoring/permissionMonitor.machine'; | ||
export * from './lib/permission/checkAndRequest/permissionCheckAndRequestMachine'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
libs/permissions/permissionLogic/src/lib/permission.actions.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
libs/permissions/permissionLogic/src/lib/permission/checkAndRequest/permission.actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { PermissionStatuses, Permissions } from '../../permission.types'; | ||
import { PermissionCheckAndRequestMachineActions } from './permissionCheckAndRequest.types'; | ||
|
||
export const unimplementedPermissionCheckAndRequestActions: PermissionCheckAndRequestMachineActions = | ||
{ | ||
checkAllPermissions: () => { | ||
return new Promise((resolve) => | ||
resolve({ | ||
[Permissions.bluetooth]: PermissionStatuses.denied, | ||
[Permissions.microphone]: PermissionStatuses.denied, | ||
}) | ||
); | ||
}, | ||
requestBluetoothPermission: () => { | ||
return new Promise((resolve) => resolve(PermissionStatuses.granted)); | ||
}, | ||
requestMicrophonePermission: () => { | ||
return new Promise((resolve) => resolve(PermissionStatuses.granted)); | ||
}, | ||
} as const; |
18 changes: 18 additions & 0 deletions
18
...ons/permissionLogic/src/lib/permission/checkAndRequest/permissionCheckAndRequest.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { | ||
Permission, | ||
PermissionStatus, | ||
PermissionStatusMapType, | ||
} from '../../permission.types'; | ||
|
||
export interface PermissionCheckAndRequestMachineActions { | ||
checkAllPermissions: () => Promise<PermissionStatusMapType>; | ||
requestBluetoothPermission: () => Promise<PermissionStatus>; | ||
requestMicrophonePermission: () => Promise<PermissionStatus>; | ||
} | ||
|
||
export type PermissionMachineEvents = | ||
| { type: 'triggerPermissionCheck' } | ||
| { | ||
type: 'triggerPermissionRequest'; | ||
permission: Permission; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
libs/permissions/permissionLogic/src/lib/permission/monitoring/permissionMonitor.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { AnyActorRef } from 'xstate'; | ||
import { | ||
Permission, | ||
PermissionStatus, | ||
PermissionStatusMapType, | ||
} from '../../permission.types'; | ||
|
||
export type PermissionMonitoringMachineEvents = | ||
| { | ||
type: 'subscribeToPermissionStatuses'; | ||
permissions: Permission[]; | ||
self: AnyActorRef; | ||
} | ||
| { | ||
type: 'allPermissionsChecked'; | ||
statuses: PermissionStatusMapType; | ||
} | ||
| { type: 'triggerPermissionRequest'; permission: Permission } | ||
| { | ||
type: 'permissionRequestCompleted'; | ||
status: PermissionStatus; | ||
permission: Permission; | ||
} | ||
| { type: 'triggerPermissionCheck' } | ||
| { type: 'applicationForegrounded' } | ||
| { type: 'applicationBackgrounded' }; | ||
|
||
export type PermissionMonitoringMachineContext = { | ||
permissionStatuses: PermissionStatusMapType; | ||
}; | ||
|
||
export type PermissionSubscribers = Array<AnyActorRef>; | ||
export type PermissionSubscriberMap = Record<Permission, PermissionSubscribers>; |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
libs/permissions/permissionLogic/src/lib/systemManagement/systemManagement.machine.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.