mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-08 09:18:39 +01:00
Fix duplicate contacts during story selection.
This commit is contained in:
committed by
Greyson Parrelli
parent
010c45da94
commit
dadf782bd1
+4
-1
@@ -78,7 +78,10 @@ abstract class BaseStoryRecipientSelectionFragment : Fragment(R.layout.stories_b
|
|||||||
|
|
||||||
viewModel.state.observe(viewLifecycleOwner) {
|
viewModel.state.observe(viewLifecycleOwner) {
|
||||||
if (it.distributionListId == null || it.privateStory != null) {
|
if (it.distributionListId == null || it.privateStory != null) {
|
||||||
getAttachedContactSelectionFragment().markSelected(it.selection.toSet())
|
if (it.isStartingSelection) {
|
||||||
|
getAttachedContactSelectionFragment().markSelected(it.selection.toSet())
|
||||||
|
viewModel.onStartingSelectionAdded()
|
||||||
|
}
|
||||||
presentTitle(toolbar, it.selection.size)
|
presentTitle(toolbar, it.selection.size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -7,5 +7,6 @@ import org.thoughtcrime.securesms.recipients.RecipientId
|
|||||||
data class BaseStoryRecipientSelectionState(
|
data class BaseStoryRecipientSelectionState(
|
||||||
val distributionListId: DistributionListId?,
|
val distributionListId: DistributionListId?,
|
||||||
val privateStory: DistributionListRecord? = null,
|
val privateStory: DistributionListRecord? = null,
|
||||||
val selection: Set<RecipientId> = emptySet()
|
val selection: Set<RecipientId> = emptySet(),
|
||||||
|
val isStartingSelection: Boolean = false
|
||||||
)
|
)
|
||||||
|
|||||||
+5
-1
@@ -29,7 +29,7 @@ class BaseStoryRecipientSelectionViewModel(
|
|||||||
disposable += repository.getRecord(distributionListId)
|
disposable += repository.getRecord(distributionListId)
|
||||||
.subscribe { record ->
|
.subscribe { record ->
|
||||||
val startingSelection = if (record.privacyMode == DistributionListPrivacyMode.ALL_EXCEPT) record.rawMembers else record.members
|
val startingSelection = if (record.privacyMode == DistributionListPrivacyMode.ALL_EXCEPT) record.rawMembers else record.members
|
||||||
store.update { it.copy(privateStory = record, selection = it.selection + startingSelection) }
|
store.update { it.copy(privateStory = record, selection = it.selection + startingSelection, isStartingSelection = true) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,6 +61,10 @@ class BaseStoryRecipientSelectionViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun onStartingSelectionAdded() {
|
||||||
|
store.update { it.copy(isStartingSelection = false) }
|
||||||
|
}
|
||||||
|
|
||||||
sealed class Action {
|
sealed class Action {
|
||||||
data class GoToNextScreen(val recipients: Set<RecipientId>) : Action()
|
data class GoToNextScreen(val recipients: Set<RecipientId>) : Action()
|
||||||
object ExitFlow : Action()
|
object ExitFlow : Action()
|
||||||
|
|||||||
Reference in New Issue
Block a user