mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-05 12:55:11 +01:00
Move improved notification management to Labs.
This commit is contained in:
committed by
Michelle Tang
parent
7d6a31b254
commit
600acb82bd
+1
@@ -12,4 +12,5 @@ sealed interface LabsSettingsEvents {
|
||||
data class ToggleBetterSearch(val enabled: Boolean) : LabsSettingsEvents
|
||||
data class ToggleStarredMessages(val enabled: Boolean) : LabsSettingsEvents
|
||||
data class ToggleStickerReplies(val enabled: Boolean) : LabsSettingsEvents
|
||||
data class ToggleMuteBreakthroughNotifications(val enabled: Boolean) : LabsSettingsEvents
|
||||
}
|
||||
|
||||
+9
@@ -142,6 +142,15 @@ private fun LabsSettingsContent(
|
||||
onCheckChanged = { onEvent(LabsSettingsEvents.ToggleStickerReplies(it)) }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
Rows.ToggleRow(
|
||||
checked = state.muteBreakthroughNotifications,
|
||||
text = "Improved Notification Management",
|
||||
label = "Adds per-conversation controls to let calls and replies break through mute. New options in the sounds & notifications settings for a chat.",
|
||||
onCheckChanged = { onEvent(LabsSettingsEvents.ToggleMuteBreakthroughNotifications(it)) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -14,5 +14,6 @@ data class LabsSettingsState(
|
||||
val incognito: Boolean = false,
|
||||
val betterSearch: Boolean = false,
|
||||
val starredMessages: Boolean = false,
|
||||
val stickerReplies: Boolean = false
|
||||
val stickerReplies: Boolean = false,
|
||||
val muteBreakthroughNotifications: Boolean = false
|
||||
)
|
||||
|
||||
+6
-1
@@ -41,6 +41,10 @@ class LabsSettingsViewModel : ViewModel() {
|
||||
SignalStore.labs.stickerReplies = event.enabled
|
||||
_state.value = _state.value.copy(stickerReplies = event.enabled)
|
||||
}
|
||||
is LabsSettingsEvents.ToggleMuteBreakthroughNotifications -> {
|
||||
SignalStore.labs.muteBreakthroughNotifications = event.enabled
|
||||
_state.value = _state.value.copy(muteBreakthroughNotifications = event.enabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +55,8 @@ class LabsSettingsViewModel : ViewModel() {
|
||||
incognito = SignalStore.labs.incognito,
|
||||
betterSearch = SignalStore.labs.betterSearch,
|
||||
starredMessages = SignalStore.labs.starredMessages,
|
||||
stickerReplies = SignalStore.labs.stickerReplies
|
||||
stickerReplies = SignalStore.labs.stickerReplies,
|
||||
muteBreakthroughNotifications = SignalStore.labs.muteBreakthroughNotifications
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class LabsValues internal constructor(store: KeyValueStore) : SignalStoreValues(
|
||||
const val BETTER_SEARCH: String = "labs.better_search"
|
||||
const val STARRED_MESSAGES: String = "labs.starred_messages"
|
||||
const val STICKER_REPLIES: String = "labs.sticker_replies"
|
||||
const val MUTE_BREAKTHROUGH_NOTIFICATIONS: String = "labs.mute_breakthrough_notifications"
|
||||
}
|
||||
|
||||
public override fun onFirstEverAppLaunch() = Unit
|
||||
@@ -28,6 +29,8 @@ class LabsValues internal constructor(store: KeyValueStore) : SignalStoreValues(
|
||||
|
||||
var stickerReplies by booleanValue(STICKER_REPLIES, false).falseForExternalUsers()
|
||||
|
||||
var muteBreakthroughNotifications by booleanValue(MUTE_BREAKTHROUGH_NOTIFICATIONS, true).falseForExternalUsers()
|
||||
|
||||
private fun SignalStoreValueDelegate<Boolean>.falseForExternalUsers(): SignalStoreValueDelegate<Boolean> {
|
||||
return this.map { actualValue -> RemoteConfig.internalUser && actualValue }
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ import org.thoughtcrime.securesms.phonenumbers.NumberUtil
|
||||
import org.thoughtcrime.securesms.profiles.ProfileName
|
||||
import org.thoughtcrime.securesms.recipients.Recipient.Companion.external
|
||||
import org.thoughtcrime.securesms.service.webrtc.links.CallLinkRoomId
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.SignalE164Util
|
||||
import org.thoughtcrime.securesms.util.SpanUtil
|
||||
import org.thoughtcrime.securesms.util.UsernameUtil.isValidUsernameForSearch
|
||||
@@ -339,11 +338,11 @@ class Recipient(
|
||||
|
||||
/** Whether calls should break through mute for this recipient. */
|
||||
val callNotificationSetting: NotificationSetting
|
||||
get() = if (RemoteConfig.internalUser) callNotificationSettingValue else NotificationSetting.ALWAYS_NOTIFY
|
||||
get() = if (SignalStore.labs.muteBreakthroughNotifications) callNotificationSettingValue else NotificationSetting.ALWAYS_NOTIFY
|
||||
|
||||
/** Whether replies should break through mute for this recipient. Only applicable to groups. */
|
||||
val replyNotificationSetting: NotificationSetting
|
||||
get() = if (groupIdValue == null) NotificationSetting.DO_NOT_NOTIFY else if (RemoteConfig.internalUser) replyNotificationSettingValue else mentionSetting
|
||||
get() = if (groupIdValue == null) NotificationSetting.DO_NOT_NOTIFY else if (SignalStore.labs.muteBreakthroughNotifications) replyNotificationSettingValue else mentionSetting
|
||||
|
||||
/** The state around whether we can send sealed sender to this user. */
|
||||
val sealedSenderAccessMode: SealedSenderAccessMode = if (pni.isPresent && pni == serviceId) {
|
||||
|
||||
Reference in New Issue
Block a user