From cc438af7ca0d8161a143d6ef886fb070a4b3d743 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 27 Jul 2022 16:13:07 +0800 Subject: [PATCH] 11111 --- .../dialog/InstructorOperationDialog.java | 2 + .../activity/PDLiveConversationActivity.java | 5 +- .../yunbao/main/activity/EntryActivity.java | 4 + .../yunbao/main/activity/LoginActivity.java | 4 + .../main/activity/RegisterActivity.java | 117 ++++++++---------- 5 files changed, 63 insertions(+), 69 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java b/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java index ec8b1493c..049993ce5 100644 --- a/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java @@ -13,6 +13,7 @@ import androidx.fragment.app.FragmentTransaction; import com.yunbao.common.R; import com.yunbao.common.event.InstructorOperationEvent; +import com.yunbao.common.manager.NoviceInstructorManager; import org.greenrobot.eventbus.EventBus; @@ -77,6 +78,7 @@ public class InstructorOperationDialog extends AbsDialogFragment { @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); + NoviceInstructorManager.get(getActivity()).setHomeZdyPop(""); mRootView.findViewById(R.id.hurry_contact).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java index d73531594..40569c9be 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java @@ -195,7 +195,8 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl RongIMClient.getInstance().getTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, new RongIMClient.ResultCallback() { @Override public void onSuccess(String s) { - inputPanel.setPresetInformation(s); + if (TextUtils.isEmpty(inputPanel.getPresetInformation())) + inputPanel.setPresetInformation(s); } @Override @@ -229,7 +230,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl super.onDestroy(); //获取输入框信息存进输入框 String content = inputPanel.getPresetInformation(); - if (!TextUtils.isEmpty(content)){ + if (!TextUtils.isEmpty(content)) { IMCenter.getInstance().saveTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, content, null); } diff --git a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java index 68362dd4b..5242e0b06 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -75,6 +75,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; @@ -736,6 +737,9 @@ public class EntryActivity extends AppCompatActivity { MainActivity.forward(EntryActivity.this, false); gotoLive(obj.getString("anchor_id")); IMLoginManager.get(EntryActivity.this).setisNewUserOne(true); + if (obj.containsKey("home_zdy_pop")) { + NoviceInstructorManager.get(activity).setHomeZdyPop(obj.getString("home_zdy_pop")); + } } else { MainActivity.forward(EntryActivity.this, false); } diff --git a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java index 6f6cd545a..daf4d1465 100644 --- a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java @@ -41,6 +41,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -320,6 +321,9 @@ public class LoginActivity extends AbsActivity { MainActivity.forward(LoginActivity.this, false); gotoLive(obj.getString("anchor_id")); IMLoginManager.get(mContext).setisNewUserOne(true); + if (obj.containsKey("home_zdy_pop")) { + NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop")); + } } else { MainActivity.forward(LoginActivity.this, false); } diff --git a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java index c6e2ba7f4..d9f745e2e 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -1,6 +1,7 @@ package com.yunbao.main.activity; import android.app.Dialog; +import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -32,16 +33,16 @@ import com.sahooz.library.Country; import com.sahooz.library.CountryPicker; import com.sahooz.library.OnPick; import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.bean.IMLoginModel; -import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; -import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.ToastUtil; @@ -97,6 +98,8 @@ public class RegisterActivity extends AbsActivity { private LinearLayout yqm_view; private ArrayList allCountries = new ArrayList<>(); private RegisterActivity activity; + //网络请求的回执 + private Handler netHandler = new Handler(); @Override protected int getLayoutId() { @@ -117,7 +120,7 @@ public class RegisterActivity extends AbsActivity { CommonHttpUtil.setAdvertisingChannels("pooqmz", new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if(code == 0) { + if (code == 0) { //谷歌 mFirebaseAnalytics.logEvent("FS_complete_2nd_loading", null); logger.logEvent("FB_complete_2nd_loading"); @@ -276,11 +279,6 @@ public class RegisterActivity extends AbsActivity { } private void changeEnable() { -// String phone = mEditPhone.getText().toString(); -// String code = mEditCode.getText().toString(); -// String pwd1 = mEditPwd1.getText().toString(); -// String pwd2 = mEditPwd2.getText().toString(); -// mBtnRegister.setEnabled(!TextUtils.isEmpty(phone) && !TextUtils.isEmpty(code) && !TextUtils.isEmpty(pwd1) && !TextUtils.isEmpty(pwd2)); } private void showCountryCode() { @@ -297,8 +295,6 @@ public class RegisterActivity extends AbsActivity { int i = v.getId(); if (i == R.id.btn_code) { webview.setVisibility(View.VISIBLE); - -// getPromoCode(); //获取设备唯一标识符 getUuidDevice(); //获取验证码 @@ -308,11 +304,8 @@ public class RegisterActivity extends AbsActivity { logger.logEvent("FB_phone_getcode"); } else if (i == R.id.btn_register) { register(); - AdjustEvent adjustEvent1 = new AdjustEvent("wrajax"); Adjust.trackEvent(adjustEvent1); - Bundle params = new Bundle(); - mFirebaseAnalytics.logEvent("FS_phone_clickregister", null); logger.logEvent("FB_phone_clickregister"); } else if (i == R.id.btn_tip2) { @@ -339,13 +332,6 @@ public class RegisterActivity extends AbsActivity { mEditPhone.requestFocus(); return; } - //屏蔽,原因:国外手机号无法校验合法性 -// if (!ValidatePhoneUtil.validateMobileNumber(phoneNum)) -// { -// mEditPhone.setError(WordUtil.getString(R.string.login_phone_error)); -// mEditPhone.requestFocus(); -// return; -// } mEditCode.requestFocus(); MainHttpUtil.getRegisterCode(Randstr, Ticket, phoneNum, mCountryCode, mGetCodeCallback); } @@ -378,12 +364,6 @@ public class RegisterActivity extends AbsActivity { mEditPhone.requestFocus(); return; } - //屏蔽,原因:国外手机号无法校验合法性 -// if (!ValidatePhoneUtil.validateMobileNumber(phoneNum)) { -// mEditPhone.setError(WordUtil.getString(R.string.login_phone_error)); -// mEditPhone.requestFocus(); -// return; -// } String code = mEditCode.getText().toString().trim(); if (TextUtils.isEmpty(code)) { mEditCode.setError(WordUtil.getString(R.string.reg_input_code)); @@ -423,7 +403,7 @@ public class RegisterActivity extends AbsActivity { CommonHttpUtil.setAdvertisingChannels("fhqx62", new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if(code == 0) { + if (code == 0) { mFirebaseAnalytics.logEvent("FS_reg_phone", null); logger.logEvent("FB_reg_phone"); } @@ -432,10 +412,7 @@ public class RegisterActivity extends AbsActivity { Bundle params1 = new Bundle(); params1.putString(AppEventsConstants.EVENT_PARAM_REGISTRATION_METHOD, "Phone number"); - logger.logEvent(AppEventsConstants.EVENT_NAME_COMPLETED_REGISTRATION, - params1); - - + logger.logEvent(AppEventsConstants.EVENT_NAME_COMPLETED_REGISTRATION, params1); login(phoneNum, pwd, mUuidDevice); OpenInstall.reportRegister(); } else { @@ -493,7 +470,16 @@ public class RegisterActivity extends AbsActivity { IMLoginManager.get(activity).setupLoginUser(model); //融云连接服务器 RongcloudIMManager.connectIM(activity); - getBaseUserInfo(); + if (mFirstLogin) { + if (mDialog != null) { + mDialog.dismiss(); + } + //绑定广告渠道用户 + AdjustEvent adjustEvent = new AdjustEvent("s1or0t"); + adjustEvent.addCallbackParameter("userid", CommonAppConfig.getInstance().getUid()); + Adjust.trackEvent(adjustEvent); + netHandler.post(getRandJoinAnchor); + } } else { @@ -511,42 +497,39 @@ public class RegisterActivity extends AbsActivity { } /** - * 获取用户信息 + * 用户自动签到 */ - private void getBaseUserInfo() { - MainHttpUtil.getBaseInfo(new CommonCallback() { - @Override - public void callback(UserBean bean) { - if (mDialog != null) { - mDialog.dismiss(); - } - if (bean != null) { - if (mFirstLogin) { - //绑定广告渠道用户 - AdjustEvent adjustEvent = new AdjustEvent("s1or0t"); - adjustEvent.addCallbackParameter("userid", CommonAppConfig.getInstance().getUid()); - Adjust.trackEvent(adjustEvent); - HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor") - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) - .execute(new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (info[0] != null) { - JSONObject obj = JSON.parseObject(info[0]); - MainActivity.forward(RegisterActivity.this, false); - gotoLive(obj.getString("anchor_id")); - IMLoginManager.get(RegisterActivity.this).setisNewUserOne(true); - } else { - MainActivity.forward(RegisterActivity.this, false); - } - } - }); - } - EventBus.getDefault().post(new RegSuccessEvent()); - } - } - }); + private Runnable getRandJoinAnchor = new Runnable() { + @Override + public void run() { + IMLoginModel userInfo = IMLoginManager.get(activity).getUserInfo(); + HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor") + .params("uid", userInfo.getId()) + .params("token", userInfo.getToken()) + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (info[0] != null) { + JSONObject obj = JSON.parseObject(info[0]); + IMLoginManager.get(activity).setisNewUserOne(true); + gotoLive(obj.getString("anchor_id")); + if (obj.containsKey("home_zdy_pop")) { + NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop")); + } + jumpMain(false); + } else { + jumpMain(false); + } + EventBus.getDefault().post(new RegSuccessEvent()); + } + }); + } + }; + + private void jumpMain(boolean showInvite) { + Intent intent = new Intent(activity, MainActivity.class); + intent.putExtra(Constants.SHOW_INVITE, showInvite); + startActivity(intent); } private LiveRoomCheckLivePresenter mCheckLivePresenter;