unsubscribe from notifications when policy is none

re: mastodon#520
This commit is contained in:
sk 2023-01-26 15:48:10 +01:00
parent 4f435c6957
commit a29a072e53
1 changed files with 5 additions and 1 deletions

View File

@ -270,9 +270,13 @@ public class SettingsFragment extends MastodonToolbarFragment{
list.getAdapter().notifyItemChanged(index); list.getAdapter().notifyItemChanged(index);
} }
if((prevPolicy==PushSubscription.Policy.NONE)!=(policy==PushSubscription.Policy.NONE)){ if((prevPolicy==PushSubscription.Policy.NONE)!=(policy==PushSubscription.Policy.NONE)){
boolean newState=policy!=PushSubscription.Policy.NONE;
for(PushNotification.Type value : PushNotification.Type.values()){
onNotificationsChanged(value, newState);
}
index++; index++;
while(items.get(index) instanceof SwitchItem si){ while(items.get(index) instanceof SwitchItem si){
si.enabled=si.checked=policy!=PushSubscription.Policy.NONE; si.enabled=si.checked=newState;
RecyclerView.ViewHolder holder=list.findViewHolderForAdapterPosition(index); RecyclerView.ViewHolder holder=list.findViewHolderForAdapterPosition(index);
if(holder!=null) if(holder!=null)
((BindableViewHolder<?>)holder).rebind(); ((BindableViewHolder<?>)holder).rebind();