diff options
Diffstat (limited to 'wallet/src/main/java')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/MainViewModel.kt | 14 | ||||
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/SettingsFragment.kt | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/MainViewModel.kt b/wallet/src/main/java/net/taler/wallet/MainViewModel.kt index c2ad2e0..230c310 100644 --- a/wallet/src/main/java/net/taler/wallet/MainViewModel.kt +++ b/wallet/src/main/java/net/taler/wallet/MainViewModel.kt @@ -52,14 +52,20 @@ class MainViewModel(val app: Application) : AndroidViewModel(app) { val devMode = MutableLiveData(BuildConfig.DEBUG) val showProgressBar = MutableLiveData<Boolean>() + var exchangeVersion: String? = null + private set + var merchantVersion: String? = null + private set private val walletBackendApi = WalletBackendApi(app, { // nothing to do when we connect, balance will be requested by BalanceFragment in onStart() }) { payload -> - if ( - payload.getString("type") != "waiting-for-retry" && // ignore ping - payload.optString("operation") != "init" // ignore init notification - ) { + if (payload.optString("operation") == "init") { + val result = payload.getJSONObject("result") + val versions = result.getJSONObject("supported_protocol_versions") + exchangeVersion = versions.getString("exchange") + merchantVersion = versions.getString("merchant") + } else if (payload.getString("type") != "waiting-for-retry") { // ignore ping Log.i(TAG, "Received notification from wallet-core: ${payload.toString(2)}") loadBalances() if (payload.optString("type") in transactionNotifications) { diff --git a/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt b/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt index 2020c49..97deaa5 100644 --- a/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt @@ -73,6 +73,8 @@ class SettingsFragment : PreferenceFragmentCompat() { if (enabled) { prefVersionApp.summary = "$VERSION_NAME ($VERSION_CODE)" prefVersionCore.summary = WALLET_CORE_VERSION + model.exchangeVersion?.let { prefVersionExchange.summary = it } + model.merchantVersion?.let { prefVersionMerchant.summary = it } } devPrefs.forEach { it.isVisible = enabled } }) |