-
Notifications
You must be signed in to change notification settings - Fork 294
feat: Permission repo, replace ko observables with zustand store [WPB-20570] #19609
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
base: dev
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #19609 +/- ##
==========================================
+ Coverage 43.61% 43.67% +0.05%
==========================================
Files 1291 1292 +1
Lines 32266 32312 +46
Branches 7168 7173 +5
==========================================
+ Hits 14072 14111 +39
- Misses 16503 16509 +6
- Partials 1691 1692 +1 🚀 New features to boost your workflow:
|
🔗 Download Full Report Artifact 🧪 Playwright Test Summary
Failed Tests:❌ Calls in channels with device switch and screenshare (tags: TC-8754, crit-flow-web)Location: specs/CriticalFlow/channelsCall-TC-8755.spec.ts:38 Errors:
❌ Channels Management (tags: TC-8752, crit-flow-web)Location: specs/CriticalFlow/channelsManagement-TC-8752.spec.ts:36 Errors:
❌ Planning group call with sending various messages during call (tags: TC-8632, crit-flow-web)Location: specs/CriticalFlow/groupCalls-TC-8632.spec.ts:37 Errors:
❌ Group Video call (tags: TC-8637, crit-flow-web)Location: specs/CriticalFlow/groupVideoCall-TC-8637.spec.ts:39 Errors:
❌ Messages in Channels (tags: TC-8753, crit-flow-web)Location: specs/CriticalFlow/messagesInChannels-TC-8753.spec.ts:44 Errors:
❌ Messages in Groups (tags: TC-8751, crit-flow-web)Location: specs/CriticalFlow/messagesInGroups-TC-8751.spec.ts:42 Errors:
Flaky Tests: |
state: PermissionState | PermissionStatusState | NotificationPermission, | ||
): UnifiedPermissionState { | ||
switch (state) { | ||
case 'default': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why we need both default and prompt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both default
(Notification API) and prompt
(Permissions API) represent the same "not yet requested" state but come from different browser APIs, so they're normalized to a unified PROMPT state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the naming is not perfect, since we have case "default" and default in the same switch statement
https://github.com/wireapp/wire-webapp into feat/knockout-removal-permission-repository-WPB-20570
|
@@ -0,0 +1,141 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Permission repository replaced with handlers and pure functions.
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we separate the hookless store from the hook, please?
like:
Permissions.store.ts
Permissions.hooks.ts
Permissions.types.ts (for exported common types, not for types that belong to the store for example)
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we refactor already, can we move that file into the folder it belongs and call it Permissions.test.ts?
Description
This pull request refactors how permissions are handled across the app, particularly removing direct usage of the
PermissionRepository
in favor of new permission handler utilities and normalized permission state enums. The changes focus on simplifying permission management for notifications and media streams, and updating related tests and imports to use the new approach.Permission Handling Refactor:
PermissionRepository
inapp.ts
,MediaStreamHandler
, andNotificationRepository
with new permission handler functions (initializePermissions
,getPermissionStates
,getPermissionState
,setPermissionState
). This centralizes permission logic and removes the need to pass around repository instances.MediaStreamHandler
andNotificationRepository
to use the newBrowserPermissionStatus
enum and handler functions, replacing previous usage ofPermissionStatusState
and repository methods.Notification Permission State Normalization:
NotificationRepository
usingnormalizePermissionState
, ensuring consistent state management and updating viasetPermissionState
.Enum and File Renaming:
PermissionStatusState
toBrowserPermissionStatus
andPermissionState
toAppPermissionState
for clarity, updating all references and imports accordingly.Test Updates:
PermissionRepository
and update permission state checks to the new enums and handler functions. This includes changes in both media and notification repository tests.Code Cleanup:
This refactor streamlines permission management, improves code clarity, and reduces coupling between repositories and permission logic.
Checklist