kopia lustrzana https://github.com/ryukoposting/Signal-Android
Do not allow users to attempt to send story replies to an inactive group.
rodzic
8a452ddf11
commit
891c99a148
|
@ -16,7 +16,6 @@ import com.google.android.material.bottomsheet.BottomSheetBehaviorHack
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
|
||||||
import io.reactivex.rxjava3.kotlin.subscribeBy
|
import io.reactivex.rxjava3.kotlin.subscribeBy
|
||||||
import org.signal.core.util.concurrent.SignalExecutors
|
import org.signal.core.util.concurrent.SignalExecutors
|
||||||
import org.signal.core.util.logging.Log
|
import org.signal.core.util.logging.Log
|
||||||
|
@ -146,6 +145,7 @@ class StoryGroupReplyFragment :
|
||||||
private lateinit var adapter: PagingMappingAdapter<MessageId>
|
private lateinit var adapter: PagingMappingAdapter<MessageId>
|
||||||
private lateinit var dataObserver: RecyclerView.AdapterDataObserver
|
private lateinit var dataObserver: RecyclerView.AdapterDataObserver
|
||||||
private lateinit var composer: StoryReplyComposer
|
private lateinit var composer: StoryReplyComposer
|
||||||
|
private lateinit var notInGroup: View
|
||||||
|
|
||||||
private var markReadHelper: MarkReadHelper? = null
|
private var markReadHelper: MarkReadHelper? = null
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ class StoryGroupReplyFragment :
|
||||||
|
|
||||||
recyclerView = view.findViewById(R.id.recycler)
|
recyclerView = view.findViewById(R.id.recycler)
|
||||||
composer = view.findViewById(R.id.composer)
|
composer = view.findViewById(R.id.composer)
|
||||||
|
notInGroup = view.findViewById(R.id.not_in_group)
|
||||||
|
|
||||||
lifecycleDisposable.bindTo(viewLifecycleOwner)
|
lifecycleDisposable.bindTo(viewLifecycleOwner)
|
||||||
|
|
||||||
|
@ -215,10 +216,7 @@ class StoryGroupReplyFragment :
|
||||||
adapter.registerAdapterDataObserver(dataObserver)
|
adapter.registerAdapterDataObserver(dataObserver)
|
||||||
|
|
||||||
initializeMentions()
|
initializeMentions()
|
||||||
|
initializeComposer(savedInstanceState)
|
||||||
if (savedInstanceState == null) {
|
|
||||||
ViewUtil.focusAndShowKeyboard(composer)
|
|
||||||
}
|
|
||||||
|
|
||||||
recyclerView.addOnScrollListener(GroupReplyScrollObserver())
|
recyclerView.addOnScrollListener(GroupReplyScrollObserver())
|
||||||
}
|
}
|
||||||
|
@ -433,6 +431,22 @@ class StoryGroupReplyFragment :
|
||||||
sendReaction(emoji)
|
sendReaction(emoji)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun initializeComposer(savedInstanceState: Bundle?) {
|
||||||
|
val isActiveGroup = Recipient.observable(groupRecipientId).map { it.isActiveGroup }
|
||||||
|
if (savedInstanceState == null) {
|
||||||
|
lifecycleDisposable += isActiveGroup.firstOrError().observeOn(AndroidSchedulers.mainThread()).subscribe { active ->
|
||||||
|
if (active) {
|
||||||
|
ViewUtil.focusAndShowKeyboard(composer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lifecycleDisposable += isActiveGroup.distinctUntilChanged().observeOn(AndroidSchedulers.mainThread()).forEach { active ->
|
||||||
|
composer.visible = active
|
||||||
|
notInGroup.visible = !active
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun initializeMentions() {
|
private fun initializeMentions() {
|
||||||
inlineQueryResultsController = InlineQueryResultsController(
|
inlineQueryResultsController = InlineQueryResultsController(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
tools:viewBindingIgnore="true"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:layout_gravity="bottom">
|
tools:layout_gravity="bottom"
|
||||||
|
tools:viewBindingIgnore="true">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/empty_notice"
|
android:id="@+id/empty_notice"
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:scrollbars="vertical"
|
android:scrollbars="vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/composer"
|
app:layout_constraintBottom_toTopOf="@+id/bottom_bar"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
@ -36,16 +36,36 @@
|
||||||
android:id="@+id/mentions_picker_container"
|
android:id="@+id/mentions_picker_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/composer"
|
app:layout_constraintBottom_toTopOf="@+id/bottom_bar"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintVertical_bias="1" />
|
app:layout_constraintVertical_bias="1" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.stories.viewer.reply.composer.StoryReplyComposer
|
<FrameLayout
|
||||||
android:id="@+id/composer"
|
android:id="@+id/bottom_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/not_in_group"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginHorizontal="@dimen/dsl_settings_gutter"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:minHeight="48dp"
|
||||||
|
android:text="@string/StoryGroupReplyFragment__you_cant_reply"
|
||||||
|
android:textAppearance="@style/Signal.Text.BodyMedium"
|
||||||
|
android:textColor="@color/signal_colorOnSurfaceVariant"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.stories.viewer.reply.composer.StoryReplyComposer
|
||||||
|
android:id="@+id/composer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -4829,6 +4829,8 @@
|
||||||
<string name="StoryViewItem__remove_viewer">Remove viewer</string>
|
<string name="StoryViewItem__remove_viewer">Remove viewer</string>
|
||||||
<!-- Displayed when a story has no replies yet -->
|
<!-- Displayed when a story has no replies yet -->
|
||||||
<string name="StoryGroupReplyFragment__no_replies_yet">No replies yet</string>
|
<string name="StoryGroupReplyFragment__no_replies_yet">No replies yet</string>
|
||||||
|
<!-- Displayed when no longer a group member -->
|
||||||
|
<string name="StoryGroupReplyFragment__you_cant_reply">You can\'t reply to this story because you\'re no longer a member of this group.</string>
|
||||||
<!-- Displayed for each user that reacted to a story when viewing replies -->
|
<!-- Displayed for each user that reacted to a story when viewing replies -->
|
||||||
<string name="StoryGroupReactionReplyItem__reacted_to_the_story">Reacted to the story</string>
|
<string name="StoryGroupReactionReplyItem__reacted_to_the_story">Reacted to the story</string>
|
||||||
<!-- Label for story views tab -->
|
<!-- Label for story views tab -->
|
||||||
|
|
Ładowanie…
Reference in New Issue