Skip to content
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

[Android] Add option to enable/disable download notification bubble #16556

Merged

Conversation

tapanmodh
Copy link
Contributor

Resolves brave/brave-browser#25611

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • 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:

  • Update the "ask where to save files" copy to: "Ask where to save files (if SD card is detected)"
  • Show download progress notifications with On/Off switch in download settings
  • Enable the switch, it should show notification bubble when downloading file
  • Disable the switch, it shouldn't show notification bubble when downloading file

@tapanmodh tapanmodh added CI/skip-linux CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-ios Do not run CI builds for iOS labels Jan 6, 2023
@tapanmodh tapanmodh added this to the 1.49.x - Nightly milestone Jan 6, 2023
@tapanmodh tapanmodh requested a review from a team as a code owner January 6, 2023 07:16
@tapanmodh tapanmodh self-assigned this Jan 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2023

⚠️ PR head is an unsigned commit
commit: 16d0602dd80602e5bc7bc2568e0b3dd81681916b
reason: unsigned
Please follow the handbook to configure commit signing
cc: @tapanmodh

2 similar comments
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2023

⚠️ PR head is an unsigned commit
commit: 16d0602dd80602e5bc7bc2568e0b3dd81681916b
reason: unsigned
Please follow the handbook to configure commit signing
cc: @tapanmodh

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2023

⚠️ PR head is an unsigned commit
commit: 16d0602dd80602e5bc7bc2568e0b3dd81681916b
reason: unsigned
Please follow the handbook to configure commit signing
cc: @tapanmodh

@tapanmodh tapanmodh requested a review from a team as a code owner January 6, 2023 12:24
Copy link
Contributor

@wchen342 wchen342 left a comment

Choose a reason for hiding this comment

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

Android test change++

@tapanmodh tapanmodh force-pushed the enable_disable_download_progress_notification_android branch 2 times, most recently from d5a239e to 58f60b7 Compare January 6, 2023 13:11
@@ -25,6 +25,11 @@ public final class BravePreferenceKeys {
"org.chromium.chrome.browser.upgrade.Milliseconds_New";
public static final String BRAVE_DOWNLOADS_AUTOMATICALLY_OPEN_WHEN_POSSIBLE =
"org.chromium.chrome.browser.downloads.Automatically_Open_When_Possible";

// Value is being used in
// browser/download/internal/android/java/src/org/chromium/chrome/browser/download/BraveDownloadMessageUiControllerImpl.java
Copy link
Contributor

Choose a reason for hiding this comment

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

We should move BravePreferenceKeys.java to base to be accessible in all components, like we did with BraveFeatureList.java

android/java/apk_for_test.flags Show resolved Hide resolved
@@ -13,6 +13,10 @@
*** createViewProvider(...);
}

-keep class org.chromium.chrome.browser.download.DownloadMessageUiControllerImpl {
Copy link
Contributor

Choose a reason for hiding this comment

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

This rule should be required for tests only, why we need it in the main proguard file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My mistake. I'll remove it here and will add in tests

@tapanmodh tapanmodh force-pushed the enable_disable_download_progress_notification_android branch from ec5b4cc to 649dea5 Compare January 6, 2023 16:19
Copy link
Contributor

@samartnik samartnik left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -35,6 +39,17 @@ public void onCreate(Bundle savedInstanceState) {
(ChromeSwitchPreference) findPreference(PREF_AUTOMATICALLY_OPEN_WHEN_POSSIBLE);
mAutomaticallyOpenWhenPossiblePref.setOnPreferenceChangeListener(this);

mDownloadProgressNotificationBubblePref =
(ChromeSwitchPreference) findPreference(PREF_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE);
Copy link
Contributor

Choose a reason for hiding this comment

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

should we check for null here ?

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 don't think it is needed as we are adding this ChromeSwitchPreference from our brave_download_preferences.xml

@@ -66,6 +87,13 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
BravePreferenceKeys.BRAVE_DOWNLOADS_AUTOMATICALLY_OPEN_WHEN_POSSIBLE,
(boolean) newValue)
.apply();
} else if (PREF_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE.equals(preference.getKey())) {
ContextUtils.getAppSharedPreferences()
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use SharedPreferenceManager here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure about this. we are already using ContextUtils.getAppSharedPreferences() in download setting's another item


package org.chromium.chrome.browser.preferences;
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the reason to change package ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We wants to access BravePreferenceKeys in browser/download/internal/android/java/src/org/chromium/chrome/browser/download/BraveDownloadMessageUiControllerImpl.java and from @samartnik's suggestion #16556 (comment)

Copy link
Contributor

@deeppandya deeppandya left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link
Contributor

⚠️ PR head is an unsigned commit
commit: 649dea5
reason: unsigned
Please follow the handbook to configure commit signing
cc: @tapanmodh

@tapanmodh tapanmodh merged commit 98a6382 into master Jan 11, 2023
@tapanmodh tapanmodh deleted the enable_disable_download_progress_notification_android branch January 11, 2023 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/skip-ios Do not run CI builds for iOS CI/skip-macos-x64 Do not run CI builds for macOS x64
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] Add option to enable/disable download bubbles
4 participants