Skip to content

Commit 82c86a2

Browse files
committed
Remove FeatureFlag.NotificationSettings and FeatureFlag.PinUnlock
1 parent 7fb70fa commit 82c86a2

File tree

12 files changed

+16
-77
lines changed

12 files changed

+16
-77
lines changed

features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/DefaultLockScreenService.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import io.element.android.features.lockscreen.impl.storage.LockScreenStore
1818
import io.element.android.libraries.di.AppScope
1919
import io.element.android.libraries.di.SingleIn
2020
import io.element.android.libraries.di.annotations.AppCoroutineScope
21-
import io.element.android.libraries.featureflag.api.FeatureFlagService
22-
import io.element.android.libraries.featureflag.api.FeatureFlags
2321
import io.element.android.libraries.sessionstorage.api.observer.SessionListener
2422
import io.element.android.libraries.sessionstorage.api.observer.SessionObserver
2523
import io.element.android.services.appnavstate.api.AppForegroundStateService
@@ -29,7 +27,6 @@ import kotlinx.coroutines.delay
2927
import kotlinx.coroutines.flow.Flow
3028
import kotlinx.coroutines.flow.MutableStateFlow
3129
import kotlinx.coroutines.flow.StateFlow
32-
import kotlinx.coroutines.flow.combine
3330
import kotlinx.coroutines.flow.first
3431
import kotlinx.coroutines.flow.map
3532
import kotlinx.coroutines.launch
@@ -40,7 +37,6 @@ import kotlin.time.Duration
4037
@ContributesBinding(AppScope::class)
4138
class DefaultLockScreenService @Inject constructor(
4239
private val lockScreenConfig: LockScreenConfig,
43-
private val featureFlagService: FeatureFlagService,
4440
private val lockScreenStore: LockScreenStore,
4541
private val pinCodeManager: PinCodeManager,
4642
@AppCoroutineScope
@@ -108,12 +104,7 @@ class DefaultLockScreenService @Inject constructor(
108104
}
109105

110106
override fun isPinSetup(): Flow<Boolean> {
111-
return combine(
112-
featureFlagService.isFeatureEnabledFlow(FeatureFlags.PinUnlock),
113-
pinCodeManager.hasPinCode()
114-
) { isEnabled, hasPinCode ->
115-
isEnabled && hasPinCode
116-
}
107+
return pinCodeManager.hasPinCode()
117108
}
118109

119110
override fun isSetupRequired(): Flow<Boolean> {

features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenter.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import io.element.android.features.rageshake.api.RageshakeFeatureAvailability
2323
import io.element.android.libraries.architecture.Presenter
2424
import io.element.android.libraries.designsystem.utils.snackbar.SnackbarDispatcher
2525
import io.element.android.libraries.designsystem.utils.snackbar.collectSnackbarMessageAsState
26-
import io.element.android.libraries.featureflag.api.FeatureFlagService
27-
import io.element.android.libraries.featureflag.api.FeatureFlags
2826
import io.element.android.libraries.indicator.api.IndicatorService
2927
import io.element.android.libraries.matrix.api.MatrixClient
3028
import io.element.android.libraries.matrix.api.oidc.AccountManagementAction
@@ -42,7 +40,6 @@ class PreferencesRootPresenter @Inject constructor(
4240
private val analyticsService: AnalyticsService,
4341
private val versionFormatter: VersionFormatter,
4442
private val snackbarDispatcher: SnackbarDispatcher,
45-
private val featureFlagService: FeatureFlagService,
4643
private val indicatorService: IndicatorService,
4744
private val directLogoutPresenter: Presenter<DirectLogoutState>,
4845
private val showDeveloperSettingsProvider: ShowDeveloperSettingsProvider,
@@ -60,15 +57,6 @@ class PreferencesRootPresenter @Inject constructor(
6057
val snackbarMessage by snackbarDispatcher.collectSnackbarMessageAsState()
6158
val hasAnalyticsProviders = remember { analyticsService.getAvailableAnalyticsProviders().isNotEmpty() }
6259

63-
val showNotificationSettings = remember { mutableStateOf(false) }
64-
LaunchedEffect(Unit) {
65-
showNotificationSettings.value = featureFlagService.isFeatureEnabled(FeatureFlags.NotificationSettings)
66-
}
67-
val showLockScreenSettings = remember { mutableStateOf(false) }
68-
LaunchedEffect(Unit) {
69-
showLockScreenSettings.value = featureFlagService.isFeatureEnabled(FeatureFlags.PinUnlock)
70-
}
71-
7260
// We should display the 'complete verification' option if the current session can be verified
7361
val canVerifyUserSession by sessionVerificationService.needsSessionVerification.collectAsState(false)
7462

@@ -122,8 +110,6 @@ class PreferencesRootPresenter @Inject constructor(
122110
canReportBug = canReportBug,
123111
showDeveloperSettings = showDeveloperSettings,
124112
canDeactivateAccount = canDeactivateAccount,
125-
showNotificationSettings = showNotificationSettings.value,
126-
showLockScreenSettings = showLockScreenSettings.value,
127113
showBlockedUsersItem = showBlockedUsersItem,
128114
directLogoutState = directLogoutState,
129115
snackbarMessage = snackbarMessage,

features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootState.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ data class PreferencesRootState(
2424
val showAnalyticsSettings: Boolean,
2525
val showDeveloperSettings: Boolean,
2626
val canDeactivateAccount: Boolean,
27-
val showLockScreenSettings: Boolean,
28-
val showNotificationSettings: Boolean,
2927
val showBlockedUsersItem: Boolean,
3028
val directLogoutState: DirectLogoutState,
3129
val snackbarMessage: SnackbarMessage?,

features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootStateProvider.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ fun aPreferencesRootState(
2727
showAnalyticsSettings = true,
2828
canReportBug = true,
2929
showDeveloperSettings = true,
30-
showNotificationSettings = true,
31-
showLockScreenSettings = true,
3230
showBlockedUsersItem = true,
3331
canDeactivateAccount = true,
3432
snackbarMessage = SnackbarMessage(CommonStrings.common_verification_complete),

features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,16 @@ private fun ColumnScope.ManageAppSection(
121121
onOpenLockScreenSettings: () -> Unit,
122122
onSecureBackupClick: () -> Unit,
123123
) {
124-
if (state.showNotificationSettings) {
125-
ListItem(
126-
headlineContent = { Text(stringResource(id = R.string.screen_notification_settings_title)) },
127-
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Notifications())),
128-
onClick = onOpenNotificationSettings,
129-
)
130-
}
131-
if (state.showLockScreenSettings) {
132-
ListItem(
133-
headlineContent = { Text(stringResource(id = CommonStrings.common_screen_lock)) },
134-
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())),
135-
onClick = onOpenLockScreenSettings,
136-
)
137-
}
124+
ListItem(
125+
headlineContent = { Text(stringResource(id = R.string.screen_notification_settings_title)) },
126+
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Notifications())),
127+
onClick = onOpenNotificationSettings,
128+
)
129+
ListItem(
130+
headlineContent = { Text(stringResource(id = CommonStrings.common_screen_lock)) },
131+
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())),
132+
onClick = onOpenLockScreenSettings,
133+
)
138134
if (state.showSecureBackup) {
139135
ListItem(
140136
headlineContent = { Text(stringResource(id = CommonStrings.common_encryption)) },
@@ -143,9 +139,7 @@ private fun ColumnScope.ManageAppSection(
143139
onClick = onSecureBackupClick,
144140
)
145141
}
146-
if (state.showNotificationSettings || state.showLockScreenSettings || state.showSecureBackup) {
147-
HorizontalDivider()
148-
}
142+
HorizontalDivider()
149143
}
150144

151145
@Composable

features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenterTest.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import io.element.android.features.preferences.impl.utils.ShowDeveloperSettingsP
1616
import io.element.android.features.rageshake.api.RageshakeFeatureAvailability
1717
import io.element.android.libraries.core.meta.BuildType
1818
import io.element.android.libraries.designsystem.utils.snackbar.SnackbarDispatcher
19-
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
2019
import io.element.android.libraries.indicator.api.IndicatorService
2120
import io.element.android.libraries.indicator.test.FakeIndicatorService
2221
import io.element.android.libraries.matrix.api.oidc.AccountManagementAction
@@ -77,8 +76,6 @@ class PreferencesRootPresenterTest {
7776
assertThat(loadedState.devicesManagementUrl).isNull()
7877
assertThat(loadedState.showAnalyticsSettings).isFalse()
7978
assertThat(loadedState.showDeveloperSettings).isTrue()
80-
assertThat(loadedState.showLockScreenSettings).isTrue()
81-
assertThat(loadedState.showNotificationSettings).isTrue()
8279
assertThat(loadedState.canDeactivateAccount).isTrue()
8380
assertThat(loadedState.canReportBug).isTrue()
8481
assertThat(loadedState.directLogoutState).isEqualTo(aDirectLogoutState())
@@ -194,7 +191,6 @@ class PreferencesRootPresenterTest {
194191
analyticsService = FakeAnalyticsService(),
195192
versionFormatter = FakeVersionFormatter(),
196193
snackbarDispatcher = SnackbarDispatcher(),
197-
featureFlagService = FakeFeatureFlagService(),
198194
indicatorService = indicatorService,
199195
directLogoutPresenter = { aDirectLogoutState() },
200196
showDeveloperSettingsProvider = showDeveloperSettingsProvider,

features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsPresenter.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import androidx.compose.runtime.LaunchedEffect
1212
import androidx.compose.runtime.collectAsState
1313
import androidx.compose.runtime.derivedStateOf
1414
import androidx.compose.runtime.getValue
15-
import androidx.compose.runtime.mutableStateOf
1615
import androidx.compose.runtime.produceState
1716
import androidx.compose.runtime.remember
1817
import androidx.compose.runtime.rememberCoroutineScope
@@ -77,7 +76,6 @@ class RoomDetailsPresenter @Inject constructor(
7776
override fun present(): RoomDetailsState {
7877
val scope = rememberCoroutineScope()
7978
val leaveRoomState = leaveRoomPresenter.present()
80-
val canShowNotificationSettings = remember { mutableStateOf(false) }
8179
val roomInfo by room.roomInfoFlow.collectAsState()
8280
val isUserAdmin = room.isOwnUserAdmin()
8381
val syncUpdateFlow = room.syncUpdateFlow.collectAsState()
@@ -96,11 +94,8 @@ class RoomDetailsPresenter @Inject constructor(
9694
}.collectAsState(false)
9795

9896
LaunchedEffect(Unit) {
99-
canShowNotificationSettings.value = featureFlagService.isFeatureEnabled(FeatureFlags.NotificationSettings)
100-
if (canShowNotificationSettings.value) {
101-
room.updateRoomNotificationSettings()
102-
observeNotificationSettings()
103-
}
97+
room.updateRoomNotificationSettings()
98+
observeNotificationSettings()
10499
}
105100

106101
val membersState by room.membersStateFlow.collectAsState()
@@ -197,7 +192,6 @@ class RoomDetailsPresenter @Inject constructor(
197192
isEncrypted = isEncrypted,
198193
canInvite = canInvite,
199194
canEdit = (canEditAvatar || canEditName || canEditTopic) && roomType == RoomDetailsType.Room,
200-
canShowNotificationSettings = canShowNotificationSettings.value,
201195
roomCallState = roomCallState,
202196
roomType = roomType,
203197
roomMemberDetailsState = roomMemberDetailsState,

features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsState.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ data class RoomDetailsState(
3232
val roomMemberDetailsState: UserProfileState?,
3333
val canEdit: Boolean,
3434
val canInvite: Boolean,
35-
val canShowNotificationSettings: Boolean,
3635
val roomCallState: RoomCallState,
3736
val leaveRoomState: LeaveRoomState,
3837
val roomNotificationSettings: RoomNotificationSettings?,

features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsStateProvider.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ fun aRoomDetailsState(
100100
isEncrypted: Boolean = true,
101101
canInvite: Boolean = false,
102102
canEdit: Boolean = false,
103-
canShowNotificationSettings: Boolean = true,
104103
roomCallState: RoomCallState = aStandByCallState(),
105104
roomType: RoomDetailsType = RoomDetailsType.Room,
106105
roomMemberDetailsState: UserProfileState? = null,
@@ -132,7 +131,6 @@ fun aRoomDetailsState(
132131
isEncrypted = isEncrypted,
133132
canInvite = canInvite,
134133
canEdit = canEdit,
135-
canShowNotificationSettings = canShowNotificationSettings,
136134
roomCallState = roomCallState,
137135
roomType = roomType,
138136
roomMemberDetailsState = roomMemberDetailsState,

features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsView.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fun RoomDetailsView(
185185
}
186186

187187
PreferenceCategory {
188-
if (state.canShowNotificationSettings && state.roomNotificationSettings != null) {
188+
if (state.roomNotificationSettings != null) {
189189
NotificationItem(
190190
isDefaultMode = state.roomNotificationSettings.isDefault,
191191
openRoomNotificationSettings = openRoomNotificationSettings
@@ -337,8 +337,7 @@ private fun MainActionsSection(
337337
.padding(horizontal = 16.dp),
338338
horizontalArrangement = Arrangement.SpaceEvenly,
339339
) {
340-
val roomNotificationSettings = state.roomNotificationSettings
341-
if (state.canShowNotificationSettings && roomNotificationSettings != null) {
340+
state.roomNotificationSettings?.let { roomNotificationSettings ->
342341
if (roomNotificationSettings.mode == RoomNotificationMode.MUTE) {
343342
MainActionButton(
344343
title = stringResource(CommonStrings.common_unmute),

0 commit comments

Comments
 (0)