[PR #2205] [MERGED] [SG-601] Enhance experience when user denies camera access in Authenticator #3427

Closed
opened 2025-11-26 23:32:38 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/2205
Author: @andrebispo5
Created: 11/25/2022
Status: Merged
Merged: 12/6/2022
Merged by: @andrebispo5

Base: masterHead: bugfix/SG-601-camera-permissions


📝 Commits (10+)

  • 64b68a1 [SG-601] Handle camera denied permissions
  • 8588293 [SG-601] Code format
  • b48fc04 [SG-601] PR Fixes
  • 5aedb67 [SG-601] Change resource text to singular
  • 58cb62e [SG-601] Remove horizontal and vertical options
  • 7954696 [SG-601] Add start and stop scanner methods
  • f1faa03 [SG-601] Remove parameter from ScanPage
  • a08f8a6 [SG-601] Move initialization to viewmodel
  • 0772add [SG-601] Fix zxing scanning bug
  • 8a0dbdb [SG-601] Move RunUIThread inside of method

📊 Changes

6 files changed (+149 additions, -28 deletions)

View changed files

📝 src/App/Pages/Vault/CipherAddEditPage.xaml.cs (+1 -6)
📝 src/App/Pages/Vault/ScanPage.xaml (+3 -6)
📝 src/App/Pages/Vault/ScanPage.xaml.cs (+60 -11)
📝 src/App/Pages/Vault/ScanPageViewModel.cs (+71 -3)
📝 src/App/Resources/AppResources.Designer.cs (+11 -2)
📝 src/App/Resources/AppResources.resx (+3 -0)

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

When a user denies camera access for the QR code scan, they are neither prompted again nor are they given a modal that says ‘You must enable camera access…’ etc. when they tap the icon to add an authenticator code to an item that does not yet have one. This occurs in Prod as well; the camera icon/Set up TOTP buttons do not respond when selected if you have previously denied the setting.This poses an issue in the Authenticator UI because there is no way to manually add a new TOTP without accessing those screens, however, you can edit an existing one.

Expected behavior: When the user has camera permissions turned off, clicking the “add new TOTP” button launches the “Enter Key Manually” mode. If the user then clicks the “scan QR Code” link (attempting to switch to camera mode) we show the user the dialog requesting camera permissions.

Code changes

ScanPage.xaml: Changed ScannerView to a container. The scanner is only added if the user has permissions to use the camera.
ScanPage.xaml.cs: Added couple of code protections agains a null scanner. Also added a command to init the scanner from the ViewModel.
ScanViewModel.cs: When executing the ToggleScanModeCommand it now checks if the user has camera permissions. If not it will prompt the user to go to settings and enable them. If it has permissions tries to init the scanner if needed and changes the UI.

Screenshots

https://user-images.githubusercontent.com/4648522/204020241-c9501aa7-6569-4f4a-b9d1-e9fb83684f60.mov

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/2205 **Author:** [@andrebispo5](https://github.com/andrebispo5) **Created:** 11/25/2022 **Status:** ✅ Merged **Merged:** 12/6/2022 **Merged by:** [@andrebispo5](https://github.com/andrebispo5) **Base:** `master` ← **Head:** `bugfix/SG-601-camera-permissions` --- ### 📝 Commits (10+) - [`64b68a1`](https://github.com/bitwarden/android/commit/64b68a19a66443ee518bf348238a7c32eb7a76bc) [SG-601] Handle camera denied permissions - [`8588293`](https://github.com/bitwarden/android/commit/85882935e2f599d949ca9e3757cbbc6112ffa266) [SG-601] Code format - [`b48fc04`](https://github.com/bitwarden/android/commit/b48fc04d148143a3593619486093bfbf8d7be22e) [SG-601] PR Fixes - [`5aedb67`](https://github.com/bitwarden/android/commit/5aedb676759ef302c6ccbb2aaf105b144d1a970d) [SG-601] Change resource text to singular - [`58cb62e`](https://github.com/bitwarden/android/commit/58cb62e46be790952b95f60daecdd0b316c3b9ae) [SG-601] Remove horizontal and vertical options - [`7954696`](https://github.com/bitwarden/android/commit/79546966de7c97e118f7b7f13fe9bc5ead3b7780) [SG-601] Add start and stop scanner methods - [`f1faa03`](https://github.com/bitwarden/android/commit/f1faa035ad6c19e7e8ebc388452e5928408ca260) [SG-601] Remove parameter from ScanPage - [`a08f8a6`](https://github.com/bitwarden/android/commit/a08f8a6b468d7042c9799945633b9443a8c51b0d) [SG-601] Move initialization to viewmodel - [`0772add`](https://github.com/bitwarden/android/commit/0772addd13b33e294bf5fec3ae51126ed0f00fcd) [SG-601] Fix zxing scanning bug - [`8a0dbdb`](https://github.com/bitwarden/android/commit/8a0dbdb492bd93521cbe636724c3b9fd730a493b) [SG-601] Move RunUIThread inside of method ### 📊 Changes **6 files changed** (+149 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `src/App/Pages/Vault/CipherAddEditPage.xaml.cs` (+1 -6) 📝 `src/App/Pages/Vault/ScanPage.xaml` (+3 -6) 📝 `src/App/Pages/Vault/ScanPage.xaml.cs` (+60 -11) 📝 `src/App/Pages/Vault/ScanPageViewModel.cs` (+71 -3) 📝 `src/App/Resources/AppResources.Designer.cs` (+11 -2) 📝 `src/App/Resources/AppResources.resx` (+3 -0) </details> ### 📄 Description ## Type of change - [ ] Bug fix - [x] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> When a user denies camera access for the QR code scan, they are neither prompted again nor are they given a modal that says ‘You must enable camera access…’ etc. when they tap the icon to add an authenticator code to an item that does not yet have one. This occurs in Prod as well; the camera icon/Set up TOTP buttons do not respond when selected if you have previously denied the setting.This poses an issue in the Authenticator UI because there is no way to manually add a new TOTP without accessing those screens, however, you can edit an existing one. Expected behavior: When the user has camera permissions turned off, clicking the “add new TOTP” button launches the “Enter Key Manually” mode. If the user then clicks the “scan QR Code” link (attempting to switch to camera mode) we show the user the dialog requesting camera permissions. ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> **ScanPage.xaml**: Changed ScannerView to a container. The scanner is only added if the user has permissions to use the camera. **ScanPage.xaml.cs**: Added couple of code protections agains a null scanner. Also added a command to init the scanner from the ViewModel. **ScanViewModel.cs**: When executing the ToggleScanModeCommand it now checks if the user has camera permissions. If not it will prompt the user to go to settings and enable them. If it has permissions tries to init the scanner if needed and changes the UI. ## Screenshots <!--Required for any UI changes. Delete if not applicable--> https://user-images.githubusercontent.com/4648522/204020241-c9501aa7-6569-4f4a-b9d1-e9fb83684f60.mov ## Before you submit - Please check for formatting errors (`dotnet format --verify-no-changes`) (required) - Please add **unit tests** where it makes sense to do so (encouraged but not required) - If this change requires a **documentation update** - notify the documentation team - If this change has particular **deployment requirements** - notify the DevOps team --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-26 23:32:38 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#3427