[PR #2081] [MERGED] [EC-519] Refactor Split DeviceActionService #33840

Closed
opened 2026-04-21 01:33:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/2081
Author: @fedemkr
Created: 9/16/2022
Status: Merged
Merged: 10/11/2022
Merged by: @fedemkr

Base: masterHead: EC-519-split-device-action-service


📝 Commits (7)

  • 63133b7 EC-519 Refactored IDeviceActionService to be split into IFileService and IAutofillManager also some cleanups were made
  • e770437 Merge branch 'master' into EC-519-split-device-action-service
  • ee2607e EC-519 Fix format
  • 7d92216 Merge branch 'master' into EC-519-split-device-action-service
  • d16edb8 EC-519 Fix merge to use the new AutofillHandler
  • 56be577 Merge branch 'master' into EC-519-split-device-action-service
  • aedd2a7 Merge branch 'master' into EC-519-split-device-action-service

📊 Changes

35 files changed (+883 additions, -798 deletions)

View changed files

📝 src/Android/Android.csproj (+2 -0)
📝 src/Android/MainActivity.cs (+3 -1)
📝 src/Android/MainApplication.cs (+5 -2)
src/Android/Services/AutofillHandler.cs (+210 -0)
📝 src/Android/Services/DeviceActionService.cs (+1 -454)
src/Android/Services/FileService.cs (+278 -0)
📝 src/App/Abstractions/IDeviceActionService.cs (+11 -24)
📝 src/App/App.xaml.cs (+3 -1)
📝 src/App/Pages/Send/SendAddEditPageViewModel.cs (+3 -1)
📝 src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs (+1 -1)
📝 src/App/Pages/Settings/AutofillServicesPageViewModel.cs (+7 -5)
📝 src/App/Pages/Settings/ExportVaultPageViewModel.cs (+4 -2)
📝 src/App/Pages/Settings/OptionsPage.xaml.cs (+4 -3)
📝 src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs (+4 -2)
📝 src/App/Pages/Vault/AttachmentsPageViewModel.cs (+3 -1)
📝 src/App/Pages/Vault/AutofillCiphersPageViewModel.cs (+3 -1)
📝 src/App/Pages/Vault/BaseCipherViewModel.cs (+2 -0)
📝 src/App/Pages/Vault/CipherAddEditPage.xaml.cs (+4 -2)
📝 src/App/Pages/Vault/CipherAddEditPageViewModel.cs (+3 -1)
📝 src/App/Pages/Vault/CipherDetailsPageViewModel.cs (+4 -4)

...and 15 more files

📄 Description

Type of change

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

Objective

Split DeviceActionService given that now it's doing a lot of different stuff. In this PR it's going to be split into IFileService and IAutofillService.

Code changes

  • IDeviceActionService.cs, DeviceActionService.cs: Moved away files and autofill related stuff to the new services. Also deleted Background() method that was not being used and it's purpose wasn't clear and also deleted HasAutofillService() given that we can use the method SupportsAutofillService(). Also reorder method on interface to be grouped by functionality
  • IAutofillHandler.cs, AutofillHandler.cs: New service to handle autofill related things. I couldn't use Service or Manager because there are already classes with those names.
  • IFileService.cs, FileService.cs: New service to handle file related things
  • IPlatformUtilsService.cs, MobilePlatformUtilsService.cs: Removed IsDev() and SaveFile() they weren't being used
  • MainApplication.cs: Register new services
  • iOSCoreHelpers.cs: Register new services
  • LazyResolve.cs: Added constructor that doesn't need the string key to resolve
  • UIViewControllerExtensions.cs: Added this to use GetVisibleViewController() as an extension method or static call
  • SendGroupingsPageViewModel.cs: Changed to use Xamarin.Forms runtime platform check
  • GroupingsPageViewModel.cs: Changed to use Xamarin.Forms runtime platform check

Replaced DeviceActionService with FileService:

  • MainActivity.cs: Replaced DeviceActionService with FileService
  • App.xaml.cs: Replaced DeviceActionService with FileService
  • SendAddEditPageViewModel.cs: Replaced DeviceActionService with FileService
  • ExportVaultPageViewModel.cs: Replaced DeviceActionService with FileService
  • AttachmentsPageViewModel.cs: Replaced DeviceActionService with FileService
  • BaseCipherViewModel.cs: Replaced DeviceActionService with FileService
  • CipherDetailsPageViewModel.cs: Replaced DeviceActionService with FileService
  • AppHelpers.cs: Replaced DeviceActionService with FileService

Replaced DeviceActionService with AutofillHandler

  • AutofillServicesPageViewModel.cs: Replaced DeviceActionService with AutofillHandler
  • OptionsPage.xaml.cs: Replaced DeviceActionService with AutofillHandler
  • SettingsPageViewModel.cs: Replaced DeviceActionService with AutofillHandler and changed to use Xamarin.Forms runtime platform check
  • AutofillCiphersPageViewModel.cs: Replaced DeviceActionService with AutofillHandler
  • CipherAddEditPage.xaml.cs: Replaced DeviceActionService with AutofillHandler
  • CipherAddEditPageViewModel.cs: Replaced DeviceActionService with AutofillHandler
  • CiphersPage.xaml.cs: Replaced DeviceActionService with AutofillHandler
  • CiphersPageViewModel.cs: Replaced DeviceActionService with AutofillHandler

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/2081 **Author:** [@fedemkr](https://github.com/fedemkr) **Created:** 9/16/2022 **Status:** ✅ Merged **Merged:** 10/11/2022 **Merged by:** [@fedemkr](https://github.com/fedemkr) **Base:** `master` ← **Head:** `EC-519-split-device-action-service` --- ### 📝 Commits (7) - [`63133b7`](https://github.com/bitwarden/android/commit/63133b7f9f1578bb45ad5b649c6323e79cb6c8ba) EC-519 Refactored IDeviceActionService to be split into IFileService and IAutofillManager also some cleanups were made - [`e770437`](https://github.com/bitwarden/android/commit/e7704377c082e02b1d97e36ec07b6fe0185211b2) Merge branch 'master' into EC-519-split-device-action-service - [`ee2607e`](https://github.com/bitwarden/android/commit/ee2607efcca8d5e6507d4b28d47319673735c166) EC-519 Fix format - [`7d92216`](https://github.com/bitwarden/android/commit/7d92216dbba50d2d0d5c777ab43834d3d17a9ff0) Merge branch 'master' into EC-519-split-device-action-service - [`d16edb8`](https://github.com/bitwarden/android/commit/d16edb8081b0f7663b5e3242de6c4a0c18f23088) EC-519 Fix merge to use the new AutofillHandler - [`56be577`](https://github.com/bitwarden/android/commit/56be5774ae032ecebcc13c71dba38aed89c01965) Merge branch 'master' into EC-519-split-device-action-service - [`aedd2a7`](https://github.com/bitwarden/android/commit/aedd2a7964ef956f98bc7e98d0122adfa62e4ed7) Merge branch 'master' into EC-519-split-device-action-service ### 📊 Changes **35 files changed** (+883 additions, -798 deletions) <details> <summary>View changed files</summary> 📝 `src/Android/Android.csproj` (+2 -0) 📝 `src/Android/MainActivity.cs` (+3 -1) 📝 `src/Android/MainApplication.cs` (+5 -2) ➕ `src/Android/Services/AutofillHandler.cs` (+210 -0) 📝 `src/Android/Services/DeviceActionService.cs` (+1 -454) ➕ `src/Android/Services/FileService.cs` (+278 -0) 📝 `src/App/Abstractions/IDeviceActionService.cs` (+11 -24) 📝 `src/App/App.xaml.cs` (+3 -1) 📝 `src/App/Pages/Send/SendAddEditPageViewModel.cs` (+3 -1) 📝 `src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs` (+1 -1) 📝 `src/App/Pages/Settings/AutofillServicesPageViewModel.cs` (+7 -5) 📝 `src/App/Pages/Settings/ExportVaultPageViewModel.cs` (+4 -2) 📝 `src/App/Pages/Settings/OptionsPage.xaml.cs` (+4 -3) 📝 `src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs` (+4 -2) 📝 `src/App/Pages/Vault/AttachmentsPageViewModel.cs` (+3 -1) 📝 `src/App/Pages/Vault/AutofillCiphersPageViewModel.cs` (+3 -1) 📝 `src/App/Pages/Vault/BaseCipherViewModel.cs` (+2 -0) 📝 `src/App/Pages/Vault/CipherAddEditPage.xaml.cs` (+4 -2) 📝 `src/App/Pages/Vault/CipherAddEditPageViewModel.cs` (+3 -1) 📝 `src/App/Pages/Vault/CipherDetailsPageViewModel.cs` (+4 -4) _...and 15 more files_ </details> ### 📄 Description ## Type of change - [ ] Bug fix - [ ] New feature development - [X] 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--> Split `DeviceActionService` given that now it's doing a lot of different stuff. In this PR it's going to be split into `IFileService` and `IAutofillService`. ## 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--> * **IDeviceActionService.cs, DeviceActionService.cs:** Moved away files and autofill related stuff to the new services. Also deleted `Background()` method that was not being used and it's purpose wasn't clear and also deleted `HasAutofillService()` given that we can use the method `SupportsAutofillService()`. Also reorder method on interface to be grouped by functionality * **IAutofillHandler.cs, AutofillHandler.cs:** New service to handle autofill related things. I couldn't use `Service` or `Manager` because there are already classes with those names. * **IFileService.cs, FileService.cs:** New service to handle file related things * **IPlatformUtilsService.cs, MobilePlatformUtilsService.cs:** Removed `IsDev()` and `SaveFile()` they weren't being used * **MainApplication.cs:** Register new services * **iOSCoreHelpers.cs:** Register new services * **LazyResolve.cs:** Added constructor that doesn't need the string key to resolve * **UIViewControllerExtensions.cs:** Added this to use `GetVisibleViewController()` as an extension method or static call * **SendGroupingsPageViewModel.cs:** Changed to use Xamarin.Forms runtime platform check * **GroupingsPageViewModel.cs:** Changed to use Xamarin.Forms runtime platform check Replaced `DeviceActionService` with `FileService`: * **MainActivity.cs:** Replaced `DeviceActionService` with `FileService` * **App.xaml.cs:** Replaced `DeviceActionService` with `FileService` * **SendAddEditPageViewModel.cs:** Replaced `DeviceActionService` with `FileService` * **ExportVaultPageViewModel.cs:** Replaced `DeviceActionService` with `FileService` * **AttachmentsPageViewModel.cs:** Replaced `DeviceActionService` with `FileService` * **BaseCipherViewModel.cs:** Replaced `DeviceActionService` with `FileService` * **CipherDetailsPageViewModel.cs:** Replaced `DeviceActionService` with `FileService` * **AppHelpers.cs:** Replaced `DeviceActionService` with `FileService` Replaced `DeviceActionService` with `AutofillHandler` * **AutofillServicesPageViewModel.cs:** Replaced `DeviceActionService` with `AutofillHandler` * **OptionsPage.xaml.cs:** Replaced `DeviceActionService` with `AutofillHandler` * **SettingsPageViewModel.cs:** Replaced `DeviceActionService` with `AutofillHandler` and changed to use Xamarin.Forms runtime platform check * **AutofillCiphersPageViewModel.cs:** Replaced `DeviceActionService` with `AutofillHandler` * **CipherAddEditPage.xaml.cs:** Replaced `DeviceActionService` with `AutofillHandler` * **CipherAddEditPageViewModel.cs:** Replaced `DeviceActionService` with `AutofillHandler` * **CiphersPage.xaml.cs:** Replaced `DeviceActionService` with `AutofillHandler` * **CiphersPageViewModel.cs:** Replaced `DeviceActionService` with `AutofillHandler` ## 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 2026-04-21 01:33:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#33840