Commit da235e2
authored
SERP Settings Sync: Add event when Duck Ai setting changed (#7052)
Task/Issue URL:
https://app.asana.com/1/137249556945/project/1207908166761516/task/1211756086814103?focus=true
### Description
Added support for sending subscription events to ContentScopeScripts.
This enables real-time updates to the SERP settings when DuckChat
settings change. The implementation includes:
- Created a new `ContentScopeScriptsSubscriptionEventPlugin` interface
to allow features to provide subscription event data
- Added a plugin point for subscription event plugins
- Implemented a DuckChat-specific plugin that sends the enabled state to
Content Scope Scripts
- Added subscription event channels and flows in both
BrowserTabViewModel and SettingsWebViewViewModel
- Set up observers in BrowserTabFragment and SettingsWebViewActivity to
send events to Content Scope Scripts
### Steps to test this PR
_DuckChat Settings Sync_ _from_ _Browser_
- [x] Enable `serpSettingsSync` feature toggle
- [x] Do a search e.g. "FPL"
- [x] Open Settings -> AI Features
- [x] Disable/enable Duck.AI
- [x] Navigate back to SERP
- [x] Verify that the subscription event is sent to Content Scope
Scripts (check logs for "SERP-Settings: Sending subscription event
data") with the correct state
- [x] Open Settings -> AI Features
- [x] Disable/enable Duck.AI
- [x] Verify that the subscription event is sent to Content Scope
Scripts (check logs for "SERP-Settings: Sending subscription event
data") with the correct state
_DuckChat Settings Sync_ _from_ _SettingsWebView_
- [x] Enable `serpSettingsSync` feature toggle
- [x] Open Settings -> AI Features
- [x] Note the current state of Duck.AI
- [x] Click "Search Assist Settings"
- [x] Press back
- [x] Verify that the subscription event is sent to Content Scope
Scripts (check logs for "SERP-Settings: Sending subscription event
data") with the correct state
- [x] Disable/enable Duck.AI
- [x] Click "Search Assist Settings"
- [x] Press back
- [x] Verify that the subscription event is sent to Content Scope
Scripts (check logs for "SERP-Settings: Sending subscription event
data") with the correct state
### UI changes
N/A1 parent 9d09622 commit da235e2
File tree
11 files changed
+386
-61
lines changed- app/src
- androidTest/java/com/duckduckgo/app/browser
- main/java/com/duckduckgo/app/browser
- test/java/com/duckduckgo/app/browser
- content-scope-scripts
- content-scope-scripts-api/src/main/java/com/duckduckgo/contentscopescripts/api
- content-scope-scripts-impl/src/main/java/com/duckduckgo/contentscopescripts/impl
- duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/settings
- settings/settings-impl/src
- main/java/com/duckduckgo/settings/impl
- test/java/com/duckduckgo/settings/impl
11 files changed
+386
-61
lines changedLines changed: 87 additions & 53 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
| 237 | + | |
236 | 238 | | |
237 | 239 | | |
238 | 240 | | |
| |||
259 | 261 | | |
260 | 262 | | |
261 | 263 | | |
262 | | - | |
263 | 264 | | |
264 | | - | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | 266 | | |
269 | 267 | | |
270 | 268 | | |
| |||
290 | 288 | | |
291 | 289 | | |
292 | 290 | | |
| 291 | + | |
293 | 292 | | |
294 | 293 | | |
295 | 294 | | |
| |||
619 | 618 | | |
620 | 619 | | |
621 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
622 | 624 | | |
623 | 625 | | |
624 | 626 | | |
| |||
758 | 760 | | |
759 | 761 | | |
760 | 762 | | |
| 763 | + | |
| 764 | + | |
761 | 765 | | |
762 | 766 | | |
763 | 767 | | |
| |||
849 | 853 | | |
850 | 854 | | |
851 | 855 | | |
| 856 | + | |
| 857 | + | |
852 | 858 | | |
853 | 859 | | |
854 | 860 | | |
| |||
7874 | 7880 | | |
7875 | 7881 | | |
7876 | 7882 | | |
7877 | | - | |
7878 | | - | |
7879 | | - | |
7880 | | - | |
7881 | | - | |
7882 | | - | |
7883 | | - | |
7884 | | - | |
7885 | | - | |
| 7883 | + | |
| 7884 | + | |
| 7885 | + | |
| 7886 | + | |
7886 | 7887 | | |
7887 | 7888 | | |
7888 | | - | |
7889 | | - | |
7890 | | - | |
| 7889 | + | |
7891 | 7890 | | |
7892 | | - | |
| 7891 | + | |
| 7892 | + | |
| 7893 | + | |
| 7894 | + | |
| 7895 | + | |
| 7896 | + | |
| 7897 | + | |
7893 | 7898 | | |
7894 | 7899 | | |
7895 | | - | |
7896 | | - | |
7897 | | - | |
| 7900 | + | |
| 7901 | + | |
| 7902 | + | |
7898 | 7903 | | |
7899 | | - | |
7900 | | - | |
7901 | | - | |
| 7904 | + | |
7902 | 7905 | | |
7903 | | - | |
7904 | | - | |
7905 | | - | |
7906 | | - | |
7907 | | - | |
| 7906 | + | |
| 7907 | + | |
| 7908 | + | |
7908 | 7909 | | |
| 7910 | + | |
7909 | 7911 | | |
7910 | | - | |
7911 | | - | |
7912 | | - | |
7913 | | - | |
| 7912 | + | |
| 7913 | + | |
| 7914 | + | |
| 7915 | + | |
| 7916 | + | |
| 7917 | + | |
| 7918 | + | |
| 7919 | + | |
| 7920 | + | |
| 7921 | + | |
| 7922 | + | |
| 7923 | + | |
| 7924 | + | |
| 7925 | + | |
| 7926 | + | |
| 7927 | + | |
| 7928 | + | |
| 7929 | + | |
7914 | 7930 | | |
7915 | 7931 | | |
7916 | | - | |
7917 | | - | |
7918 | | - | |
| 7932 | + | |
| 7933 | + | |
| 7934 | + | |
7919 | 7935 | | |
7920 | | - | |
7921 | | - | |
| 7936 | + | |
7922 | 7937 | | |
7923 | | - | |
| 7938 | + | |
| 7939 | + | |
| 7940 | + | |
| 7941 | + | |
| 7942 | + | |
| 7943 | + | |
| 7944 | + | |
| 7945 | + | |
| 7946 | + | |
7924 | 7947 | | |
7925 | 7948 | | |
7926 | | - | |
7927 | | - | |
7928 | | - | |
7929 | | - | |
7930 | | - | |
7931 | | - | |
7932 | | - | |
7933 | | - | |
7934 | | - | |
| 7949 | + | |
| 7950 | + | |
| 7951 | + | |
| 7952 | + | |
| 7953 | + | |
| 7954 | + | |
| 7955 | + | |
| 7956 | + | |
| 7957 | + | |
| 7958 | + | |
| 7959 | + | |
| 7960 | + | |
| 7961 | + | |
| 7962 | + | |
| 7963 | + | |
| 7964 | + | |
| 7965 | + | |
| 7966 | + | |
7935 | 7967 | | |
7936 | 7968 | | |
7937 | | - | |
7938 | | - | |
7939 | | - | |
| 7969 | + | |
| 7970 | + | |
| 7971 | + | |
7940 | 7972 | | |
7941 | | - | |
7942 | | - | |
| 7973 | + | |
7943 | 7974 | | |
7944 | | - | |
| 7975 | + | |
| 7976 | + | |
| 7977 | + | |
| 7978 | + | |
7945 | 7979 | | |
7946 | 7980 | | |
7947 | 7981 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
992 | 992 | | |
993 | 993 | | |
994 | 994 | | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
995 | 1004 | | |
996 | 1005 | | |
997 | 1006 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| 311 | + | |
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
| |||
323 | 324 | | |
324 | 325 | | |
325 | 326 | | |
| 327 | + | |
326 | 328 | | |
327 | 329 | | |
328 | 330 | | |
| |||
350 | 352 | | |
351 | 353 | | |
352 | 354 | | |
| 355 | + | |
353 | 356 | | |
354 | 357 | | |
355 | 358 | | |
| |||
365 | 368 | | |
366 | 369 | | |
367 | 370 | | |
| 371 | + | |
368 | 372 | | |
369 | 373 | | |
370 | 374 | | |
| |||
383 | 387 | | |
384 | 388 | | |
385 | 389 | | |
| 390 | + | |
386 | 391 | | |
387 | 392 | | |
388 | 393 | | |
| |||
490 | 495 | | |
491 | 496 | | |
492 | 497 | | |
| 498 | + | |
| 499 | + | |
493 | 500 | | |
494 | 501 | | |
495 | 502 | | |
| |||
539 | 546 | | |
540 | 547 | | |
541 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
542 | 552 | | |
543 | 553 | | |
544 | 554 | | |
| |||
941 | 951 | | |
942 | 952 | | |
943 | 953 | | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
944 | 962 | | |
945 | 963 | | |
946 | 964 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
| |||
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
105 | | - | |
106 | 104 | | |
107 | 105 | | |
108 | 106 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
100 | | - | |
101 | | - | |
102 | 99 | | |
103 | 100 | | |
104 | 101 | | |
| |||
535 | 532 | | |
536 | 533 | | |
537 | 534 | | |
538 | | - | |
539 | 535 | | |
540 | 536 | | |
541 | 537 | | |
| |||
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
0 commit comments