From 92a44cd9d61c369ce79d34091b816ca543fbc566 Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 11 Aug 2021 13:13:38 +0100 Subject: [PATCH] add build config, use single variable in grandle file and update source to use feature flag --- vector/build.gradle | 9 +++++++-- .../list/actions/RoomListQuickActionsEpoxyController.kt | 3 ++- .../app/features/roomprofile/RoomProfileFragment.kt | 8 ++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/vector/build.gradle b/vector/build.gradle index 5b5f65e9dd..311f7ed172 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -142,9 +142,14 @@ android { resValue "bool", "useLoginV1", "true" resValue "bool", "useLoginV2", "false" + + // NotificationSettingsV2 is disabled. To be released in conjunction with iOS/Web - resValue "bool", "useNotificationSettingsV1", "true" - resValue "bool", "useNotificationSettingsV2", "false" + def useNotificationSettingsV2 = false + buildConfigField "Boolean", "USE_NOTIFICATION_SETTINGS_V2", "${useNotificationSettingsV2}" + resValue "bool", "useNotificationSettingsV1", "${!useNotificationSettingsV2}" + resValue "bool", "useNotificationSettingsV2", "${useNotificationSettingsV2}" + buildConfigField "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy.WhenTyping" diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt b/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt index 0bca6639a0..ccfe0fdf71 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt @@ -17,6 +17,7 @@ package im.vector.app.features.home.room.list.actions import androidx.annotation.StringRes import com.airbnb.epoxy.TypedEpoxyController +import im.vector.app.BuildConfig import im.vector.app.R import im.vector.app.core.epoxy.bottomSheetDividerItem import im.vector.app.core.epoxy.bottomsheet.bottomSheetActionItem @@ -55,7 +56,7 @@ class RoomListQuickActionsEpoxyController @Inject constructor( val roomSummary = notificationViewState.roomSummary() ?: return val host = this val showFull = state.roomListActionsArgs.mode == RoomListActionsArgs.Mode.FULL - var isV2 = true + var isV2 = BuildConfig.USE_NOTIFICATION_SETTINGS_V2 if (showFull || isV2) { // Preview, favorite, settings diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileFragment.kt index 7030e96c6f..ea5bbd2e84 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileFragment.kt @@ -30,6 +30,7 @@ import com.airbnb.mvrx.args import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState import com.google.android.material.dialog.MaterialAlertDialogBuilder +import im.vector.app.BuildConfig import im.vector.app.R import im.vector.app.core.animations.AppBarStateChangeListener import im.vector.app.core.animations.MatrixItemAppBarStateChangeListener @@ -253,13 +254,12 @@ class RoomProfileFragment @Inject constructor( } override fun onNotificationsClicked() { - // TODO: Use BuildConfig here when merged in - if (false) { + if (BuildConfig.USE_NOTIFICATION_SETTINGS_V2) { + roomProfileSharedActionViewModel.post(RoomProfileSharedAction.OpenRoomNotificaitonSettings) + } else { RoomListQuickActionsBottomSheet .newInstance(roomProfileArgs.roomId, RoomListActionsArgs.Mode.NOTIFICATIONS) .show(childFragmentManager, "ROOM_PROFILE_NOTIFICATIONS") - } else { - roomProfileSharedActionViewModel.post(RoomProfileSharedAction.OpenRoomNotificaitonSettings) } }