Skip to content

Commit

Permalink
android: fixed account data missed bug~
Browse files Browse the repository at this point in the history
  • Loading branch information
syalon committed Sep 20, 2019
1 parent 94f9002 commit 19727ca
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,25 +182,36 @@ class ActivityLaunch : BtsppActivity() {
// 初始化网络相关数据
chainMgr.grapheneNetworkInit().then { data ->
// 初始化逻辑相关数据
val initTickerData = chainMgr.marketsInitAllTickerData()
val initGlobalProperties = connMgr.last_connection().async_exec_db("get_global_properties")
val initFeeAssetInfo = chainMgr.queryFeeAssetListDynamicInfo() // 查询手续费兑换比例、手续费池等信息
return@then Promise.all(initTickerData, initGlobalProperties, initFeeAssetInfo).then { data_array ->
val walletMgr = WalletManager.sharedWalletManager()
val promise_map = JSONObject().apply {
put("kInitTickerData", chainMgr.marketsInitAllTickerData())
put("kInitGlobalProperties", connMgr.last_connection().async_exec_db("get_global_properties"))
put("kInitFeeAssetInfo", chainMgr.queryFeeAssetListDynamicInfo()) // 查询手续费兑换比例、手续费池等信息
if (walletMgr.isWalletExist() && walletMgr.isMissFullAccountData()) {
put("kInitFullUserData", chainMgr.queryFullAccountInfo(walletMgr.getWalletInfo().getString("kAccountName")))
}
}
return@then Promise.map(promise_map).then {
// 更新全局属性
val data_array = data_array as JSONArray
chainMgr.updateObjectGlobalProperties(data_array.getJSONObject(1))
val data_hash = it as JSONObject
chainMgr.updateObjectGlobalProperties(data_hash.getJSONObject("kInitGlobalProperties"))
// 更新帐号完整数据
val full_account_data = data_hash.optJSONObject("kInitFullUserData")
if (full_account_data != null) {
AppCacheManager.sharedAppCacheManager().updateWalletAccountInfo(full_account_data)
}
// 初始化完成之后:启动计划调度任务
ScheduleManager.sharedScheduleManager().startTimer()
ScheduleManager.sharedScheduleManager().autoRefreshTickerScheduleByMergedMarketInfos()
// 初始化完成
p.resolve(true)
return@then null
}
}.catch { error ->
}.catch {
p.reject(resources.getString(R.string.tip_network_error))
}
return@then null
}.catch { error ->
}.catch {
p.reject(resources.getString(R.string.tip_network_error))
}
return p
Expand Down

0 comments on commit 19727ca

Please sign in to comment.