improvements

This commit is contained in:
Evgeny @ SimpleX Chat committed 2026-09-27 12:42:45 +00:00
1 parent a15b817c59
commit 867949d2aa
13 files changed
+308 -296

No files matched your search

@@ -10,12 +10,13 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import chat.simplex.common.model.*
import chat.simplex.common.ui.theme.*
import chat.simplex.common.views.helpers.BADGE_GRACE_INTERVAL
import chat.simplex.common.views.helpers.BADGE_OLD_INTERVAL
import chat.simplex.common.views.helpers.NameWithBadge
import chat.simplex.common.views.helpers.ProfileImage
import chat.simplex.res.MR
import dev.icerock.moko.resources.compose.stringResource
import kotlinx.datetime.Clock
import kotlin.time.Duration.Companion.days
@Composable
fun CIChatLinkHeader(
@@ -86,8 +87,8 @@ private fun linkBadge(chatLink: MsgChatLink): LocalBadge? {
val b = (chatLink as? MsgChatLink.Contact)?.profile?.badge ?: return null
val expired = Clock.System.now() - b.badgeInfo.badgeExpiry
val status = when {
expired > 38.days -> BadgeStatus.ExpiredOld
expired > 7.days -> BadgeStatus.Expired
expired > BADGE_OLD_INTERVAL -> BadgeStatus.ExpiredOld
expired > BADGE_GRACE_INTERVAL -> BadgeStatus.Expired
else -> BadgeStatus.Active
}
return LocalBadge(b.badgeInfo, status)
@@ -133,6 +133,9 @@ const val MAX_FILE_SIZE_XFTP_LEGEND: Long = 5_368_709_120 // 5GB
// a badge raises the limit at send for this long after its expiry, shorter than the receiver's grace
val BADGE_SND_GRACE_INTERVAL: Duration = 1.days
val BADGE_GRACE_INTERVAL: Duration = 7.days
val BADGE_OLD_INTERVAL: Duration = 38.days
const val MAX_FILE_SIZE_LOCAL: Long = Long.MAX_VALUE
expect fun getAppFileUri(fileName: String): URI