Skip to content

Commit 3789aa9

Browse files
committed
Merge branch 'release/1.28.0' into merge/1.28.0-pt1
2 parents 695c1e7 + b395094 commit 3789aa9

File tree

17 files changed

+107
-49
lines changed

17 files changed

+107
-49
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ configurations.configureEach {
2626
exclude(module = "commons-logging")
2727
}
2828

29-
val canonicalVersionCode = 419
30-
val canonicalVersionName = "1.27.1"
29+
val canonicalVersionCode = 420
30+
val canonicalVersionName = "1.28.0"
3131

3232
val postFixSize = 10
3333
val abiPostFix = mapOf(

app/src/main/java/org/session/libsession/messaging/messages/ProfileUpdateHandler.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ class ProfileUpdateHandler @Inject constructor(
123123
profilePic = updates.pic ?: r.profilePic,
124124
blocksCommunityMessagesRequests = updates.blocksCommunityMessageRequests ?: r.blocksCommunityMessagesRequests
125125
)
126+
} else if (updates.blocksCommunityMessageRequests != null &&
127+
r.blocksCommunityMessagesRequests != updates.blocksCommunityMessageRequests) {
128+
r.copy(blocksCommunityMessagesRequests = updates.blocksCommunityMessageRequests)
126129
} else {
127130
r
128131
}
@@ -140,8 +143,11 @@ class ProfileUpdateHandler @Inject constructor(
140143
lastUpdated: Instant?,
141144
newUpdateTime: Instant?
142145
): Boolean {
143-
return (lastUpdated == null && newUpdateTime == null) ||
144-
(newUpdateTime != null && lastUpdated != null && newUpdateTime > lastUpdated)
146+
val lastUpdatedTimestamp = lastUpdated?.toEpochSeconds() ?: 0L
147+
val newUpdateTimestamp = newUpdateTime?.toEpochSeconds() ?: 0L
148+
149+
return (lastUpdatedTimestamp == 0L && newUpdateTimestamp == 0L) ||
150+
(newUpdateTimestamp > lastUpdatedTimestamp)
145151
}
146152

147153
class Updates private constructor(

app/src/main/java/org/session/libsession/messaging/sending_receiving/MessageRequestResponseHandler.kt

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ class MessageRequestResponseHandler @Inject constructor(
6060
!messageSender.isSelf && messageReceiver.isSelf -> {
6161
// We received a request response from another user.
6262

63+
// Mark the sender as "approvedMe".
64+
// This process MUST be done before trying to update the profile,
65+
// as profile updating requires the contact to exist
66+
val didApproveMe = configFactory.withMutableUserConfigs { configs ->
67+
configs.contacts.upsertContact(messageSender.address) {
68+
val oldApproveMe = approvedMe
69+
approvedMe = true
70+
oldApproveMe
71+
}
72+
}
73+
74+
6375
// Process the profile update if any
6476
message.profile?.toUpdates()?.let { updates ->
6577
profileUpdateHandler.get().handleProfileUpdate(
@@ -69,14 +81,6 @@ class MessageRequestResponseHandler @Inject constructor(
6981
)
7082
}
7183

72-
// Mark the sender as "approvedMe"
73-
val didApproveMe = configFactory.withMutableUserConfigs { configs ->
74-
configs.contacts.upsertContact(messageSender.address) {
75-
val oldApproveMe = approvedMe
76-
approvedMe = true
77-
oldApproveMe
78-
}
79-
}
8084

8185
val threadId by lazy {
8286
threadDatabase.getOrCreateThreadIdFor(messageSender.address)
@@ -124,16 +128,24 @@ class MessageRequestResponseHandler @Inject constructor(
124128
moveConversation(fromThreadId = blindedThreadId, toThreadId = threadId)
125129
}
126130

127-
// If we ever have any blinded conversations with this sender, we should make
128-
// sure we have set "approved" to true for them, because when we started the blinded
129-
// conversation, we didn't know their real standard addresses, so we didn't say
130-
// we have approved them, but now that we do, we need to approve them.
131-
if (existingBlindedThreadIDs.isNotEmpty()) {
132-
configFactory.withMutableUserConfigs { configs ->
131+
configFactory.withMutableUserConfigs { configs ->
132+
// If we ever have any blinded conversations with this sender, we should make
133+
// sure we have set "approved" to true for them, because when we started the blinded
134+
// conversation, we didn't know their real standard addresses, so we didn't say
135+
// we have approved them, but now that we do, we need to approve them.
136+
if (existingBlindedThreadIDs.isNotEmpty()) {
133137
configs.contacts.updateContact(messageSender.address) {
134138
approved = true
135139
}
136140
}
141+
142+
// Also remove all blinded contacts
143+
for (address in blindedConversationAddresses) {
144+
configs.contacts.eraseBlinded(
145+
communityServerUrl = address.serverUrl,
146+
blindedId = address.blindedId.address
147+
)
148+
}
137149
}
138150
}
139151

app/src/main/java/org/session/libsession/utilities/ViewUtils.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,7 @@ fun TextView.needsCollapsing(
3434
availableWidthPx: Int,
3535
maxLines: Int
3636
): Boolean {
37-
// Pick the width the TextView will actually respect before draw
38-
val rawWidth = when {
39-
measuredWidth > 0 -> measuredWidth
40-
// if maxWidth is set, we check it
41-
maxWidth in 1 until Int.MAX_VALUE -> minOf(availableWidthPx, maxWidth)
42-
else -> availableWidthPx
43-
}
44-
val contentWidth = (rawWidth - paddingLeft - paddingRight).coerceAtLeast(0)
37+
val contentWidth = (availableWidthPx - paddingLeft - paddingRight).coerceAtLeast(0)
4538
if (contentWidth <= 0 || text.isNullOrEmpty()) return false
4639

4740
val textForLayout = transformationMethod?.getTransformation(text, this) ?: text
@@ -67,7 +60,7 @@ fun TextView.needsCollapsing(
6760
.setAlignment(alignment)
6861
.setTextDirection(direction)
6962
.setMaxLines(maxLines) // cap at maxLines
70-
.setEllipsize(ellipsize ?: TextUtils.TruncateAt.END) // compute ellipsis
63+
.setEllipsize(ellipsize) // compute ellipsis
7164

7265
builder.setJustificationMode(justificationMode)
7366

app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageContentView.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,9 @@ class VisibleMessageContentView : ConstraintLayout {
356356
}
357357
}
358358

359-
val widthCap = binding.bodyTextView.maxWidth
360-
.takeIf { it > 0 && it < Int.MAX_VALUE }
361-
?: resources.getDimensionPixelSize(R.dimen.max_bubble_width)
362-
363359
// if the text was already manually expanded, we can skip this logic
364360
if(!isTextExpanded && binding.bodyTextView.needsCollapsing(
365-
availableWidthPx = widthCap,
361+
availableWidthPx = binding.bodyTextView.maxWidth,
366362
maxLines = MAX_COLLAPSED_LINE_COUNT)
367363
){
368364
// show the "Read mode" button

app/src/main/java/org/thoughtcrime/securesms/home/startconversation/community/JoinCommunityScreen.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ private fun CommunityScreen(
183183
.fillMaxWidth()
184184
.qaTag(R.string.AccessibilityId_communityJoin),
185185
enabled = state.isJoinButtonEnabled,
186+
disabledColor = LocalColors.current.textSecondary,
186187
onClick = {
187188
sendCommand(JoinCommunityViewModel.Commands.JoinCommunity(
188189
state.communityUrl

app/src/main/java/org/thoughtcrime/securesms/home/startconversation/home/StartConversation.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ internal fun StartConversationScreen(
7474
text = annotatedStringResource(newMessageTitleTxt),
7575
textStyle = LocalType.current.xl,
7676
iconRes = R.drawable.ic_message_square,
77+
iconSize = LocalDimensions.current.iconMedium2,
7778
modifier = Modifier.qaTag(R.string.AccessibilityId_messageNew),
7879
onClick = {
7980
navigateTo(StartConversationDestination.NewMessage)
@@ -89,6 +90,7 @@ internal fun StartConversationScreen(
8990
text = annotatedStringResource(R.string.groupCreate),
9091
textStyle = LocalType.current.xl,
9192
iconRes = R.drawable.ic_users_group_custom,
93+
iconSize = LocalDimensions.current.iconMedium2,
9294
modifier = Modifier.qaTag(R.string.AccessibilityId_groupCreate),
9395
onClick = {
9496
navigateTo(StartConversationDestination.CreateGroup)
@@ -104,6 +106,7 @@ internal fun StartConversationScreen(
104106
text = annotatedStringResource(R.string.communityJoin),
105107
textStyle = LocalType.current.xl,
106108
iconRes = R.drawable.ic_globe,
109+
iconSize = LocalDimensions.current.iconMedium2,
107110
modifier = Modifier.qaTag(R.string.AccessibilityId_communityJoin),
108111
onClick = {
109112
navigateTo(StartConversationDestination.JoinCommunity)
@@ -119,6 +122,7 @@ internal fun StartConversationScreen(
119122
text = annotatedStringResource(R.string.sessionInviteAFriend),
120123
textStyle = LocalType.current.xl,
121124
iconRes = R.drawable.ic_user_round_plus,
125+
iconSize = LocalDimensions.current.iconMedium2,
122126
modifier = Modifier.qaTag(R.string.AccessibilityId_sessionInviteAFriendButton),
123127
onClick = {
124128
navigateTo(StartConversationDestination.InviteFriend)

app/src/main/java/org/thoughtcrime/securesms/home/startconversation/newmessage/NewMessage.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ private fun EnterAccountId(
139139
.fillMaxWidth()
140140
.qaTag(R.string.next),
141141
enabled = state.isNextButtonEnabled,
142+
disabledColor = LocalColors.current.textSecondary,
142143
onClick = callbacks::onContinue
143144
) {
144145
LoadingArcOr(state.loading) {

app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsScreen.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import androidx.compose.ui.text.style.TextAlign
5959
import androidx.compose.ui.tooling.preview.Preview
6060
import androidx.compose.ui.tooling.preview.PreviewParameter
6161
import androidx.compose.ui.unit.dp
62+
import androidx.compose.ui.unit.sp
6263
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
6364
import com.bumptech.glide.integration.compose.GlideImage
6465
import network.loki.messenger.BuildConfig
@@ -107,6 +108,7 @@ import org.thoughtcrime.securesms.ui.ProBadgeText
107108
import org.thoughtcrime.securesms.ui.RadioOption
108109
import org.thoughtcrime.securesms.ui.components.AcccentOutlineCopyButton
109110
import org.thoughtcrime.securesms.ui.components.AccentOutlineButton
111+
import org.thoughtcrime.securesms.ui.components.AnnotatedTextWithIcon
110112
import org.thoughtcrime.securesms.ui.components.AppBarCloseIcon
111113
import org.thoughtcrime.securesms.ui.components.Avatar
112114
import org.thoughtcrime.securesms.ui.components.BaseBottomSheet
@@ -116,6 +118,7 @@ import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
116118
import org.thoughtcrime.securesms.ui.components.SmallCircularProgressIndicator
117119
import org.thoughtcrime.securesms.ui.components.annotatedStringResource
118120
import org.thoughtcrime.securesms.ui.qaTag
121+
import org.thoughtcrime.securesms.ui.safeContentWidth
119122
import org.thoughtcrime.securesms.ui.theme.LocalColors
120123
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
121124
import org.thoughtcrime.securesms.ui.theme.LocalType
@@ -252,16 +255,21 @@ fun Settings(
252255
Spacer(modifier = Modifier.height(LocalDimensions.current.spacing))
253256

254257
// name
255-
ProBadgeText(
258+
AnnotatedTextWithIcon(
256259
modifier = Modifier.qaTag(R.string.AccessibilityId_displayName)
260+
.fillMaxWidth()
261+
.safeContentWidth()
257262
.clickable(
258263
interactionSource = remember { MutableInteractionSource() },
259264
indication = null
260265
) {
261266
sendCommand(ShowUsernameDialog)
262267
},
263268
text = uiState.username,
264-
showBadge = uiState.showProBadge,
269+
iconRes = if(uiState.showProBadge) R.drawable.ic_pro_badge else null,
270+
onIconClick = null,
271+
iconSize = 53.sp to 24.sp,
272+
style = LocalType.current.h5,
265273
)
266274

267275
Spacer(modifier = Modifier.height(LocalDimensions.current.smallSpacing))

app/src/main/java/org/thoughtcrime/securesms/preferences/prosettings/ProSettingsHomeScreen.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ fun ProStats(
254254
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallSpacing)
255255
){
256256
Row(
257+
verticalAlignment = Alignment.CenterVertically,
257258
horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.xsSpacing)
258259
) {
259260
// groups updated
@@ -281,6 +282,7 @@ fun ProStats(
281282
}
282283

283284
Row(
285+
verticalAlignment = Alignment.CenterVertically,
284286
horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.xsSpacing)
285287
) {
286288
// Pro Badges
@@ -325,7 +327,7 @@ fun ProStatItem(
325327
Image(
326328
painter = painterResource(id = icon),
327329
contentDescription = null,
328-
modifier = Modifier.size(LocalDimensions.current.iconRowItem),
330+
modifier = Modifier.size(LocalDimensions.current.iconMedium2),
329331
colorFilter = ColorFilter.tint(LocalColors.current.accent)
330332
)
331333

0 commit comments

Comments
 (0)