Respect server currency lists for subscriptions and badges.

This commit is contained in:
Alex Hart
2021-11-03 11:30:07 -03:00
committed by Greyson Parrelli
parent c06fb81490
commit 2a9eb1bae0
18 changed files with 162 additions and 78 deletions

View File

@@ -0,0 +1,24 @@
package org.thoughtcrime.securesms.util
import java.util.Currency
/**
* Utility methods for java.util.Currency
*
* This is prefixed with "Platform" as there are several different Currency classes
* available in the app, and this utility class is specifically for dealing with
* java.util.Currency
*/
object PlatformCurrencyUtil {
val USD: Currency = Currency.getInstance("USD")
/**
* Note: Adding this as an extension method of Currency causes some confusion in
* AndroidStudio due to a separate Currency class from the AndroidSDK having
* an extension method of the same signature.
*/
fun getAvailableCurrencyCodes(): Set<String> {
return Currency.getAvailableCurrencies().map { it.currencyCode }.toSet()
}
}