Revert "Add more logging to forwarding bottom sheet."

This reverts commit 3fc26733ad.
This commit is contained in:
Cody Henthorne
2023-09-26 19:43:48 -04:00
parent 8d72b27e1d
commit 96c1077238
3 changed files with 5 additions and 39 deletions

View File

@@ -9,7 +9,6 @@ import androidx.lifecycle.ViewModelProvider
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Observable
import org.signal.core.util.logging.Log
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.conversationlist.chatfilter.ConversationFilterRequest
import org.thoughtcrime.securesms.groups.SelectionLimits
@@ -51,10 +50,6 @@ class ContactSearchMediator(
arbitraryRepository: ArbitraryRepository? = null
) {
companion object {
private val TAG = Log.tag(ContactSearchMediator::class.java)
}
private val queryDebouncer = Debouncer(300, TimeUnit.MILLISECONDS)
private val viewModel: ContactSearchViewModel = ViewModelProvider(
@@ -75,17 +70,14 @@ class ContactSearchMediator(
displayOptions = displayOptions,
callbacks = object : ContactSearchAdapter.ClickCallbacks {
override fun onStoryClicked(view: View, story: ContactSearchData.Story, isSelected: Boolean) {
Log.d(TAG, "onStoryClicked() Recipient: ${story.recipient.id}")
toggleStorySelection(view, story, isSelected)
}
override fun onKnownRecipientClicked(view: View, knownRecipient: ContactSearchData.KnownRecipient, isSelected: Boolean) {
Log.d(TAG, "onKnownRecipientClicked() Recipient: ${knownRecipient.recipient.id}")
toggleSelection(view, knownRecipient, isSelected)
}
override fun onExpandClicked(expand: ContactSearchData.Expand) {
Log.d(TAG, "onExpandClicked()")
viewModel.expandSection(expand.sectionKey)
}
},
@@ -127,7 +119,6 @@ class ContactSearchMediator(
}
fun setKeysSelected(keys: Set<ContactSearchKey>) {
Log.d(TAG, "setKeysSelected() Keys: ${keys.map { it.toString() }}")
viewModel.setKeysSelected(callbacks.onBeforeContactsSelected(null, keys))
}
@@ -176,11 +167,9 @@ class ContactSearchMediator(
private fun toggleSelection(view: View, contactSearchData: ContactSearchData, isSelected: Boolean) {
return if (isSelected) {
Log.d(TAG, "toggleSelection(OFF) ${contactSearchData.contactSearchKey}")
callbacks.onContactDeselected(view, contactSearchData.contactSearchKey)
viewModel.setKeysNotSelected(setOf(contactSearchData.contactSearchKey))
} else {
Log.d(TAG, "toggleSelection(ON) ${contactSearchData.contactSearchKey}")
viewModel.setKeysSelected(callbacks.onBeforeContactsSelected(view, setOf(contactSearchData.contactSearchKey)))
}
}
@@ -223,13 +212,10 @@ class ContactSearchMediator(
open class SimpleCallbacks : Callbacks {
override fun onBeforeContactsSelected(view: View?, contactSearchKeys: Set<ContactSearchKey>): Set<ContactSearchKey> {
Log.d(TAG, "onBeforeContactsSelected() Selecting: ${contactSearchKeys.map { it.toString() }}")
return contactSearchKeys
}
override fun onContactDeselected(view: View?, contactSearchKey: ContactSearchKey) {
Log.i(TAG, "onContactDeselected() Deselected: $contactSearchKey}")
}
override fun onContactDeselected(view: View?, contactSearchKey: ContactSearchKey) = Unit
override fun onAdapterListCommitted(size: Int) = Unit
}

View File

@@ -8,7 +8,6 @@ import android.view.ViewGroup
import androidx.fragment.app.setFragmentResult
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import org.signal.core.util.logging.Log
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.components.FixedRoundedCornerBottomSheetDialogFragment
import org.thoughtcrime.securesms.stories.Stories
@@ -20,17 +19,11 @@ class MultiselectForwardBottomSheet : FixedRoundedCornerBottomSheetDialogFragmen
private var callback: Callback? = null
companion object {
private val TAG = Log.tag(MultiselectForwardBottomSheet::class.java)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.multiselect_bottom_sheet, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Log.d(TAG, "onViewCreated()")
callback = findListener<Callback>()
if (savedInstanceState == null) {
@@ -60,22 +53,18 @@ class MultiselectForwardBottomSheet : FixedRoundedCornerBottomSheetDialogFragmen
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
Log.d(TAG, "onDismiss()")
callback?.onDismissForwardSheet()
}
override fun onFinishForwardAction() {
Log.d(TAG, "onFinishForwardAction()")
callback?.onFinishForwardAction()
}
override fun exitFlow() {
Log.d(TAG, "exitFlow()")
dismissAllowingStateLoss()
}
override fun onSearchInputFocused() {
Log.d(TAG, "onSearchInputFocused()")
(requireDialog() as BottomSheetDialog).behavior.state = BottomSheetBehavior.STATE_EXPANDED
}

View File

@@ -117,8 +117,6 @@ class MultiselectForwardFragment :
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Log.d(TAG, "onViewCreated()")
view.minimumHeight = resources.displayMetrics.heightPixels
contactSearchRecycler = view.findViewById(R.id.contact_selection_list)
@@ -135,9 +133,7 @@ class MultiselectForwardFragment :
this::getConfiguration,
object : ContactSearchMediator.SimpleCallbacks() {
override fun onBeforeContactsSelected(view: View?, contactSearchKeys: Set<ContactSearchKey>): Set<ContactSearchKey> {
val filtered: Set<ContactSearchKey> = filterContacts(view, contactSearchKeys)
Log.d(TAG, "onBeforeContactsSelected() Attempting to select: ${contactSearchKeys.map { it.toString() }}, Filtered selection: ${filtered.map { it.toString() } }")
return filtered
return filterContacts(view, contactSearchKeys)
}
}
)
@@ -228,6 +224,7 @@ class MultiselectForwardFragment :
disposables += contactSearchMediator
.getErrorEvents()
.subscribe {
@Suppress("WHEN_ENUM_CAN_BE_NULL_IN_JAVA")
val message: Int = when (it) {
ContactSearchError.CONTACT_NOT_SELECTABLE -> R.string.MultiselectForwardFragment__only_admins_can_send_messages_to_this_group
ContactSearchError.RECOMMENDED_LIMIT_REACHED -> R.string.ContactSelectionListFragment_recommended_member_limit_reached
@@ -238,8 +235,6 @@ class MultiselectForwardFragment :
}
viewModel.state.observe(viewLifecycleOwner) {
Log.d(TAG, "State change: ${it.stage.javaClass.simpleName}")
when (it.stage) {
MultiselectForwardState.Stage.Selection -> {}
MultiselectForwardState.Stage.FirstConfirmation -> displayFirstSendConfirmation()
@@ -277,8 +272,6 @@ class MultiselectForwardFragment :
override fun onResume() {
super.onResume()
Log.d(TAG, "onViewCreated()")
val now = System.currentTimeMillis()
val expiringMessages = args.multiShareArgs.filter { it.expiresAt > 0L }
val firstToExpire = expiringMessages.minByOrNull { it.expiresAt }
@@ -338,8 +331,6 @@ class MultiselectForwardFragment :
}
private fun dismissWithSuccess(@PluralsRes toastTextResId: Int) {
Log.d(TAG, "dismissWithSuccess() Selected: ${contactSearchMediator.getSelectedContacts().map { it.toString() }}")
requireListener<Callback>().setResult(
Bundle().apply {
putBoolean(RESULT_SENT, true)
@@ -350,7 +341,7 @@ class MultiselectForwardFragment :
}
private fun dismissAndShowToast(@PluralsRes toastTextResId: Int) {
Log.d(TAG, "dismissAndShowToast() Selected: ${contactSearchMediator.getSelectedContacts().map { it.toString() }}")
Log.d(TAG, "dismissAndShowToast")
val argCount = getMessageCount()
@@ -372,7 +363,7 @@ class MultiselectForwardFragment :
}
private fun dismissWithSelection(selectedContacts: Set<ContactSearchKey>) {
Log.d(TAG, "dismissWithSelection() Selected: ${selectedContacts.map { it.toString() }}")
Log.d(TAG, "dismissWithSelection")
callback.onFinishForwardAction()
dismissibleDialog?.dismiss()