Skip to content

Commit

Permalink
android: release bitshares v2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
syalon committed Sep 20, 2019
1 parent 19727ca commit 3d740af
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
9 changes: 6 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
applicationId "org.bitshares.app"
minSdkVersion 21
targetSdkVersion 28
versionCode 201908151
versionName "2.6"
versionCode 201909201
versionName "2.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
Expand All @@ -35,6 +35,7 @@ android {
buildConfigField "boolean", "kAppCheckUpdate", "true"

buildConfigField "String", "kAppCommunityFaucetAddress", "\"\""
buildConfigField "String", "kAppConfigFile", "\"fowallet_config.json\""

// 不区分维度
flavorDimensions "default"
Expand All @@ -44,8 +45,10 @@ android {
// 0:iOS企业版 1:AppStore版 10:btspp 20:community(bbf) 100:baichenglian
buildConfigField "int", "kAppChannelID", "10"
buildConfigField "boolean", "kUseCommunityFaucet", "false"
buildConfigField "String", "kAppConfigFile", "\"fowallet_config_btspp.json\""
}
community_bbf {
// for community_bbf
bitshares {
buildConfigField "int", "kAppChannelID", "20"
buildConfigField "boolean", "kUseCommunityFaucet", "true"
buildConfigField "String", "kAppCommunityFaucetAddress", "\"https://faucet.bitshares.eu/onboarding/api/v1/accounts\""
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/assets/fowallet_config_btspp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"internal_themes":[{"themeCode":"blue","themeName":"静谧蓝","themeNameLangKey":"kThemeNameBlue","themeStatusBarWhite":true,"colors":{"appBackColor":"131f30","contentBackColor":"333333","bottomLineColor":"1a273a","buyColor":"03c087","sellColor":"e76d42","zeroColor":"8c9fad","callOrderColor":"ffff00","textColorPercent":"ffffff","textColorHighlight":"5786d2","textColorGray":"3d526b","textColorNormal":"6d87a8","textColorMain":"ffffff","ma5Color":"f6dc93","ma10Color":"61d1c0","ma30Color":"cb92fe","navigationBarBackColor":"131f30","navigationBarTextColor":"ffffff","tabBarColor":"172941","blockButtonBackColor":"607D8B","blockButtonTextColor":"ffffff","mainButtonBackColor":"e76d42","mainButtonTextColor":"ffffff","frameButtonBorderColor":"607D8B","frameButtonTextColor":"607D8B","tintColor":"e76d42","iconColor":"fe6c5a","textColor01":"212121","textColor02":"727272","noticeColor":"fe6c5a","ticketColor":"8d9caa"}},{"themeCode":"white","themeName":"珍珠白","themeNameLangKey":"kThemeNameWhite","themeStatusBarWhite":false,"colors":{"appBackColor":"ffffff","contentBackColor":"333333","bottomLineColor":"e7ebee","buyColor":"03c087","sellColor":"e76d42","zeroColor":"8c9fad","callOrderColor":"ffff00","textColorPercent":"ffffff","textColorHighlight":"5786d2","textColorGray":"c5cfd5","textColorNormal":"8c9fad","textColorMain":"1f3f59","ma5Color":"f6dc93","ma10Color":"61d1c0","ma30Color":"cb92fe","navigationBarBackColor":"ffffff","navigationBarTextColor":"1f3f59","tabBarColor":"f2f2f2","blockButtonBackColor":"607D8B","blockButtonTextColor":"ffffff","mainButtonBackColor":"fe6c5a","mainButtonTextColor":"ffffff","frameButtonBorderColor":"607D8B","frameButtonTextColor":"607D8B","tintColor":"fe6c5a","iconColor":"fe6c5a","textColor01":"212121","textColor02":"727272","noticeColor":"fe6c5a","ticketColor":"8d9caa"}}],"internal_assets":{"BTS":{"symbol":"BTS","id":"1.3.0","precision":5},"CNY":{"symbol":"CNY","id":"1.3.113","precision":4,"bitasset_data_id":"2.4.13"},"USD":{"symbol":"USD","id":"1.3.121","precision":4,"bitasset_data_id":"2.4.21"},"EUR":{"symbol":"EUR","id":"1.3.120","precision":4,"bitasset_data_id":"2.4.20"},"JPY":{"symbol":"JPY","id":"1.3.119","precision":2,"bitasset_data_id":"2.4.19"},"KRW":{"symbol":"KRW","id":"1.3.102","precision":4,"bitasset_data_id":"2.4.2"},"YOYOW":{"symbol":"YOYOW","id":"1.3.1093","precision":5},"GDEX.BTC":{"symbol":"GDEX.BTC","id":"1.3.2241","precision":8},"GDEX.ETH":{"symbol":"GDEX.ETH","id":"1.3.2598","precision":6},"GDEX.EOS":{"symbol":"GDEX.EOS","id":"1.3.2635","precision":6},"GDEX.SEER":{"symbol":"GDEX.SEER","id":"1.3.3736","precision":5},"FEEFREE":{"symbol":"FEEFREE","id":"1.3.5442","precision":5},"CNVOTE":{"symbol":"CNVOTE","id":"1.3.5476","precision":4},"BEOS":{"symbol":"BEOS","id":"1.3.4485","precision":5}},"estimate_unit":[{"namekey":"kSettingCurrencyNameCNY","symbol":"CNY"},{"namekey":"kSettingCurrencyNameUSD","symbol":"USD"},{"namekey":"kSettingCurrencyNameEUR","symbol":"EUR"},{"namekey":"kSettingCurrencyNameJPY","symbol":"JPY"},{"namekey":"kSettingCurrencyNameKRW","symbol":"KRW"},{"namekey":"kSettingCurrencyNameBTS","symbol":"BTS"}],"network_infos":{"max_parallel_num":5,"max_retry_num":3,"connect_timeout":5,"ws_node_list":[{"url":"wss://node.market.rudex.org","location":"Germany","enable":true,"username":"","password":""},{"url":"wss://api.weaccount.cn","location":"China(btspp)","enable":true,"username":"","password":""},{"url":"wss://api.bts.mobi/ws","location":"USA","enable":true,"username":"","password":""},{"url":"wss://btsapi.magicw.net/ws","location":"China(MagicWallet)","enable":true,"username":"","password":""}]},"parameters":{"default_kline_index":{"kMain":"ma","kSub":"","ma_value":[5,10,30],"ema_value":[9,15,30],"boll_value":{"n":20,"p":2},"macd_value":{"s":12,"l":26,"m":9}},"kline_period_ary":[1,30,50,60,70],"kline_query_callorder_number":50,"kline_query_limitorder_number":100,"kline_query_fillorder_number":20,"trade_query_callorder_number":50,"trade_query_limitorder_number":20,"trade_query_fillorder_number":20,"kline_period_default":2,"display_precision":5,"display_min_fraction":2,"num_price_total_max_precision":10,"max_custom_pair_num":20,"order_book_num_kline":20,"order_book_num_trade":5,"wallet_import_account_max_num":20,"collateral_ratio_default":3.0,"mcr_default":1.75,"max_ratio":6.0,"max_target_ratio":4.0,"base_budget_id":"2.13.25084","base_budget_time":"2018-08-24T03:00:00","voting_proxy_to_self":"1.2.5","voting_proxy_max_level":3},"faucet":{"url":"http://120.26.136.190:7773/v1/chain/"},"call_order_ranking_list":["CNY","USD"],"detail_feedprice_list":["CNY","USD"],"debt_asset_list":["CNY","USD","EUR","JPY","KRW"],"fee_assets_list":["FEEFREE","BTS","CNY","USD"],"internal_groups":{"MAIN":{"id":10,"key":"MAIN","name":"主区","name_key":"kLabelGroupNameMain","main":true,"intro":false},"COMMUNITY":{"id":90,"key":"MAIN","name":"社区","name_key":"kLabelGroupNameCommunity","intro":false},"GDEX":{"id":20,"key":"GDEX","issuer":["1.2.442525"],"name":"GDEX(网关)","name_key":"kLabelGroupNameGDEX","gateway":true,"prefix":"GDEX","intro":true},"WWW":{"id":30,"key":"WWW","issuer":["1.2.471972"],"name":"WWW(网关)","name_key":"kLabelGroupNameWWW","gateway":true,"prefix":"WWW"},"OPEN":{"id":40,"key":"OPEN","issuer":["1.2.96397","1.2.100614"],"name":"OPEN(网关)","name_key":"kLabelGroupNameOPEN","gateway":true,"prefix":"OPEN"},"WIN":{"id":50,"key":"WIN","issuer":["1.2.452990"],"name":"WIN(网关)","name_key":"kLabelGroupNameWIN","gateway":true,"prefix":"WIN"},"__OTHER":{"id":100,"key":"__OTHER","name":"其他","name_key":"kLabelGroupNameOther","other":true,"intro":false}},"markets":[{"base":{"symbol":"CNY","name":"BitCNY"},"group_list":[{"group_key":"MAIN","quote_list":["BTS","USD"]},{"group_key":"GDEX","quote_list":["GDEX.BTC","GDEX.ETH","GDEX.EOS","GDEX.SEER"]},{"group_key":"COMMUNITY","quote_list":["CNVOTE"]}]},{"base":{"symbol":"USD","name":"BitUSD"},"group_list":[{"group_key":"MAIN","quote_list":["BTS","CNY"]},{"group_key":"GDEX","quote_list":["GDEX.BTC","GDEX.EOS"]}]},{"base":{"symbol":"BTS","name":"BTS"},"group_list":[{"group_key":"MAIN","quote_list":["CNY","USD"]},{"group_key":"GDEX","quote_list":["GDEX.EOS"]},{"group_key":"COMMUNITY","quote_list":["CNVOTE","BEOS"]}]}]}
29 changes: 22 additions & 7 deletions android/app/src/main/java/bitshares/ChainObjectManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class ChainObjectManager {
if (_defaultMarketInfos != null) {
return
}
_defaultMarketInfos = Utils.readJsonToMap(ctx, "fowallet_config.json")

_defaultMarketInfos = Utils.readJsonToMap(ctx, com.btsplusplus.fowallet.BuildConfig.kAppConfigFile)
assert(_defaultMarketInfos != null)

// 获取 markets
Expand Down Expand Up @@ -1390,17 +1391,31 @@ class ChainObjectManager {
}

/**
* (public) 查询指定帐号的完整信息
* (public) 查询指定帐号的完整信息
*/
fun queryFullAccountInfo(account_name_or_id: String): Promise {
val conn = GrapheneConnectionManager.sharedGrapheneConnectionManager().any_connection()
return queryFullAccountInfoWithRetry(account_name_or_id, retry_num = 1)
}

return conn.async_exec_db("get_full_accounts", jsonArrayfrom(jsonArrayfrom(account_name_or_id), false)).then { data: Any? ->
val data = data as JSONArray?
/**
* (public) 查询完整账号信息,带重试。REMARK:刚注册成功的账号可能查询失败,网络尚未同步完毕。
*/
fun queryFullAccountInfoWithRetry(account_name_or_id: String, retry_num: Int): Promise {
val conn = GrapheneConnectionManager.sharedGrapheneConnectionManager().any_connection()
return conn.async_exec_db("get_full_accounts", jsonArrayfrom(jsonArrayfrom(account_name_or_id), false)).then {
val data = it as? JSONArray
// 查询失败的情况下
if (data == null || data.length() <= 0) {
return@then null
if (retry_num > 1) {
// 等待一会 & 重试
return@then OrgUtils.asyncWait(2000).then {
return@then queryFullAccountInfoWithRetry(account_name_or_id, retry_num - 1)
}
} else {
// 失败
return@then null
}
}
val _data = data
// 获取帐号信息
val full_account_data = data.getJSONArray(0).getJSONObject(1)
// [缓存] 添加到缓存
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class FragmentRegisterAccountMode : Fragment() {
}

// 3、注册成功(查询full_account_data)
chainMgr.queryFullAccountInfo(username).then {
chainMgr.queryFullAccountInfoWithRetry(username, retry_num = 3).then {
mask.dismiss()
val new_full_account_data = it as? JSONObject
if (new_full_account_data == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class FragmentRegisterWalletMode : Fragment() {
// 3、注册成功
val full_wallet_bin = WalletManager.sharedWalletManager().genFullWalletData(activity!!, username, jsonArrayfrom(private_active, private_owner), password)
// 查询完整帐号信息
chainMgr.queryFullAccountInfo(username).then {
chainMgr.queryFullAccountInfoWithRetry(username, retry_num = 3).then {
mask.dismiss()
val new_full_account_data = it as? JSONObject
if (new_full_account_data == null) {
Expand Down

0 comments on commit 3d740af

Please sign in to comment.