Commit 6d384b9a by 徐健

Merge branch 'feature/userinfo_collect' of…

Merge branch 'feature/userinfo_collect' of ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component into feature/userinfo_collect
parents 921bdbda a30c25d3
...@@ -47,7 +47,7 @@ ext { ...@@ -47,7 +47,7 @@ ext {
"m-fm" : "0.0.29.3", "m-fm" : "0.0.29.3",
"m-user" : "0.0.59.15", "m-user" : "0.0.59.15",
"m-home" : "0.0.19.1", "m-home" : "0.0.19.1",
"m-im" : "0.0.16.2", "m-im" : "0.0.16.3",
"m-dynamic" : "0.0.6.1", "m-dynamic" : "0.0.6.1",
"m-muse" : "0.0.28.9", "m-muse" : "0.0.28.9",
......
...@@ -47,6 +47,7 @@ import com.ydl.ydlcommon.utils.SharedPreferencesEditor; ...@@ -47,6 +47,7 @@ import com.ydl.ydlcommon.utils.SharedPreferencesEditor;
import com.ydl.ydlcommon.utils.YdlBuryPointUtil; import com.ydl.ydlcommon.utils.YdlBuryPointUtil;
import com.ydl.ydlcommon.utils.log.LogHelper; import com.ydl.ydlcommon.utils.log.LogHelper;
import com.ydl.ydlcommon.view.CircleImageView; import com.ydl.ydlcommon.view.CircleImageView;
import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.yidianling.common.tools.ToastUtil; import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.im.router.ImIn; import com.yidianling.im.router.ImIn;
...@@ -258,9 +259,10 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -258,9 +259,10 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if (ChatStatusCacheHelper.getStatusCache("collectEvent")) { if (ChatStatusCacheHelper.getStatusCache("collectEvent")) {
String time = Calendar.getInstance().get(Calendar.YEAR) + "-" + Calendar.getInstance().get(Calendar.MONTH) + Calendar.getInstance().get(Calendar.DAY_OF_MONTH); String time = Calendar.getInstance().get(Calendar.YEAR) + "-" + Calendar.getInstance().get(Calendar.MONTH) + Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
// if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + YdlCommonRouterManager.INSTANCE.getYdlCommonRoute().getUid()))) {
if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()))) { if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()))) {
collectInfoPopupWindow = new CollectInfoPopupWindow(getActivity(), (content, result) -> { collectInfoPopupWindow = new CollectInfoPopupWindow(getActivity(), new CollectInfoPopupWindow.OnSendMsgListener() {
@Override
public void sendMsg(@NotNull String content, @NotNull List<UserQuestInfoBean> result) {
if (TextUtils.isEmpty(content)) {//点击跳过后当天不再显示此弹窗 if (TextUtils.isEmpty(content)) {//点击跳过后当天不再显示此弹窗
SharedPreferencesEditor.putString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid() SharedPreferencesEditor.putString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()
, time); , time);
...@@ -271,6 +273,12 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -271,6 +273,12 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
} }
submitUserCollect(result); submitUserCollect(result);
} }
}
@Override
public void finishPage() {
getActivity().finish();
}
}); });
getUserInfoCollect(); getUserInfoCollect();
if (!getActivity().isFinishing()) { if (!getActivity().isFinishing()) {
...@@ -380,6 +388,33 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -380,6 +388,33 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
rl_doctor_name.setVisibility(View.GONE); rl_doctor_name.setVisibility(View.GONE);
}); });
} }
if (ActionHandlerStorage.getL(sessionId) != null && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 1) {
if (TextUtils.isEmpty(SharedPreferencesEditor.getString("chat_age_ensure_" + ImIn.INSTANCE.getUserInfo().getUid()))) {
ServiceImpl.Companion.getInstance().getNewUserMes()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(hasCollectedInResp -> {
if (hasCollectedInResp.data != null && hasCollectedInResp.data.size() > 0) {
for (UserQuestInfoBean bean : hasCollectedInResp.data) {
if (TextUtils.equals(bean.getUserInfoType(), "age")) {
try {
String year = bean.getContent();
if ((Calendar.getInstance().get(Calendar.YEAR) - Integer.valueOf(year)) < 16) {
if (!getActivity().isFinishing()) {
showCheckAgeDialog();
}
}
} catch (Exception e) {
}
}
}
}
}, throwable -> {
});
}
}
} }
private void addScrollListener() { private void addScrollListener() {
...@@ -1188,7 +1223,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -1188,7 +1223,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> { .subscribe(resp -> {
if (resp.data != null && resp.data.size() > 0) { if (resp.data != null && resp.data.size() > 0) {
ServiceImpl.Companion.getInstance().userCollectList() ServiceImpl.Companion.getInstance().getNewUserMes()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(hasCollectedInResp -> { .subscribe(hasCollectedInResp -> {
...@@ -1219,4 +1254,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -1219,4 +1254,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}, throwable -> { }, throwable -> {
}); });
} }
private void showCheckAgeDialog() {
CommonDialog.create(getActivity())
.setLeftOnclick("返回", v -> getActivity().finish())
.setRightClick("继续", v -> SharedPreferencesEditor.putString("chat_age_ensure_" + ImIn.INSTANCE.getUserInfo().getUid(), "ensure"))
.setMessage("由于您未满16周岁,如需咨询需要在家长陪同下进行")
.setCancelAble(false)
.show();
}
} }
...@@ -31,6 +31,9 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe ...@@ -31,6 +31,9 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe
listener.sendMsg("", ArrayList()) listener.sendMsg("", ArrayList())
isFromBack = false isFromBack = false
dismiss() dismiss()
}, {
dismiss()
listener.finishPage()
}, { _content, _list -> }, { _content, _list ->
listener.sendMsg(_content, _list) listener.sendMsg(_content, _list)
isFromBack = false isFromBack = false
...@@ -79,6 +82,8 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe ...@@ -79,6 +82,8 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe
interface OnSendMsgListener { interface OnSendMsgListener {
fun sendMsg(content: String, result: List<UserQuestInfoBean>) fun sendMsg(content: String, result: List<UserQuestInfoBean>)
fun finishPage()
} }
} }
\ No newline at end of file
...@@ -18,11 +18,13 @@ import android.widget.EditText ...@@ -18,11 +18,13 @@ import android.widget.EditText
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.ScrollView import android.widget.ScrollView
import android.widget.TextView import android.widget.TextView
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.view.dialog.CommonDialog import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R import com.yidianling.im.R
import com.yidianling.im.router.ImIn.getUserInfo
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import kotlinx.android.synthetic.main.im_view_collect_user_infomation.view.* import kotlinx.android.synthetic.main.im_view_collect_user_infomation.view.*
import java.util.* import java.util.*
...@@ -40,14 +42,17 @@ import kotlin.collections.ArrayList ...@@ -40,14 +42,17 @@ import kotlin.collections.ArrayList
class CollectUserInformationView( class CollectUserInformationView(
var mContext: Context, var mContext: Context,
var skipEvent: () -> Unit, var skipEvent: () -> Unit,
var backEvent: () -> Unit,
var sendMsgEvent: (content: String, list: List<UserQuestInfoBean>) -> Unit var sendMsgEvent: (content: String, list: List<UserQuestInfoBean>) -> Unit
) : LinearLayout(mContext) { ) : LinearLayout(mContext) {
private var resultInfoList = ArrayList<UserQuestInfoBean>() private var resultInfoList = ArrayList<UserQuestInfoBean>()
private var hasAge = false private var hasAge = false
private var hasGender = false private var hasGender = false
private var currentIndex = 0 private var currentIndex = 0
private var isNeedShowCheckAgeDialog = false
private var year = 1994 private var year = 1994
private var dialog: CommonDialog? = null private var dialog: CommonDialog? = null
private var ensureAgeDialog: CommonDialog? = null
private var ageStr = "" private var ageStr = ""
private var genderStr = "" private var genderStr = ""
private var questionStr = "" private var questionStr = ""
...@@ -167,6 +172,9 @@ class CollectUserInformationView( ...@@ -167,6 +172,9 @@ class CollectUserInformationView(
return@setOnClickListener return@setOnClickListener
} }
ageStr = "年龄:${(Calendar.getInstance().get(Calendar.YEAR) - year)}岁" ageStr = "年龄:${(Calendar.getInstance().get(Calendar.YEAR) - year)}岁"
if ((Calendar.getInstance().get(Calendar.YEAR) - year) < 16) {
isNeedShowCheckAgeDialog = true
}
addContentView("${year}年", false) addContentView("${year}年", false)
tv_age_ensure.postDelayed({ tv_age_ensure.postDelayed({
...@@ -255,9 +263,14 @@ class CollectUserInformationView( ...@@ -255,9 +263,14 @@ class CollectUserInformationView(
resultList.add(questionStyleBean) resultList.add(questionStyleBean)
resultList.add(questionBean) resultList.add(questionBean)
if (isNeedShowCheckAgeDialog) {
showCheckAgeEnsure(resultContent, resultList)
} else {
sendMsgEvent(resultContent, resultList) sendMsgEvent(resultContent, resultList)
} }
} }
}
@SuppressLint("RtlHardcoded") @SuppressLint("RtlHardcoded")
...@@ -325,6 +338,30 @@ class CollectUserInformationView( ...@@ -325,6 +338,30 @@ class CollectUserInformationView(
imm.showSoftInput(editTextMessage, 0) imm.showSoftInput(editTextMessage, 0)
} }
private fun showCheckAgeEnsure(content: String, list: List<UserQuestInfoBean>) {
if (ensureAgeDialog == null) {
ensureAgeDialog = CommonDialog.create(mContext)
.setLeftOnclick("返回") {
backEvent()
ensureAgeDialog!!.dismiss()
}
.setRightClick("继续") {
SharedPreferencesEditor.putString(
"chat_age_ensure_${getUserInfo()!!.uid}",
"ensure"
)
sendMsgEvent(content, list)
ensureAgeDialog!!.dismiss()
}
.setMessage("由于您未满16周岁,如需咨询需要在家长陪同下进行")
.setTitle_color(R.color.im_color_242424)
.setCancelAble(false)
}
if (!ensureAgeDialog!!.isShowing) {
ensureAgeDialog!!.show()
}
}
fun showSkipDialog() { fun showSkipDialog() {
if (dialog == null) { if (dialog == null) {
dialog = CommonDialog.create(mContext) dialog = CommonDialog.create(mContext)
......
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