Skip to content

Commit bc91a0c

Browse files
authored
chore(chat): retire the GroupChats flag (#1472)
Group chats reach the chat list unconditionally. The flag only ever filtered the list — sync was already unconditional — and it was unreachable outside internal builds: GroupChats inherited FeatureTrack.Internal, which the Labs screen hides without the beta override, over a default of false. So it gated nothing for anyone who was not staff, and staff are the only accounts the server places in a group today. Membership is server-assigned, so there is no client action to gate. When create, join and leave arrive they gate actions rather than visibility, which is a different flag.
1 parent a20c29a commit bc91a0c

4 files changed

Lines changed: 1 addition & 32 deletions

File tree

‎apps/flipcash/features/tipping/src/main/kotlin/com/flipcash/app/tipping/internal/TipFlowViewModel.kt‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import androidx.lifecycle.viewModelScope
44
import dagger.hilt.android.lifecycle.HiltViewModel
55
import com.flipcash.app.core.bill.Scannable
66
import com.flipcash.app.core.data.Loadable
7-
import com.flipcash.app.featureflags.FeatureFlag
8-
import com.flipcash.app.featureflags.FeatureFlagController
97
import com.flipcash.app.core.extensions.onResult
108
import com.flipcash.app.core.tipping.TipStep
119
import com.flipcash.app.shareable.ShareSheetController
@@ -21,18 +19,15 @@ import com.flipcash.shared.chat.ui.toConversationReference
2119
import com.flipcash.shared.tipping.TippingCoordinator
2220
import com.getcode.util.resources.ResourceHelper
2321
import com.getcode.view.BaseViewModel
24-
import kotlinx.coroutines.ExperimentalCoroutinesApi
2522
import kotlinx.coroutines.flow.combine
2623
import kotlinx.coroutines.flow.distinctUntilChanged
2724
import kotlinx.coroutines.flow.filterIsInstance
28-
import kotlinx.coroutines.flow.flatMapLatest
2925
import kotlinx.coroutines.flow.launchIn
3026
import kotlinx.coroutines.flow.map
3127
import kotlinx.coroutines.flow.mapNotNull
3228
import kotlinx.coroutines.flow.onEach
3329
import javax.inject.Inject
3430

35-
@OptIn(ExperimentalCoroutinesApi::class)
3631
@HiltViewModel
3732
internal class TipFlowViewModel @Inject constructor(
3833
chatCoordinator: ChatCoordinator,
@@ -41,7 +36,6 @@ internal class TipFlowViewModel @Inject constructor(
4136
tokenCoordinator: TokenCoordinator,
4237
shareable: ShareSheetController,
4338
tipCodePreviewCache: TipCodePreviewCache,
44-
featureFlags: FeatureFlagController,
4539
private val resources: ResourceHelper,
4640
) : BaseViewModel<TipFlowViewModel.State, TipFlowViewModel.Event>(
4741
initialState = State(),
@@ -93,14 +87,7 @@ internal class TipFlowViewModel @Inject constructor(
9387
.launchIn(viewModelScope)
9488

9589
combine(
96-
featureFlags.observe(FeatureFlag.GroupChats)
97-
.flatMapLatest { groupsOn ->
98-
if (groupsOn) {
99-
chatCoordinator.feed(ChatType.TIP_DM, ChatType.GROUP)
100-
} else {
101-
chatCoordinator.feed(ChatType.TIP_DM)
102-
}
103-
},
90+
chatCoordinator.feed(ChatType.TIP_DM, ChatType.GROUP),
10491
tokenCoordinator.tokens,
10592
) { summaries, tokens ->
10693
val selfId = userManager.accountId

‎apps/flipcash/shared/chat/src/main/kotlin/com/flipcash/shared/chat/internal/RealChatCoordinator.kt‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@ class RealChatCoordinator @Inject constructor(
123123
feedDelegate.observeFeedFromDb()
124124
feedDelegate.syncFeed()
125125
groupFeedDelegate.initialize(scope)
126-
// Synced unconditionally. The GroupChats flag filters the chat list, and every read of
127-
// this cache is already scoped to the chat types its caller asked for, so a group sitting
128-
// in the database with the flag off is invisible rather than latent. Gating the fetch
129-
// instead made the toggle do nothing until the process restarted, and contradicted the
130-
// roster-change routing below, which was never gated.
131126
groupFeedDelegate.syncGroupFeed()
132127
eventStreamDelegate.open()
133128
eventStreamDelegate.startHeartbeat { feedDelegate.syncFeed() }

‎apps/flipcash/shared/chat/src/test/kotlin/com/flipcash/shared/chat/GroupChatRoutingTest.kt‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ class GroupChatRoutingTest {
167167
subject.onUserLoggedIn(mockk<AccountCluster>(relaxed = true))
168168
runCurrent()
169169

170-
// Unconditional: the GroupChats flag filters the list, it does not decide whether the
171-
// cache is populated. Gating the fetch here made the toggle a no-op until the next launch.
172170
coVerify { groupFeedDelegate.syncGroupFeed() }
173171
subject.teardown()
174172
}

‎apps/flipcash/shared/featureflags/src/main/kotlin/com/flipcash/app/featureflags/FeatureFlag.kt‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,6 @@ sealed interface FeatureFlag<T: Any> {
117117
override val persistLogOut: Boolean = false
118118
}
119119

120-
@FeatureFlagMarker
121-
data object GroupChats: FeatureFlag<Boolean> {
122-
override val key: String = "group_chats_enabled"
123-
override val default: Boolean = false
124-
override val launched: Boolean = false
125-
override val visible: Boolean = true
126-
override val persistLogOut: Boolean = false
127-
}
128-
129120
companion object {
130121
val entries: List<FeatureFlag<*>>
131122
get() = FeatureFlagEntries.entries
@@ -148,7 +139,6 @@ val FeatureFlag<*>.title: String
148139
FeatureFlag.ContactPickerMode -> "Contact Picker Mode"
149140
FeatureFlag.ShowNetworkState -> "Network Offline Indicator"
150141
FeatureFlag.FrostedTipCard -> "Frosted Tip Card"
151-
FeatureFlag.GroupChats -> "Group Chats"
152142
}
153143

154144
val FeatureFlag<*>.message: String
@@ -162,7 +152,6 @@ val FeatureFlag<*>.message: String
162152
FeatureFlag.ContactPickerMode -> "When enabled, contacts will be accessed via the system contact picker instead of requesting full READ_CONTACTS permission"
163153
FeatureFlag.ShowNetworkState -> "When enabled, you'll gain the ability to see the network state on the Scanner when offline"
164154
FeatureFlag.FrostedTipCard -> "When enabled, the tip card in the scanner renders as frosted glass over a blurred snapshot of the camera instead of a solid card"
165-
FeatureFlag.GroupChats -> "When enabled, group chats appear in your chat list alongside your direct messages"
166155
}
167156

168157

0 commit comments

Comments
 (0)