Rename NotificationMode.ENABLED_DEFAULT to NotificationMode.ENABLED
This commit is contained in:
parent
7c6140b331
commit
64a7978c7f
5 changed files with 6 additions and 6 deletions
|
@ -4,11 +4,11 @@ import androidx.annotation.IntDef;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
@IntDef({NotificationMode.DISABLED, NotificationMode.ENABLED_DEFAULT})
|
@IntDef({NotificationMode.DISABLED, NotificationMode.ENABLED})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface NotificationMode {
|
public @interface NotificationMode {
|
||||||
|
|
||||||
int DISABLED = 0;
|
int DISABLED = 0;
|
||||||
int ENABLED_DEFAULT = 1;
|
int ENABLED = 1;
|
||||||
//other values reserved for the future
|
//other values reserved for the future
|
||||||
}
|
}
|
||||||
|
|
|
@ -414,7 +414,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNotify(final boolean isEnabled) {
|
private void setNotify(final boolean isEnabled) {
|
||||||
final int mode = isEnabled ? NotificationMode.ENABLED_DEFAULT : NotificationMode.DISABLED;
|
final int mode = isEnabled ? NotificationMode.ENABLED : NotificationMode.DISABLED;
|
||||||
disposables.add(
|
disposables.add(
|
||||||
subscriptionManager.updateNotificationMode(currentInfo.getServiceId(),
|
subscriptionManager.updateNotificationMode(currentInfo.getServiceId(),
|
||||||
currentInfo.getUrl(), mode)
|
currentInfo.getUrl(), mode)
|
||||||
|
|
|
@ -36,7 +36,7 @@ class NotificationWorker(
|
||||||
.map { feed ->
|
.map { feed ->
|
||||||
feed.mapNotNull { x ->
|
feed.mapNotNull { x ->
|
||||||
x.value?.takeIf {
|
x.value?.takeIf {
|
||||||
it.notificationMode == NotificationMode.ENABLED_DEFAULT &&
|
it.notificationMode == NotificationMode.ENABLED &&
|
||||||
it.newStreamsCount > 0
|
it.newStreamsCount > 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ class NotificationsChannelsConfigFragment : Fragment(), ModeToggleListener {
|
||||||
val subscriptions = adapter?.getCurrentList() ?: return
|
val subscriptions = adapter?.getCurrentList() ?: return
|
||||||
val mode = subscriptions.firstOrNull()?.notificationMode ?: return
|
val mode = subscriptions.firstOrNull()?.notificationMode ?: return
|
||||||
val newMode = when (mode) {
|
val newMode = when (mode) {
|
||||||
NotificationMode.DISABLED -> NotificationMode.ENABLED_DEFAULT
|
NotificationMode.DISABLED -> NotificationMode.ENABLED
|
||||||
else -> NotificationMode.DISABLED
|
else -> NotificationMode.DISABLED
|
||||||
}
|
}
|
||||||
val subscriptionManager = SubscriptionManager(requireContext())
|
val subscriptionManager = SubscriptionManager(requireContext())
|
||||||
|
|
|
@ -85,7 +85,7 @@ class NotificationsConfigAdapter(
|
||||||
val mode = if (checkedTextView.isChecked) {
|
val mode = if (checkedTextView.isChecked) {
|
||||||
NotificationMode.DISABLED
|
NotificationMode.DISABLED
|
||||||
} else {
|
} else {
|
||||||
NotificationMode.ENABLED_DEFAULT
|
NotificationMode.ENABLED
|
||||||
}
|
}
|
||||||
listener.onModeToggle(adapterPosition, mode)
|
listener.onModeToggle(adapterPosition, mode)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue