Skip to content

Commit

Permalink
Merge branch 'molly-7.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Apr 14, 2024
2 parents 660fe12 + b2121b9 commit 6bc9644
Show file tree
Hide file tree
Showing 73 changed files with 592 additions and 574 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ apply {
from("fix-profm.gradle")
}

val canonicalVersionCode = 1406
val canonicalVersionName = "7.3.0"
val canonicalVersionCode = 1407
val canonicalVersionName = "7.3.1"
val mollyRevision = 1

val postFixSize = 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,6 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
val values = getValuesForStorageGroupV2(insert, true)

writableDatabase.insertOrThrow(TABLE_NAME, null, values)
val recipient = Recipient.externalGroupExact(groupId)

Log.i(TAG, "Creating restore placeholder for $groupId")
val createdId = groups.create(
Expand All @@ -967,6 +966,9 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
}

groups.setShowAsStoryState(groupId, insert.storySendMode.toShowAsStoryState())

val recipient = Recipient.externalGroupExact(groupId)

updateExtras(recipient.id) {
it.hideStory(insert.shouldHideStory())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void refresh(@NonNull RecipientId id) {
if (groupRecord.isPresent()) {
return RecipientCreator.forGroup(groupRecord.get(), record);
} else {
return RecipientCreator.forUnknown();
return RecipientCreator.forUnknownGroup(record.getId(), record.getGroupId());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,56 +187,64 @@ class Recipient(
val isHidden: Boolean = hiddenState != HiddenState.NOT_HIDDEN

/** Whether the recipient represents an individual person (as opposed to a group or list). */
val isIndividual: Boolean by lazy { !isGroup && !isCallLink && !isDistributionList && !isReleaseNotes }
val isIndividual: Boolean
get() = !isGroup && !isCallLink && !isDistributionList && !isReleaseNotes

/** Whether the recipient represents a group. It could be a Signal group or MMS group. */
val isGroup: Boolean by lazy { resolved.groupIdValue != null }
val isGroup: Boolean
get() = resolved.groupIdValue != null

/** Whether the recipient represents an MMS group. */
val isMmsGroup: Boolean by lazy {
val groupId = resolved.groupIdValue
groupId != null && groupId.isMms()
}
val isMmsGroup: Boolean
get() {
val groupId = resolved.groupIdValue
return groupId != null && groupId.isMms()
}

/** Whether the recipient represents a Signal group. */
val isPushGroup: Boolean by lazy {
val groupId = resolved.groupIdValue
groupId != null && groupId.isPush()
}
val isPushGroup: Boolean
get() {
val groupId = resolved.groupIdValue
return groupId != null && groupId.isPush()
}

/** Whether the recipient represents a V1 Signal group. These types of groups were deprecated in 2020. */
val isPushV1Group: Boolean by lazy {
val groupId = resolved.groupIdValue
groupId != null && groupId.isV1()
}
val isPushV1Group: Boolean
get() {
val groupId = resolved.groupIdValue
return groupId != null && groupId.isV1()
}

/** Whether the recipient represents a V2 Signal group. */
val isPushV2Group: Boolean by lazy {
val groupId = resolved.groupIdValue
groupId != null && groupId.isV2()
}
val isPushV2Group: Boolean
get() {
val groupId = resolved.groupIdValue
return groupId != null && groupId.isV2()
}

/** Whether the recipient represents a distribution list (a specific list of people to send a story to). */
val isDistributionList: Boolean by lazy { resolved.distributionListIdValue != null }
val isDistributionList: Boolean
get() = resolved.distributionListIdValue != null

/** Whether the recipient represents the "My Story" distribution list. */
val isMyStory: Boolean by lazy { resolved.distributionListIdValue == DistributionListId.from(DistributionListId.MY_STORY_ID) }
val isMyStory: Boolean
get() = resolved.distributionListIdValue == DistributionListId.from(DistributionListId.MY_STORY_ID)

/** A group is considered "unknown" if we don't have any data to render it. */
val isUnknownGroup: Boolean by lazy {
if ((groupAvatarId.isPresent && groupAvatarId.get() != -1L) || groupName.isNotNullOrBlank()) {
val isUnknownGroup: Boolean
get() = if ((groupAvatarId.isPresent && groupAvatarId.get() != -1L) || groupName.isNotNullOrBlank()) {
false
} else {
participantIdsValue.isEmpty() || participantIdsValue.size == 1 && participantIdsValue.contains(self().id)
}
}

/** Whether the group is inactive. Groups become inactive when you leave them. */
val isInactiveGroup: Boolean by lazy { isGroup && !isActiveGroup }
val isInactiveGroup: Boolean
get() = isGroup && !isActiveGroup

/** A photo to render for this recipient. */
val contactPhoto: ContactPhoto? by lazy {
if (isSelf) {
val contactPhoto: ContactPhoto?
get() = if (isSelf) {
null
} else if (groupIdValue != null && groupAvatarId.isPresent) {
GroupRecordContactPhoto(groupIdValue, groupAvatarId.get())
Expand All @@ -249,10 +257,10 @@ class Recipient(
} else {
null
}
}

/** A photo you can use as a fallback if [contactPhoto] fails to load. */
val fallbackContactPhoto: FallbackContactPhoto by lazy { getFallbackContactPhoto(DEFAULT_FALLBACK_PHOTO_PROVIDER) }
val fallbackContactPhoto: FallbackContactPhoto
get() = getFallbackContactPhoto(DEFAULT_FALLBACK_PHOTO_PROVIDER)

/** The URI of the ringtone that should be used when receiving a message from this recipient, if set. */
val messageRingtone: Uri? by lazy {
Expand Down Expand Up @@ -281,30 +289,33 @@ class Recipient(
get() = ArrayList(participantIdsValue)

/** The [ACI]'s of the members if this recipient is a group, otherwise empty. */
val participantAcis: List<ServiceId> by lazy {
check(groupRecord.isPresent)
groupRecord.get().requireV2GroupProperties().getMemberServiceIds().toImmutableList()
}
val participantAcis: List<ServiceId>
get() {
check(groupRecord.isPresent)
return groupRecord.get().requireV2GroupProperties().getMemberServiceIds().toImmutableList()
}

/** The [RegisteredState] of this recipient. Signal groups/lists are always registered. */
val registered: RegisteredState by lazy {
if (isPushGroup || isDistributionList) {
val registered: RegisteredState
get() = if (isPushGroup || isDistributionList) {
RegisteredState.REGISTERED
} else if (isMmsGroup) {
RegisteredState.NOT_REGISTERED
} else {
registeredValue
}
}

/** Shorthand to check if a user has been explicitly marked registered. */
val isRegistered: Boolean by lazy { registered == RegisteredState.REGISTERED }
val isRegistered: Boolean
get() = registered == RegisteredState.REGISTERED

/** Shorthand to check if a user has _not_ been explicitly marked unregistered. */
val isMaybeRegistered: Boolean by lazy { registered != RegisteredState.NOT_REGISTERED }
val isMaybeRegistered: Boolean
get() = registered != RegisteredState.NOT_REGISTERED

/** Shorthand to check if a user has been explicitly marked unregistered. */
val isUnregistered: Boolean by lazy { registered == RegisteredState.NOT_REGISTERED }
val isUnregistered: Boolean
get() = registered == RegisteredState.NOT_REGISTERED

/** Whether or not to show a special verified badge, indicating this is a special conversation (like release notes or note to self). */
val showVerified: Boolean = isReleaseNotes || isSelf
Expand Down Expand Up @@ -376,13 +387,8 @@ class Recipient(
get() = wallpaper?.autoChatColors ?: ChatColorsPalette.Bubbles.default.withId(Auto)

/** A fully resolved copy of this recipient, if needed. */
private val resolved: Recipient by lazy {
if (isResolving) {
live().resolve()
} else {
this
}
}
private val resolved: Recipient
get() = if (isResolving) live().resolve() else this

/** Convenience method to get a non-null [serviceId] hen you know it is there. */
fun requireServiceId(): ServiceId {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.thoughtcrime.securesms.conversation.colors.AvatarColor
import org.thoughtcrime.securesms.database.RecipientTable.RegisteredState
import org.thoughtcrime.securesms.database.model.GroupRecord
import org.thoughtcrime.securesms.database.model.RecipientRecord
import org.thoughtcrime.securesms.groups.GroupId
import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.thoughtcrime.securesms.util.Util
Expand Down Expand Up @@ -105,6 +106,15 @@ object RecipientCreator {
return Recipient.UNKNOWN
}

@JvmStatic
fun forUnknownGroup(id: RecipientId, groupId: GroupId?): Recipient {
return Recipient(
id = id,
isResolving = true,
groupIdValue = groupId
)
}

@VisibleForTesting
fun create(
resolved: Boolean,
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/res/values-af/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1973,7 +1973,7 @@
<!-- Displayed in bottom sheet describing that the user has no direct messages with this person. The placeholder is a person\'s name. -->
<string name="AboutSheet__no_direct_message">Geen direkte boodskappe nie met %1$s</string>
<!-- Explains that the given user (placeholder is short name) is in the users system contact -->
<string name="AboutSheet__s_is_in_your_system_contacts">%1$s is in your phone contacts</string>
<string name="AboutSheet__s_is_in_your_system_contacts">%1$s is in jou telefoonkontakte</string>
<!-- Notice in a row when user has no groups in common -->
<string name="AboutSheet__you_have_no_groups_in_common">Julle het geen groepe gemeen nie</string>
<!-- Notice when a user is not a connection to review requests carefully -->
Expand Down Expand Up @@ -4179,7 +4179,7 @@
<!-- Displayed when a recent name change has occurred. First placeholder is new short name, second is previous name, third is new name. -->
<string name="ReviewCard__s_recently_changed">%1$s het onlangs hul profielnaam van %2$s na %3$sverander</string>
<!-- Displayed when a review user is in your system contacts. Placeholder is short name. -->
<string name="ReviewCard__s_is_in_your_system_contacts">%1$s is in your phone contacts</string>
<string name="ReviewCard__s_is_in_your_system_contacts">%1$s is in jou telefoonkontakte</string>

<!-- CallParticipantsListUpdatePopupWindow -->
<string name="CallParticipantsListUpdatePopupWindow__s_joined">%1$s het aangesluit</string>
Expand Down Expand Up @@ -4730,7 +4730,7 @@
<string name="ConversationSettingsFragment__disappearing_messages">Verdwynboodskappe</string>
<string name="ConversationSettingsFragment__sounds_and_notifications">Klanke &amp; kennisgewings</string>
<!-- Removed by excludeNonTranslatables <string name="ConversationSettingsFragment__internal_details" translatable="false">Internal details</string> -->
<string name="ConversationSettingsFragment__contact_details">Phone contact info</string>
<string name="ConversationSettingsFragment__contact_details">Telefoonkontakinligting</string>
<string name="ConversationSettingsFragment__view_safety_number">Bekyk veiligheidsnommer</string>
<string name="ConversationSettingsFragment__block">Versper</string>
<string name="ConversationSettingsFragment__block_group">Versper groep</string>
Expand Down Expand Up @@ -5581,7 +5581,7 @@
<!-- Signal connections sheet bullet point 2 -->
<string name="SignalConnectionsBottomSheet__accepting_a_message_request">\'n Boodskapversoek te aanvaar</string>
<!-- Signal connections sheet bullet point 3 -->
<string name="SignalConnectionsBottomSheet__having_them_in_your_system_contacts">Having them in your phone contacts</string>
<string name="SignalConnectionsBottomSheet__having_them_in_your_system_contacts">Hulle in jou telefoonkontakte te hê</string>
<!-- Note at the bottom of the Signal connections sheet -->
<string name="SignalConnectionsBottomSheet__your_connections_can_see_your_name">"Jou verbindings kan jou naam en foto sien, en kan plasings in \"My Storie\" sien, tensy jy dit vir hulle versteek."</string>
<!-- Clickable option to add a viewer to a custom story -->
Expand Down Expand Up @@ -6681,7 +6681,7 @@
<!-- Title displayed at the top of the screen -->
<string name="NicknameActivity__nickname">Noemnaam</string>
<!-- Subtitle displayed under title -->
<string name="NicknameActivity__nicknames_amp_notes">Byname en notas word gestoor met behulp van Signal se end-tot-end-geënkripteerde stoorruimtediens. Dis slegs vir jou sigbaar.</string>
<string name="NicknameActivity__nicknames_amp_notes">Nicknames &amp; notes are stored with Signal and end-to-end encrypted. They are only visible to you.</string>
<!-- Field label for given name -->
<string name="NicknameActivity__first_name">Voornaam</string>
<!-- Content description for first name clear button -->
Expand All @@ -6695,9 +6695,9 @@
<!-- Button label to save -->
<string name="NicknameActivity__save">Stoor</string>
<!-- Dialog title for note and name deletion -->
<string name="NicknameActivity__delete_nickname">Skrap noemnaam?</string>
<string name="NicknameActivity__delete_nickname">Delete?</string>
<!-- Dialog message for note and name deletion -->
<string name="NicknameActivity__this_will_permanently_delete_this_nickname_and_note">Dit sal hierdie noemnaam en nota permanent skrap.</string>
<string name="NicknameActivity__this_will_permanently_delete_this_nickname_and_note">This will permanently delete any nickname and note you’ve set.</string>

<!-- ViewNoteBottomSheetDialogFragment -->
<!-- Sheet title -->
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2269,7 +2269,7 @@
<!-- Displayed in bottom sheet describing that the user has no direct messages with this person. The placeholder is a person\'s name. -->
<string name="AboutSheet__no_direct_message">لا توجد رسائل مباشرة مع %1$s</string>
<!-- Explains that the given user (placeholder is short name) is in the users system contact -->
<string name="AboutSheet__s_is_in_your_system_contacts">%1$s is in your phone contacts</string>
<string name="AboutSheet__s_is_in_your_system_contacts">%1$s موجود في جهات اتصال هاتفك</string>
<!-- Notice in a row when user has no groups in common -->
<string name="AboutSheet__you_have_no_groups_in_common">لا توجد مجموعات مُشتركة بينكم</string>
<!-- Notice when a user is not a connection to review requests carefully -->
Expand Down Expand Up @@ -4611,7 +4611,7 @@
<!-- Displayed when a recent name change has occurred. First placeholder is new short name, second is previous name, third is new name. -->
<string name="ReviewCard__s_recently_changed">غيّر مؤخرًا %1$s اسم حسابه الشخصي من %2$s إلى %3$s</string>
<!-- Displayed when a review user is in your system contacts. Placeholder is short name. -->
<string name="ReviewCard__s_is_in_your_system_contacts">%1$s is in your phone contacts</string>
<string name="ReviewCard__s_is_in_your_system_contacts">%1$s موجود في جهات اتصال هاتفك</string>

<!-- CallParticipantsListUpdatePopupWindow -->
<string name="CallParticipantsListUpdatePopupWindow__s_joined">انضم %1$s</string>
Expand Down Expand Up @@ -5178,7 +5178,7 @@
<string name="ConversationSettingsFragment__disappearing_messages">الرسائل المختفية</string>
<string name="ConversationSettingsFragment__sounds_and_notifications">الأصوات والإشعارات</string>
<!-- Removed by excludeNonTranslatables <string name="ConversationSettingsFragment__internal_details" translatable="false">Internal details</string> -->
<string name="ConversationSettingsFragment__contact_details">Phone contact info</string>
<string name="ConversationSettingsFragment__contact_details">معلومات عن جهة اتصال الهاتف</string>
<string name="ConversationSettingsFragment__view_safety_number">عرض رقم الأمان</string>
<string name="ConversationSettingsFragment__block">حظر</string>
<string name="ConversationSettingsFragment__block_group">حظر المجموعة</string>
Expand Down Expand Up @@ -6081,7 +6081,7 @@
<!-- Signal connections sheet bullet point 2 -->
<string name="SignalConnectionsBottomSheet__accepting_a_message_request">قبول طلب التراسل معهم</string>
<!-- Signal connections sheet bullet point 3 -->
<string name="SignalConnectionsBottomSheet__having_them_in_your_system_contacts">Having them in your phone contacts</string>
<string name="SignalConnectionsBottomSheet__having_them_in_your_system_contacts">وجودهم في جهات اتصال نظامك</string>
<!-- Note at the bottom of the Signal connections sheet -->
<string name="SignalConnectionsBottomSheet__your_connections_can_see_your_name">"يُمكن لِجهات اتصالك رؤية اسمك وصورتك، كما يمكنهم الاطلاع على منشوراتك في \"قصتي\" إلا إذا أخفيتها عنهم."</string>
<!-- Clickable option to add a viewer to a custom story -->
Expand Down Expand Up @@ -7265,7 +7265,7 @@
<!-- Title displayed at the top of the screen -->
<string name="NicknameActivity__nickname">اسم مستعار</string>
<!-- Subtitle displayed under title -->
<string name="NicknameActivity__nicknames_amp_notes">يتم تخزين الأسماء المُستعارة والملاحظات باستخدام خدمة التخزين المشفرة من طرف لطرف. تكون الأسماء المستعارة والملاحظات مرئية لك فقط.</string>
<string name="NicknameActivity__nicknames_amp_notes">Nicknames &amp; notes are stored with Signal and end-to-end encrypted. They are only visible to you.</string>
<!-- Field label for given name -->
<string name="NicknameActivity__first_name">الاسم الشخصي</string>
<!-- Content description for first name clear button -->
Expand All @@ -7279,9 +7279,9 @@
<!-- Button label to save -->
<string name="NicknameActivity__save">حفظ</string>
<!-- Dialog title for note and name deletion -->
<string name="NicknameActivity__delete_nickname">هل تريد حذف الاسم المستعار؟</string>
<string name="NicknameActivity__delete_nickname">Delete?</string>
<!-- Dialog message for note and name deletion -->
<string name="NicknameActivity__this_will_permanently_delete_this_nickname_and_note">هذا الإجراء سَيحذف الاسم المستعار والملاحظة بشكل دائم.</string>
<string name="NicknameActivity__this_will_permanently_delete_this_nickname_and_note">This will permanently delete any nickname and note you’ve set.</string>

<!-- ViewNoteBottomSheetDialogFragment -->
<!-- Sheet title -->
Expand Down
Loading

0 comments on commit 6bc9644

Please sign in to comment.