|
@@ -0,0 +1,67 @@
|
|
|
+package com.liaobo.im.ui.base;
|
|
|
+
|
|
|
+import android.text.TextUtils;
|
|
|
+
|
|
|
+import com.liaobo.im.ui.dialog.VerifiedDialogView;
|
|
|
+import com.liaobo.im.util.PreferenceUtils;
|
|
|
+import com.liaobo.im.util.ToastUtil;
|
|
|
+import com.liaobo.im.view.ChatBottomView;
|
|
|
+import com.liaobo.im.view.ChatContentView;
|
|
|
+import com.liaobo.im.view.SelectCardPopupWindow;
|
|
|
+import com.liaobo.im.xmpp.listener.ChatMessageListener;
|
|
|
+import com.liaobo.im.xuan.xuanhttplibrary.okhttp.HttpUtils;
|
|
|
+import com.liaobo.im.xuan.xuanhttplibrary.okhttp.callback.BaseCallback;
|
|
|
+import com.liaobo.im.xuan.xuanhttplibrary.okhttp.result.ObjectResult;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+
|
|
|
+import okhttp3.Call;
|
|
|
+
|
|
|
+public abstract class BaseChatActivity extends BaseActivity implements
|
|
|
+ ChatContentView.MessageEventListener, ChatBottomView.ChatBottomListener, ChatMessageListener, SelectCardPopupWindow.SendCardS {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ protected void checkVerified(){
|
|
|
+ new VerifiedDialogView(this, ((name, id) -> {
|
|
|
+ makeVerified(name,id);
|
|
|
+ })).show();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void makeVerified(String name, String id) {
|
|
|
+ HashMap<String, String> params = new HashMap<String, String>();
|
|
|
+ params.put("access_token", coreManager.getSelfStatus().accessToken);
|
|
|
+ params.put("realName", name);
|
|
|
+ params.put("idcard", id);
|
|
|
+
|
|
|
+ HttpUtils.get().url(coreManager.getConfig().MAKE_VERIFIED)
|
|
|
+ .params(params)
|
|
|
+ .build()
|
|
|
+ .execute(new BaseCallback<String>(String.class) {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResponse(ObjectResult<String> result) {
|
|
|
+ ToastUtil.showToast(BaseChatActivity.this, result.getResultMsg());
|
|
|
+ if (result.getResultCode() == 1) {
|
|
|
+ PreferenceUtils.putString(BaseChatActivity.this, "isVerified", "true");
|
|
|
+ }else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(Call call, Exception e) {
|
|
|
+
|
|
|
+ ToastUtil.showNetError(BaseChatActivity.this);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ protected boolean isVerified(){
|
|
|
+
|
|
|
+ boolean isVerified = !TextUtils.equals(PreferenceUtils.getString(this, "isVerified"), "false");
|
|
|
+ return isVerified;
|
|
|
+ }
|
|
|
+}
|