[PR #1662] [MERGED] [EC-528] Refactor Custom Fields into separate components #3039

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

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1662
Author: @fedemkr
Created: 11/26/2021
Status: Merged
Merged: 9/9/2022
Merged by: @fedemkr

Base: masterHead: refactor-custom-fields


📝 Commits (6)

  • f6c20ea Refactored CustomFields to stop using RepeaterView and use BindableLayout and divided the different types on different files and added a factory to create them
  • f7983ec Merge branch 'master' into refactor-custom-fields
  • eab18b5 Merge branch 'master' into refactor-custom-fields
  • 5ba6b22 Fix formatting
  • f896c78 Merge branch 'master' into refactor-custom-fields
  • ba5b634 Merge branch 'master' into refactor-custom-fields

📊 Changes

30 files changed (+912 additions, -449 deletions)

View changed files

📝 src/Android/MainApplication.cs (+8 -0)
📝 src/App/App.csproj (+13 -0)
📝 src/App/Controls/RepeaterView.cs (+3 -1)
src/App/Lists/DataTemplateSelectors/CustomFieldItemTemplateSelector.cs (+28 -0)
src/App/Lists/ItemLayouts/CustomFields/BooleanCustomFieldItemLayout.xaml (+71 -0)
src/App/Lists/ItemLayouts/CustomFields/BooleanCustomFieldItemLayout.xaml.cs (+12 -0)
src/App/Lists/ItemLayouts/CustomFields/HiddenCustomFieldItemLayout.xaml (+98 -0)
src/App/Lists/ItemLayouts/CustomFields/HiddenCustomFieldItemLayout.xaml.cs (+12 -0)
src/App/Lists/ItemLayouts/CustomFields/LinkedCustomFieldItemLayout.xaml (+61 -0)
src/App/Lists/ItemLayouts/CustomFields/LinkedCustomFieldItemLayout.xaml.cs (+12 -0)
src/App/Lists/ItemLayouts/CustomFields/TextCustomFieldItemLayout.xaml (+67 -0)
src/App/Lists/ItemLayouts/CustomFields/TextCustomFieldItemLayout.xaml.cs (+12 -0)
src/App/Lists/ItemViewModels/CustomFields/BaseCustomFieldItemViewModel.cs (+49 -0)
src/App/Lists/ItemViewModels/CustomFields/BooleanCustomFieldItemViewModel.cs (+23 -0)
src/App/Lists/ItemViewModels/CustomFields/CustomFieldItemFactory.cs (+53 -0)
src/App/Lists/ItemViewModels/CustomFields/HiddenCustomFieldItemViewModel.cs (+70 -0)
src/App/Lists/ItemViewModels/CustomFields/ICustomFieldItemViewModel.cs (+13 -0)
src/App/Lists/ItemViewModels/CustomFields/LinkedCustomFieldItemViewModel.cs (+70 -0)
src/App/Lists/ItemViewModels/CustomFields/TextCustomFieldItemViewModel.cs (+19 -0)
📝 src/App/Pages/Vault/BaseCipherViewModel.cs (+0 -1)

...and 10 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

Refactor custom fields to separate the different types on components to reuse them on the different views.

Code changes

  • ViewPage.xaml, AddEditPage.xaml: Replaced RepeaterView with StackLayout with BindableLayout in order to use the feature provided by Xamarin.Forms.
  • RepeaterView.cs: Marked as Obsolete because we should use a layout BindableLayout properties so that we take advantage of the power of Xamarin.Forms.
  • AppSetup.cs: Added this setup to configure things specifics to the App project, like registering services (this is called from both platforms Android and iOS).
  • ViewPageViewModel, AddEditPageViewModel: Replaced logic of the fields creation to use the new factory and the custom fields interface for the items. So that we have better control and scalability in case new field types are added.
  • IconGlyphExtensions.cs: Added this file in order to not rely only on the Converter to have the proper glyph, also added some enum to use to get the correct glyph when there are more than one for a given type, e.g. boolean we have for the eye and the checkbox
  • Lists: Added this folder on the App project in order to have a place to have list related things reused across the app.

Screenshots

Testing requirements

Regression test custom fields on edition and also when viewing them. The behavior should be the same as before

Before you submit

  • I have checked for formatting errors (dotnet tool run dotnet-format --check) (required)
  • 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/1662 **Author:** [@fedemkr](https://github.com/fedemkr) **Created:** 11/26/2021 **Status:** ✅ Merged **Merged:** 9/9/2022 **Merged by:** [@fedemkr](https://github.com/fedemkr) **Base:** `master` ← **Head:** `refactor-custom-fields` --- ### 📝 Commits (6) - [`f6c20ea`](https://github.com/bitwarden/android/commit/f6c20eaef14e9d9d402bcb2792ab609d769f2617) Refactored CustomFields to stop using RepeaterView and use BindableLayout and divided the different types on different files and added a factory to create them - [`f7983ec`](https://github.com/bitwarden/android/commit/f7983ec227fb93dee3ca02b186c11d02b015e8d0) Merge branch 'master' into refactor-custom-fields - [`eab18b5`](https://github.com/bitwarden/android/commit/eab18b59370161e9bc3318c5b807203c12102e02) Merge branch 'master' into refactor-custom-fields - [`5ba6b22`](https://github.com/bitwarden/android/commit/5ba6b22eabc5508ab1de0d58e990a00ca834170b) Fix formatting - [`f896c78`](https://github.com/bitwarden/android/commit/f896c7890fbe61fa0d0dd3481840922d5cdfcf1c) Merge branch 'master' into refactor-custom-fields - [`ba5b634`](https://github.com/bitwarden/android/commit/ba5b634a2d57ea15fbeed87006b86007f42c7fda) Merge branch 'master' into refactor-custom-fields ### 📊 Changes **30 files changed** (+912 additions, -449 deletions) <details> <summary>View changed files</summary> 📝 `src/Android/MainApplication.cs` (+8 -0) 📝 `src/App/App.csproj` (+13 -0) 📝 `src/App/Controls/RepeaterView.cs` (+3 -1) ➕ `src/App/Lists/DataTemplateSelectors/CustomFieldItemTemplateSelector.cs` (+28 -0) ➕ `src/App/Lists/ItemLayouts/CustomFields/BooleanCustomFieldItemLayout.xaml` (+71 -0) ➕ `src/App/Lists/ItemLayouts/CustomFields/BooleanCustomFieldItemLayout.xaml.cs` (+12 -0) ➕ `src/App/Lists/ItemLayouts/CustomFields/HiddenCustomFieldItemLayout.xaml` (+98 -0) ➕ `src/App/Lists/ItemLayouts/CustomFields/HiddenCustomFieldItemLayout.xaml.cs` (+12 -0) ➕ `src/App/Lists/ItemLayouts/CustomFields/LinkedCustomFieldItemLayout.xaml` (+61 -0) ➕ `src/App/Lists/ItemLayouts/CustomFields/LinkedCustomFieldItemLayout.xaml.cs` (+12 -0) ➕ `src/App/Lists/ItemLayouts/CustomFields/TextCustomFieldItemLayout.xaml` (+67 -0) ➕ `src/App/Lists/ItemLayouts/CustomFields/TextCustomFieldItemLayout.xaml.cs` (+12 -0) ➕ `src/App/Lists/ItemViewModels/CustomFields/BaseCustomFieldItemViewModel.cs` (+49 -0) ➕ `src/App/Lists/ItemViewModels/CustomFields/BooleanCustomFieldItemViewModel.cs` (+23 -0) ➕ `src/App/Lists/ItemViewModels/CustomFields/CustomFieldItemFactory.cs` (+53 -0) ➕ `src/App/Lists/ItemViewModels/CustomFields/HiddenCustomFieldItemViewModel.cs` (+70 -0) ➕ `src/App/Lists/ItemViewModels/CustomFields/ICustomFieldItemViewModel.cs` (+13 -0) ➕ `src/App/Lists/ItemViewModels/CustomFields/LinkedCustomFieldItemViewModel.cs` (+70 -0) ➕ `src/App/Lists/ItemViewModels/CustomFields/TextCustomFieldItemViewModel.cs` (+19 -0) 📝 `src/App/Pages/Vault/BaseCipherViewModel.cs` (+0 -1) _...and 10 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--> Refactor custom fields to separate the different types on components to reuse them on the different views. ## 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--> * **ViewPage.xaml, AddEditPage.xaml:** Replaced `RepeaterView` with `StackLayout` with `BindableLayout` in order to use the feature provided by Xamarin.Forms. * **RepeaterView.cs:** Marked as Obsolete because we should use a layout `BindableLayout` properties so that we take advantage of the power of Xamarin.Forms. * **AppSetup.cs:** Added this setup to configure things specifics to the `App` project, like registering services (this is called from both platforms Android and iOS). * **ViewPageViewModel, AddEditPageViewModel:** Replaced logic of the fields creation to use the new factory and the custom fields interface for the items. So that we have better control and scalability in case new field types are added. * **IconGlyphExtensions.cs:** Added this file in order to not rely only on the Converter to have the proper glyph, also added some enum to use to get the correct glyph when there are more than one for a given type, e.g. boolean we have for the `eye` and the `checkbox` * **Lists:** Added this folder on the `App` project in order to have a place to have list related things reused across the app. ## Screenshots <!--Required for any UI changes. Delete if not applicable--> ## Testing requirements <!--What functionality requires testing by QA? This includes testing new behavior and regression testing--> Regression test custom fields on edition and also when viewing them. The behavior should be the same as before ## Before you submit - [X] I have checked for formatting errors (`dotnet tool run dotnet-format --check`) (required) - [ ] 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:27:29 -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#3039