mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 20:18:36 +00:00
Story Privacy Setting UI issues
Fixes #13863 Resolves #13892 Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
@@ -77,6 +77,8 @@ abstract class BaseStoryRecipientSelectionFragment : Fragment(R.layout.stories_b
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewModel.state.observe(viewLifecycleOwner) {
|
viewModel.state.observe(viewLifecycleOwner) {
|
||||||
|
actionButton.isEnabled = it.selection.isNotEmpty()
|
||||||
|
|
||||||
if (it.distributionListId == null || it.privateStory != null) {
|
if (it.distributionListId == null || it.privateStory != null) {
|
||||||
if (it.isStartingSelection) {
|
if (it.isStartingSelection) {
|
||||||
getAttachedContactSelectionFragment().markSelected(it.selection.toSet())
|
getAttachedContactSelectionFragment().markSelected(it.selection.toSet())
|
||||||
@@ -141,7 +143,9 @@ abstract class BaseStoryRecipientSelectionFragment : Fragment(R.layout.stories_b
|
|||||||
return HeaderAction(
|
return HeaderAction(
|
||||||
R.string.BaseStoryRecipientSelectionFragment__select_all
|
R.string.BaseStoryRecipientSelectionFragment__select_all
|
||||||
) {
|
) {
|
||||||
viewModel.toggleSelectAll()
|
lifecycleDisposable += viewModel.toggleSelectAll().subscribe { updatedRecipients ->
|
||||||
|
getAttachedContactSelectionFragment().markSelected(updatedRecipients)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import androidx.lifecycle.LiveData
|
|||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import io.reactivex.rxjava3.core.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import io.reactivex.rxjava3.kotlin.subscribeBy
|
import io.reactivex.rxjava3.kotlin.subscribeBy
|
||||||
@@ -38,9 +39,12 @@ class BaseStoryRecipientSelectionViewModel(
|
|||||||
disposable.clear()
|
disposable.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toggleSelectAll() {
|
fun toggleSelectAll(): Single<Set<RecipientId>> {
|
||||||
|
return Single.create { emitter ->
|
||||||
disposable += repository.getAllSignalContacts().subscribeBy { allSignalRecipients ->
|
disposable += repository.getAllSignalContacts().subscribeBy { allSignalRecipients ->
|
||||||
store.update { it.copy(selection = allSignalRecipients) }
|
store.update { it.copy(selection = allSignalRecipients) }
|
||||||
|
emitter.onSuccess(allSignalRecipients)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user