Update backups bottom sheet data handling.

This commit is contained in:
Alex Hart
2024-11-06 09:31:20 -04:00
committed by Greyson Parrelli
parent 3901c52e45
commit f14f7f7478
16 changed files with 163 additions and 114 deletions

View File

@@ -6,20 +6,31 @@
package org.thoughtcrime.securesms.dependencies
import android.content.Context
import org.signal.billing.BillingError
import org.signal.core.util.billing.BillingDependencies
import org.whispersystems.signalservice.internal.push.SubscriptionsConfiguration
import java.util.Locale
/**
* Dependency object for Google Play Billing.
*/
object GooglePlayBillingDependencies : BillingDependencies {
private const val BILLING_PRODUCT_ID_NOT_AVAILABLE = -1000
override val context: Context get() = AppDependencies.application
override suspend fun getProductId(): String {
return "backup" // TODO [backups] This really shouldn't be hardcoded into the app.
val config = AppDependencies.donationsService.getDonationsConfiguration(Locale.getDefault())
if (config.result.isPresent) {
return config.result.get().backupConfiguration.backupLevelConfigurationMap[SubscriptionsConfiguration.BACKUPS_LEVEL]?.playProductId ?: throw BillingError(BILLING_PRODUCT_ID_NOT_AVAILABLE)
} else {
throw BillingError(BILLING_PRODUCT_ID_NOT_AVAILABLE)
}
}
override suspend fun getBasePlanId(): String {
return "monthly" // TODO [backups] This really shouldn't be hardcoded into the app.
return "monthly"
}
}