kopia lustrzana https://github.com/ryukoposting/Signal-Android
Show excluded count in Story privacy settings overview.
rodzic
cdff0a61f2
commit
258951dea8
|
@ -16,7 +16,7 @@ sealed class ContactSearchData(val contactSearchKey: ContactSearchKey) {
|
||||||
*/
|
*/
|
||||||
data class Story(
|
data class Story(
|
||||||
val recipient: Recipient,
|
val recipient: Recipient,
|
||||||
val viewerCount: Int,
|
val count: Int,
|
||||||
val privacyMode: DistributionListPrivacyMode
|
val privacyMode: DistributionListPrivacyMode
|
||||||
) : ContactSearchData(ContactSearchKey.RecipientSearchKey.Story(recipient.id))
|
) : ContactSearchData(ContactSearchKey.RecipientSearchKey.Story(recipient.id))
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ object ContactSearchItems {
|
||||||
val count = if (model.story.recipient.isGroup) {
|
val count = if (model.story.recipient.isGroup) {
|
||||||
model.story.recipient.participantIds.size
|
model.story.recipient.participantIds.size
|
||||||
} else {
|
} else {
|
||||||
model.story.viewerCount
|
model.story.count
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.story.recipient.isMyStory && !model.hasBeenNotified) {
|
if (model.story.recipient.isMyStory && !model.hasBeenNotified) {
|
||||||
|
@ -138,7 +138,13 @@ object ContactSearchItems {
|
||||||
} else {
|
} else {
|
||||||
number.text = when {
|
number.text = when {
|
||||||
model.story.recipient.isGroup -> context.resources.getQuantityString(R.plurals.ContactSearchItems__group_story_d_viewers, count, count)
|
model.story.recipient.isGroup -> context.resources.getQuantityString(R.plurals.ContactSearchItems__group_story_d_viewers, count, count)
|
||||||
model.story.recipient.isMyStory -> context.resources.getQuantityString(R.plurals.ContactSearchItems__my_story_s_dot_d_viewers, count, presentPrivacyMode(model.story.privacyMode), count)
|
model.story.recipient.isMyStory -> {
|
||||||
|
if (model.story.privacyMode == DistributionListPrivacyMode.ALL_EXCEPT) {
|
||||||
|
context.resources.getQuantityString(R.plurals.ContactSearchItems__my_story_s_dot_d_excluded, count, presentPrivacyMode(DistributionListPrivacyMode.ALL), count)
|
||||||
|
} else {
|
||||||
|
context.resources.getQuantityString(R.plurals.ContactSearchItems__my_story_s_dot_d_viewers, count, presentPrivacyMode(model.story.privacyMode), count)
|
||||||
|
}
|
||||||
|
}
|
||||||
else -> context.resources.getQuantityString(R.plurals.ContactSearchItems__custom_story_d_viewers, count, count)
|
else -> context.resources.getQuantityString(R.plurals.ContactSearchItems__custom_story_d_viewers, count, count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -451,13 +451,12 @@ class DistributionListDatabase constructor(context: Context?, databaseHelper: Si
|
||||||
|
|
||||||
val memberCount = when (privacyMode) {
|
val memberCount = when (privacyMode) {
|
||||||
DistributionListPrivacyMode.ALL -> totalContactCount
|
DistributionListPrivacyMode.ALL -> totalContactCount
|
||||||
DistributionListPrivacyMode.ALL_EXCEPT -> totalContactCount - rawMemberCount
|
DistributionListPrivacyMode.ALL_EXCEPT -> rawMemberCount
|
||||||
DistributionListPrivacyMode.ONLY_WITH -> rawMemberCount
|
DistributionListPrivacyMode.ONLY_WITH -> rawMemberCount
|
||||||
}
|
}
|
||||||
|
|
||||||
return DistributionListPrivacyData(
|
return DistributionListPrivacyData(
|
||||||
privacyMode = privacyMode,
|
privacyMode = privacyMode,
|
||||||
rawMemberCount = rawMemberCount,
|
|
||||||
memberCount = memberCount
|
memberCount = memberCount
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,5 @@ package org.thoughtcrime.securesms.database.model
|
||||||
*/
|
*/
|
||||||
data class DistributionListPrivacyData(
|
data class DistributionListPrivacyData(
|
||||||
val privacyMode: DistributionListPrivacyMode,
|
val privacyMode: DistributionListPrivacyMode,
|
||||||
val rawMemberCount: Int,
|
|
||||||
val memberCount: Int
|
val memberCount: Int
|
||||||
)
|
)
|
||||||
|
|
|
@ -66,7 +66,7 @@ class MyStorySettingsRepository {
|
||||||
|
|
||||||
return MyStoryPrivacyState(
|
return MyStoryPrivacyState(
|
||||||
privacyMode = privacyData.privacyMode,
|
privacyMode = privacyData.privacyMode,
|
||||||
connectionCount = if (privacyData.privacyMode == DistributionListPrivacyMode.ALL_EXCEPT) privacyData.rawMemberCount else privacyData.memberCount
|
connectionCount = privacyData.memberCount
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5237,6 +5237,11 @@
|
||||||
<item quantity="one">%1$s · %2$d viewer</item>
|
<item quantity="one">%1$s · %2$d viewer</item>
|
||||||
<item quantity="other">%1$s · %2$d viewers</item>
|
<item quantity="other">%1$s · %2$d viewers</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
<!-- Label under name for my story -->
|
||||||
|
<plurals name="ContactSearchItems__my_story_s_dot_d_excluded">
|
||||||
|
<item quantity="one">%1$s · %2$d excluded</item>
|
||||||
|
<item quantity="other">%1$s · %2$d excluded</item>
|
||||||
|
</plurals>
|
||||||
<!-- Label under name for My Story when first sending to my story -->
|
<!-- Label under name for My Story when first sending to my story -->
|
||||||
<string name="ContactSearchItems__tap_to_choose_your_viewers">Tap to choose your viewers</string>
|
<string name="ContactSearchItems__tap_to_choose_your_viewers">Tap to choose your viewers</string>
|
||||||
<!-- Label for context menu item to open story settings -->
|
<!-- Label for context menu item to open story settings -->
|
||||||
|
|
Ładowanie…
Reference in New Issue