[PR #1912] [CLOSED] Feature/allow screenshots #3215

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

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1912
Author: @darochapires
Created: 5/19/2022
Status: Closed

Base: masterHead: feature/allow_screenshots


📝 Commits (6)

  • 3f4df57 option to allow screenshot in settings on the Android app
  • 2ff1364 naming refactor and code cleanup
  • e0eeca9 fix screenCaptureAllowed item add and change state
  • 0e6ba05 Merge branch 'master' into feature/allow_screenshots
  • 21bd893 Merge branch 'bitwarden:master' into feature/allow_screenshots
  • 0107306 Merge branch 'master' into feature/allow_screen_capture

📊 Changes

12 files changed (+91 additions, -7 deletions)

View changed files

📝 src/Android/MainActivity.cs (+3 -5)
📝 src/Android/Services/DeviceActionService.cs (+13 -0)
📝 src/App/Abstractions/IDeviceActionService.cs (+1 -0)
📝 src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs (+4 -0)
📝 src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs (+23 -0)
📝 src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs (+2 -0)
📝 src/App/Resources/AppResources.Designer.cs (+11 -2)
📝 src/Core/Abstractions/IStateService.cs (+2 -0)
📝 src/Core/Models/Domain/Account.cs (+2 -0)
📝 src/Core/Services/StateMigrationService.cs (+3 -0)
📝 src/Core/Services/StateService.cs (+21 -0)
📝 src/iOS.Core/Services/DeviceActionService.cs (+6 -0)

📄 Description

Feature name:
Allow Screen Capture

Feature Description:
This feature was requested by the community: https://community.bitwarden.com/t/option-to-allow-screenshots/317
It only concerns Android platform
I added a toggle on the setting page that enables/disables the possibility to capture the screen, either by screen sharing, screenshots or screen recording.

Clients / Repos Affected:
Mobile

Timeline to completion (estimate):
One week

Type of change

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

Objective

Code changes

  • Created an async Task on IDeviceActionService, called SetScreenCaptureAllowedAsync. On Android, it adds/removes the secure flag in order to allow/prevent screen capturing. On iOS, it does nothing.
  • On Android, SetScreenCaptureAllowedAsync is called on MainActivity in OnCreate. Since this is an async Task, I had to make OnCreate async.
  • On SettingsPageViewModel, I'm checking if the app is running on Android and, if so, add a new item to securityItems that toggles the allow screen capture feature.
  • Since the app supports multiple accounts, added the flag ScreenCaptureAllowed to the Account model to save the state for each account. The state is saved and loaded on StateService and StateMigrationService.
  • I'm calling _deviceActionService.SetScreenCaptureAllowedAsync() on GroupingsPageViewModel LoadAsync to keep consistency.
  • Added a static method on AppResources.Designer that returns the string "Allow Screen Capture", that will be used to display the item in the respective page. I left a TODO there to add this string to the resources. Please help me on this task.
  • Also tested iOS to make sure it didn't suffer any change from the code updates.

Screenshots

Screenshot1

Before you submit

  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • 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/1912 **Author:** [@darochapires](https://github.com/darochapires) **Created:** 5/19/2022 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feature/allow_screenshots` --- ### 📝 Commits (6) - [`3f4df57`](https://github.com/bitwarden/android/commit/3f4df571d0d0a80af354388b8dfc6159b6c27e5f) option to allow screenshot in settings on the Android app - [`2ff1364`](https://github.com/bitwarden/android/commit/2ff13645a9924f19f74ef9927e09a55366510396) naming refactor and code cleanup - [`e0eeca9`](https://github.com/bitwarden/android/commit/e0eeca98e74df981cba7deab941309815a1cae0c) fix screenCaptureAllowed item add and change state - [`0e6ba05`](https://github.com/bitwarden/android/commit/0e6ba05832e96efee9f0ec6bd456b7174e235240) Merge branch 'master' into feature/allow_screenshots - [`21bd893`](https://github.com/bitwarden/android/commit/21bd893f92d80f897e5c1e1ad970d24ff101be8c) Merge branch 'bitwarden:master' into feature/allow_screenshots - [`0107306`](https://github.com/bitwarden/android/commit/01073060fbc2ec9ffc8d02ec1c91aebdf4a8733d) Merge branch 'master' into feature/allow_screen_capture ### 📊 Changes **12 files changed** (+91 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/Android/MainActivity.cs` (+3 -5) 📝 `src/Android/Services/DeviceActionService.cs` (+13 -0) 📝 `src/App/Abstractions/IDeviceActionService.cs` (+1 -0) 📝 `src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs` (+4 -0) 📝 `src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs` (+23 -0) 📝 `src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs` (+2 -0) 📝 `src/App/Resources/AppResources.Designer.cs` (+11 -2) 📝 `src/Core/Abstractions/IStateService.cs` (+2 -0) 📝 `src/Core/Models/Domain/Account.cs` (+2 -0) 📝 `src/Core/Services/StateMigrationService.cs` (+3 -0) 📝 `src/Core/Services/StateService.cs` (+21 -0) 📝 `src/iOS.Core/Services/DeviceActionService.cs` (+6 -0) </details> ### 📄 Description Feature name: Allow Screen Capture Feature Description: This feature was requested by the community: https://community.bitwarden.com/t/option-to-allow-screenshots/317 It only concerns Android platform I added a toggle on the setting page that enables/disables the possibility to capture the screen, either by screen sharing, screenshots or screen recording. Clients / Repos Affected: Mobile Timeline to completion (estimate): One week ## Type of change - [ ] Bug fix - [x] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective - This feature was requested by the community: https://community.bitwarden.com/t/option-to-allow-screenshots/317 - It only concerns Android platform - Added a toggle on the setting page that enables/disables the possibility to capture the screen, either by screen sharing, screenshots or screen recording ## 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--> - Created an async `Task` on `IDeviceActionService`, called `SetScreenCaptureAllowedAsync`. On Android, it adds/removes the secure flag in order to allow/prevent screen capturing. On iOS, it does nothing. - On Android, `SetScreenCaptureAllowedAsync` is called on `MainActivity` in `OnCreate`. Since this is an `async Task`, I had to make `OnCreate` `async`. - On `SettingsPageViewModel`, I'm checking if the app is running on Android and, if so, add a new item to `securityItems` that toggles the allow screen capture feature. - Since the app supports multiple accounts, added the flag `ScreenCaptureAllowed` to the `Account` model to save the state for each account. The state is saved and loaded on `StateService` and `StateMigrationService`. - I'm calling `_deviceActionService.SetScreenCaptureAllowedAsync()` on `GroupingsPageViewModel` `LoadAsync` to keep consistency. - Added a static method on `AppResources.Designer` that returns the string "Allow Screen Capture", that will be used to display the item in the respective page. I left a `TODO` there to add this string to the resources. Please help me on this task. - Also tested iOS to make sure it didn't suffer any change from the code updates. ## Screenshots <!--Required for any UI changes. Delete if not applicable--> ![Screenshot1](https://user-images.githubusercontent.com/3696035/169279194-46f58f7d-8976-4913-95d4-d15c543a3cbc.png) ## Before you submit - [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required) - [ ] This change requires a **documentation update** (notify the documentation team) - [ ] 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:29:47 -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#3215