feat(permission): add dialog text for website_data_access permission
- commit
- a1e4979beedc03111cec0d7b3f4668292ebcb65c
- author
- brice · · 2026-03-17 19:10 UTC
- parent
- 09f434a
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +16 -0
M internal/ui/dialog/permission.go +10 -0
| @@ -130,6 +130,7 @@ func (d *PermissionDialog) buildHeading(permTypes []entity.PermissionType) strin | |||
| 130 | 130 | hasMic := false | |
| 131 | 131 | hasCam := false | |
| 132 | 132 | hasDisplay := false | |
| 133 | + | hasDataAccess := false | |
| 133 | 134 | ||
| 134 | 135 | for _, pt := range permTypes { | |
| 135 | 136 | switch pt { | |
| @@ -139,6 +140,8 @@ func (d *PermissionDialog) buildHeading(permTypes []entity.PermissionType) strin | |||
| 139 | 140 | hasCam = true | |
| 140 | 141 | case entity.PermissionTypeDisplay: | |
| 141 | 142 | hasDisplay = true | |
| 143 | + | case entity.PermissionTypeWebsiteDataAccess: | |
| 144 | + | hasDataAccess = true | |
| 142 | 145 | } | |
| 143 | 146 | } | |
| 144 | 147 | ||
| @@ -157,6 +160,8 @@ func (d *PermissionDialog) buildHeading(permTypes []entity.PermissionType) strin | |||
| 157 | 160 | return "Allow Camera Access?" | |
| 158 | 161 | case hasDisplay: | |
| 159 | 162 | return "Allow Screen Sharing?" | |
| 163 | + | case hasDataAccess: | |
| 164 | + | return "Allow Third-Party Data Access?" | |
| 160 | 165 | default: | |
| 161 | 166 | return "Allow Permission?" | |
| 162 | 167 | } | |
| @@ -167,6 +172,7 @@ func (d *PermissionDialog) buildBody(origin string, permTypes []entity.Permissio | |||
| 167 | 172 | hasMic := false | |
| 168 | 173 | hasCam := false | |
| 169 | 174 | hasDisplay := false | |
| 175 | + | hasDataAccess := false | |
| 170 | 176 | ||
| 171 | 177 | for _, pt := range permTypes { | |
| 172 | 178 | switch pt { | |
| @@ -176,6 +182,8 @@ func (d *PermissionDialog) buildBody(origin string, permTypes []entity.Permissio | |||
| 176 | 182 | hasCam = true | |
| 177 | 183 | case entity.PermissionTypeDisplay: | |
| 178 | 184 | hasDisplay = true | |
| 185 | + | case entity.PermissionTypeWebsiteDataAccess: | |
| 186 | + | hasDataAccess = true | |
| 179 | 187 | } | |
| 180 | 188 | } | |
| 181 | 189 | ||
| @@ -195,6 +203,8 @@ func (d *PermissionDialog) buildBody(origin string, permTypes []entity.Permissio | |||
| 195 | 203 | action = "access your camera" | |
| 196 | 204 | case hasDisplay: | |
| 197 | 205 | action = "share your screen" | |
| 206 | + | case hasDataAccess: | |
| 207 | + | action = "access its stored data while you browse this site" | |
| 198 | 208 | default: | |
| 199 | 209 | action = "access your device" | |
| 200 | 210 | } | |
| @@ -130,6 +130,7 @@ func (d *PermissionDialog) buildHeading(permTypes []entity.PermissionType) strin | |||||
| 130 | hasMic := false | 130 | hasMic := false | ||
| 131 | hasCam := false | 131 | hasCam := false | ||
| 132 | hasDisplay := false | 132 | hasDisplay := false | ||
| 133 | + | hasDataAccess := false | |||
| 133 | 134 | ||||
| 134 | for _, pt := range permTypes { | 135 | for _, pt := range permTypes { | ||
| 135 | switch pt { | 136 | switch pt { | ||
| @@ -139,6 +140,8 @@ func (d *PermissionDialog) buildHeading(permTypes []entity.PermissionType) strin | |||||
| 139 | hasCam = true | 140 | hasCam = true | ||
| 140 | case entity.PermissionTypeDisplay: | 141 | case entity.PermissionTypeDisplay: | ||
| 141 | hasDisplay = true | 142 | hasDisplay = true | ||
| 143 | + | case entity.PermissionTypeWebsiteDataAccess: | |||
| 144 | + | hasDataAccess = true | |||
| 142 | } | 145 | } | ||
| 143 | } | 146 | } | ||
| 144 | 147 | ||||
| @@ -157,6 +160,8 @@ func (d *PermissionDialog) buildHeading(permTypes []entity.PermissionType) strin | |||||
| 157 | return "Allow Camera Access?" | 160 | return "Allow Camera Access?" | ||
| 158 | case hasDisplay: | 161 | case hasDisplay: | ||
| 159 | return "Allow Screen Sharing?" | 162 | return "Allow Screen Sharing?" | ||
| 163 | + | case hasDataAccess: | |||
| 164 | + | return "Allow Third-Party Data Access?" | |||
| 160 | default: | 165 | default: | ||
| 161 | return "Allow Permission?" | 166 | return "Allow Permission?" | ||
| 162 | } | 167 | } | ||
| @@ -167,6 +172,7 @@ func (d *PermissionDialog) buildBody(origin string, permTypes []entity.Permissio | |||||
| 167 | hasMic := false | 172 | hasMic := false | ||
| 168 | hasCam := false | 173 | hasCam := false | ||
| 169 | hasDisplay := false | 174 | hasDisplay := false | ||
| 175 | + | hasDataAccess := false | |||
| 170 | 176 | ||||
| 171 | for _, pt := range permTypes { | 177 | for _, pt := range permTypes { | ||
| 172 | switch pt { | 178 | switch pt { | ||
| @@ -176,6 +182,8 @@ func (d *PermissionDialog) buildBody(origin string, permTypes []entity.Permissio | |||||
| 176 | hasCam = true | 182 | hasCam = true | ||
| 177 | case entity.PermissionTypeDisplay: | 183 | case entity.PermissionTypeDisplay: | ||
| 178 | hasDisplay = true | 184 | hasDisplay = true | ||
| 185 | + | case entity.PermissionTypeWebsiteDataAccess: | |||
| 186 | + | hasDataAccess = true | |||
| 179 | } | 187 | } | ||
| 180 | } | 188 | } | ||
| 181 | 189 | ||||
| @@ -195,6 +203,8 @@ func (d *PermissionDialog) buildBody(origin string, permTypes []entity.Permissio | |||||
| 195 | action = "access your camera" | 203 | action = "access your camera" | ||
| 196 | case hasDisplay: | 204 | case hasDisplay: | ||
| 197 | action = "share your screen" | 205 | action = "share your screen" | ||
| 206 | + | case hasDataAccess: | |||
| 207 | + | action = "access its stored data while you browse this site" | |||
| 198 | default: | 208 | default: | ||
| 199 | action = "access your device" | 209 | action = "access your device" | ||
| 200 | } | 210 | } | ||
M internal/ui/dialog/permission_test.go +6 -0
| @@ -142,6 +142,12 @@ func TestPermissionDialog_BuildHeadingAndBody_DisplayCombinations(t *testing.T) | |||
| 142 | 142 | expectHeading: "Allow Microphone, Camera, and Screen Sharing?", | |
| 143 | 143 | expectedAction: "access your microphone and camera, and share your screen", | |
| 144 | 144 | }, | |
| 145 | + | { | |
| 146 | + | name: "website data access only", | |
| 147 | + | permTypes: []entity.PermissionType{entity.PermissionTypeWebsiteDataAccess}, | |
| 148 | + | expectHeading: "Allow Third-Party Data Access?", | |
| 149 | + | expectedAction: "access its stored data while you browse this site", | |
| 150 | + | }, | |
| 145 | 151 | } | |
| 146 | 152 | ||
| 147 | 153 | for _, tt := range tests { | |
| @@ -142,6 +142,12 @@ func TestPermissionDialog_BuildHeadingAndBody_DisplayCombinations(t *testing.T) | |||||
| 142 | expectHeading: "Allow Microphone, Camera, and Screen Sharing?", | 142 | expectHeading: "Allow Microphone, Camera, and Screen Sharing?", | ||
| 143 | expectedAction: "access your microphone and camera, and share your screen", | 143 | expectedAction: "access your microphone and camera, and share your screen", | ||
| 144 | }, | 144 | }, | ||
| 145 | + | { | |||
| 146 | + | name: "website data access only", | |||
| 147 | + | permTypes: []entity.PermissionType{entity.PermissionTypeWebsiteDataAccess}, | |||
| 148 | + | expectHeading: "Allow Third-Party Data Access?", | |||
| 149 | + | expectedAction: "access its stored data while you browse this site", | |||
| 150 | + | }, | |||
| 145 | } | 151 | } | ||
| 146 | 152 | ||||
| 147 | for _, tt := range tests { | 153 | for _, tt := range tests { | ||