Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Update SDK version to 1.5.2 and replace transfer code specific error …
Browse files Browse the repository at this point in the history
…codes
  • Loading branch information
M-Wong committed Oct 20, 2021
1 parent 71c598e commit c9913e5
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
4 changes: 2 additions & 2 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ android {
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

api 'ch.admin.bag.covidcertificate:sdk-android:1.5.1'
api 'ch.admin.bag.covidcertificate:sdk-core:2.0'
api 'ch.admin.bag.covidcertificate:sdk-android:1.5.2'
api 'ch.admin.bag.covidcertificate:sdk-core:2.0.1'

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import ch.admin.bag.covidcertificate.wallet.data.WalletDataItem
import ch.admin.bag.covidcertificate.wallet.data.WalletDataSecureStorage
import ch.admin.bag.covidcertificate.wallet.homescreen.pager.StatefulWalletItem
import ch.admin.bag.covidcertificate.wallet.homescreen.pager.WalletItem
import ch.admin.bag.covidcertificate.wallet.transfercode.TransferCodeErrorCodes
import ch.admin.bag.covidcertificate.wallet.transfercode.logic.TransferCodeCrypto
import ch.admin.bag.covidcertificate.wallet.transfercode.model.TransferCodeConversionState
import ch.admin.bag.covidcertificate.wallet.transfercode.model.TransferCodeModel
Expand Down Expand Up @@ -293,7 +294,7 @@ class CertificatesViewModel(application: Application) : AndroidViewModel(applica
}
}
} else {
conversionState = TransferCodeConversionState.ERROR(StateError(ErrorCodes.INAPP_DELIVERY_KEYPAIR_GENERATION_FAILED))
conversionState = TransferCodeConversionState.ERROR(StateError(TransferCodeErrorCodes.INAPP_DELIVERY_KEYPAIR_GENERATION_FAILED))
}

val updatedStatefulWalletItems = updateConversionStateForTransferCode(transferCode, conversionState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TransferCodeCreationViewModel(application: Application) : AndroidViewModel
if (keyPair != null) {
registerTransferCode(transferCode, keyPair)
} else {
creationStateMutableLiveData.postValue(TransferCodeCreationState.ERROR(StateError(ErrorCodes.INAPP_DELIVERY_KEYPAIR_GENERATION_FAILED)))
creationStateMutableLiveData.postValue(TransferCodeCreationState.ERROR(StateError(TransferCodeErrorCodes.INAPP_DELIVERY_KEYPAIR_GENERATION_FAILED)))
}

transferCodeCreationJob = null
Expand All @@ -81,7 +81,7 @@ class TransferCodeCreationViewModel(application: Application) : AndroidViewModel
creationStateMutableLiveData.postValue(TransferCodeCreationState.ERROR(StateError(DeliveryRepository.ERROR_CODE_INVALID_TIME)))
}
else -> {
creationStateMutableLiveData.postValue(TransferCodeCreationState.ERROR(StateError(ErrorCodes.INAPP_DELIVERY_REGISTRATION_FAILED)))
creationStateMutableLiveData.postValue(TransferCodeCreationState.ERROR(StateError(TransferCodeErrorCodes.INAPP_DELIVERY_REGISTRATION_FAILED)))
}
}
} catch (e: IOException) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2021 Ubique Innovation AG <https://www.ubique.ch>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/

package ch.admin.bag.covidcertificate.wallet.transfercode

object TransferCodeErrorCodes {

const val INAPP_DELIVERY_KEYPAIR_GENERATION_FAILED = "I|KPG"
const val INAPP_DELIVERY_REGISTRATION_FAILED = "I|REG"

}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class TransferCodeViewModel(application: Application) : AndroidViewModel(applica
}
}
} else {
conversionStateMutableLiveData.postValue(TransferCodeConversionState.ERROR(StateError(ErrorCodes.INAPP_DELIVERY_KEYPAIR_GENERATION_FAILED)))
conversionStateMutableLiveData.postValue(TransferCodeConversionState.ERROR(StateError(TransferCodeErrorCodes.INAPP_DELIVERY_KEYPAIR_GENERATION_FAILED)))
}

downloadJob = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import ch.admin.bag.covidcertificate.sdk.core.data.ErrorCodes
import ch.admin.bag.covidcertificate.sdk.core.models.state.StateError
import ch.admin.bag.covidcertificate.wallet.R
import ch.admin.bag.covidcertificate.wallet.databinding.ViewTransferCodeBubbleBinding
import ch.admin.bag.covidcertificate.wallet.transfercode.TransferCodeErrorCodes
import ch.admin.bag.covidcertificate.wallet.transfercode.model.TransferCodeModel
import ch.admin.bag.covidcertificate.wallet.transfercode.net.DeliveryRepository
import java.time.Instant
Expand Down Expand Up @@ -208,7 +209,7 @@ class TransferCodeBubbleView @JvmOverloads constructor(
setIconAndTextColor(R.color.orange)
setBubbleBackgroundColor(R.color.orangeish)
}
ErrorCodes.INAPP_DELIVERY_KEYPAIR_GENERATION_FAILED -> {
TransferCodeErrorCodes.INAPP_DELIVERY_KEYPAIR_GENERATION_FAILED -> {
binding.transferCodeStatusIcon.setImageResource(R.drawable.ic_scanner_alert)
binding.transferCodeErrorTitle.setText(R.string.wallet_transfer_code_unexpected_error_text)
binding.transferCodeErrorDescription.setText(R.string.wallet_transfer_code_unexpected_error_phone_number)
Expand Down

0 comments on commit c9913e5

Please sign in to comment.