Skip to content

Commit c61371e

Browse files
committed
Message truncation logic and comments
1 parent 73958bd commit c61371e

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ data class VisibleMessage(
3030
var reaction: Reaction? = null,
3131
var hasMention: Boolean = false,
3232
var blocksMessageRequests: Boolean = false,
33+
/**
34+
* The pro features enabled for this message.
35+
*
36+
* Note:
37+
* * When this message is an incoming message, the pro features will only be populated
38+
* if we can prove that the sender has an active pro subscription.
39+
*
40+
* * When this message represents an outgoing message, this property can be populated by
41+
* application code at their wishes but the actual translating to protobuf onto the wired will
42+
* be checked against the current user's pro proof, if no active pro subscription is found,
43+
* the pro features will not be sent in the protobuf messages.
44+
*/
3345
var proFeatures: Set<ProFeature> = emptySet()
3446
) : Message() {
3547

app/src/main/java/org/thoughtcrime/securesms/pro/ProStatusManager.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,11 @@ class ProStatusManager @Inject constructor(
381381
// if the debug is set, return that
382382
if (prefs.forceIncomingMessagesAsPro()) return MAX_CHARACTER_PRO
383383

384-
// otherwise return the true value
385-
return if(isPostPro()) MAX_CHARACTER_REGULAR else MAX_CHARACTER_PRO //todo PRO implement real logic once it's in
384+
if (message.proFeatures.contains(ProMessageFeature.HIGHER_CHARACTER_LIMIT)) {
385+
return MAX_CHARACTER_PRO
386+
}
387+
388+
return MAX_CHARACTER_REGULAR
386389
}
387390

388391
// Temporary method and concept that we should remove once Pro is out

0 commit comments

Comments
 (0)