mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-21 02:08:40 +00:00
Remove hard coded message backups remote config.
This commit is contained in:
committed by
Jeffrey Starke
parent
6976ac7d44
commit
8b2f58e0e7
@@ -238,7 +238,6 @@ android {
|
||||
buildConfigField("String", "STRIPE_BASE_URL", "\"https://api.stripe.com/v1\"")
|
||||
buildConfigField("String", "STRIPE_PUBLISHABLE_KEY", "\"pk_live_6cmGZopuTsV8novGgJJW9JpC00vLIgtQ1D\"")
|
||||
buildConfigField("boolean", "TRACING_ENABLED", "false")
|
||||
buildConfigField("boolean", "MESSAGE_BACKUP_RESTORE_ENABLED", "true")
|
||||
buildConfigField("boolean", "LINK_DEVICE_UX_ENABLED", "false")
|
||||
|
||||
ndk {
|
||||
@@ -379,7 +378,6 @@ android {
|
||||
buildConfigField("boolean", "MANAGES_APP_UPDATES", "true")
|
||||
buildConfigField("String", "APK_UPDATE_MANIFEST_URL", "\"${apkUpdateManifestUrl}\"")
|
||||
buildConfigField("String", "BUILD_DISTRIBUTION_TYPE", "\"nightly\"")
|
||||
buildConfigField("boolean", "MESSAGE_BACKUP_RESTORE_ENABLED", "true")
|
||||
}
|
||||
|
||||
create("prod") {
|
||||
@@ -418,7 +416,6 @@ android {
|
||||
|
||||
buildConfigField("String", "BUILD_ENVIRONMENT_TYPE", "\"Staging\"")
|
||||
buildConfigField("String", "STRIPE_PUBLISHABLE_KEY", "\"pk_test_sngOd8FnXNkpce9nPXawKrJD00kIDngZkD\"")
|
||||
buildConfigField("boolean", "MESSAGE_BACKUP_RESTORE_ENABLED", "true")
|
||||
}
|
||||
|
||||
create("backup") {
|
||||
@@ -430,7 +427,6 @@ android {
|
||||
|
||||
buildConfigField("boolean", "MANAGES_APP_UPDATES", "true")
|
||||
buildConfigField("String", "BUILD_ENVIRONMENT_TYPE", "\"Backup\"")
|
||||
buildConfigField("boolean", "MESSAGE_BACKUP_RESTORE_ENABLED", "true")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import assertk.assertions.isEqualTo
|
||||
import assertk.assertions.isNull
|
||||
import io.mockk.coEvery
|
||||
import io.mockk.every
|
||||
import io.mockk.mockkStatic
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.test.StandardTestDispatcher
|
||||
@@ -43,7 +42,6 @@ import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.testing.CoroutineDispatcherRule
|
||||
import org.thoughtcrime.securesms.testing.InAppPaymentsRule
|
||||
import org.thoughtcrime.securesms.testing.SignalActivityRule
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import java.math.BigDecimal
|
||||
import java.util.Currency
|
||||
|
||||
@@ -67,9 +65,6 @@ class MessageBackupsCheckoutActivityTest {
|
||||
every { AppDependencies.billingApi.getBillingPurchaseResults() } returns purchaseResults
|
||||
coEvery { AppDependencies.billingApi.queryProduct() } returns BillingProduct(price = FiatMoney(BigDecimal.ONE, Currency.getInstance("USD")))
|
||||
coEvery { AppDependencies.billingApi.launchBillingFlow(any()) } returns Unit
|
||||
|
||||
mockkStatic(RemoteConfig::class)
|
||||
every { RemoteConfig.messageBackups } returns true
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -38,7 +38,6 @@ class BackupDeleteJobTest {
|
||||
@Before
|
||||
fun setUp() {
|
||||
mockkObject(RemoteConfig)
|
||||
every { RemoteConfig.messageBackups } returns true
|
||||
every { RemoteConfig.internalUser } returns true
|
||||
every { RemoteConfig.defaultMaxBackoff } returns 1000L
|
||||
|
||||
@@ -53,17 +52,6 @@ class BackupDeleteJobTest {
|
||||
unmockkAll()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun givenBackupsNotEnabled_whenIRun_thenIExpectFailure() {
|
||||
every { RemoteConfig.messageBackups } returns false
|
||||
|
||||
val job = BackupDeleteJob()
|
||||
|
||||
val result = job.run()
|
||||
|
||||
assertThat(result.isFailure).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun givenUserNotRegistered_whenIRun_thenIExpectFailure() {
|
||||
mockkObject(SignalStore) {
|
||||
|
||||
@@ -65,7 +65,6 @@ class BackupSubscriptionCheckJobTest {
|
||||
@Before
|
||||
fun setUp() {
|
||||
mockkObject(RemoteConfig)
|
||||
every { RemoteConfig.messageBackups } returns true
|
||||
every { RemoteConfig.internalUser } returns true
|
||||
|
||||
coEvery { AppDependencies.billingApi.getApiAvailability() } returns BillingResponseCode.OK
|
||||
|
||||
@@ -299,10 +299,8 @@ public class ApplicationContext extends Application implements AppForegroundObse
|
||||
}
|
||||
|
||||
public void checkFreeDiskSpace() {
|
||||
if (RemoteConfig.messageBackups()) {
|
||||
long availableBytes = BackupRepository.INSTANCE.getFreeStorageSpace().getBytes();
|
||||
SignalStore.backup().setSpaceAvailableOnDiskBytes(availableBytes);
|
||||
}
|
||||
long availableBytes = BackupRepository.INSTANCE.getFreeStorageSpace().getBytes();
|
||||
SignalStore.backup().setSpaceAvailableOnDiskBytes(availableBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -621,7 +621,7 @@ object BackupRepository {
|
||||
}
|
||||
|
||||
private fun shouldNotDisplayBackupFailedMessaging(): Boolean {
|
||||
return !SignalStore.account.isRegistered || !RemoteConfig.messageBackups || !SignalStore.backup.areBackupsEnabled
|
||||
return !SignalStore.account.isRegistered || !SignalStore.backup.areBackupsEnabled
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1933,9 +1933,7 @@ object BackupRepository {
|
||||
* prevents early initialization with incorrect keys before we have restored them.
|
||||
*/
|
||||
private fun initBackupAndFetchAuth(): NetworkResult<ArchiveServiceAccessPair> {
|
||||
return if (!RemoteConfig.messageBackups) {
|
||||
NetworkResult.StatusCodeError(555, null, null, emptyMap(), NonSuccessfulResponseCodeException(555, "Backups disabled!"))
|
||||
} else if (SignalStore.backup.backupsInitialized || SignalStore.account.isLinkedDevice) {
|
||||
return if (SignalStore.backup.backupsInitialized || SignalStore.account.isLinkedDevice) {
|
||||
getArchiveServiceAccessPair()
|
||||
.runOnStatusCodeError(resetInitializedStateErrorAction)
|
||||
.runOnApplicationError(clearAuthCredentials)
|
||||
|
||||
@@ -45,7 +45,6 @@ import org.thoughtcrime.securesms.jobs.InAppPaymentPurchaseTokenJob
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.next
|
||||
import org.whispersystems.signalservice.api.storage.IAPSubscriptionId
|
||||
import org.whispersystems.signalservice.internal.push.SubscriptionsConfiguration
|
||||
@@ -104,7 +103,7 @@ class MessageBackupsFlowViewModel(
|
||||
val allBackupTypes: List<MessageBackupsType> = try {
|
||||
withContext(SignalDispatchers.IO) {
|
||||
BackupRepository.getBackupTypes(
|
||||
if (!RemoteConfig.messageBackups) emptyList() else listOf(MessageBackupTier.FREE, MessageBackupTier.PAID)
|
||||
listOf(MessageBackupTier.FREE, MessageBackupTier.PAID)
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
@@ -371,7 +371,7 @@ private fun AppSettingsContent(
|
||||
onClick = {
|
||||
callbacks.navigate(AppSettingsRoute.ChatsRoute.Chats)
|
||||
},
|
||||
enabled = state.legacyLocalBackupsEnabled || isRegisteredAndUpToDate
|
||||
enabled = isRegisteredAndUpToDate
|
||||
)
|
||||
}
|
||||
|
||||
@@ -408,31 +408,29 @@ private fun AppSettingsContent(
|
||||
)
|
||||
}
|
||||
|
||||
if (state.showBackups) {
|
||||
item {
|
||||
Rows.TextRow(
|
||||
text = {
|
||||
TextWithBetaLabel(
|
||||
text = stringResource(R.string.preferences_chats__backups),
|
||||
textStyle = MaterialTheme.typography.bodyLarge
|
||||
)
|
||||
},
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = ImageVector.vectorResource(R.drawable.symbol_backup_24),
|
||||
contentDescription = stringResource(R.string.preferences_chats__backups),
|
||||
tint = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
callbacks.navigate(AppSettingsRoute.BackupsRoute.Backups)
|
||||
},
|
||||
onLongClick = {
|
||||
callbacks.copyRemoteBackupsSubscriberIdToClipboard()
|
||||
},
|
||||
enabled = isRegisteredAndUpToDate
|
||||
)
|
||||
}
|
||||
item {
|
||||
Rows.TextRow(
|
||||
text = {
|
||||
TextWithBetaLabel(
|
||||
text = stringResource(R.string.preferences_chats__backups),
|
||||
textStyle = MaterialTheme.typography.bodyLarge
|
||||
)
|
||||
},
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = ImageVector.vectorResource(R.drawable.symbol_backup_24),
|
||||
contentDescription = stringResource(R.string.preferences_chats__backups),
|
||||
tint = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
callbacks.navigate(AppSettingsRoute.BackupsRoute.Backups)
|
||||
},
|
||||
onLongClick = {
|
||||
callbacks.copyRemoteBackupsSubscriberIdToClipboard()
|
||||
},
|
||||
enabled = isRegisteredAndUpToDate
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
@@ -702,9 +700,7 @@ private fun AppSettingsContentPreview() {
|
||||
showInternalPreferences = true,
|
||||
showPayments = true,
|
||||
showAppUpdates = true,
|
||||
showBackups = true,
|
||||
backupFailureState = BackupFailureState.OUT_OF_STORAGE_SPACE,
|
||||
legacyLocalBackupsEnabled = false
|
||||
backupFailureState = BackupFailureState.OUT_OF_STORAGE_SPACE
|
||||
),
|
||||
bannerManager = BannerManager(
|
||||
banners = listOf(TestBanner())
|
||||
|
||||
@@ -15,9 +15,7 @@ data class AppSettingsState(
|
||||
val showInternalPreferences: Boolean = RemoteConfig.internalUser,
|
||||
val showPayments: Boolean = SignalStore.payments.paymentsAvailability.showPaymentsMenu(),
|
||||
val showAppUpdates: Boolean = Environment.IS_NIGHTLY,
|
||||
val showBackups: Boolean = RemoteConfig.messageBackups,
|
||||
val backupFailureState: BackupFailureState = BackupFailureState.NONE,
|
||||
val legacyLocalBackupsEnabled: Boolean
|
||||
val backupFailureState: BackupFailureState = BackupFailureState.NONE
|
||||
) {
|
||||
fun isRegisteredAndUpToDate(): Boolean {
|
||||
return !userUnregistered && !clientDeprecated
|
||||
|
||||
@@ -14,8 +14,6 @@ import org.thoughtcrime.securesms.database.model.InAppPaymentSubscriberRecord
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.BackupUtil
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.util.livedata.Store
|
||||
|
||||
@@ -27,8 +25,7 @@ class AppSettingsViewModel : ViewModel() {
|
||||
hasExpiredGiftBadge = SignalStore.inAppPayments.getExpiredGiftBadge() != null,
|
||||
allowUserToGoToDonationManagementScreen = SignalStore.inAppPayments.isLikelyASustainer() || InAppDonations.hasAtLeastOnePaymentMethodAvailable(),
|
||||
userUnregistered = TextSecurePreferences.isUnauthorizedReceived(AppDependencies.application) || !SignalStore.account.isRegistered,
|
||||
clientDeprecated = SignalStore.misc.isClientDeprecated,
|
||||
legacyLocalBackupsEnabled = !RemoteConfig.messageBackups && SignalStore.settings.isBackupEnabled && BackupUtil.canUserAccessBackupDirectory(AppDependencies.application)
|
||||
clientDeprecated = SignalStore.misc.isClientDeprecated
|
||||
)
|
||||
)
|
||||
|
||||
@@ -74,9 +71,7 @@ class AppSettingsViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
private fun getBackupFailureState(): BackupFailureState {
|
||||
return if (!RemoteConfig.messageBackups) {
|
||||
BackupFailureState.NONE
|
||||
} else if (BackupRepository.shouldDisplayOutOfRemoteStorageSpaceUx()) {
|
||||
return if (BackupRepository.shouldDisplayOutOfRemoteStorageSpaceUx()) {
|
||||
BackupFailureState.OUT_OF_STORAGE_SPACE
|
||||
} else if (BackupRepository.shouldDisplayBackupFailedSettingsRow()) {
|
||||
BackupFailureState.BACKUP_FAILED
|
||||
|
||||
@@ -15,11 +15,6 @@ import kotlin.time.Duration.Companion.seconds
|
||||
* Describes the state of the user's selected backup tier.
|
||||
*/
|
||||
sealed interface BackupState {
|
||||
/**
|
||||
* Backups are not available on this device
|
||||
*/
|
||||
data object NotAvailable : BackupState
|
||||
|
||||
/**
|
||||
* User has no active backup tier, no tier history
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.thoughtcrime.securesms.database.model.InAppPaymentSubscriberRecord
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.InternetConnectionObserver
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.whispersystems.signalservice.api.NetworkResult
|
||||
import org.whispersystems.signalservice.api.subscriptions.ActiveSubscription
|
||||
import java.math.BigDecimal
|
||||
@@ -80,16 +79,12 @@ class BackupStateObserver(
|
||||
* setting initial ViewModel state values.
|
||||
*/
|
||||
fun getNonIOBackupState(): BackupState {
|
||||
return if (RemoteConfig.messageBackups) {
|
||||
val tier = SignalStore.backup.backupTier
|
||||
val tier = SignalStore.backup.backupTier
|
||||
|
||||
if (tier != null) {
|
||||
BackupState.LocalStore(tier)
|
||||
} else {
|
||||
BackupState.None
|
||||
}
|
||||
return if (tier != null) {
|
||||
BackupState.LocalStore(tier)
|
||||
} else {
|
||||
BackupState.NotAvailable
|
||||
BackupState.None
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,11 +212,6 @@ class BackupStateObserver(
|
||||
}
|
||||
|
||||
private suspend fun performDatabaseBackupStateRefresh() {
|
||||
if (!RemoteConfig.messageBackups) {
|
||||
Log.d(TAG, "[performDatabaseBackupStateRefresh] Dropping refresh for disabled feature.")
|
||||
return
|
||||
}
|
||||
|
||||
if (!SignalStore.account.isRegistered) {
|
||||
Log.d(TAG, "[performDatabaseBackupStateRefresh] Dropping refresh for unregistered user.")
|
||||
return
|
||||
@@ -236,11 +226,6 @@ class BackupStateObserver(
|
||||
}
|
||||
|
||||
private suspend fun performFullBackupStateRefresh() {
|
||||
if (!RemoteConfig.messageBackups) {
|
||||
Log.d(TAG, "[performFullBackupStateRefresh] Dropping refresh for disabled feature.")
|
||||
return
|
||||
}
|
||||
|
||||
if (!SignalStore.account.isRegistered) {
|
||||
Log.d(TAG, "[performFullBackupStateRefresh] Dropping refresh for unregistered user.")
|
||||
return
|
||||
|
||||
@@ -92,7 +92,7 @@ class BackupsSettingsFragment : ComposeFragment() {
|
||||
onNavigationClick = { requireActivity().onNavigateUp() },
|
||||
onBackupsRowClick = {
|
||||
when (state.backupState) {
|
||||
is BackupState.Error, BackupState.NotAvailable -> Unit
|
||||
is BackupState.Error -> Unit
|
||||
|
||||
BackupState.None -> {
|
||||
checkoutLauncher.launch(null)
|
||||
@@ -197,8 +197,6 @@ private fun BackupsSettingsContent(
|
||||
OtherWaysToBackUpHeading()
|
||||
}
|
||||
|
||||
BackupState.NotAvailable -> Unit
|
||||
|
||||
BackupState.NotFound -> {
|
||||
NotFoundBackupRow(
|
||||
onBackupsRowClick = onBackupsRowClick
|
||||
@@ -630,19 +628,6 @@ private fun BackupsSettingsContentPreview() {
|
||||
}
|
||||
}
|
||||
|
||||
@SignalPreview
|
||||
@Composable
|
||||
private fun BackupsSettingsContentNotAvailablePreview() {
|
||||
Previews.Preview {
|
||||
BackupsSettingsContent(
|
||||
backupsSettingsState = BackupsSettingsState(
|
||||
backupState = BackupState.NotAvailable,
|
||||
lastBackupAt = 0.seconds
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@SignalPreview
|
||||
@Composable
|
||||
private fun BackupsSettingsContentBackupTierInternalOverridePreview() {
|
||||
|
||||
@@ -519,8 +519,6 @@ private fun RemoteBackupsSettingsContent(
|
||||
isRenewEnabled = backupDeleteState.isIdle()
|
||||
)
|
||||
}
|
||||
|
||||
BackupState.NotAvailable -> error("This shouldn't happen on this screen.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.signal.core.ui.compose.Texts
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.compose.ComposeFragment
|
||||
import org.thoughtcrime.securesms.compose.rememberStatusBarColorNestedScrollModifier
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||
|
||||
/**
|
||||
@@ -45,8 +44,7 @@ class ChatsSettingsFragment : ComposeFragment() {
|
||||
|
||||
ChatsSettingsScreen(
|
||||
state = state,
|
||||
callbacks = callbacks,
|
||||
isRemoteBackupsAvailable = RemoteConfig.messageBackups
|
||||
callbacks = callbacks
|
||||
)
|
||||
}
|
||||
|
||||
@@ -105,7 +103,6 @@ private interface ChatsSettingsCallbacks {
|
||||
|
||||
@Composable
|
||||
private fun ChatsSettingsScreen(
|
||||
isRemoteBackupsAvailable: Boolean,
|
||||
state: ChatsSettingsState,
|
||||
callbacks: ChatsSettingsCallbacks
|
||||
) {
|
||||
@@ -201,25 +198,6 @@ private fun ChatsSettingsScreen(
|
||||
onCheckChanged = callbacks::onEnterKeySendsChanged
|
||||
)
|
||||
}
|
||||
|
||||
if (!isRemoteBackupsAvailable) {
|
||||
item {
|
||||
Dividers.Default()
|
||||
}
|
||||
|
||||
item {
|
||||
Texts.SectionHeader(stringResource(R.string.preferences_chats__backups))
|
||||
}
|
||||
|
||||
item {
|
||||
Rows.TextRow(
|
||||
text = stringResource(R.string.preferences_chats__chat_backups),
|
||||
label = stringResource(if (state.localBackupsEnabled) R.string.arrays__enabled else R.string.arrays__disabled),
|
||||
enabled = state.localBackupsEnabled || state.isRegisteredAndUpToDate(),
|
||||
onClick = callbacks::onChatBackupsClick
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,8 +218,7 @@ private fun ChatsSettingsScreenPreview() {
|
||||
userUnregistered = false,
|
||||
clientDeprecated = false
|
||||
),
|
||||
callbacks = ChatsSettingsCallbacks.Empty,
|
||||
isRemoteBackupsAvailable = false
|
||||
callbacks = ChatsSettingsCallbacks.Empty
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,18 +42,16 @@ class ManageStorageSettingsViewModel : ViewModel() {
|
||||
val state = store.asStateFlow()
|
||||
|
||||
init {
|
||||
if (RemoteConfig.messageBackups) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
InAppPaymentsRepository.observeLatestBackupPayment()
|
||||
.collectLatest { payment ->
|
||||
store.update { it.copy(isPaidTierPending = payment.state == InAppPaymentTable.State.PENDING) }
|
||||
}
|
||||
}
|
||||
|
||||
viewModelScope.launch {
|
||||
store.update {
|
||||
it.copy(onDeviceStorageOptimizationState = getOnDeviceStorageOptimizationState())
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
InAppPaymentsRepository.observeLatestBackupPayment()
|
||||
.collectLatest { payment ->
|
||||
store.update { it.copy(isPaidTierPending = payment.state == InAppPaymentTable.State.PENDING) }
|
||||
}
|
||||
}
|
||||
|
||||
viewModelScope.launch {
|
||||
store.update {
|
||||
it.copy(onDeviceStorageOptimizationState = getOnDeviceStorageOptimizationState())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,7 +133,7 @@ class ManageStorageSettingsViewModel : ViewModel() {
|
||||
|
||||
private suspend fun getOnDeviceStorageOptimizationState(): OnDeviceStorageOptimizationState {
|
||||
return when {
|
||||
!RemoteConfig.messageBackups || !SignalStore.backup.areBackupsEnabled || !AppDependencies.billingApi.getApiAvailability().isSuccess || (!RemoteConfig.internalUser && !Environment.IS_STAGING) -> OnDeviceStorageOptimizationState.FEATURE_NOT_AVAILABLE
|
||||
!SignalStore.backup.areBackupsEnabled || !AppDependencies.billingApi.getApiAvailability().isSuccess || (!RemoteConfig.internalUser && !Environment.IS_STAGING) -> OnDeviceStorageOptimizationState.FEATURE_NOT_AVAILABLE
|
||||
SignalStore.backup.backupTier != MessageBackupTier.PAID -> OnDeviceStorageOptimizationState.REQUIRES_PAID_TIER
|
||||
SignalStore.backup.optimizeStorage -> OnDeviceStorageOptimizationState.ENABLED
|
||||
else -> OnDeviceStorageOptimizationState.DISABLED
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.database.model.databaseprotos.DonationErrorValue
|
||||
import org.thoughtcrime.securesms.database.model.databaseprotos.InAppPaymentData
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
|
||||
/**
|
||||
* Handles displaying bottom sheets for in-app payments. The current policy is to "fire and forget".
|
||||
@@ -58,10 +57,7 @@ class InAppPaymentsBottomSheetDelegate(
|
||||
handleLegacyTerminalDonationSheets()
|
||||
handleLegacyVerifiedMonthlyDonationSheets()
|
||||
handleInAppPaymentDonationSheets()
|
||||
|
||||
if (RemoteConfig.messageBackups) {
|
||||
handleInAppPaymentBackupsSheets()
|
||||
}
|
||||
handleInAppPaymentBackupsSheets()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.messagerequests.MessageRequestRepository
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingModel
|
||||
|
||||
private typealias ConversationElement = MappingModel<*>
|
||||
@@ -125,7 +124,7 @@ class ConversationDataSource(
|
||||
records = MessageDataFetcher.updateModelsWithData(records, extraData).toMutableList()
|
||||
stopwatch.split("models")
|
||||
|
||||
if (RemoteConfig.messageBackups && ArchiveRestoreProgress.state.activelyRestoring()) {
|
||||
if (ArchiveRestoreProgress.state.activelyRestoring()) {
|
||||
BackupRestoreManager.prioritizeAttachmentsIfNeeded(records)
|
||||
stopwatch.split("restore")
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
|
||||
@Override
|
||||
public @NonNull BillingApi provideBillingApi() {
|
||||
return BillingFactory.create(GooglePlayBillingDependencies.INSTANCE, RemoteConfig.messageBackups() && Environment.Backups.supportsGooglePlayBilling());
|
||||
return BillingFactory.create(GooglePlayBillingDependencies.INSTANCE, Environment.Backups.supportsGooglePlayBilling());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.thoughtcrime.securesms.jobs.protos.BackupDeleteJobData
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.whispersystems.signalservice.api.NetworkResult
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
@@ -53,11 +52,6 @@ class BackupDeleteJob private constructor(
|
||||
override fun getFactoryKey(): String = KEY
|
||||
|
||||
override fun run(): Result {
|
||||
if (!RemoteConfig.messageBackups) {
|
||||
Log.w(TAG, "Message backups are not available on this device. Exiting without local cleanup.")
|
||||
return Result.failure()
|
||||
}
|
||||
|
||||
if (!SignalStore.account.isRegistered) {
|
||||
Log.w(TAG, "User not registered. Exiting without local cleanup.")
|
||||
return Result.failure()
|
||||
|
||||
@@ -78,11 +78,6 @@ class BackupMessagesJob private constructor(
|
||||
|
||||
private fun isBackupAllowed(): Boolean {
|
||||
return when {
|
||||
!RemoteConfig.messageBackups -> {
|
||||
Log.i(TAG, "Remote config for backups is disabled.", true)
|
||||
false
|
||||
}
|
||||
|
||||
SignalStore.registration.restoreDecisionState.isDecisionPending -> {
|
||||
Log.i(TAG, "Backup not allowed: a restore decision is pending.", true)
|
||||
false
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.jobmanager.Job
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.whispersystems.signalservice.api.NetworkResult
|
||||
import kotlin.time.Duration.Companion.days
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
@@ -60,11 +59,6 @@ class BackupRefreshJob private constructor(
|
||||
return false
|
||||
}
|
||||
|
||||
if (!RemoteConfig.messageBackups) {
|
||||
Log.i(TAG, "Backups are not enabled in remote config. Exiting.")
|
||||
return false
|
||||
}
|
||||
|
||||
if (!SignalStore.backup.areBackupsEnabled) {
|
||||
Log.i(TAG, "Backups have not been enabled on this device. Exiting.")
|
||||
return false
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.net.SignalNetwork
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.whispersystems.signalservice.api.NetworkResult
|
||||
import org.whispersystems.signalservice.api.storage.IAPSubscriptionId
|
||||
import org.whispersystems.signalservice.api.subscriptions.ActiveSubscription
|
||||
@@ -61,10 +60,6 @@ class BackupSubscriptionCheckJob private constructor(parameters: Parameters) : C
|
||||
|
||||
@JvmStatic
|
||||
fun enqueueIfAble() {
|
||||
if (!RemoteConfig.messageBackups) {
|
||||
return
|
||||
}
|
||||
|
||||
val job = create()
|
||||
|
||||
AppDependencies.jobManager.add(job)
|
||||
@@ -84,12 +79,6 @@ class BackupSubscriptionCheckJob private constructor(parameters: Parameters) : C
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
if (!RemoteConfig.messageBackups) {
|
||||
Log.i(TAG, "Message backups feature is not available. Clearing mismatch value and exiting.", true)
|
||||
SignalStore.backup.subscriptionStateMismatchDetected = false
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
if (!AppDependencies.billingApi.getApiAvailability().isSuccess) {
|
||||
Log.i(TAG, "Google Play Billing API is not available on this device. Clearing mismatch value and exiting.", true)
|
||||
SignalStore.backup.subscriptionStateMismatchDetected = false
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.thoughtcrime.securesms.jobmanager.Job
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.whispersystems.signalservice.internal.push.SubscriptionsConfiguration
|
||||
import java.math.BigDecimal
|
||||
import java.util.Currency
|
||||
@@ -61,11 +60,6 @@ class PostRegistrationBackupRedemptionJob : CoroutineJob {
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
if (!RemoteConfig.messageBackups) {
|
||||
info("Message backups feature is not available. Exiting.")
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
if (SignalStore.account.isLinkedDevice) {
|
||||
info("Linked device. Exiting.")
|
||||
return Result.success()
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.keyvalue
|
||||
import androidx.annotation.CheckResult
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.BuildConfig
|
||||
import org.thoughtcrime.securesms.database.model.databaseprotos.LocalRegistrationMetadata
|
||||
import org.thoughtcrime.securesms.database.model.databaseprotos.RestoreDecisionState
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
@@ -35,7 +34,7 @@ class RegistrationValues internal constructor(store: KeyValueStore) : SignalStor
|
||||
.putBoolean(HAS_UPLOADED_PROFILE, false)
|
||||
.putBoolean(REGISTRATION_COMPLETE, false)
|
||||
.putBoolean(PIN_REQUIRED, true)
|
||||
.apply { if (BuildConfig.MESSAGE_BACKUP_RESTORE_ENABLED) putBlob(RESTORE_DECISION_STATE, RestoreDecisionState.Start.encode()) }
|
||||
.putBlob(RESTORE_DECISION_STATE, RestoreDecisionState.Start.encode())
|
||||
.commit()
|
||||
}
|
||||
|
||||
|
||||
@@ -558,7 +558,7 @@ public final class Megaphones {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!RemoteConfig.messageBackups() || SignalStore.backup().getLatestBackupTier() != null) {
|
||||
if (SignalStore.backup().getLatestBackupTier() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.thoughtcrime.securesms.megaphone
|
||||
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import kotlin.time.Duration.Companion.days
|
||||
|
||||
/**
|
||||
@@ -13,10 +12,6 @@ import kotlin.time.Duration.Companion.days
|
||||
class VerifyBackupKeyReminderSchedule : MegaphoneSchedule {
|
||||
|
||||
override fun shouldDisplay(seenCount: Int, lastSeen: Long, firstVisible: Long, currentTime: Long): Boolean {
|
||||
if (!RemoteConfig.messageBackups) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!SignalStore.backup.areBackupsEnabled) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ public class PinRestoreEntryFragment extends LoggingFragment {
|
||||
|
||||
Activity activity = requireActivity();
|
||||
|
||||
if (RemoteConfig.messageBackups() && RestoreDecisionStateUtil.isDecisionPending(SignalStore.registration().getRestoreDecisionState())) {
|
||||
if (RestoreDecisionStateUtil.isDecisionPending(SignalStore.registration().getRestoreDecisionState())) {
|
||||
final Intent transferOrRestore = RestoreActivity.getRestoreIntent(activity);
|
||||
transferOrRestore.putExtra(PassphraseRequiredActivity.NEXT_INTENT_EXTRA, MainActivity.clearTop(requireContext()));
|
||||
startActivity(transferOrRestore);
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.content.Context
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import org.thoughtcrime.securesms.jobs.BackupMessagesJob
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.toMillis
|
||||
import java.time.LocalDateTime
|
||||
import java.util.Random
|
||||
@@ -43,7 +42,7 @@ class MessageBackupListener : PersistentAlarmManagerListener() {
|
||||
|
||||
@JvmStatic
|
||||
fun schedule(context: Context?) {
|
||||
if (RemoteConfig.messageBackups && SignalStore.backup.areBackupsEnabled) {
|
||||
if (SignalStore.backup.areBackupsEnabled) {
|
||||
MessageBackupListener().onReceive(context, getScheduleIntent())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.signal.core.util.kibiBytes
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.signal.core.util.mebiBytes
|
||||
import org.signal.libsignal.protocol.UsePqRatchet
|
||||
import org.thoughtcrime.securesms.BuildConfig
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.groups.SelectionLimits
|
||||
import org.thoughtcrime.securesms.jobs.RemoteConfigRefreshJob
|
||||
@@ -1039,20 +1038,6 @@ object RemoteConfig {
|
||||
inSeconds.seconds.inWholeMilliseconds
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable Message Backups UI
|
||||
* Note: This feature is in active development and is not intended to currently function.
|
||||
*/
|
||||
@JvmStatic
|
||||
@get:JvmName("messageBackups")
|
||||
val messageBackups: Boolean by remoteValue(
|
||||
key = "android.messageBackups",
|
||||
hotSwappable = false,
|
||||
active = true
|
||||
) { value ->
|
||||
BuildConfig.MESSAGE_BACKUP_RESTORE_ENABLED || value.asBoolean(false)
|
||||
}
|
||||
|
||||
val backupFallbackArchiveCdn: Int by remoteInt(
|
||||
key = "global.backups.mediaTierFallbackCdnNumber",
|
||||
hotSwappable = true,
|
||||
|
||||
@@ -50,8 +50,7 @@ class RemoteConfig_StaticValuesTest {
|
||||
"CRASH_PROMPT_CONFIG",
|
||||
"PROMPT_BATTERY_SAVER",
|
||||
"PROMPT_FOR_NOTIFICATION_LOGS",
|
||||
"DEVICE_SPECIFIC_NOTIFICATION_CONFIG",
|
||||
"messageBackups"
|
||||
"DEVICE_SPECIFIC_NOTIFICATION_CONFIG"
|
||||
)
|
||||
|
||||
val publicVals: List<KProperty1<*, *>> = RemoteConfig::class.memberProperties
|
||||
|
||||
Reference in New Issue
Block a user