Commit 231cba09 authored by 赵鹏翔's avatar 赵鹏翔

kotlin非空处理

parent 090e977c
......@@ -36,11 +36,11 @@ class SystemParameterDialog(context: Context) : Dialog(context, R.style.CommonDi
private fun init() {
val accountInfo = getAccountInfo()
setInfo(viewBinding.tvVersion, getVersion(context))
setInfo(viewBinding.tvStoreName, accountInfo!!.shopInfo.storeName)
setInfo(viewBinding.tvStoreNum, accountInfo.shopInfo.storeId)
setInfo(viewBinding.tvMerchantNum, accountInfo.shopInfo.hhMerchant)
setInfo(viewBinding.tvPos, accountInfo.shopInfo.posId)
setInfo(viewBinding.tvCashier, accountInfo.shopInfo.operatorId)
setInfo(viewBinding.tvStoreName, accountInfo!!.shopInfo?.storeName)
setInfo(viewBinding.tvStoreNum, accountInfo.shopInfo?.storeId)
setInfo(viewBinding.tvMerchantNum, accountInfo.shopInfo?.hhMerchant)
setInfo(viewBinding.tvPos, accountInfo.shopInfo?.posId)
setInfo(viewBinding.tvCashier, accountInfo.shopInfo?.operatorId)
setInfo(viewBinding.tvVersionType, "fastCashier_" + BuildConfig.appType)
setInfo(viewBinding.tvEquipment, "sunmi_v2pro")
setInfo(viewBinding.tvServerUrl, baseUrl)
......
......@@ -23,10 +23,12 @@ class RequestSignInterceptor : Interceptor {
val requestBuilder: Request.Builder = original.newBuilder()
val accountInfo = getAccountInfo()
if (accountInfo != null && accountInfo.accessToken != null) {
requestBuilder.addHeader(
AUTHORIZATION,
getAuthorization(accountInfo.accessToken.accessToken)
)
accountInfo.accessToken!!.accessToken?.let { getAuthorization(it) }?.let {
requestBuilder.addHeader(
AUTHORIZATION,
it
)
}
}
val request: Request = requestBuilder.build()
return chain.proceed(request)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment