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

allow to enable/disable notifications per-account #3143

Merged
merged 7 commits into from
Jul 13, 2024
Merged

Conversation

adbenitez
Copy link
Member

close #3126

image

@adbenitez adbenitez added the enhancement actually in development, user visible enhancement label Jul 3, 2024
@adbenitez adbenitez requested a review from r10s July 3, 2024 16:54
@adbenitez adbenitez self-assigned this Jul 3, 2024
@adbenitez adbenitez added the PR waiting for core PR is waiting for core release label Jul 3, 2024
@adbenitez
Copy link
Member Author

currently ui.muted config is used, we need a proper core config for this

Copy link

github-actions bot commented Jul 3, 2024

To test the changes in this pull request, install this apk:
📦 app-preview.apk

Copy link

github-actions bot commented Jul 8, 2024

To test the changes in this pull request, install this apk:
📦 app-preview.apk

Copy link
Member

@r10s r10s left a comment

Choose a reason for hiding this comment

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

android part lgtm. but let's wait for core:

i agree, we should use a core settings instead of ui.muted - we then have the option to do $things on the option, eg. not doing FCM (which may or may not be wanted, no need to decide that now).
also, it is in sync with muted-chats, which are also handled in core - that way, we have the option to not fire fresh-events and do the notification-logic more in core (again, this may or may not be wanted, no need to decide that now, it is just about the option)

@r10s
Copy link
Member

r10s commented Jul 9, 2024

i created a PR offering is_muted at deltachat/deltachat-core-rust#5759

btw, i think we should migrate the old setting, so that we do not start adding notifications the user has disabled before. we could do that similar to "migrating chat backgrounds" (which can be removed then)

Copy link

github-actions bot commented Jul 9, 2024

To test the changes in this pull request, install this apk:
📦 app-preview.apk

Copy link

To test the changes in this pull request, install this apk:
📦 app-preview.apk

@adbenitez adbenitez removed the PR waiting for core PR is waiting for core release label Jul 10, 2024
Copy link
Member

@r10s r10s left a comment

Choose a reason for hiding this comment

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

the migration seems buggy, i could also confirm that in a test.

apart from that and the log, things lgtm.

when these two things are fixed, this PR should maybe better be squashed - i assume this will re-create a commit that not confuses git, sth. is broken in the git history still on some system

}
Prefs.setStringPreference(this, "pref_chat_background", "");
Prefs.removePreference(this, NOTIFICATION_PREF);
Copy link
Member

Choose a reason for hiding this comment

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

as SwitchPreferenceCompat (resp. its base classes) persist changes in "shared preferences" under the name pref_key_enable_notifications as well, the migration is executed whenever the user muted notifications for any account.

on the next app start, all accounts get muted then.

i do not know if we can prevent SwitchPreferenceCompat from persisting things, an easy fix would be to use a different name as pref_enable_notifications (strike the "key")

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch! I renamed it as per your suggestion

Copy link
Member

Choose a reason for hiding this comment

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

the references need to be changed as well (i'd do a grep over .xml and .java and rename everything but the migration)

Copy link
Member Author

Choose a reason for hiding this comment

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

I fixed it, I wonder if it is possible to move such keys to some xml file and then don't have this problem, it is easy to overlook and the keys are manually typed in both sides

Copy link
Member

@r10s r10s Jul 10, 2024

Choose a reason for hiding this comment

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

for me, there are still dependencies in preferences_notifications.xml as android:dependency="pref_key_enable_notifications" , this leads to crashes on opening the page.

but maybe a commit is missing again due to git hickup ...

Copy link
Member Author

Choose a reason for hiding this comment

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

sorry, fixed it and compiled locally this time before pushing it (was thinking it was a quick simple single-line renaming fix and didn't test last times)

Copy link

To test the changes in this pull request, install this apk:
📦 app-preview.apk

Copy link

To test the changes in this pull request, install this apk:
📦 app-preview.apk

Copy link

To test the changes in this pull request, install this apk:
📦 app-preview.apk

@adbenitez adbenitez merged commit 307e457 into main Jul 13, 2024
2 checks passed
@adbenitez adbenitez deleted the adb/issue-3126 branch July 13, 2024 15:26
r10s added a commit to deltachat/deltachat-ios that referenced this pull request Jul 23, 2024
see discussion at
deltachat/deltachat-android#3143 (review) ,
there was the idea to show them as 'muted',
however, we tried the simple solution first, which make sense as well
and does not have the issue with the global counter on the badge icon
(where we could not use different colors)
r10s added a commit to deltachat/deltachat-ios that referenced this pull request Jul 25, 2024
see discussion at
deltachat/deltachat-android#3143 (review) ,
there was the idea to show them as 'muted',
however, we tried the simple solution first, which make sense as well
and does not have the issue with the global counter on the badge icon
(where we could not use different colors)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement actually in development, user visible enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make “Notifications on/off” a per-profile setting
3 participants