feat : 勿打擾 功能
This commit is contained in:
@@ -22,12 +22,14 @@ import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.chwl.app.common.widget.dialog.DialogManager;
|
||||
import com.chwl.app.ui.im.GreetPresenter;
|
||||
import com.chwl.app.ui.im.MessageListPanelEx;
|
||||
import com.chwl.app.ui.im.chat.MVHChatterBoxStart;
|
||||
import com.chwl.app.ui.im.model.IMCustomModel;
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity;
|
||||
import com.chwl.app.utils.PushMessageHandler;
|
||||
import com.chwl.app.vip.VipCenterActivity;
|
||||
import com.chwl.core.UriProvider;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.im.chatterbox.ChatterBoxHelper;
|
||||
@@ -333,9 +335,40 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
if (!isAllowSendMessage(imMessage)) {
|
||||
return false;
|
||||
}
|
||||
//todo do 消息防打扰, 发送消息前 请求接口
|
||||
// IMCustomModel.get().isSend(imMessage.getSessionId())
|
||||
// .doOnSuccess(s -> {
|
||||
inputPanel.setInputViewEnabled(false);
|
||||
//todo do 消息防打扰, 发送消息前 请求接口
|
||||
IMCustomModel.get().getPrivateChatLimitV2(imMessage.getSessionId())
|
||||
.doOnSuccess(s -> {
|
||||
try {
|
||||
if (!s.isChat()) {
|
||||
//isChat = false , 彈窗阻止聊天
|
||||
DialogManager dialog = new DialogManager(requireActivity());
|
||||
if (s.getNextVipLevel() == -1 && s.getNextUserCountLimit() == -1) {
|
||||
//最高等級
|
||||
dialog.showOkDialog(ResUtil.getString(R.string.chat_limit_tip3));
|
||||
} else if (s.getNextVipLevel() != -1 && s.getNextUserCountLimit() == -1) {
|
||||
//未達到最小等級
|
||||
dialog.showOkDialog(ResUtil.getString(R.string.chat_limit_tip1));
|
||||
} else {
|
||||
//其他
|
||||
dialog.showOkCancelDialog(
|
||||
ResUtil.getString(R.string.chat_limit_tip2, s.getNextVipLevel(), s.getNextUserCountLimit()), ResUtil.getString(R.string.getsVip, s.getNextVipLevel()), ResUtil.getString(R.string.cancel), true, new DialogManager.OkCancelDialogListener() {
|
||||
@Override
|
||||
public void onOk() {
|
||||
VipCenterActivity.start(requireActivity());
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
inputPanel.setInputViewEnabled(true);
|
||||
return;
|
||||
}
|
||||
}catch (Exception e){
|
||||
inputPanel.setInputViewEnabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
appendTeamMemberPush(imMessage);
|
||||
IMMessage message = changeToRobotMsg(imMessage);
|
||||
Map<String, Object> payload = new HashMap<>();
|
||||
@@ -378,11 +411,13 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
if (aitManager != null) {
|
||||
aitManager.reset();
|
||||
}
|
||||
// })
|
||||
// .doOnError(throwable -> {
|
||||
// SingleToastUtil.showToast(throwable.getMessage());
|
||||
// })
|
||||
// .subscribe();
|
||||
inputPanel.setInputViewEnabled(true);
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
inputPanel.setInputViewEnabled(true);
|
||||
SingleToastUtil.showToast(throwable.getMessage());
|
||||
})
|
||||
.subscribe();
|
||||
|
||||
|
||||
return true;
|
||||
|
@@ -30,8 +30,8 @@ public class IMCustomModel extends BaseMvpModel {
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
public Single<PrivateChatLimitInfo> isSend(String receiverUid) {
|
||||
return api.isSend(receiverUid)
|
||||
public Single<PrivateChatLimitInfo> getPrivateChatLimitV2(String receiverUid) {
|
||||
return api.getPrivateChatLimitV2(receiverUid)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
@@ -50,6 +50,6 @@ public class IMCustomModel extends BaseMvpModel {
|
||||
* @return
|
||||
*/
|
||||
@GET("/privateChat/limitV2")
|
||||
Single<ServiceResult<PrivateChatLimitInfo>> isSend(@Query("receiverUid") String receiverUid);
|
||||
Single<ServiceResult<PrivateChatLimitInfo>> getPrivateChatLimitV2(@Query("receiverUid") String receiverUid);
|
||||
}
|
||||
}
|
||||
|
@@ -5,20 +5,16 @@ import android.content.Intent
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.avroom.ButtonItemFactory
|
||||
import com.chwl.app.base.BaseViewBindingActivity
|
||||
import com.chwl.app.databinding.VipSetActivityBinding
|
||||
import com.chwl.app.ui.widget.UserInfoDialog
|
||||
import com.chwl.core.auth.AuthModel
|
||||
import com.chwl.core.bean.response.ServiceResult
|
||||
import com.chwl.core.user.UserModel
|
||||
import com.chwl.core.user.bean.UserInfo
|
||||
import com.chwl.core.utils.net.RxHelper
|
||||
import com.chwl.library.common.util.setMargin
|
||||
import com.chwl.library.common.util.setViewWH
|
||||
import com.chwl.library.net.rxnet.RxNet
|
||||
import com.chwl.library.utils.ResUtil
|
||||
import com.chwl.library.utils.SingleToastUtil
|
||||
import com.example.lib_utils.ktx.getDimension
|
||||
import com.example.lib_utils.log.ILog
|
||||
import com.google.gson.JsonElement
|
||||
@@ -65,6 +61,11 @@ class VipSetActivity : BaseViewBindingActivity<VipSetActivityBinding>(), ILog, V
|
||||
, R.drawable.vip_icon_lv8
|
||||
, R.drawable.vip_icon_lv9
|
||||
)
|
||||
initVipIcons(binding.vipSetIcons5
|
||||
, R.drawable.vip_icon_lv7
|
||||
, R.drawable.vip_icon_lv8
|
||||
, R.drawable.vip_icon_lv9
|
||||
)
|
||||
if (AuthModel.get().isLogin) {
|
||||
UserModel.get().getUserInfoFromServerUpdate(AuthModel.get().currentUid,true)
|
||||
.compose(bindToLifecycle())
|
||||
@@ -73,6 +74,7 @@ class VipSetActivity : BaseViewBindingActivity<VipSetActivityBinding>(), ILog, V
|
||||
setSwitchView(binding.vipSetSwitch2, it?.userVipInfoVO?.preventTrace?:false)//防跟随
|
||||
setSwitchView(binding.vipSetSwitch3, it?.userVipInfoVO?.enterHide?:false)//开关隐身进房状态
|
||||
setSwitchView(binding.vipSetSwitch4, it?.userVipInfoVO?.preventKick?:false)//防踢
|
||||
setSwitchView(binding.vipSetSwitch5, it?.userVipInfoVO?.privateChatLimit?:false)//無打擾
|
||||
}
|
||||
.doOnError {
|
||||
|
||||
@@ -126,6 +128,7 @@ class VipSetActivity : BaseViewBindingActivity<VipSetActivityBinding>(), ILog, V
|
||||
binding.vipSetSwitch2.id -> return api.notTrace(value).compose(RxHelper.handleIgnoreData()).compose(RxHelper.handleSchedulers())
|
||||
binding.vipSetSwitch3.id -> return api.invisible(value).compose(RxHelper.handleIgnoreData()).compose(RxHelper.handleSchedulers())
|
||||
binding.vipSetSwitch4.id -> return api.notKick(value).compose(RxHelper.handleIgnoreData()).compose(RxHelper.handleSchedulers())
|
||||
binding.vipSetSwitch5.id -> return api.chatLimit(value).compose(RxHelper.handleIgnoreData()).compose(RxHelper.handleSchedulers())
|
||||
else -> return api.notFollowed(!value).compose(RxHelper.handleIgnoreData()).compose(RxHelper.handleSchedulers())
|
||||
}
|
||||
}
|
||||
@@ -157,6 +160,11 @@ class VipSetActivity : BaseViewBindingActivity<VipSetActivityBinding>(), ILog, V
|
||||
*/
|
||||
@GET("/vip/changePreventKick")
|
||||
fun notKick(@Query("open") open: Boolean): Single<ServiceResult<JsonElement>>
|
||||
/**
|
||||
* 無打擾
|
||||
*/
|
||||
@GET("/vip/changePrivateChatLimit")
|
||||
fun chatLimit(@Query("open") open: Boolean): Single<ServiceResult<JsonElement>>
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +174,8 @@ class VipSetActivity : BaseViewBindingActivity<VipSetActivityBinding>(), ILog, V
|
||||
binding.vipSetSwitch1,
|
||||
binding.vipSetSwitch2,
|
||||
binding.vipSetSwitch3,
|
||||
binding.vipSetSwitch4 -> switchClick(it)
|
||||
binding.vipSetSwitch4,
|
||||
binding.vipSetSwitch5 -> switchClick(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -137,6 +137,55 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:layout_marginTop="@dimen/dp_20">
|
||||
|
||||
<com.chwl.library.widget.text.DrawableTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:dt_drawableType="shape"
|
||||
app:dt_radius="@dimen/dp_8"
|
||||
app:dt_soildColor="#f2f3f7" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/vipSetIcons5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginHorizontal="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/vipSetTitle5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:text="@string/vipSetItemTitle5"
|
||||
android:textColor="@color/color_313131"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/vipSetSwitch5"
|
||||
android:layout_width="@dimen/dp_34"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/icon_room_set_lock_false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
|
@@ -5341,6 +5341,12 @@ You cannot join again within 24 hours after leaving</string>
|
||||
<string name="Purchases_hint">Purchases Hint</string>
|
||||
<string name="Purchases_hint_info">Purchases Hint info</string>
|
||||
|
||||
<string name="chat_limit_tip1">沒達到vip等級</string>
|
||||
<string name="chat_limit_tip2">升級到vip%s,每天能聊%s個陌生人</string>
|
||||
<string name="chat_limit_tip3">今天到上線了</string>
|
||||
<string name="getsVip">Get VIP%s</string>
|
||||
<string name="vipSetItemTitle5">無打擾</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
@@ -11,8 +11,7 @@ public class PrivateChatLimitInfo implements Serializable {
|
||||
private int wealthLevel;
|
||||
private int charmLevel;
|
||||
|
||||
private int nextVipLevel; //下一级Vip等级
|
||||
private int userCount; //聊天人数
|
||||
private int nextVipLevel = -1; //下一级Vip等级 只返 nextVipLevel 表示未達到 第一個彈窗的級別(目前是vip3)
|
||||
private int nextUserCountLimit = -1; //聊天人数 兩個都沒返,表示達到最大等級
|
||||
|
||||
private boolean isMaxVipLevel; // 是否最高等级vip
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ data class UserVipInfo(
|
||||
val vipLevel: Int = 0,
|
||||
val friendNickColour: String = "",
|
||||
val preventKick: Boolean = false,
|
||||
val privateChatLimit: Boolean = false,
|
||||
var enterHide: Boolean = false,
|
||||
val preventTrace: Boolean = false,
|
||||
var preventFollow: Boolean = false,
|
||||
|
@@ -979,4 +979,8 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
}
|
||||
}
|
||||
|
||||
public void setInputViewEnabled(boolean isEnabled) {
|
||||
messageActivityBottomLayout.setEnabled(isEnabled);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user