Commit 1de00fc
committed
Refactor CredentialManager to use CipherListView and CipherMatchingManager
This commit refactors `BitwardenCredentialManagerImpl` and its tests to utilize `CipherListView` objects directly for credential retrieval and matching, instead of relying on `AutofillCipherProvider`.
Key changes:
- `BitwardenCredentialManagerImpl` now uses `CipherMatchingManager` to filter `CipherListViews` based on the calling app's package name.
- The `getCredentialEntries` method in `BitwardenCredentialManagerImpl` has been updated to fetch and filter `CipherListViews` from `VaultRepository`.
- `CredentialEntryBuilder` and its implementation now accept `List<CipherListView>` instead of `List<AutofillCipher.Login>` for building password credential entries.
- The `AutofillCipherProvider` dependency has been removed from `BitwardenCredentialManagerImpl` and `CredentialProviderModule`.
- Introduced `isActiveWithCopyablePassword` extension for `CipherListView`.
- Tests for `BitwardenCredentialManagerImpl`, `CredentialEntryBuilderTest`, and related ViewModels have been updated to reflect these changes, including mocking `CipherMatchingManager` and providing `CipherListView` instances.
- Updated `createMockProviderGetPasswordCredentialRequest` to accept a number parameter for easier test data generation.
- Minor adjustments in test helpers and mock object creation to align with the refactoring.
- `VaultItemListingViewModel` now checks `CipherListView.reprompt` before fetching the full `CipherView` for password credential requests. An error is now sent if the `CipherListView` is not found.1 parent cc56505 commit 1de00fc
File tree
15 files changed
+587
-254
lines changed- app/src
- main/kotlin/com/x8bit/bitwarden
- data
- autofill/util
- credentials
- builder
- di
- manager
- ui/vault/feature/itemlisting
- test/kotlin/com/x8bit/bitwarden
- data
- credentials
- builder
- manager
- model
- platform/manager/util
- vault/datasource/sdk/model
- ui
- vault/feature
- addedit/util
- itemlisting
15 files changed
+587
-254
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | | - | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
112 | | - | |
| 113 | + | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
117 | | - | |
| 119 | + | |
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
app/src/main/kotlin/com/x8bit/bitwarden/data/credentials/manager/BitwardenCredentialManagerImpl.kt
Lines changed: 22 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
176 | | - | |
| 178 | + | |
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
| |||
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
185 | | - | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
193 | 195 | | |
194 | 196 | | |
195 | 197 | | |
196 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
197 | 202 | | |
198 | 203 | | |
199 | 204 | | |
| |||
202 | 207 | | |
203 | 208 | | |
204 | 209 | | |
205 | | - | |
| 210 | + | |
| 211 | + | |
206 | 212 | | |
207 | 213 | | |
208 | 214 | | |
| |||
231 | 237 | | |
232 | 238 | | |
233 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
234 | 246 | | |
235 | 247 | | |
236 | 248 | | |
| |||
262 | 274 | | |
263 | 275 | | |
264 | 276 | | |
265 | | - | |
266 | | - | |
| 277 | + | |
267 | 278 | | |
268 | 279 | | |
269 | 280 | | |
| |||
364 | 375 | | |
365 | 376 | | |
366 | 377 | | |
367 | | - | |
| 378 | + | |
368 | 379 | | |
369 | | - | |
| 380 | + | |
370 | 381 | | |
371 | 382 | | |
372 | 383 | | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | 384 | | |
378 | 385 | | |
379 | 386 | | |
380 | | - | |
| 387 | + | |
381 | 388 | | |
382 | 389 | | |
383 | 390 | | |
| |||
Lines changed: 23 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2182 | 2182 | | |
2183 | 2183 | | |
2184 | 2184 | | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
2185 | 2203 | | |
2186 | 2204 | | |
2187 | 2205 | | |
2188 | 2206 | | |
2189 | | - | |
2190 | | - | |
2191 | | - | |
2192 | | - | |
2193 | | - | |
2194 | | - | |
2195 | | - | |
2196 | | - | |
2197 | | - | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
2198 | 2210 | | |
2199 | 2211 | | |
2200 | 2212 | | |
| |||
2209 | 2221 | | |
2210 | 2222 | | |
2211 | 2223 | | |
2212 | | - | |
2213 | | - | |
| 2224 | + | |
| 2225 | + | |
2214 | 2226 | | |
2215 | 2227 | | |
2216 | 2228 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
812 | 812 | | |
813 | 813 | | |
814 | 814 | | |
815 | | - | |
| 815 | + | |
816 | 816 | | |
817 | 817 | | |
818 | 818 | | |
| |||
0 commit comments