Release/1.18.5 (#1536)

* Fix issue with span being the full length (#1528)

* Proper display of unresolved names in mentions (#1530)

* Fix issue with span being the full length

* Making sure a mention with a username without a resolved name still displayed with the appropriate style with the truncated is

* Testnet build (#1532)

Co-authored-by: fanchao <git@fanchao.dev>

* Allow "public.loki.foundation" to be accessed by http (#1534)

Co-authored-by: fanchao <git@fanchao.dev>

* Bumping the version code and name

* Reverting temporary change

---------

Co-authored-by: Fanchao Liu <273191+simophin@users.noreply.github.com>
Co-authored-by: fanchao <git@fanchao.dev>
This commit is contained in:
ThomasSession 2024-07-09 11:45:30 +10:00 committed by GitHub
parent 1e02845fd2
commit 8c4bd9b448
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 5 deletions

View File

@ -31,8 +31,8 @@ configurations.all {
exclude module: "commons-logging"
}
def canonicalVersionCode = 373
def canonicalVersionName = "1.18.4"
def canonicalVersionCode = 374
def canonicalVersionName = "1.18.5"
def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1,

View File

@ -18,6 +18,7 @@ import org.session.libsession.messaging.utilities.SodiumUtilities
import org.session.libsession.utilities.TextSecurePreferences
import org.session.libsession.utilities.ThemeUtil
import org.session.libsession.utilities.getColorFromAttr
import org.session.libsession.utilities.truncateIdForDisplay
import org.thoughtcrime.securesms.dependencies.DatabaseComponent
import org.thoughtcrime.securesms.util.RoundedBackgroundSpan
import org.thoughtcrime.securesms.util.getAccentColor
@ -67,7 +68,7 @@ object MentionUtilities {
} else {
val contact = DatabaseComponent.get(context).sessionContactDatabase().getContactWithSessionID(publicKey)
@Suppress("NAME_SHADOWING") val context = if (openGroup != null) Contact.ContactContext.OPEN_GROUP else Contact.ContactContext.REGULAR
contact?.displayName(context)
contact?.displayName(context) ?: truncateIdForDisplay(publicKey)
}
if (userDisplayName != null) {
val mention = "@$userDisplayName"

View File

@ -1,7 +1,6 @@
package org.thoughtcrime.securesms.util
import android.content.Context
import android.content.res.Resources
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.RectF
@ -50,6 +49,17 @@ class RoundedBackgroundSpan(
override fun getSize(
paint: Paint, text: CharSequence?, start: Int, end: Int, fm: Paint.FontMetricsInt?
): Int {
// If the span covers the whole text, and the height is not set, draw() will not be called for the span.
// To help with that we need to take the font metric into account
val metrics = paint.fontMetricsInt
if (fm != null) {
fm.top = metrics.top
fm.ascent = metrics.ascent
fm.descent = metrics.descent
fm.bottom = metrics.bottom
}
return (paint.measureText(text, start, end) + 2 * paddingHorizontal).toInt()
}

View File

@ -2,6 +2,7 @@
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">127.0.0.1</domain>
<domain includeSubdomains="true">public.loki.foundation</domain>
</domain-config>
<domain-config cleartextTrafficPermitted="false">
<domain includeSubdomains="false">seed1.getsession.org</domain>

View File

@ -1,4 +1,4 @@
package org.session.libsession.utilities
fun truncateIdForDisplay(id: String): String =
id.takeIf { it.length > 8 }?.apply{ "${take(4)}${takeLast(4)}" } ?: id
id.takeIf { it.length > 8 }?.run{ "${take(4)}${takeLast(4)}" } ?: id