|
@@ -18,6 +18,7 @@ import com.doverfuelingsolutions.issp.utils.PermissionUtil
|
|
|
import com.doverfuelingsolutions.issp.utils.StringUtil
|
|
|
import com.doverfuelingsolutions.issp.utils.log.DFSLog
|
|
|
import com.google.android.material.snackbar.Snackbar
|
|
|
+import kotlinx.coroutines.async
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
|
|
class LoginActivity : AppCompatActivity(),
|
|
@@ -77,18 +78,28 @@ class LoginActivity : AppCompatActivity(),
|
|
|
if (!result.success) snackbar.setText(StringUtil.get(R.string.login_fail_reason, result.message)).show()
|
|
|
else {
|
|
|
GlobalData.isLogin = true
|
|
|
+ // 并发
|
|
|
+ val deferredPhone = async { SystemApi.sessionInfo() }
|
|
|
+ val deferredLogo = async { SystemApi.stationLogo() }
|
|
|
+ val deferredPayment = async { SystemApi.paymentParam() }
|
|
|
// 油站号码
|
|
|
- val resultPhone = SystemApi.sessionInfo()
|
|
|
+ val resultPhone = deferredPhone.await()
|
|
|
if (resultPhone.success && resultPhone.data?.phoneNumber?.isBlank() == false) {
|
|
|
DFSLog.d("station phone: ${resultPhone.data.phoneNumber}")
|
|
|
GlobalData.stationTel.set(resultPhone.data.phoneNumber)
|
|
|
}
|
|
|
// 油站 LOGO
|
|
|
- val resultLogo = SystemApi.stationLogo()
|
|
|
+ val resultLogo = deferredLogo.await()
|
|
|
if (resultLogo.success && resultLogo.data != null) {
|
|
|
DFSLog.d("station logo file: ${resultLogo.data}")
|
|
|
GlobalData.stationLogoFileName.set(resultLogo.data)
|
|
|
}
|
|
|
+ // 支付参数
|
|
|
+ val resultPayment = deferredPayment.await()
|
|
|
+ if (resultPayment.success && resultPayment.data != null) {
|
|
|
+ GlobalData.paymentId.set(resultPayment.data.PaymentId)
|
|
|
+ GlobalData.paymentName.set(resultPayment.data.DispalyName)
|
|
|
+ }
|
|
|
|
|
|
startMain()
|
|
|
}
|