Clean up remaining CFv2 todos.
This commit is contained in:
parent
daf077b3c9
commit
7b75a32394
3 changed files with 12 additions and 17 deletions
|
@ -184,19 +184,16 @@ class ConversationAdapterV2(
|
|||
}
|
||||
|
||||
fun canJumpToPosition(absolutePosition: Int): Boolean {
|
||||
// todo [cody] handle typing indicator
|
||||
val position = absolutePosition
|
||||
|
||||
if (position < 0) {
|
||||
if (absolutePosition < 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (position > super.getItemCount()) {
|
||||
Log.d(TAG, "Could not access corrected position $position as it is out of bounds.")
|
||||
if (absolutePosition > super.getItemCount()) {
|
||||
Log.d(TAG, "Could not access corrected position $absolutePosition as it is out of bounds.")
|
||||
return false
|
||||
}
|
||||
|
||||
if (!isRangeAvailable(position - 10, position + 5)) {
|
||||
if (!isRangeAvailable(absolutePosition - 10, absolutePosition + 5)) {
|
||||
getItem(absolutePosition)
|
||||
return false
|
||||
}
|
||||
|
@ -228,15 +225,12 @@ class ConversationAdapterV2(
|
|||
* Momentarily highlights a mention at the requested position.
|
||||
*/
|
||||
fun pulseAtPosition(position: Int) {
|
||||
if (position >= 0 && position < itemCount) {
|
||||
// TODO [cfv2] adjust for typing indicator
|
||||
val correctedPosition = position
|
||||
|
||||
recordToPulse = getConversationMessage(correctedPosition)
|
||||
if (position in 0 until itemCount) {
|
||||
recordToPulse = getConversationMessage(position)
|
||||
if (recordToPulse != null) {
|
||||
pulseRequest = ConversationAdapterBridge.PulseRequest(position, recordToPulse!!.messageRecord.isOutgoing)
|
||||
}
|
||||
notifyItemChanged(correctedPosition)
|
||||
notifyItemChanged(position)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1506,8 +1506,7 @@ class ConversationFragment :
|
|||
}
|
||||
|
||||
private fun updateLinkPreviewState() {
|
||||
// TODO [cfv2] include viewModel.isPushAvailable && in check
|
||||
if (!attachmentManager.isAttachmentPresent && context != null) {
|
||||
if (viewModel.isPushAvailable && !attachmentManager.isAttachmentPresent && context != null) {
|
||||
linkPreviewViewModel.onEnabled()
|
||||
linkPreviewViewModel.onTextChanged(composeText.textTrimmed.toString(), composeText.selectionStart, composeText.selectionEnd)
|
||||
} else {
|
||||
|
@ -2693,7 +2692,7 @@ class ConversationFragment :
|
|||
val recipient: Recipient? = viewModel.recipientSnapshot
|
||||
return ConversationOptionsMenu.Snapshot(
|
||||
recipient = recipient,
|
||||
isPushAvailable = recipient?.isRegistered == true && Recipient.self().isRegistered,
|
||||
isPushAvailable = viewModel.isPushAvailable,
|
||||
canShowAsBubble = Observable.empty(),
|
||||
isActiveGroup = recipient?.isActiveGroup == true,
|
||||
isActiveV2Group = recipient?.let { it.isActiveGroup && it.isPushV2Group } == true,
|
||||
|
@ -3572,7 +3571,6 @@ class ConversationFragment :
|
|||
|
||||
private inner class AttachmentManagerListener : AttachmentManager.AttachmentListener {
|
||||
override fun onAttachmentChanged() {
|
||||
// TODO [cfv2] handleSecurityChange(viewModel.getConversationStateSnapshot().getSecurityInfo());
|
||||
updateToggleButtonState()
|
||||
updateLinkPreviewState()
|
||||
}
|
||||
|
|
|
@ -112,6 +112,9 @@ class ConversationViewModel(
|
|||
var recipientSnapshot: Recipient? = null
|
||||
private set
|
||||
|
||||
val isPushAvailable: Boolean
|
||||
get() = recipientSnapshot?.isRegistered == true && Recipient.self().isRegistered
|
||||
|
||||
val wallpaperSnapshot: ChatWallpaper?
|
||||
get() = recipientSnapshot?.wallpaper
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue