新增贵族隐身访问个人主页功能
This commit is contained in:
@@ -40,7 +40,7 @@ import com.mango.moshen.ui.utils.ImageLoadUtils
|
|||||||
import com.mango.moshen.ui.utils.load
|
import com.mango.moshen.ui.utils.load
|
||||||
import com.mango.moshen.ui.widget.OnPageSelectedListener
|
import com.mango.moshen.ui.widget.OnPageSelectedListener
|
||||||
import com.mango.moshen.vip.VipMainActivity
|
import com.mango.moshen.vip.VipMainActivity
|
||||||
import com.mango.moshen.vip.VipViewModel
|
import com.mango.moshen.vip.VipMainViewModel
|
||||||
import com.mango.core.auth.AuthModel
|
import com.mango.core.auth.AuthModel
|
||||||
import com.mango.core.home.event.VisitorUnreadCountEvent
|
import com.mango.core.home.event.VisitorUnreadCountEvent
|
||||||
import com.mango.core.level.UserLevelVo
|
import com.mango.core.level.UserLevelVo
|
||||||
@@ -86,7 +86,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
|||||||
private lateinit var mBinding: FragmentMeBinding
|
private lateinit var mBinding: FragmentMeBinding
|
||||||
private val meViewModel: MeViewModel by viewModels()
|
private val meViewModel: MeViewModel by viewModels()
|
||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||||
private val vipViewModel: VipViewModel by viewModels()
|
private val vipViewModel: VipMainViewModel by viewModels()
|
||||||
private var newUserDisposable: Disposable? = null
|
private var newUserDisposable: Disposable? = null
|
||||||
private var centerIndex = 0
|
private var centerIndex = 0
|
||||||
private var gameIndex = 0
|
private var gameIndex = 0
|
||||||
|
@@ -134,7 +134,7 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
|||||||
setEditButton(identityState, true);
|
setEditButton(identityState, true);
|
||||||
setTitleVisible(false);
|
setTitleVisible(false);
|
||||||
initViewPager();
|
initViewPager();
|
||||||
if (userId != AuthModel.get().getCurrentUid()) {
|
if (userId != AuthModel.get().getCurrentUid() && !VipHelper.isHideLookUser()) {
|
||||||
UserModel.get().visitUserDetail(userId).subscribe();
|
UserModel.get().visitUserDetail(userId).subscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@ class VipBroadcastDialog : BaseDialog<DialogVipBroadcastBinding>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val viewModel: VipViewModel by viewModels()
|
private val viewModel: VipMainViewModel by viewModels()
|
||||||
private var disposable: Disposable? = null
|
private var disposable: Disposable? = null
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
|
@@ -51,4 +51,10 @@ public class VipHelper {
|
|||||||
public static boolean notKick(UserInfo userInfo) {
|
public static boolean notKick(UserInfo userInfo) {
|
||||||
return userInfo != null && userInfo.getUserVipInfoVO() != null && userInfo.getUserVipInfoVO().getPreventKick();
|
return userInfo != null && userInfo.getUserVipInfoVO() != null && userInfo.getUserVipInfoVO().getPreventKick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isHideLookUser() {
|
||||||
|
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||||
|
if (userInfo == null) return false;
|
||||||
|
return userInfo.getUserVipInfoVO() != null && userInfo.getUserVipInfoVO().getLookHomepageHide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,7 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
|||||||
|
|
||||||
private val authAdapter = VipAuthAdapter()
|
private val authAdapter = VipAuthAdapter()
|
||||||
private lateinit var rvDelegate: RVDelegate<VipAuthInfo>
|
private lateinit var rvDelegate: RVDelegate<VipAuthInfo>
|
||||||
private val vipViewModel: VipViewModel by viewModels()
|
private val vipViewModel: VipMainViewModel by viewModels()
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun init() {
|
override fun init() {
|
||||||
@@ -155,10 +155,16 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
|||||||
keepParams.horizontalBias = it.levelKeepScore.toFloat() / it.levelUpScore
|
keepParams.horizontalBias = it.levelKeepScore.toFloat() / it.levelUpScore
|
||||||
binding.ivKeepIndicator.layoutParams = keepParams
|
binding.ivKeepIndicator.layoutParams = keepParams
|
||||||
|
|
||||||
if (it.ownAuthTypes?.contains(13) == true && mTitleBar.actionCount == 1) {
|
val isShowEnterHide = it.ownAuthTypes?.contains(13) == true
|
||||||
|
val isShowLookHide = it.ownAuthTypes?.contains(16) == true
|
||||||
|
if ((isShowEnterHide || isShowLookHide) && mTitleBar.actionCount == 1) {
|
||||||
mTitleBar.addAction(object : TitleBar.ImageAction(R.drawable.ic_vip_setting) {
|
mTitleBar.addAction(object : TitleBar.ImageAction(R.drawable.ic_vip_setting) {
|
||||||
override fun performAction(view: View) {
|
override fun performAction(view: View) {
|
||||||
VipSettingActivity.start(this@VipMainActivity)
|
VipSettingActivity.start(
|
||||||
|
this@VipMainActivity,
|
||||||
|
isShowEnterHide,
|
||||||
|
isShowLookHide
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ import com.mango.core.vip.VipBroadcastInfo
|
|||||||
import com.mango.core.vip.VipInfo
|
import com.mango.core.vip.VipInfo
|
||||||
import com.mango.core.vip.VipModel
|
import com.mango.core.vip.VipModel
|
||||||
|
|
||||||
class VipViewModel : BaseViewModel() {
|
class VipMainViewModel : BaseViewModel() {
|
||||||
|
|
||||||
|
|
||||||
private val _authInfosLiveData = MutableLiveData<List<VipAuthInfo>>()
|
private val _authInfosLiveData = MutableLiveData<List<VipAuthInfo>>()
|
||||||
@@ -39,9 +39,6 @@ class VipViewModel : BaseViewModel() {
|
|||||||
private val _vipBroadcastInfoLiveData = MutableLiveData<BeanResult<VipBroadcastInfo>>()
|
private val _vipBroadcastInfoLiveData = MutableLiveData<BeanResult<VipBroadcastInfo>>()
|
||||||
val vipBroadcastInfoLiveData: LiveData<BeanResult<VipBroadcastInfo>> = _vipBroadcastInfoLiveData
|
val vipBroadcastInfoLiveData: LiveData<BeanResult<VipBroadcastInfo>> = _vipBroadcastInfoLiveData
|
||||||
|
|
||||||
private val _enterHideLiveData = MutableLiveData<Boolean>()
|
|
||||||
val enterHideLiveData: LiveData<Boolean> = _enterHideLiveData
|
|
||||||
|
|
||||||
private val _chargeBeanLiveData = MutableLiveData<ChargeBean>()
|
private val _chargeBeanLiveData = MutableLiveData<ChargeBean>()
|
||||||
val chargeBeanLiveData: LiveData<ChargeBean> = _chargeBeanLiveData
|
val chargeBeanLiveData: LiveData<ChargeBean> = _chargeBeanLiveData
|
||||||
|
|
||||||
@@ -124,22 +121,6 @@ class VipViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun changeInvisibleInRoom(open: Boolean) {
|
|
||||||
safeLaunch(
|
|
||||||
true,
|
|
||||||
onError = {
|
|
||||||
it.message.toast()
|
|
||||||
_enterHideLiveData.value = !open
|
|
||||||
},
|
|
||||||
block = {
|
|
||||||
VipModel.changeInvisibleInRoom(open)
|
|
||||||
_enterHideLiveData.value = open
|
|
||||||
UserModel.get().cacheLoginUserInfo?.userVipInfoVO?.enterHide = open
|
|
||||||
"设置成功".toast()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun onItemSelect(position: Int) {
|
fun onItemSelect(position: Int) {
|
||||||
_currVipInfoLiveData.value = vipInfosLiveData.value?.getOrNull(position)
|
_currVipInfoLiveData.value = vipInfosLiveData.value?.getOrNull(position)
|
||||||
_pageLiveData.value = position
|
_pageLiveData.value = position
|
@@ -4,25 +4,31 @@ import android.annotation.SuppressLint
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import com.netease.nim.uikit.StatusBarUtil
|
import androidx.core.view.isVisible
|
||||||
|
import com.mango.core.user.UserModel
|
||||||
import com.mango.moshen.R
|
import com.mango.moshen.R
|
||||||
import com.mango.moshen.base.BaseViewBindingActivity
|
import com.mango.moshen.base.BaseViewBindingActivity
|
||||||
import com.mango.moshen.databinding.ActivityVipSettingBinding
|
import com.mango.moshen.databinding.ActivityVipSettingBinding
|
||||||
import com.mango.core.user.UserModel
|
import com.netease.nim.uikit.StatusBarUtil
|
||||||
|
|
||||||
class VipSettingActivity : BaseViewBindingActivity<ActivityVipSettingBinding>() {
|
class VipSettingActivity : BaseViewBindingActivity<ActivityVipSettingBinding>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun start(context: Context) {
|
fun start(context: Context, isShowEnterHide: Boolean, isShowLookHide: Boolean) {
|
||||||
val starter = Intent(context, VipSettingActivity::class.java)
|
val starter = Intent(context, VipSettingActivity::class.java)
|
||||||
|
starter.putExtra("isShowEnterHide", isShowEnterHide)
|
||||||
|
starter.putExtra("isShowLookHide", isShowLookHide)
|
||||||
context.startActivity(starter)
|
context.startActivity(starter)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val vipViewModel: VipViewModel by viewModels()
|
private val vipViewModel: VipSettingViewModel by viewModels()
|
||||||
|
|
||||||
|
private val isShowEnterHide by lazy { intent.getBooleanExtra("isShowEnterHide",false) }
|
||||||
|
private val isShowLookHide by lazy { intent.getBooleanExtra("isShowLookHide",false) }
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun init() {
|
override fun init() {
|
||||||
@@ -38,12 +44,22 @@ class VipSettingActivity : BaseViewBindingActivity<ActivityVipSettingBinding>()
|
|||||||
vipViewModel.enterHideLiveData.observe(this) {
|
vipViewModel.enterHideLiveData.observe(this) {
|
||||||
binding.switchHideGoRoom.isOn = it == true
|
binding.switchHideGoRoom.isOn = it == true
|
||||||
}
|
}
|
||||||
|
binding.switchHideGoRoom.isOn =
|
||||||
binding.switchHideGoRoom.isOn = UserModel.get().cacheLoginUserInfo?.userVipInfoVO?.enterHide == true
|
UserModel.get().cacheLoginUserInfo?.userVipInfoVO?.enterHide == true
|
||||||
|
|
||||||
binding.switchHideGoRoom.setOnSwitchStateChangeListener {
|
binding.switchHideGoRoom.setOnSwitchStateChangeListener {
|
||||||
vipViewModel.changeInvisibleInRoom(it)
|
vipViewModel.changeInvisibleInRoom(it)
|
||||||
}
|
}
|
||||||
|
binding.groupHideGoRoom.isVisible = isShowEnterHide
|
||||||
|
|
||||||
|
vipViewModel.lookHideLiveData.observe(this) {
|
||||||
|
binding.switchHideLookUser.isOn = it == true
|
||||||
|
}
|
||||||
|
binding.switchHideLookUser.isOn =
|
||||||
|
UserModel.get().cacheLoginUserInfo?.userVipInfoVO?.lookHomepageHide == true
|
||||||
|
binding.switchHideLookUser.setOnSwitchStateChangeListener {
|
||||||
|
vipViewModel.changeInvisibleLookHomepage(it)
|
||||||
|
}
|
||||||
|
binding.groupHideLookUser.isVisible = isShowLookHide
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,51 @@
|
|||||||
|
package com.mango.moshen.vip
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.mango.core.user.UserModel
|
||||||
|
import com.mango.core.utils.toast
|
||||||
|
import com.mango.core.vip.VipModel
|
||||||
|
import com.mango.moshen.base.BaseViewModel
|
||||||
|
|
||||||
|
class VipSettingViewModel : BaseViewModel() {
|
||||||
|
|
||||||
|
private val _enterHideLiveData = MutableLiveData<Boolean>()
|
||||||
|
val enterHideLiveData: LiveData<Boolean> = _enterHideLiveData
|
||||||
|
|
||||||
|
private val _lookHideLiveData = MutableLiveData<Boolean>()
|
||||||
|
val lookHideLiveData: LiveData<Boolean> = _lookHideLiveData
|
||||||
|
|
||||||
|
|
||||||
|
fun changeInvisibleInRoom(open: Boolean) {
|
||||||
|
safeLaunch(
|
||||||
|
true,
|
||||||
|
onError = {
|
||||||
|
it.message.toast()
|
||||||
|
_enterHideLiveData.value = !open
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
VipModel.changeInvisibleInRoom(open)
|
||||||
|
_enterHideLiveData.value = open
|
||||||
|
UserModel.get().cacheLoginUserInfo?.userVipInfoVO?.enterHide = open
|
||||||
|
"设置成功".toast()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun changeInvisibleLookHomepage(open: Boolean) {
|
||||||
|
safeLaunch(
|
||||||
|
true,
|
||||||
|
onError = {
|
||||||
|
it.message.toast()
|
||||||
|
_lookHideLiveData.value = !open
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
VipModel.changeInvisibleLookHomepage(open)
|
||||||
|
_lookHideLiveData.value = open
|
||||||
|
UserModel.get().cacheLoginUserInfo?.userVipInfoVO?.lookHomepageHide = open
|
||||||
|
"设置成功".toast()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -26,7 +26,7 @@ class VipUpgradeDialog : BaseDialog<DialogVipUpgradeBinding>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val vm: VipViewModel by activityViewModels()
|
private val vm: VipMainViewModel by activityViewModels()
|
||||||
|
|
||||||
private val vipInfo by lazy { requireArguments().getSerializable("vipInfo") as VipInfo }
|
private val vipInfo by lazy { requireArguments().getSerializable("vipInfo") as VipInfo }
|
||||||
|
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_hide_go_room"
|
android:id="@+id/tv_hide_go_room"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -38,4 +37,38 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/tv_hide_go_room" />
|
app:layout_constraintTop_toTopOf="@id/tv_hide_go_room" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Group
|
||||||
|
android:id="@+id/group_hide_go_room"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:constraint_referenced_ids="switch_hide_go_room,tv_hide_go_room" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_hide_look_user"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:text="隐身访问个人主页"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_hide_go_room" />
|
||||||
|
|
||||||
|
<com.mango.xchat_android_library.widget.IOSSwitchView
|
||||||
|
android:id="@+id/switch_hide_look_user"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/tv_hide_look_user"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_hide_look_user" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Group
|
||||||
|
android:id="@+id/group_hide_look_user"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:constraint_referenced_ids="switch_hide_look_user,tv_hide_look_user" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -9,5 +9,6 @@ data class UserVipInfo(
|
|||||||
val friendNickColour: String = "",
|
val friendNickColour: String = "",
|
||||||
val preventKick: Boolean = false,
|
val preventKick: Boolean = false,
|
||||||
var enterHide: Boolean = false,
|
var enterHide: Boolean = false,
|
||||||
|
var lookHomepageHide: Boolean = false,
|
||||||
val enterRoomEffects: String = ""
|
val enterRoomEffects: String = ""
|
||||||
) : Serializable
|
) : Serializable
|
||||||
|
@@ -39,6 +39,11 @@ object VipModel : BaseModel() {
|
|||||||
api.changeInvisibleInRoom(open)
|
api.changeInvisibleInRoom(open)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun changeInvisibleLookHomepage(open: Boolean): String? =
|
||||||
|
launchRequest {
|
||||||
|
api.changeInvisibleLookHomepage(open)
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun getVipRank(): VipRankInfo? =
|
suspend fun getVipRank(): VipRankInfo? =
|
||||||
launchRequest {
|
launchRequest {
|
||||||
api.getVipRank()
|
api.getVipRank()
|
||||||
@@ -105,6 +110,14 @@ object VipModel : BaseModel() {
|
|||||||
@GET("/vip/changeInvisibleInRoom")
|
@GET("/vip/changeInvisibleInRoom")
|
||||||
suspend fun changeInvisibleInRoom(@Query("open") open: Boolean): ServiceResult<String>
|
suspend fun changeInvisibleInRoom(@Query("open") open: Boolean): ServiceResult<String>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开关隐身访问主页
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/vip/changeInvisibleLookHomepage")
|
||||||
|
suspend fun changeInvisibleLookHomepage(@Query("open") open: Boolean): ServiceResult<String>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取贵族排行榜信息
|
* 获取贵族排行榜信息
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user