Merge pull request #1015 from avereha/avereha/save-ltk

dash bugfix: save the LTK
This commit is contained in:
AdrianLxM 2021-12-01 00:33:35 +01:00 committed by GitHub
commit 8783e67a9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -678,8 +678,9 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
private fun store() {
try {
val cleanPodState = podState.copy(ltk = byteArrayOf()) // do not log ltk
val serialized = Gson().toJson(cleanPodState)
logger.debug(LTag.PUMP, "Storing Pod state: $serialized")
logger.debug(LTag.PUMP, "Storing Pod state: ${Gson().toJson(cleanPodState)}")
val serialized = Gson().toJson(podState)
sharedPreferences.putString(R.string.key_omnipod_dash_pod_state, serialized)
} catch (ex: Exception) {
logger.error(LTag.PUMP, "Failed to store Pod state", ex)

View file

@ -127,7 +127,7 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
binding.buttonDiscardPod.visibility = discardButtonEnabled.toVisibility()
binding.buttonActivatePod.isEnabled = podStateManager.activationProgress.isBefore(ActivationProgress.COMPLETED)
binding.buttonDeactivatePod.isEnabled = podStateManager.bluetoothAddress != null
binding.buttonDeactivatePod.isEnabled = podStateManager.bluetoothAddress != null || podStateManager.ltk != null
if (podStateManager.activationProgress.isAtLeast(ActivationProgress.PHASE_1_COMPLETED)) {
if (commandQueue.isCustomCommandInQueue(CommandPlayTestBeep::class.java)) {