Skip to content

Add DebounceService for iOS #20315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 6, 2024
Merged

Add DebounceService for iOS #20315

merged 2 commits into from
Feb 6, 2024

Conversation

cuba
Copy link
Contributor

@cuba cuba commented Sep 27, 2023

Resolves brave/brave-browser#33275

Expose the debounce service to iOS. In order to do this a couple of things had to be done:

  1. Separate core and common debounce component code so only the usable parts are exposed to iOS
  2. Create a debounce service factory for iOS
  3. Create a iOS objc API interface for iOS

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@cuba cuba requested review from a team as code owners September 27, 2023 16:45
@github-actions github-actions bot added the potential-layer-violation-fixes This PR touches a BUILD.gn file with check_includes=false label Sep 27, 2023
@cuba cuba force-pushed the js/debounce-service branch from 64bb790 to a808318 Compare September 28, 2023 23:02
@cuba cuba force-pushed the js/debounce-service branch from 8daf5b4 to 370617d Compare October 12, 2023 21:21
@cuba cuba requested a review from a team as a code owner October 12, 2023 21:21
@cuba cuba requested a review from kylehickinson October 12, 2023 21:35
@cuba cuba force-pushed the js/debounce-service branch 4 times, most recently from dc5399b to 2c8dcb8 Compare October 17, 2023 18:12
@cuba cuba requested a review from a team as a code owner October 17, 2023 18:13
@cuba cuba force-pushed the js/debounce-service branch from 2c8dcb8 to f682ca7 Compare October 17, 2023 18:47
@cuba cuba force-pushed the js/debounce-service branch from f682ca7 to 4c0cbef Compare November 27, 2023 22:02
@cuba cuba force-pushed the js/debounce-service branch from 4c0cbef to 7c5571f Compare November 28, 2023 19:57
#include "ios/chrome/browser/shared/model/application_context/application_context.h"
#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h"

@implementation DeAmpPrefs {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we just expose a generic interface to prefs? cc @Brandon-T

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed along other examples we had but I agree some generic approach would be perhaps nicer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we look at this in a follow-up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think it's a good idea. But while I opened up some discussion around a generic approach there was no conclusive decision about this. Im willing to re-open this discussion more openly.

@cuba cuba force-pushed the js/debounce-service branch 2 times, most recently from 8b71172 to ea66282 Compare November 28, 2023 21:29
@cuba cuba force-pushed the js/debounce-service branch from ea66282 to 670cd70 Compare December 8, 2023 16:04
Copy link
Collaborator

@kylehickinson kylehickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS++

@rillian rillian removed their request for review December 11, 2023 18:49
@cuba cuba requested a review from rillian December 12, 2023 17:21
@cuba cuba force-pushed the js/debounce-service branch from dd11f33 to b4dd7a9 Compare January 9, 2024 18:10
@github-actions github-actions bot added the CI/run-upstream-tests Run upstream unit and browser tests on Linux and Windows (otherwise only on Linux) label Jan 9, 2024
@cuba cuba force-pushed the js/debounce-service branch 2 times, most recently from 5ed4d71 to 0e57c39 Compare January 9, 2024 18:59
@rillian rillian removed their request for review January 9, 2024 21:01
@@ -0,0 +1,3 @@
include_rules = [
"+content/public/browser",
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline here. I recommend configuring your editor to always add it

@cuba cuba force-pushed the js/debounce-service branch 2 times, most recently from 3395336 to 65d65ed Compare January 10, 2024 22:16
@cuba
Copy link
Contributor Author

cuba commented Jan 10, 2024

@bridiver I removed a bunch of unneeded imports. But as stated is there a mechanism in which I can detect unused imports or is it just a manual process of cross referencing imports with code usage?

@cuba cuba force-pushed the js/debounce-service branch 4 times, most recently from efea717 to 9fcae42 Compare January 12, 2024 22:48
@cuba cuba requested a review from bridiver January 15, 2024 21:21
@ShivanKaul
Copy link
Collaborator

@bridiver I removed a bunch of unneeded imports. But as stated is there a mechanism in which I can detect unused imports or is it just a manual process of cross referencing imports with code usage?

We've discussed adding automation for this but AFAIK we don't have anything just yet.

@cuba cuba force-pushed the js/debounce-service branch from 3f0d497 to 8d3743e Compare February 5, 2024 21:58
Copy link
Contributor

github-actions bot commented Feb 5, 2024

[puLL-Merge] - brave/brave-core@20315

Description

This PR refactors the debounce component by moving it to a new subdirectory (core) within its module, affecting various parts of the codebase where the debounce component is integrated or utilized. The aim seems to be to reorganize the code for better modularity or clarity, grouping core functionality distinctly.

Changes

Changes

  • Component Move & Namespace Changes: Refactored the structure of the debounce component, moving files from components/debounce/browser and components/debounce/common to components/debounce/core/browser and components/debounce/core/common respectively.

    • Major filename changes and path adjustments reflect this structure change across the codebase.
    • Updated include statements in various files to the new paths.
  • Build Configuration Updates: Altered paths in .gn files to accommodate the new directory structure. Updated dependencies in BUILD.gn files across various targets to reflect the moved debounce component files.

  • Code Modifications:

    • Updated file headers from block comments to line comments for consistency.
    • Minor code style and formatting tweaks (e.g., added braces around single-line if statements).

Security Hotspots

  1. Refactor Scope & Dependency Management: While not directly a security risk, large-scale refactors can introduce bugs due to the vast number of dependencies and interactions within the system. Full regression testing should ensure no unintended side effects occur.

  2. Feature Flag Consistency: Changes involve files related to feature flagging (features.cc, features.h). Ensuring these flags behave as expected post-refactor is crucial to maintaining intended functionality and security postures controlled by these flags.

  3. Path Updates in Build Configs: Changes in the .gn files to reflect new paths ensure correct building and linking of components. Misconfiguration can lead to runtime errors, potentially exposing uninitialized or improperly secured resources.

@cuba cuba merged commit 1ac7c89 into master Feb 6, 2024
@cuba cuba deleted the js/debounce-service branch February 6, 2024 02:20
@github-actions github-actions bot added this to the 1.64.x - Nightly milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/run-upstream-tests Run upstream unit and browser tests on Linux and Windows (otherwise only on Linux) potential-layer-violation-fixes This PR touches a BUILD.gn file with check_includes=false puLL-Merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add brave-core debounce layers for iOS
6 participants