feat:适配新的H5公会体系入口跳转
This commit is contained in:
@@ -24,13 +24,16 @@ import com.chwl.app.home.MeViewModel
|
||||
import com.chwl.app.home.activity.AssociationActivity
|
||||
import com.chwl.app.home.adapter.MeCenterAdapter
|
||||
import com.chwl.app.home.helper.OpenRoomHelper
|
||||
import com.chwl.app.module_hall.HallDataManager
|
||||
import com.chwl.app.module_hall.hall.activity.ModuleClanActivity
|
||||
import com.chwl.app.module_hall.hall.activity.ModuleHallActivity
|
||||
import com.chwl.app.support.FragmentVisibleStateHelper
|
||||
import com.chwl.app.ui.im.RouterHandler
|
||||
import com.chwl.app.ui.pay.ChargeActivity
|
||||
import com.chwl.app.ui.relation.AttentionListActivity
|
||||
import com.chwl.app.ui.relation.FansListActivity
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity
|
||||
import com.chwl.app.view.GenderAgeTextView
|
||||
import com.chwl.app.vip.VipMainActivity
|
||||
import com.chwl.app.vip.VipViewModel
|
||||
@@ -40,8 +43,9 @@ import com.chwl.core.initial.InitialModel
|
||||
import com.chwl.core.level.UserLevelVo
|
||||
import com.chwl.core.manager.IMNetEaseManager
|
||||
import com.chwl.core.manager.RelationShipEvent
|
||||
import com.chwl.core.module_hall.hall.HallModel
|
||||
import com.chwl.core.module_hall.hall.bean.ClanAndHallInfo
|
||||
import com.chwl.core.module_hall.hall.bean.H5FamilyInfo
|
||||
import com.chwl.core.module_hall.hall.bean.UserClanInfo
|
||||
import com.chwl.core.pay.PayModel
|
||||
import com.chwl.core.pay.event.GetWalletInfoEvent
|
||||
import com.chwl.core.pay.event.UpdateWalletInfoEvent
|
||||
@@ -130,6 +134,11 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
vipViewModel.myVipInfoLiveData.observe(viewLifecycleOwner) {
|
||||
loadVipInfo(it)
|
||||
}
|
||||
|
||||
FragmentVisibleStateHelper(this) {
|
||||
onVisibleChanged(it)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun setCenterData(list: List<MeCenterInfo>?) {
|
||||
@@ -253,17 +262,28 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
private fun setWalletInfo() {
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onLoginUserInfoUpdateEvent(event: LoginUserInfoUpdateEvent?) {
|
||||
setUserData()
|
||||
vipViewModel.getVipPageInfo()
|
||||
meViewModel.refreshData()
|
||||
HallModel.get().getUserHallAndClan(AuthModel.get().currentUid)
|
||||
.subscribe { clanAndHallInfo: ClanAndHallInfo? ->
|
||||
this.updateHallInfo(
|
||||
clanAndHallInfo
|
||||
)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun reloadClanInfo(){
|
||||
HallDataManager.get().requestUserClanInfo(AuthModel.get().currentUid).compose(bindToLifecycle())
|
||||
.subscribe { info: UserClanInfo? ->
|
||||
val clanHallInfo = info?.asClanHall()
|
||||
if (clanHallInfo != null) {
|
||||
this.updateHallInfo(clanHallInfo)
|
||||
} else {
|
||||
val familyInfo = info?.asFamily()
|
||||
if (familyInfo != null) {
|
||||
this.updateHallInfo(familyInfo)
|
||||
} else {
|
||||
this.updateHallInfo(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,6 +311,20 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateHallInfo(familyInfo: H5FamilyInfo) {
|
||||
if (familyInfo.familyId != null && familyInfo.familyId != 0L) {
|
||||
mBinding.ivGuild.setImageResource(R.drawable.me_bg_my_guild)
|
||||
mBinding.ivGuild.singleClick {
|
||||
CommonWebViewActivity.start(context, familyInfo.getFullMyFamilyUrl())
|
||||
}
|
||||
} else {
|
||||
mBinding.ivGuild.setImageResource(R.drawable.me_bg_guild)
|
||||
mBinding.ivGuild.singleClick {
|
||||
CommonWebViewActivity.start(context, familyInfo.getFullFamilyListUrl())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWalletInfoUpdate(event: UpdateWalletInfoEvent?) {
|
||||
setWalletInfo()
|
||||
@@ -365,4 +399,10 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
|
||||
private fun loadVipInfo(data: VipInfo?) {
|
||||
}
|
||||
|
||||
private fun onVisibleChanged(isVisible: Boolean) {
|
||||
if (isVisible) {
|
||||
reloadClanInfo()
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,6 +6,8 @@ import android.content.Context;
|
||||
import com.chwl.app.decoration.view.DecorationStoreActivity;
|
||||
import com.chwl.app.earn.activity.EarnRecordActivity;
|
||||
import com.chwl.app.pay.activity.GiveGoldActivity;
|
||||
import com.chwl.core.module_hall.hall.bean.H5FamilyInfo;
|
||||
import com.chwl.core.module_hall.hall.bean.UserClanInfo;
|
||||
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.UIHelper;
|
||||
@@ -237,6 +239,18 @@ public class RouterHandler {
|
||||
break;
|
||||
case RouterType.MODULE_CLAN:
|
||||
//公会或房间主页
|
||||
UserClanInfo info = HallDataManager.get().getUserClanInfo();
|
||||
H5FamilyInfo familyInfo = null;
|
||||
if (info != null) {
|
||||
familyInfo = info.asFamily();
|
||||
}
|
||||
if (familyInfo != null) {
|
||||
if (familyInfo.getFamilyId() != null && familyInfo.getFamilyId() > 0) {
|
||||
CommonWebViewActivity.start(context, familyInfo.getFullMyFamilyUrl());
|
||||
} else {
|
||||
CommonWebViewActivity.start(context, familyInfo.getFullFamilyListUrl());
|
||||
}
|
||||
} else {
|
||||
if (HallDataManager.get().isHasClan()) {
|
||||
ModuleClanActivity.start(context);
|
||||
} else if (HallDataManager.get().hasLiveHall()) {
|
||||
@@ -244,6 +258,7 @@ public class RouterHandler {
|
||||
} else {
|
||||
SingleToastUtil.showToast(ResUtil.getString(R.string.ui_im_routerhandler_06));
|
||||
}
|
||||
}
|
||||
break;
|
||||
// case RouterType.PATRIARCH_MODE:
|
||||
// //青少年模式
|
||||
|
@@ -13,7 +13,6 @@ import com.chwl.app.base.BaseViewBindingActivity
|
||||
import com.chwl.app.common.widget.dialog.DialogManager.OkCancelDialogListener
|
||||
import com.chwl.app.databinding.ActivitySettingBinding
|
||||
import com.chwl.app.notify.RoomNotifyManager
|
||||
import com.chwl.app.public_chat.ui.message.PublicChatRoomMessageActivity
|
||||
import com.chwl.app.ui.im.avtivity.BlackListManageActivity
|
||||
import com.chwl.app.ui.language.LanguageActivity
|
||||
import com.chwl.app.ui.login.BindPhoneActivity
|
||||
@@ -223,7 +222,7 @@ class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.
|
||||
|
||||
private fun debug() {
|
||||
// CommonWebViewActivity.start(this,"https://api.molistar.xyz/molistar/activity/2024-invitationFission/index.html")
|
||||
PublicChatRoomMessageActivity.start(this)
|
||||
// PublicChatRoomMessageActivity.start(this)
|
||||
// MyDecorationActivity.start(this,0)
|
||||
}
|
||||
}
|
@@ -9,9 +9,13 @@ import com.chwl.app.databinding.FragmentUserinfoUserinfoBinding
|
||||
import com.chwl.app.module_hall.hall.activity.ModuleClanActivity
|
||||
import com.chwl.app.module_hall.hall.activity.ModuleHallActivity
|
||||
import com.chwl.app.ui.user.viewmodel.UserInfoViewModel
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity
|
||||
import com.chwl.core.UriProvider
|
||||
import com.chwl.core.auth.AuthModel
|
||||
import com.chwl.core.family.bean.FamilyInfo
|
||||
import com.chwl.core.module_hall.hall.bean.ClanAndHallInfo
|
||||
import com.chwl.core.module_hall.hall.bean.ClanInfo
|
||||
import com.chwl.core.module_hall.hall.bean.H5FamilyInfo
|
||||
import com.chwl.core.module_hall.hall.bean.HallInfo
|
||||
import com.chwl.core.user.UserInfoUiMgr
|
||||
import com.chwl.core.user.bean.UserDetailInfo
|
||||
@@ -25,8 +29,16 @@ class UserInfoInfoFragment : BaseViewBindingFragment<FragmentUserinfoUserinfoBin
|
||||
override fun init() {
|
||||
// EventBus.getDefault().register(this)
|
||||
|
||||
vm.hallData.observe(this) {
|
||||
initPersonalData(it)
|
||||
vm.userClanData.observe(this) {
|
||||
val clanInfo = it.asClanHall()
|
||||
if (clanInfo != null) {
|
||||
initPersonalData(clanInfo)
|
||||
} else {
|
||||
val familyInfo = it.asFamily()
|
||||
if (familyInfo != null) {
|
||||
initPersonalData(familyInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vm.userInfoDetailData.observe(this) {
|
||||
@@ -100,6 +112,37 @@ class UserInfoInfoFragment : BaseViewBindingFragment<FragmentUserinfoUserinfoBin
|
||||
|
||||
}
|
||||
|
||||
private fun initPersonalData(familyInfo: H5FamilyInfo) {
|
||||
if (AuthModel.get().currentUid == UserInfoUiMgr.get().uid) {
|
||||
binding.tvMore.visibility = View.GONE
|
||||
binding.llRoom.visibility = View.GONE
|
||||
binding.llAssociation.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.tvMore.visibility = View.VISIBLE
|
||||
binding.llRoom.visibility = View.GONE
|
||||
binding.llAssociation.visibility = View.GONE
|
||||
binding.tvMore.setOnClickListener {
|
||||
binding.tvMore.visibility = View.GONE
|
||||
binding.llRoom.visibility = View.VISIBLE
|
||||
if ((familyInfo.familyId ?: 0) > 0L) {
|
||||
binding.llAssociation.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.llAssociation.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.tvJoinRoom.visibility = View.GONE
|
||||
if ((familyInfo.familyId ?: 0) > 0L) {
|
||||
binding.tvAssociation.text = familyInfo.familyName
|
||||
} else {
|
||||
binding.llAssociation.visibility = View.GONE
|
||||
}
|
||||
binding.tvAssociation.setOnClickListener {
|
||||
CommonWebViewActivity.start(context, familyInfo.getFullMyFamilyUrl())
|
||||
}
|
||||
|
||||
}
|
||||
// /**
|
||||
// * 动态列表
|
||||
// *
|
||||
|
@@ -4,8 +4,10 @@ import android.annotation.SuppressLint
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.chwl.app.module_hall.HallDataManager
|
||||
import com.chwl.core.module_hall.hall.HallModel
|
||||
import com.chwl.core.module_hall.hall.bean.ClanAndHallInfo
|
||||
import com.chwl.core.module_hall.hall.bean.UserClanInfo
|
||||
import com.chwl.core.user.UserInfoUiMgr
|
||||
import com.chwl.core.user.UserModel
|
||||
import com.chwl.core.user.bean.UserDetailInfo
|
||||
@@ -28,8 +30,7 @@ class UserInfoViewModel : ViewModel() {
|
||||
private val _userInfoDetailData = MutableLiveData<UserDetailInfo.DataBean>()
|
||||
val userInfoDetailData: LiveData<UserDetailInfo.DataBean> = _userInfoDetailData
|
||||
|
||||
private val _hallData = MutableLiveData<ClanAndHallInfo>()
|
||||
val hallData: LiveData<ClanAndHallInfo> = _hallData
|
||||
val userClanData = MutableLiveData<UserClanInfo>()
|
||||
|
||||
private val disposable: CompositeDisposable by lazy {
|
||||
CompositeDisposable()
|
||||
@@ -65,10 +66,10 @@ class UserInfoViewModel : ViewModel() {
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun getUserHallAndClan() {
|
||||
val subscribe = HallModel.get().getUserHallAndClan(userId)
|
||||
val subscribe = HallDataManager.get().requestUserClanInfo(userId)
|
||||
.toFlowable()
|
||||
.subscribe(
|
||||
{ data -> data?.let { _hallData.value = data } },
|
||||
{ data -> data?.let { userClanData.value = data } },
|
||||
{ th ->
|
||||
th.printStackTrace()
|
||||
th.message?.toast()
|
||||
|
@@ -8,6 +8,8 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.chwl.core.im.custom.bean.User;
|
||||
import com.chwl.core.module_hall.hall.bean.UserClanInfo;
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
import com.chwl.app.module_hall.im.msgholder.HallMsgViewHolder;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
@@ -28,12 +30,18 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* Created by lvzebiao on 2019/1/7.
|
||||
*/
|
||||
|
||||
public class HallDataManager {
|
||||
|
||||
private UserClanInfo userClanInfo;
|
||||
|
||||
private HallInfo hallInfo;
|
||||
/**
|
||||
* 模厅名字
|
||||
@@ -146,10 +154,26 @@ public class HallDataManager {
|
||||
liveHallExist.observe(owner, observer);
|
||||
}
|
||||
|
||||
public Single<UserClanInfo> requestUserClanInfo(long uid){
|
||||
return HallModel.get().getUserClanInfo(uid).map(
|
||||
info -> {
|
||||
if (uid == AuthModel.get().getCurrentUid()) {
|
||||
userClanInfo = info;
|
||||
ClanAndHallInfo clanAndHallInfo = info.asClanHall();
|
||||
if (clanAndHallInfo != null) {
|
||||
updateHallInfo(userClanInfo.getClan());
|
||||
} else {
|
||||
updateHallInfo(new ClanAndHallInfo());
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void updateHallInfo() {
|
||||
HallModel.get().getUserHallAndClan(AuthModel.get().getCurrentUid())
|
||||
.subscribe(this::updateHallInfo);
|
||||
requestUserClanInfo(AuthModel.get().getCurrentUid()).subscribe(info -> {});
|
||||
}
|
||||
|
||||
public void updateHallInfo(ClanAndHallInfo clanAndHallInfo) {
|
||||
@@ -228,6 +252,10 @@ public class HallDataManager {
|
||||
return hallInfo == null ? 0 : hallInfo.getOwnerUid();
|
||||
}
|
||||
|
||||
public UserClanInfo getUserClanInfo() {
|
||||
return userClanInfo;
|
||||
}
|
||||
|
||||
public String getOwnerNick() {
|
||||
return hallInfo == null ? "" : hallInfo.getOwnerNick();
|
||||
}
|
||||
|
@@ -302,4 +302,15 @@ public class UriProvider {
|
||||
public static String getLuckyGiftRule(int giftID) {
|
||||
return JAVA_WEB_URL.concat("/molistar/modules/rule/luckyGiftRule.html?giftID=" + giftID);
|
||||
}
|
||||
|
||||
public static String toFullUrl(String shortUrl) {
|
||||
if (shortUrl == null) {
|
||||
return null;
|
||||
}
|
||||
if (shortUrl.startsWith("http")) {
|
||||
return shortUrl;
|
||||
} else {
|
||||
return JAVA_WEB_URL.concat(shortUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ import com.chwl.core.module_hall.hall.bean.OptionInfo;
|
||||
import com.chwl.core.module_hall.hall.bean.OwnerHallInfo;
|
||||
import com.chwl.core.module_hall.hall.bean.SuperAdminHall;
|
||||
import com.chwl.core.module_hall.hall.bean.SuperAdminInfo;
|
||||
import com.chwl.core.module_hall.hall.bean.UserClanInfo;
|
||||
import com.chwl.core.module_hall.hall.event.UserHallUpdateEvent;
|
||||
import com.chwl.core.user.UserModel;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
@@ -313,6 +314,11 @@ public class HallModel extends BaseModel implements IHallModel {
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
public Single<UserClanInfo> getUserClanInfo(long uid) {
|
||||
return api.getUserClanInfo(uid)
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<SuperAdminHall>> getSuperAdminHallList(long clanId, long uid) {
|
||||
return api.getSuperAdminHallList(clanId, uid)
|
||||
@@ -514,18 +520,18 @@ public class HallModel extends BaseModel implements IHallModel {
|
||||
@Query("page") int page,
|
||||
@Query("pageSize") int pageSize);
|
||||
|
||||
/**
|
||||
* 获取用户家族信息
|
||||
*/
|
||||
@GET("/clan/getUserClanInfo")
|
||||
Single<ServiceResult<ClanInfo>> getUserClanInfo(@Query("uid") long uid);
|
||||
|
||||
/**
|
||||
* 获取用户家族和公会信息
|
||||
*/
|
||||
@GET("/clan/getUserHallAndClan")
|
||||
Single<ServiceResult<ClanAndHallInfo>> getUserHallAndClan(@Query("uid") long uid);
|
||||
|
||||
/**
|
||||
* 获取用户家族和公会信息
|
||||
*/
|
||||
@GET("/user/getUserClanInfo")
|
||||
Single<ServiceResult<UserClanInfo>> getUserClanInfo(@Query("uid") long uid);
|
||||
|
||||
/**
|
||||
* 获取设置超管可以管理的房间列表
|
||||
*/
|
||||
|
@@ -0,0 +1,21 @@
|
||||
package com.chwl.core.module_hall.hall.bean
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.chwl.core.UriProvider
|
||||
import java.io.Serializable
|
||||
|
||||
@Keep
|
||||
class H5FamilyInfo : Serializable {
|
||||
val familyId: Long? = null
|
||||
val familyName: String? = null
|
||||
val familyListUrl: String? = null
|
||||
val myFamilyUrl: String? = null
|
||||
|
||||
fun getFullFamilyListUrl(): String? {
|
||||
return UriProvider.toFullUrl(familyListUrl)
|
||||
}
|
||||
|
||||
fun getFullMyFamilyUrl(): String? {
|
||||
return UriProvider.toFullUrl(myFamilyUrl)
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.chwl.core.module_hall.hall.bean;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Keep
|
||||
@Data
|
||||
public class UserClanInfo implements Serializable {
|
||||
private ClanAndHallInfo clan;
|
||||
private H5FamilyInfo family;
|
||||
private String clanMode;
|
||||
|
||||
public ClanAndHallInfo asClanHall() {
|
||||
if (clanMode != null && clanMode.equals("clan_hall")) {
|
||||
return clan;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public H5FamilyInfo asFamily() {
|
||||
if (clanMode != null && clanMode.equals("family")) {
|
||||
return family;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user