Commit 4be77c5d by 范玉宾

mine tips done

Took 24 minutes
parent 4cda1b91
......@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.50.41",
"m-consultant" : "0.0.60.68",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.58",
"m-user" : "0.0.62.59",
"m-home" : "0.0.23.95",
"m-im" : "0.0.21.64",
"m-dynamic" : "0.0.7.74",
......@@ -94,7 +94,7 @@ ext {
"m-confide" : "0.0.50.41",
"m-consultant" : "0.0.60.68",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.58",
"m-user" : "0.0.62.59",
"m-home" : "0.0.23.95",
"m-im" : "0.0.21.64",
"m-dynamic" : "0.0.7.74",
......
......@@ -43,6 +43,7 @@ import com.yidianling.user.api.event.RefreshRecentContactListEvent
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.constants.UserBIConstants.UserMyPageEvent
import com.yidianling.user.mine.bean.CouponNumBean
import com.yidianling.user.mine.data.AppDataManager
import com.yidianling.user.mine.data.AppDataManager.getHttp
import com.yidianling.user.mine.data.AppDataManager.getLocal
import com.yidianling.user.mine.http.MineHttpImpl
......@@ -206,25 +207,37 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
MineHttpImpl.getInstance().getHasConfideOrder(uid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { response ->
.subscribe({ response ->
if ("200" == response.code) {
if (response.data != null) {
if (response.data.listenOrder == true) {
iv_confide_tip.visibility = View.VISIBLE
getLocal().setConfide(true)
} else {
iv_confide_tip.visibility = View.GONE
getLocal().setConfide(false)
}
if (response.data.consultOrder == true) {
iv_order_tip.visibility = View.VISIBLE
getLocal().setConsult(true)
} else {
iv_order_tip.visibility = View.GONE
getLocal().setConfide(false)
}
}else{
getLocal().setConfide(false)
getLocal().setConsult(false)
}
}else{
getLocal().setConfide(false)
getLocal().setConsult(false)
}
}
},{
getLocal().setConfide(false)
getLocal().setConsult(false)
})
}
......@@ -233,6 +246,10 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
*/
@SuppressLint("CheckResult")
private fun refreshCouponData() {
getLocal().setCoupon(false)
getLocal().setConfide(false)
getLocal().setConsult(false)
val userInfo = getUserInfo() ?: return
if (userInfo.uid != null) {
......@@ -248,11 +265,17 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
if (response.data != null) {
if (response.data?.count ?: 0 > 0) {
view_new_coupon.visibility = View.VISIBLE
getLocal().setCoupon(true)
} else {
view_new_coupon.visibility = View.INVISIBLE
view_new_coupon.visibility = View.GONE
getLocal().setCoupon(false)
}
}else{
getLocal().setCoupon(false)
}
}) { throwable: Throwable? -> }
}) { throwable: Throwable? ->
getLocal().setCoupon(false)
}
}
/**
......
......@@ -18,4 +18,16 @@ interface AppLocal {
fun putUpdate(update: Boolean)
fun getCoupon():Boolean
fun setCoupon(have:Boolean)
fun getConsult():Boolean
fun setConsult(have: Boolean)
fun getConfide():Boolean
fun setConfide(have: Boolean)
}
\ No newline at end of file
......@@ -19,6 +19,10 @@ internal class AppLocalImpl private constructor(): AppLocal {
private val APP = "app"
private val RED_POCKET_TIME = "red_pocket_time"
private val UPDATE = "update"
private val CONFIDE = "confide"
private val CONSULT = "consult"
private val COUPON = "coupon"
}
......@@ -38,6 +42,30 @@ internal class AppLocalImpl private constructor(): AppLocal {
getAppSP().edit().putBoolean(UPDATE, update).apply()
}
override fun getCoupon(): Boolean {
return getAppSP().getBoolean(COUPON, false)
}
override fun setCoupon(have: Boolean) {
getAppSP().edit().putBoolean(COUPON, have).apply()
}
override fun getConsult(): Boolean {
return getAppSP().getBoolean(CONSULT, false)
}
override fun setConsult(have: Boolean) {
getAppSP().edit().putBoolean(CONSULT, false).apply()
}
override fun getConfide(): Boolean {
return getAppSP().getBoolean(CONFIDE, false)
}
override fun setConfide(have: Boolean) {
getAppSP().edit().putBoolean(CONFIDE, have).apply()
}
private fun getAppSP(): SharedPreferences {
return BaseApp.getApp().getSharedPreferences(APP, Context.MODE_PRIVATE)
}
......
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