kopia lustrzana https://github.com/ryukoposting/Signal-Android
Remove isFeatureAvailable and remove compatibility check.
rodzic
ca36eaacce
commit
2315a1c632
|
@ -18,7 +18,7 @@ import org.thoughtcrime.securesms.components.settings.configure
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||||
import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter
|
import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient
|
import org.thoughtcrime.securesms.recipients.Recipient
|
||||||
import org.thoughtcrime.securesms.stories.Stories
|
import org.thoughtcrime.securesms.stories.Stories.isFeatureFlagEnabled
|
||||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||||
import org.thoughtcrime.securesms.util.PlayServicesUtil
|
import org.thoughtcrime.securesms.util.PlayServicesUtil
|
||||||
import org.thoughtcrime.securesms.util.Util
|
import org.thoughtcrime.securesms.util.Util
|
||||||
|
@ -107,7 +107,7 @@ class AppSettingsFragment : DSLSettingsFragment(R.string.text_secure_normal__men
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (Stories.isFeatureAvailable()) {
|
if (isFeatureFlagEnabled()) {
|
||||||
clickPref(
|
clickPref(
|
||||||
title = DSLSettingsText.from(R.string.preferences__stories),
|
title = DSLSettingsText.from(R.string.preferences__stories),
|
||||||
icon = DSLSettingsIcon.from(R.drawable.ic_stories_24),
|
icon = DSLSettingsIcon.from(R.drawable.ic_stories_24),
|
||||||
|
|
|
@ -85,7 +85,7 @@ import org.thoughtcrime.securesms.recipients.RecipientId
|
||||||
import org.thoughtcrime.securesms.storage.StorageRecordUpdate
|
import org.thoughtcrime.securesms.storage.StorageRecordUpdate
|
||||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||||
import org.thoughtcrime.securesms.storage.StorageSyncModels
|
import org.thoughtcrime.securesms.storage.StorageSyncModels
|
||||||
import org.thoughtcrime.securesms.stories.Stories
|
import org.thoughtcrime.securesms.stories.Stories.isFeatureFlagEnabled
|
||||||
import org.thoughtcrime.securesms.util.Base64
|
import org.thoughtcrime.securesms.util.Base64
|
||||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||||
import org.thoughtcrime.securesms.util.GroupUtil
|
import org.thoughtcrime.securesms.util.GroupUtil
|
||||||
|
@ -1274,7 +1274,7 @@ open class RecipientDatabase(context: Context, databaseHelper: SignalDatabase) :
|
||||||
* @return All storage IDs for synced records, excluding the ones that need to be deleted.
|
* @return All storage IDs for synced records, excluding the ones that need to be deleted.
|
||||||
*/
|
*/
|
||||||
fun getContactStorageSyncIdsMap(): Map<RecipientId, StorageId> {
|
fun getContactStorageSyncIdsMap(): Map<RecipientId, StorageId> {
|
||||||
val (inPart, args) = if (Stories.isFeatureAvailable()) {
|
val (inPart, args) = if (isFeatureFlagEnabled()) {
|
||||||
"(?, ?)" to SqlUtil.buildArgs(GroupType.NONE.id, Recipient.self().id, GroupType.SIGNAL_V1.id, GroupType.DISTRIBUTION_LIST.id)
|
"(?, ?)" to SqlUtil.buildArgs(GroupType.NONE.id, Recipient.self().id, GroupType.SIGNAL_V1.id, GroupType.DISTRIBUTION_LIST.id)
|
||||||
} else {
|
} else {
|
||||||
"(?)" to SqlUtil.buildArgs(GroupType.NONE.id, Recipient.self().id, GroupType.SIGNAL_V1.id)
|
"(?)" to SqlUtil.buildArgs(GroupType.NONE.id, Recipient.self().id, GroupType.SIGNAL_V1.id)
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient
|
import org.thoughtcrime.securesms.recipients.Recipient
|
||||||
import org.thoughtcrime.securesms.releasechannel.ReleaseChannel
|
import org.thoughtcrime.securesms.releasechannel.ReleaseChannel
|
||||||
import org.thoughtcrime.securesms.s3.S3
|
import org.thoughtcrime.securesms.s3.S3
|
||||||
import org.thoughtcrime.securesms.stories.Stories
|
import org.thoughtcrime.securesms.stories.Stories.isFeatureFlagEnabled
|
||||||
import org.thoughtcrime.securesms.transport.RetryLaterException
|
import org.thoughtcrime.securesms.transport.RetryLaterException
|
||||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException
|
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
@ -51,7 +51,7 @@ class StoryOnboardingDownloadJob private constructor(parameters: Parameters) : B
|
||||||
}
|
}
|
||||||
|
|
||||||
fun enqueueIfNeeded() {
|
fun enqueueIfNeeded() {
|
||||||
if (SignalStore.storyValues().hasDownloadedOnboardingStory || !Stories.isFeatureAvailable()) {
|
if (SignalStore.storyValues().hasDownloadedOnboardingStory || !isFeatureFlagEnabled()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1377,7 +1377,7 @@ public final class MessageContentProcessor {
|
||||||
private void handleStoryMessage(@NonNull SignalServiceContent content, @NonNull SignalServiceStoryMessage message, @NonNull Recipient senderRecipient, @NonNull Recipient threadRecipient) throws StorageFailedException {
|
private void handleStoryMessage(@NonNull SignalServiceContent content, @NonNull SignalServiceStoryMessage message, @NonNull Recipient senderRecipient, @NonNull Recipient threadRecipient) throws StorageFailedException {
|
||||||
log(content.getTimestamp(), "Story message.");
|
log(content.getTimestamp(), "Story message.");
|
||||||
|
|
||||||
if (!Stories.isFeatureAvailable()) {
|
if (!Stories.isFeatureFlagEnabled()) {
|
||||||
warn(content.getTimestamp(), "Dropping unsupported story.");
|
warn(content.getTimestamp(), "Dropping unsupported story.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1519,7 +1519,7 @@ public final class MessageContentProcessor {
|
||||||
private @Nullable MessageId handleStoryReaction(@NonNull SignalServiceContent content, @NonNull SignalServiceDataMessage message, @NonNull Recipient senderRecipient) throws StorageFailedException {
|
private @Nullable MessageId handleStoryReaction(@NonNull SignalServiceContent content, @NonNull SignalServiceDataMessage message, @NonNull Recipient senderRecipient) throws StorageFailedException {
|
||||||
log(content.getTimestamp(), "Story reaction.");
|
log(content.getTimestamp(), "Story reaction.");
|
||||||
|
|
||||||
if (!Stories.isFeatureAvailable()) {
|
if (!Stories.isFeatureFlagEnabled()) {
|
||||||
warn(content.getTimestamp(), "Dropping unsupported story reaction.");
|
warn(content.getTimestamp(), "Dropping unsupported story reaction.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1620,7 +1620,7 @@ public final class MessageContentProcessor {
|
||||||
private @Nullable MessageId handleStoryReply(@NonNull SignalServiceContent content, @NonNull SignalServiceDataMessage message, @NonNull Recipient senderRecipient, long receivedTime) throws StorageFailedException {
|
private @Nullable MessageId handleStoryReply(@NonNull SignalServiceContent content, @NonNull SignalServiceDataMessage message, @NonNull Recipient senderRecipient, long receivedTime) throws StorageFailedException {
|
||||||
log(content.getTimestamp(), "Story reply.");
|
log(content.getTimestamp(), "Story reply.");
|
||||||
|
|
||||||
if (!Stories.isFeatureAvailable()) {
|
if (!Stories.isFeatureFlagEnabled()) {
|
||||||
warn(content.getTimestamp(), "Dropping unsupported story reply.");
|
warn(content.getTimestamp(), "Dropping unsupported story reply.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1901,7 +1901,7 @@ public final class MessageContentProcessor {
|
||||||
private long handleSynchronizeSentStoryReply(@NonNull SentTranscriptMessage message, long envelopeTimestamp)
|
private long handleSynchronizeSentStoryReply(@NonNull SentTranscriptMessage message, long envelopeTimestamp)
|
||||||
throws MmsException, BadGroupIdException {
|
throws MmsException, BadGroupIdException {
|
||||||
|
|
||||||
if (!Stories.isFeatureAvailable()) {
|
if (!Stories.isFeatureFlagEnabled()) {
|
||||||
warn(envelopeTimestamp, "Dropping unsupported story reply sync message.");
|
warn(envelopeTimestamp, "Dropping unsupported story reply sync message.");
|
||||||
return -1L;
|
return -1L;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,24 +74,12 @@ object Stories {
|
||||||
return SignalStore.account().isRegistered && (FeatureFlags.stories() || LocaleFeatureFlags.isInStoriesCountry())
|
return SignalStore.account().isRegistered && (FeatureFlags.stories() || LocaleFeatureFlags.isInStoriesCountry())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether or not the user has access to stories. This checks:
|
|
||||||
*
|
|
||||||
* - Registration status
|
|
||||||
* - Flag status
|
|
||||||
* - Capabilities
|
|
||||||
*/
|
|
||||||
@JvmStatic
|
|
||||||
fun isFeatureAvailable(): Boolean {
|
|
||||||
return isFeatureFlagEnabled() && Recipient.self().storiesCapability == Recipient.Capability.SUPPORTED
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the user has the Stories feature enabled.
|
* Whether or not the user has the Stories feature enabled.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isFeatureEnabled(): Boolean {
|
fun isFeatureEnabled(): Boolean {
|
||||||
return isFeatureAvailable() && !SignalStore.storyValues().isFeatureDisabled
|
return isFeatureFlagEnabled() && !SignalStore.storyValues().isFeatureDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getHeaderAction(onClick: () -> Unit): HeaderAction {
|
fun getHeaderAction(onClick: () -> Unit): HeaderAction {
|
||||||
|
|
Ładowanie…
Reference in New Issue