mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
removing notifications v1, v2 is live
This commit is contained in:
parent
db406704c9
commit
e3155b6c98
8 changed files with 36 additions and 104 deletions
|
@ -141,7 +141,6 @@ android {
|
||||||
resValue "string", "build_number", "\"${buildNumber}\""
|
resValue "string", "build_number", "\"${buildNumber}\""
|
||||||
|
|
||||||
buildConfigField "im.vector.app.features.VectorFeatures.LoginVersion", "LOGIN_VERSION", "im.vector.app.features.VectorFeatures.LoginVersion.V1"
|
buildConfigField "im.vector.app.features.VectorFeatures.LoginVersion", "LOGIN_VERSION", "im.vector.app.features.VectorFeatures.LoginVersion.V1"
|
||||||
buildConfigField "im.vector.app.features.VectorFeatures.NotificationSettingsVersion", "NOTIFICATION_SETTINGS_VERSION", "im.vector.app.features.VectorFeatures.NotificationSettingsVersion.V2"
|
|
||||||
|
|
||||||
buildConfigField "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy.WhenTyping"
|
buildConfigField "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy.WhenTyping"
|
||||||
|
|
||||||
|
|
|
@ -18,20 +18,12 @@ package im.vector.app.ui.robot.settings
|
||||||
|
|
||||||
import androidx.test.espresso.Espresso.pressBack
|
import androidx.test.espresso.Espresso.pressBack
|
||||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||||
import im.vector.app.BuildConfig
|
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.espresso.tools.clickOnPreference
|
import im.vector.app.espresso.tools.clickOnPreference
|
||||||
import im.vector.app.features.VectorFeatures
|
|
||||||
|
|
||||||
class SettingsNotificationsRobot {
|
class SettingsNotificationsRobot {
|
||||||
|
|
||||||
fun crawl() {
|
fun crawl() {
|
||||||
when (BuildConfig.NOTIFICATION_SETTINGS_VERSION!!) {
|
|
||||||
VectorFeatures.NotificationSettingsVersion.V1 -> {
|
|
||||||
clickOn(R.string.settings_notification_advanced)
|
|
||||||
pressBack()
|
|
||||||
}
|
|
||||||
VectorFeatures.NotificationSettingsVersion.V2 -> {
|
|
||||||
clickOn(R.string.settings_notification_default)
|
clickOn(R.string.settings_notification_default)
|
||||||
pressBack()
|
pressBack()
|
||||||
clickOn(R.string.settings_notification_mentions_and_keywords)
|
clickOn(R.string.settings_notification_mentions_and_keywords)
|
||||||
|
@ -39,8 +31,6 @@ class SettingsNotificationsRobot {
|
||||||
pressBack()
|
pressBack()
|
||||||
clickOn(R.string.settings_notification_other)
|
clickOn(R.string.settings_notification_other)
|
||||||
pressBack()
|
pressBack()
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
clickOn(R.string.settings_noisy_notifications_preferences)
|
clickOn(R.string.settings_noisy_notifications_preferences)
|
||||||
|
|
|
@ -21,7 +21,6 @@ import im.vector.app.BuildConfig
|
||||||
interface VectorFeatures {
|
interface VectorFeatures {
|
||||||
|
|
||||||
fun loginVersion(): LoginVersion
|
fun loginVersion(): LoginVersion
|
||||||
fun notificationSettingsVersion(): NotificationSettingsVersion
|
|
||||||
|
|
||||||
enum class LoginVersion {
|
enum class LoginVersion {
|
||||||
V1,
|
V1,
|
||||||
|
@ -36,5 +35,4 @@ interface VectorFeatures {
|
||||||
|
|
||||||
class DefaultVectorFeatures : VectorFeatures {
|
class DefaultVectorFeatures : VectorFeatures {
|
||||||
override fun loginVersion(): VectorFeatures.LoginVersion = BuildConfig.LOGIN_VERSION
|
override fun loginVersion(): VectorFeatures.LoginVersion = BuildConfig.LOGIN_VERSION
|
||||||
override fun notificationSettingsVersion(): VectorFeatures.NotificationSettingsVersion = BuildConfig.NOTIFICATION_SETTINGS_VERSION
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import im.vector.app.core.epoxy.bottomsheet.bottomSheetRoomPreviewItem
|
||||||
import im.vector.app.core.epoxy.profiles.notifications.radioButtonItem
|
import im.vector.app.core.epoxy.profiles.notifications.radioButtonItem
|
||||||
import im.vector.app.core.resources.ColorProvider
|
import im.vector.app.core.resources.ColorProvider
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.features.VectorFeatures
|
|
||||||
import im.vector.app.features.home.AvatarRenderer
|
import im.vector.app.features.home.AvatarRenderer
|
||||||
import im.vector.app.features.roomprofile.notifications.notificationOptions
|
import im.vector.app.features.roomprofile.notifications.notificationOptions
|
||||||
import im.vector.app.features.roomprofile.notifications.notificationStateMapped
|
import im.vector.app.features.roomprofile.notifications.notificationStateMapped
|
||||||
|
@ -39,7 +38,6 @@ class RoomListQuickActionsEpoxyController @Inject constructor(
|
||||||
private val avatarRenderer: AvatarRenderer,
|
private val avatarRenderer: AvatarRenderer,
|
||||||
private val colorProvider: ColorProvider,
|
private val colorProvider: ColorProvider,
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
private val features: VectorFeatures
|
|
||||||
) : TypedEpoxyController<RoomListQuickActionViewState>() {
|
) : TypedEpoxyController<RoomListQuickActionViewState>() {
|
||||||
|
|
||||||
var listener: Listener? = null
|
var listener: Listener? = null
|
||||||
|
@ -48,11 +46,6 @@ class RoomListQuickActionsEpoxyController @Inject constructor(
|
||||||
val notificationViewState = state.notificationSettingsViewState
|
val notificationViewState = state.notificationSettingsViewState
|
||||||
val roomSummary = notificationViewState.roomSummary() ?: return
|
val roomSummary = notificationViewState.roomSummary() ?: return
|
||||||
val host = this
|
val host = this
|
||||||
val isV2 = features.notificationSettingsVersion() == VectorFeatures.NotificationSettingsVersion.V2
|
|
||||||
// V2 always shows full details as we no longer display the sheet from RoomProfile > Notifications
|
|
||||||
val showFull = state.roomListActionsArgs.mode == RoomListActionsArgs.Mode.FULL || isV2
|
|
||||||
|
|
||||||
if (showFull) {
|
|
||||||
// Preview, favorite, settings
|
// Preview, favorite, settings
|
||||||
bottomSheetRoomPreviewItem {
|
bottomSheetRoomPreviewItem {
|
||||||
id("room_preview")
|
id("room_preview")
|
||||||
|
@ -71,9 +64,7 @@ class RoomListQuickActionsEpoxyController @Inject constructor(
|
||||||
bottomSheetDividerItem {
|
bottomSheetDividerItem {
|
||||||
id("notifications_separator")
|
id("notifications_separator")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (isV2) {
|
|
||||||
notificationViewState.notificationOptions.forEach { notificationState ->
|
notificationViewState.notificationOptions.forEach { notificationState ->
|
||||||
val title = titleForNotificationState(notificationState)
|
val title = titleForNotificationState(notificationState)
|
||||||
radioButtonItem {
|
radioButtonItem {
|
||||||
|
@ -85,17 +76,8 @@ class RoomListQuickActionsEpoxyController @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
val selectedRoomState = notificationViewState.notificationState()
|
|
||||||
RoomListQuickActionsSharedAction.NotificationsAllNoisy(roomSummary.roomId).toBottomSheetItem(0, selectedRoomState)
|
|
||||||
RoomListQuickActionsSharedAction.NotificationsAll(roomSummary.roomId).toBottomSheetItem(1, selectedRoomState)
|
|
||||||
RoomListQuickActionsSharedAction.NotificationsMentionsOnly(roomSummary.roomId).toBottomSheetItem(2, selectedRoomState)
|
|
||||||
RoomListQuickActionsSharedAction.NotificationsMute(roomSummary.roomId).toBottomSheetItem(3, selectedRoomState)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showFull) {
|
RoomListQuickActionsSharedAction.Leave(roomSummary.roomId, showIcon = !true).toBottomSheetItem(5)
|
||||||
RoomListQuickActionsSharedAction.Leave(roomSummary.roomId, showIcon = !isV2).toBottomSheetItem(5)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
|
|
|
@ -44,13 +44,10 @@ import im.vector.app.core.utils.copyToClipboard
|
||||||
import im.vector.app.core.utils.startSharePlainTextIntent
|
import im.vector.app.core.utils.startSharePlainTextIntent
|
||||||
import im.vector.app.databinding.FragmentMatrixProfileBinding
|
import im.vector.app.databinding.FragmentMatrixProfileBinding
|
||||||
import im.vector.app.databinding.ViewStubRoomProfileHeaderBinding
|
import im.vector.app.databinding.ViewStubRoomProfileHeaderBinding
|
||||||
import im.vector.app.features.VectorFeatures
|
|
||||||
import im.vector.app.features.home.AvatarRenderer
|
import im.vector.app.features.home.AvatarRenderer
|
||||||
import im.vector.app.features.home.room.detail.RoomDetailPendingAction
|
import im.vector.app.features.home.room.detail.RoomDetailPendingAction
|
||||||
import im.vector.app.features.home.room.detail.RoomDetailPendingActionStore
|
import im.vector.app.features.home.room.detail.RoomDetailPendingActionStore
|
||||||
import im.vector.app.features.home.room.detail.upgrade.MigrateRoomBottomSheet
|
import im.vector.app.features.home.room.detail.upgrade.MigrateRoomBottomSheet
|
||||||
import im.vector.app.features.home.room.list.actions.RoomListActionsArgs
|
|
||||||
import im.vector.app.features.home.room.list.actions.RoomListQuickActionsBottomSheet
|
|
||||||
import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedAction
|
import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedAction
|
||||||
import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedActionViewModel
|
import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedActionViewModel
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
|
@ -69,8 +66,7 @@ data class RoomProfileArgs(
|
||||||
class RoomProfileFragment @Inject constructor(
|
class RoomProfileFragment @Inject constructor(
|
||||||
private val roomProfileController: RoomProfileController,
|
private val roomProfileController: RoomProfileController,
|
||||||
private val avatarRenderer: AvatarRenderer,
|
private val avatarRenderer: AvatarRenderer,
|
||||||
private val roomDetailPendingActionStore: RoomDetailPendingActionStore,
|
private val roomDetailPendingActionStore: RoomDetailPendingActionStore
|
||||||
private val features: VectorFeatures
|
|
||||||
) :
|
) :
|
||||||
VectorBaseFragment<FragmentMatrixProfileBinding>(),
|
VectorBaseFragment<FragmentMatrixProfileBinding>(),
|
||||||
RoomProfileController.Callback {
|
RoomProfileController.Callback {
|
||||||
|
@ -259,17 +255,8 @@ class RoomProfileFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNotificationsClicked() {
|
override fun onNotificationsClicked() {
|
||||||
when (features.notificationSettingsVersion()) {
|
|
||||||
VectorFeatures.NotificationSettingsVersion.V1 -> {
|
|
||||||
RoomListQuickActionsBottomSheet
|
|
||||||
.newInstance(roomProfileArgs.roomId, RoomListActionsArgs.Mode.NOTIFICATIONS)
|
|
||||||
.show(childFragmentManager, "ROOM_PROFILE_NOTIFICATIONS")
|
|
||||||
}
|
|
||||||
VectorFeatures.NotificationSettingsVersion.V2 -> {
|
|
||||||
roomProfileSharedActionViewModel.post(RoomProfileSharedAction.OpenRoomNotificationSettings)
|
roomProfileSharedActionViewModel.post(RoomProfileSharedAction.OpenRoomNotificationSettings)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onUploadsClicked() {
|
override fun onUploadsClicked() {
|
||||||
roomProfileSharedActionViewModel.post(RoomProfileSharedAction.OpenRoomUploads)
|
roomProfileSharedActionViewModel.post(RoomProfileSharedAction.OpenRoomUploads)
|
||||||
|
|
|
@ -46,10 +46,6 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
||||||
const val SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY = "SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY"
|
const val SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY = "SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY"
|
||||||
const val SETTINGS_DISCOVERY_PREFERENCE_KEY = "SETTINGS_DISCOVERY_PREFERENCE_KEY"
|
const val SETTINGS_DISCOVERY_PREFERENCE_KEY = "SETTINGS_DISCOVERY_PREFERENCE_KEY"
|
||||||
|
|
||||||
const val SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY"
|
|
||||||
const val SETTINGS_NOTIFICATION_DEFAULT_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_DEFAULT_PREFERENCE_KEY"
|
|
||||||
const val SETTINGS_NOTIFICATION_KEYWORD_AND_MENTIONS_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_KEYWORD_AND_MENTIONS_PREFERENCE_KEY"
|
|
||||||
const val SETTINGS_NOTIFICATION_OTHER_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_OTHER_PREFERENCE_KEY"
|
|
||||||
const val SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY = "SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY"
|
const val SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY = "SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY"
|
||||||
const val SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY = "SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY"
|
const val SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY = "SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY"
|
||||||
const val SETTINGS_COPYRIGHT_PREFERENCE_KEY = "SETTINGS_COPYRIGHT_PREFERENCE_KEY"
|
const val SETTINGS_COPYRIGHT_PREFERENCE_KEY = "SETTINGS_COPYRIGHT_PREFERENCE_KEY"
|
||||||
|
|
|
@ -40,7 +40,6 @@ import im.vector.app.core.pushers.PushersManager
|
||||||
import im.vector.app.core.services.GuardServiceStarter
|
import im.vector.app.core.services.GuardServiceStarter
|
||||||
import im.vector.app.core.utils.isIgnoringBatteryOptimizations
|
import im.vector.app.core.utils.isIgnoringBatteryOptimizations
|
||||||
import im.vector.app.core.utils.requestDisablingBatteryOptimization
|
import im.vector.app.core.utils.requestDisablingBatteryOptimization
|
||||||
import im.vector.app.features.VectorFeatures
|
|
||||||
import im.vector.app.features.notifications.NotificationUtils
|
import im.vector.app.features.notifications.NotificationUtils
|
||||||
import im.vector.app.features.settings.BackgroundSyncMode
|
import im.vector.app.features.settings.BackgroundSyncMode
|
||||||
import im.vector.app.features.settings.BackgroundSyncModeChooserDialog
|
import im.vector.app.features.settings.BackgroundSyncModeChooserDialog
|
||||||
|
@ -64,8 +63,7 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
||||||
private val pushManager: PushersManager,
|
private val pushManager: PushersManager,
|
||||||
private val activeSessionHolder: ActiveSessionHolder,
|
private val activeSessionHolder: ActiveSessionHolder,
|
||||||
private val vectorPreferences: VectorPreferences,
|
private val vectorPreferences: VectorPreferences,
|
||||||
private val guardServiceStarter: GuardServiceStarter,
|
private val guardServiceStarter: GuardServiceStarter
|
||||||
private val features: VectorFeatures
|
|
||||||
) : VectorSettingsBaseFragment(),
|
) : VectorSettingsBaseFragment(),
|
||||||
BackgroundSyncModeChooserDialog.InteractionListener {
|
BackgroundSyncModeChooserDialog.InteractionListener {
|
||||||
|
|
||||||
|
@ -147,7 +145,6 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
||||||
refreshBackgroundSyncPrefs()
|
refreshBackgroundSyncPrefs()
|
||||||
|
|
||||||
handleSystemPreference()
|
handleSystemPreference()
|
||||||
handleVersionedSettings()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindEmailNotifications() {
|
private fun bindEmailNotifications() {
|
||||||
|
@ -312,15 +309,6 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleVersionedSettings() {
|
|
||||||
val isNotificationSettingsV2Enabled = features.notificationSettingsVersion() == VectorFeatures.NotificationSettingsVersion.V2
|
|
||||||
|
|
||||||
findPreference<Preference>(VectorPreferences.SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY)?.isVisible = !isNotificationSettingsV2Enabled
|
|
||||||
findPreference<Preference>(VectorPreferences.SETTINGS_NOTIFICATION_DEFAULT_PREFERENCE_KEY)?.isVisible = isNotificationSettingsV2Enabled
|
|
||||||
findPreference<Preference>(VectorPreferences.SETTINGS_NOTIFICATION_KEYWORD_AND_MENTIONS_PREFERENCE_KEY)?.isVisible = isNotificationSettingsV2Enabled
|
|
||||||
findPreference<Preference>(VectorPreferences.SETTINGS_NOTIFICATION_OTHER_PREFERENCE_KEY)?.isVisible = isNotificationSettingsV2Enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
activeSessionHolder.getSafeActiveSession()?.refreshPushers()
|
activeSessionHolder.getSafeActiveSession()?.refreshPushers()
|
||||||
|
|
|
@ -20,14 +20,6 @@
|
||||||
<!--android:key="SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY"-->
|
<!--android:key="SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY"-->
|
||||||
<!--android:title="@string/settings_turn_screen_on" />-->
|
<!--android:title="@string/settings_turn_screen_on" />-->
|
||||||
|
|
||||||
<im.vector.app.core.preference.VectorPreference
|
|
||||||
android:dependency="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
|
|
||||||
android:key="SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY"
|
|
||||||
android:persistent="false"
|
|
||||||
android:summary="@string/settings_notification_advanced_summary"
|
|
||||||
android:title="@string/settings_notification_advanced"
|
|
||||||
app:fragment="im.vector.app.features.settings.notifications.VectorSettingsAdvancedNotificationPreferenceFragment" />
|
|
||||||
|
|
||||||
<im.vector.app.core.preference.VectorPreference
|
<im.vector.app.core.preference.VectorPreference
|
||||||
android:dependency="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
|
android:dependency="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
|
||||||
android:key="SETTINGS_NOTIFICATION_DEFAULT_PREFERENCE_KEY"
|
android:key="SETTINGS_NOTIFICATION_DEFAULT_PREFERENCE_KEY"
|
||||||
|
|
Loading…
Reference in a new issue