mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Update backups bottom sheet data handling.
This commit is contained in:
committed by
Greyson Parrelli
parent
3901c52e45
commit
f14f7f7478
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user