Merge pull request #1050 from session-foundation/feature/release-1.21.3-merge

Feature/release 1.21.3 merge
pull/1713/head
ThomasSession 1 month ago committed by GitHub
commit d64a40af2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,8 +15,8 @@ configurations.configureEach {
exclude module: "commons-logging" exclude module: "commons-logging"
} }
def canonicalVersionCode = 397 def canonicalVersionCode = 399
def canonicalVersionName = "1.21.1" def canonicalVersionName = "1.21.3"
def postFixSize = 10 def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1, def abiPostFix = ['armeabi-v7a' : 1,
@ -350,7 +350,6 @@ dependencies {
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion" implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
implementation "nl.komponents.kovenant:kovenant-android:$kovenantVersion" implementation "nl.komponents.kovenant:kovenant-android:$kovenantVersion"
implementation "com.jakewharton.rxbinding3:rxbinding:3.1.0" implementation "com.jakewharton.rxbinding3:rxbinding:3.1.0"
implementation "com.github.ybq:Android-SpinKit:1.4.0"
implementation "com.opencsv:opencsv:4.6" implementation "com.opencsv:opencsv:4.6"
testImplementation "junit:junit:$junitVersion" testImplementation "junit:junit:$junitVersion"
testImplementation 'org.assertj:assertj-core:3.11.1' testImplementation 'org.assertj:assertj-core:3.11.1'

@ -690,7 +690,11 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
if (author != null && messageTimestamp >= 0) { if (author != null && messageTimestamp >= 0) {
jumpToMessage(author, messageTimestamp, firstLoad.get(), null) jumpToMessage(author, messageTimestamp, firstLoad.get(), null)
} else { } else {
if (firstLoad.getAndSet(false)) scrollToFirstUnreadMessageIfNeeded(true) if (firstLoad.getAndSet(false)) {
lifecycleScope.launch(Dispatchers.Main) {
scrollToFirstUnreadMessageIfNeeded(true)
}
}
handleRecyclerViewScrolled() handleRecyclerViewScrolled()
} }
} }
@ -1041,9 +1045,13 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
} }
} }
private fun scrollToFirstUnreadMessageIfNeeded(isFirstLoad: Boolean = false, shouldHighlight: Boolean = false): Int { private suspend fun scrollToFirstUnreadMessageIfNeeded(isFirstLoad: Boolean = false, shouldHighlight: Boolean = false): Int {
val lastSeenItemPosition = withContext(Dispatchers.Default) {
val lastSeenTimestamp = threadDb.getLastSeenAndHasSent(viewModel.threadId).first() val lastSeenTimestamp = threadDb.getLastSeenAndHasSent(viewModel.threadId).first()
val lastSeenItemPosition = adapter.findLastSeenItemPosition(lastSeenTimestamp) ?: return -1 adapter.findLastSeenItemPosition(lastSeenTimestamp)
}
if(lastSeenItemPosition == null) return -1
// If this is triggered when first opening a conversation then we want to position the top // If this is triggered when first opening a conversation then we want to position the top
// of the first unread message in the middle of the screen // of the first unread message in the middle of the screen

@ -5,11 +5,8 @@ import android.util.AttributeSet
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.LinearLayout import android.widget.LinearLayout
import com.squareup.phrase.Phrase
import network.loki.messenger.R import network.loki.messenger.R
import network.loki.messenger.databinding.ViewSearchBottomBarBinding import network.loki.messenger.databinding.ViewSearchBottomBarBinding
import org.session.libsession.utilities.StringSubstitutionConstants.COUNT_KEY
import org.session.libsession.utilities.StringSubstitutionConstants.TOTAL_COUNT_KEY
class SearchBottomBar : LinearLayout { class SearchBottomBar : LinearLayout {
private lateinit var binding: ViewSearchBottomBarBinding private lateinit var binding: ViewSearchBottomBarBinding

@ -79,6 +79,7 @@ public class MediaSendFragment extends Fragment implements ViewTreeObserver.OnGl
private ViewGroup playbackControlsContainer; private ViewGroup playbackControlsContainer;
private TextView charactersLeft; private TextView charactersLeft;
private View closeButton; private View closeButton;
private View loader;
private ControllableViewPager fragmentPager; private ControllableViewPager fragmentPager;
private MediaSendFragmentPagerAdapter fragmentPagerAdapter; private MediaSendFragmentPagerAdapter fragmentPagerAdapter;
@ -137,6 +138,7 @@ public class MediaSendFragment extends Fragment implements ViewTreeObserver.OnGl
playbackControlsContainer = view.findViewById(R.id.mediasend_playback_controls_container); playbackControlsContainer = view.findViewById(R.id.mediasend_playback_controls_container);
charactersLeft = view.findViewById(R.id.mediasend_characters_left); charactersLeft = view.findViewById(R.id.mediasend_characters_left);
closeButton = view.findViewById(R.id.mediasend_close_button); closeButton = view.findViewById(R.id.mediasend_close_button);
loader = view.findViewById(R.id.loader);
View sendButtonBkg = view.findViewById(R.id.mediasend_send_button_bkg); View sendButtonBkg = view.findViewById(R.id.mediasend_send_button_bkg);
@ -342,18 +344,12 @@ public class MediaSendFragment extends Fragment implements ViewTreeObserver.OnGl
private Stopwatch renderTimer; private Stopwatch renderTimer;
private Runnable progressTimer; private Runnable progressTimer;
private AlertDialog dialog;
@Override @Override
protected void onPreExecute() { protected void onPreExecute() {
renderTimer = new Stopwatch("ProcessMedia"); renderTimer = new Stopwatch("ProcessMedia");
progressTimer = () -> { progressTimer = () -> {
dialog = new AlertDialog.Builder(new ContextThemeWrapper(requireContext(), R.style.Theme_TextSecure_Dialog_MediaSendProgress)) loader.setVisibility(View.VISIBLE);
.setView(R.layout.progress_dialog)
.setCancelable(false)
.create();
dialog.show();
dialog.getWindow().setLayout(getResources().getDimensionPixelSize(R.dimen.mediasend_progress_dialog_size), getResources().getDimensionPixelSize(R.dimen.mediasend_progress_dialog_size));
}; };
Util.runOnMainDelayed(progressTimer, 250); Util.runOnMainDelayed(progressTimer, 250);
} }
@ -394,9 +390,7 @@ public class MediaSendFragment extends Fragment implements ViewTreeObserver.OnGl
protected void onPostExecute(List<Media> media) { protected void onPostExecute(List<Media> media) {
controller.onSendClicked(media, composeText.getTextTrimmed()); controller.onSendClicked(media, composeText.getTextTrimmed());
Util.cancelRunnableOnMain(progressTimer); Util.cancelRunnableOnMain(progressTimer);
if (dialog != null) { loader.setVisibility(View.GONE);
dialog.dismiss();
}
renderTimer.stop(TAG); renderTimer.stop(TAG);
} }
}.execute(); }.execute();

@ -109,7 +109,7 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
case GroupMessage: { case GroupMessage: {
OutgoingMediaMessage reply = OutgoingMediaMessage.from(message, recipient, Collections.emptyList(), null, null, expiresInMillis, 0); OutgoingMediaMessage reply = OutgoingMediaMessage.from(message, recipient, Collections.emptyList(), null, null, expiresInMillis, 0);
try { try {
mmsDatabase.insertMessageOutbox(reply, threadId, false, null, true); message.setId(mmsDatabase.insertMessageOutbox(reply, threadId, false, null, true));
MessageSender.send(message, address); MessageSender.send(message, address);
} catch (MmsException e) { } catch (MmsException e) {
Log.w(TAG, e); Log.w(TAG, e);
@ -118,7 +118,7 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
} }
case SecureMessage: { case SecureMessage: {
OutgoingTextMessage reply = OutgoingTextMessage.from(message, recipient, expiresInMillis, expireStartedAt); OutgoingTextMessage reply = OutgoingTextMessage.from(message, recipient, expiresInMillis, expireStartedAt);
smsDatabase.insertMessageOutbox(threadId, reply, false, System.currentTimeMillis(), null, true); message.setId(smsDatabase.insertMessageOutbox(threadId, reply, false, System.currentTimeMillis(), null, true));
MessageSender.send(message, address); MessageSender.send(message, address);
break; break;
} }

@ -291,13 +291,13 @@
android:clickable="true" android:clickable="true"
android:visibility="gone"> android:visibility="gone">
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.Large.ThreeBounce" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
app:SpinKit_Color="@android:color/white" /> android:layout_gravity="center"
android:indeterminateTint="?colorAccent"
android:indeterminate="true"/>
</FrameLayout> </FrameLayout>

@ -165,13 +165,13 @@
android:visibility="gone" android:visibility="gone"
android:alpha="0"> android:alpha="0">
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.Large.ThreeBounce" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
app:SpinKit_Color="@android:color/white" /> android:indeterminateTint="?colorAccent"
android:indeterminate="true"/>
</RelativeLayout> </RelativeLayout>

@ -34,13 +34,13 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_centerInParent="true" /> android:layout_centerInParent="true" />
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.Large.ThreeBounce"
android:id="@+id/spinner" android:id="@+id/spinner"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
app:SpinKit_Color="?android:textColorPrimary" /> android:indeterminateTint="?colorAccent"
android:indeterminate="true"/>
</RelativeLayout> </RelativeLayout>

@ -127,13 +127,13 @@
android:background="#A4000000" android:background="#A4000000"
android:visibility="gone"> android:visibility="gone">
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.Large.ThreeBounce" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
app:SpinKit_Color="@android:color/white" /> android:layout_centerInParent="true"
android:indeterminateTint="?colorAccent"
android:indeterminate="true"/>
</RelativeLayout> </RelativeLayout>

@ -124,13 +124,14 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"/> android:layout_gravity="center"/>
<com.github.ybq.android.spinkit.SpinKitView
<ProgressBar
android:id="@+id/local_loading_view" android:id="@+id/local_loading_view"
style="@style/SpinKitView.Large.ThreeBounce" android:layout_width="@dimen/large_spacing"
android:layout_width="wrap_content" android:layout_height="@dimen/large_spacing"
android:layout_height="wrap_content"
app:SpinKit_Color="?android:textColorPrimary"
android:layout_gravity="center" android:layout_gravity="center"
android:indeterminateTint="?android:textColorPrimary"
android:indeterminate="true"
tools:visibility="visible" tools:visibility="visible"
android:visibility="gone" /> android:visibility="gone" />

@ -31,13 +31,12 @@
tools:visibility="visible" tools:visibility="visible"
tools:listitem="@layout/view_user"/> tools:listitem="@layout/view_user"/>
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.Large.ThreeBounce"
android:id="@+id/loader" android:id="@+id/loader"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
app:SpinKit_Color="?android:textColorPrimary" /> android:indeterminateTint="?colorAccent"
android:indeterminate="true"/>
</FrameLayout> </FrameLayout>

@ -39,7 +39,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/dialog_button_height"
android:orientation="horizontal"> android:orientation="horizontal">
<Button <Button
@ -58,14 +58,17 @@
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel" /> android:text="@string/cancel" />
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.Small.ThreeBounce"
android:id="@+id/progressBar" android:id="@+id/progressBar"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/small_button_height" android:layout_height="@dimen/large_spacing"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
app:SpinKit_Color="?colorAccent" android:indeterminateTint="?colorAccent"
android:visibility="gone" /> android:indeterminate="true"
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout> </LinearLayout>

@ -164,13 +164,13 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.Large.ThreeBounce" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
app:SpinKit_Color="@android:color/white" /> android:layout_centerInParent="true"
android:indeterminateTint="?colorAccent"
android:indeterminate="true"/>
</RelativeLayout> </RelativeLayout>

@ -39,19 +39,20 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_marginTop="56dp" android:layout_marginTop="56dp"
android:visibility="gone" android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/communityUrlEditText"> app:layout_constraintTop_toBottomOf="@id/communityUrlEditText">
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
android:id="@+id/defaultRoomsLoader" android:id="@+id/defaultRoomsLoader"
style="@style/SpinKitView.Large.ThreeBounce" android:layout_width="@dimen/large_spacing"
android:layout_width="wrap_content" android:layout_height="@dimen/large_spacing"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" android:visibility="gone"
app:SpinKit_Color="?android:textColorPrimary" /> tools:visibility="visible"
android:layout_centerInParent="true"
android:indeterminateTint="?colorAccent"
android:indeterminate="true"/>
</RelativeLayout> </RelativeLayout>

@ -78,13 +78,13 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintBottom_toBottomOf="parent">
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.Large.ThreeBounce" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
app:SpinKit_Color="@android:color/white" /> android:layout_centerInParent="true"
android:indeterminateTint="?colorAccent"
android:indeterminate="true"/>
</RelativeLayout> </RelativeLayout>

@ -11,15 +11,14 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:scrollbars="vertical"/> android:scrollbars="vertical"/>
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.Large.ThreeBounce"
android:id="@+id/loading_progress" android:id="@+id/loading_progress"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:layout_gravity="center" android:layout_gravity="center"
android:visibility="visible" android:indeterminateTint="?colorAccent"
app:SpinKit_Color="?android:textColorPrimary" /> android:indeterminate="true"/>
<TextView <TextView
android:id="@+id/no_results" android:id="@+id/no_results"

@ -136,4 +136,24 @@
</FrameLayout> </FrameLayout>
<FrameLayout
android:id="@+id/loader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#A4000000"
android:focusable="true"
android:clickable="true"
android:visibility="gone"
tools:visibility="visible">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_gravity="center"
android:indeterminateTint="?colorAccent"
android:indeterminate="true"/>
</FrameLayout>
</FrameLayout> </FrameLayout>

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/medium_spacing">
<com.github.ybq.android.spinkit.SpinKitView
style="@style/SpinKitView.Large.ThreeBounce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:SpinKit_Color="?colorAccent" />
</RelativeLayout>

@ -61,12 +61,13 @@
</RelativeLayout> </RelativeLayout>
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
android:id="@+id/linkPreviewDraftLoader" android:id="@+id/linkPreviewDraftLoader"
style="@style/SpinKitView.Large.ThreeBounce" android:layout_width="@dimen/large_spacing"
android:layout_width="wrap_content" android:layout_height="@dimen/large_spacing"
android:layout_height="wrap_content" android:layout_marginTop="8dp"
app:SpinKit_Color="?android:textColorPrimary" android:layout_centerInParent="true"
android:layout_centerInParent="true" /> android:indeterminateTint="?android:textColorPrimary"
android:indeterminate="true"/>
</RelativeLayout> </RelativeLayout>

@ -55,15 +55,17 @@
android:text="37 of 73" android:text="37 of 73"
android:textStyle="bold"/> android:textStyle="bold"/>
<com.github.ybq.android.spinkit.SpinKitView <ProgressBar
style="@style/SpinKitView.DoubleBounce"
android:id="@+id/searchProgressWheel" android:id="@+id/searchProgressWheel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="8dp" android:padding="@dimen/medium_spacing"
android:layout_centerInParent="true"
android:indeterminateTint="?colorAccent"
android:indeterminate="true"
android:background="?backgroundSecondary" android:background="?backgroundSecondary"
app:SpinKit_Color="?android:textColorPrimary" android:visibility="gone"
android:visibility="gone"/> tools:visibility="visible"/>
</RelativeLayout> </RelativeLayout>

@ -430,7 +430,8 @@ object MessageSender {
// Result Handling // Result Handling
fun handleSuccessfulMessageSend(message: Message, destination: Destination, isSyncMessage: Boolean = false, openGroupSentTimestamp: Long = -1) { fun handleSuccessfulMessageSend(message: Message, destination: Destination, isSyncMessage: Boolean = false, openGroupSentTimestamp: Long = -1) {
if (message is VisibleMessage) MessagingModuleConfiguration.shared.lastSentTimestampCache.submitTimestamp(message.threadID!!, openGroupSentTimestamp) val threadId = message.threadID!!
if (message is VisibleMessage) MessagingModuleConfiguration.shared.lastSentTimestampCache.submitTimestamp(threadId, openGroupSentTimestamp)
val storage = MessagingModuleConfiguration.shared.storage val storage = MessagingModuleConfiguration.shared.storage
val userPublicKey = storage.getUserPublicKey()!! val userPublicKey = storage.getUserPublicKey()!!
val timestamp = message.sentTimestamp!! val timestamp = message.sentTimestamp!!
@ -439,7 +440,7 @@ object MessageSender {
storage.getMessageIdInDatabase(timestamp, userPublicKey)?.let { (messageID, mms) -> storage.getMessageIdInDatabase(timestamp, userPublicKey)?.let { (messageID, mms) ->
if (openGroupSentTimestamp != -1L && message is VisibleMessage) { if (openGroupSentTimestamp != -1L && message is VisibleMessage) {
storage.addReceivedMessageTimestamp(openGroupSentTimestamp) storage.addReceivedMessageTimestamp(openGroupSentTimestamp)
storage.updateSentTimestamp(messageID, message.isMediaMessage(), openGroupSentTimestamp, message.threadID!!) storage.updateSentTimestamp(messageID, message.isMediaMessage(), openGroupSentTimestamp, threadId)
message.sentTimestamp = openGroupSentTimestamp message.sentTimestamp = openGroupSentTimestamp
} }
@ -488,8 +489,11 @@ object MessageSender {
// Fixed in: https://optf.atlassian.net/browse/SES-1567 // Fixed in: https://optf.atlassian.net/browse/SES-1567
if (messageIsAddressedToCommunity) if (messageIsAddressedToCommunity)
{ {
storage.markAsSentToCommunity(message.threadID!!, message.id!!) val messageId = message.id
storage.markUnidentifiedInCommunity(message.threadID!!, message.id!!) if (messageId != null) {
storage.markAsSentToCommunity(threadId, messageId)
storage.markUnidentifiedInCommunity(threadId, messageId)
}
} }
else else
{ {

Loading…
Cancel
Save