Skip to content

Bring release/1.23.0 to dev #1124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ configurations.configureEach {
exclude module: "commons-logging"
}

def canonicalVersionCode = 404
def canonicalVersionName = "1.22.1"
def canonicalVersionCode = 405
def canonicalVersionName = "1.23.0"

def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
private fun sendTextOnlyMessage(hasPermissionToSendSeed: Boolean = false): Pair<Address, Long>? {
val recipient = viewModel.recipient ?: return null
val sentTimestamp = SnodeAPI.nowWithOffset
viewModel.beforeSendingTextOnlyMessage()
val approvalSubmittingJob = viewModel.implicitlyApproveRecipient()
val text = getMessageBody()
val userPublicKey = textSecurePreferences.getLocalNumber()
val isNoteToSelf = (recipient.isContactRecipient && recipient.address.toString() == userPublicKey)
Expand Down Expand Up @@ -1955,6 +1955,8 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
null,
true
)

approvalSubmittingJob?.join()
MessageSender.send(message, recipient.address)
}
// Send a typing stopped message
Expand All @@ -1974,7 +1976,7 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
}
val recipient = viewModel.recipient!!
val sentTimestamp = SnodeAPI.nowWithOffset
viewModel.beforeSendingAttachments()
val approvalSubmittingJob = viewModel.implicitlyApproveRecipient()

// Create the message
val message = VisibleMessage().applyExpiryMode(viewModel.threadId)
Expand Down Expand Up @@ -2020,6 +2022,9 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
null,
runThreadUpdate = true
)

approvalSubmittingJob?.join()

MessageSender.send(message, recipient.address, attachments, quote, linkPreview)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import dagger.assisted.AssistedInject
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
Expand Down Expand Up @@ -893,7 +894,7 @@ class ConversationViewModel(
}
}

fun acceptMessageRequest() = viewModelScope.launch {
fun acceptMessageRequest(): Job = viewModelScope.launch {
val recipient = recipient ?: return@launch Log.w("Loki", "Recipient was null for accept message request action")
val currentState = _uiState.value.messageRequestState as? MessageRequestUiState.Visible
?: return@launch Log.w("Loki", "Current state was not visible for accept message request action")
Expand Down Expand Up @@ -973,23 +974,25 @@ class ConversationViewModel(
attachmentDownloadHandler.retryFailedAttachments(attachments)
}

fun beforeSendingTextOnlyMessage() {
implicitlyApproveRecipient()
}

fun beforeSendingAttachments() {
implicitlyApproveRecipient()
}

private fun implicitlyApproveRecipient() {
/**
* Implicitly approve the recipient.
*
* @return The (kotlin coroutine) job of sending job message request, if one should be sent. The job
* instance is normally just for observing purpose. Note that the completion of this job
* does not mean the message is sent, it only means the the successful submission to the message
* send queue and they will be sent later. You will not be able to observe the completion
* of message sending through this method.
*/
fun implicitlyApproveRecipient(): Job? {
val recipient = recipient

if (uiState.value.messageRequestState is MessageRequestUiState.Visible) {
acceptMessageRequest()
return acceptMessageRequest()
} else if (recipient?.isApproved == false) {
// edge case for new outgoing thread on new recipient without sending approval messages
repository.setApproved(recipient, true)
}
return null
}

fun onCommand(command: Commands) {
Expand Down
44 changes: 18 additions & 26 deletions app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.view.ViewGroup.MarginLayoutParams
import android.view.View
import android.widget.Toast
import androidx.activity.viewModels
import androidx.core.os.bundleOf
Expand Down Expand Up @@ -246,7 +245,7 @@ class HomeActivity : ScreenLockActionBarActivity(),
} else 0
homeAdapter.data = data
if(firstPos >= 0) { manager.scrollToPositionWithOffset(firstPos, offsetTop) }
updateEmptyState()
binding.emptyStateContainer.isVisible = homeAdapter.itemCount == 0
}
}
}
Expand Down Expand Up @@ -421,30 +420,28 @@ class HomeActivity : ScreenLockActionBarActivity(),
}
}

private fun setSearchShown(isShown: Boolean) {
private fun setSearchShown(isSearchShown: Boolean) {
// Request focus immediately so the user can start typing
if (isShown) {
if (isSearchShown) {
binding.globalSearchInputLayout.requestFocus()
}

binding.searchToolbar.isVisible = isShown
binding.sessionToolbar.isVisible = !isShown
binding.conversationsRecyclerView.isVisible = !isShown
binding.seedReminderView.isVisible = !TextSecurePreferences.getHasViewedSeed(this) && !isShown
binding.globalSearchRecycler.isVisible = isShown
binding.conversationListContainer.isVisible = !isShown
if(isShown){
binding.newConversationButton.animate().cancel()
binding.newConversationButton.isVisible = false
} else {
updateEmptyState()
binding.newConversationButton.apply {
alpha = 0.0f
visibility = View.VISIBLE
animate().cancel()
animate().setStartDelay(350).setDuration(250L).alpha(1.0f).setListener(null).start()
}
binding.searchToolbar.isVisible = isSearchShown
binding.sessionToolbar.isVisible = !isSearchShown
binding.seedReminderView.isVisible = !TextSecurePreferences.getHasViewedSeed(this) && !isSearchShown
binding.globalSearchRecycler.isVisible = isSearchShown


// Show a fade in animation for the conversation list upon re-appearing
val shouldShowHomeAnimation = !isSearchShown && !binding.conversationListContainer.isVisible

binding.conversationListContainer.isVisible = !isSearchShown
if (shouldShowHomeAnimation) {
binding.conversationListContainer.animate().cancel()
binding.conversationListContainer.alpha = 0f
binding.conversationListContainer.animate().alpha(1f).start()
}

}

private fun updateLegacyConfigView() {
Expand Down Expand Up @@ -482,11 +479,6 @@ class HomeActivity : ScreenLockActionBarActivity(),
// endregion

// region Updating
private fun updateEmptyState() {
val threadCount = binding.conversationsRecyclerView.adapter?.itemCount ?: 0
binding.emptyStateContainer.isVisible = threadCount == 0 && binding.conversationsRecyclerView.isVisible
}

@Subscribe(threadMode = ThreadMode.MAIN)
fun onUpdateProfileEvent(event: ProfilePictureModifiedEvent) {
if (event.recipient.isLocalNumber) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,8 @@ class DefaultConversationRepository @Inject constructor(
)
} else {
val message = MessageRequestResponse(true)
MessageSender.sendNonDurably(
message = message,
destination = Destination.from(recipient.address),
isSyncMessage = recipient.isLocalNumber
).await()

MessageSender.send(message = message, address = recipient.address)

// add a control message for our user
storage.insertMessageRequestResponseFromYou(threadId)
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
</androidx.appcompat.widget.Toolbar>

<FrameLayout
android:animateLayoutChanges="true"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down