Commit ee3dbe51 by 刘鹏

Merge branch 'd/v4.3.97' into 'release'

D/v4.3.97

See merge request app_android_lib/YDL-Component!162
parents 9014f2e8 3bad977f
......@@ -53,9 +53,6 @@
<meta-data
android:name="com.ydl.component.base.DemoGlobalConfig"
android:value="ModuleConfig" />
<meta-data
android:name="com.openinstall.APP_KEY"
android:value="jz0d0s"/>
<activity
android:name="com.tencent.tauth.AuthActivity"
android:launchMode="singleTask"
......
......@@ -12,10 +12,10 @@ import android.provider.Settings
import android.util.Log
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.fm.openinstall.OpenInstall
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper
import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.analytics.MobclickAgent
import com.ydl.audioim.YDLavManager
import com.ydl.component.music.FragmentContainerActivity
import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter
......@@ -35,6 +35,7 @@ import com.yidianling.muse.helper.MediaPlayerManager
import com.yidianling.muse.service.MeditationWindowService
import com.yidianling.tests.home.NewTestHomeActivity
import com.yidianling.user.StatusUtils
import com.yidianling.user.api.service.IUserService
import com.yidianling.user.ui.collect.CollectSexAndBirthActivity
import com.yidianling.user.ui.login.OneKeyLoginHelp
import com.yidianling.user.widget.SecretDescriptionDialog
......@@ -84,11 +85,12 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
override fun initDataAndEvent() {
EventBus.getDefault().register(this)
//线上
// YDLavManager.instances.init(this, "3387e9b251f3491e9221a9877e8f7830")
//测试
YDLavManager.instances.init(this, "13b1536698f64905a1e7e5bb978ba821")
YdlCommonRouterManager.initYdlCommonRoute(PlatformTempCommonRouteImpl())
OpenInstall.init(this);// TODO: 1/29/21 统计渠道测试
StatusUtils.isUseOpenInstall = true
// 初始化一键登录sdk
OneKeyLoginHelp.sdkInit(this, OneKeyLoginHelp.YDL_USER_APP, PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN)
bindService()
......@@ -159,7 +161,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
startActivity(Intent(this, CollectSexAndBirthActivity::class.java))
}
bt_to_confide.setOnClickListener {
// YDLavManager.instances.login("1193016")
YDLavManager.instances.login(ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid)
startActivity(Intent(this, ConfideHomeActivity::class.java))
}
......
......@@ -137,7 +137,6 @@
android:id="@+id/bt_to_tests"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="测评" />
......
......@@ -5,8 +5,8 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.21",
"m-consultant" : "0.0.60.66",
"m-confide" : "0.0.50.25",
"m-consultant" : "0.0.60.67",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.48",
"m-home" : "0.0.23.90",
......@@ -14,7 +14,7 @@ ext {
"m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.76",
"m-muse" : "0.0.28.78",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.39",
......@@ -36,13 +36,14 @@ ext {
"ydl-tuicore" : "0.0.23",
//第一步
"ydl-platform" : "0.0.41.33",
"ydl-platform" : "0.0.41.39",
//第二步 若干
"ydl-webview" : "0.0.38.92",
"ydl-media" : "0.0.21.52",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.30.15",
"m-audioim" : "0.0.49.30.18",
......@@ -93,8 +94,8 @@ ext {
ydlCompileVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.21",
"m-consultant" : "0.0.60.66",
"m-confide" : "0.0.50.25",
"m-consultant" : "0.0.60.67",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.48",
"m-home" : "0.0.23.90",
......@@ -102,7 +103,7 @@ ext {
"m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.76",
"m-muse" : "0.0.28.78",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.39",
......@@ -123,13 +124,13 @@ ext {
//mdt 组件
"ydl-tuicore" : "0.0.23",
//第一步
"ydl-platform" : "0.0.41.33",
"ydl-platform" : "0.0.41.39",
//第二步 若干
"ydl-webview" : "0.0.38.92",
"ydl-media" : "0.0.21.52",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.30.15",
"m-audioim" : "0.0.49.30.18",
"ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动
......
......@@ -4,9 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.text.TextUtils
import android.util.Log
import com.alibaba.android.arouter.launcher.ARouter
import com.bytedance.apm.insight.ApmInsightAgent
import com.google.gson.Gson
import com.ydl.audioim.bean.AgoraInvitationBean
import com.ydl.audioim.http.AudioApiRequestUtil
......@@ -25,6 +23,7 @@ import com.ydl.ydl_av.messge_service.callback.LoginCallback
import com.ydl.ydl_av.messge_service.request.LoginParam
import com.ydl.ydl_av.messge_service.response.CallLocalResponse
import com.ydl.ydl_av.messge_service.response.CallRemoteResponse
import com.ydl.ydlcommon.app.Apm
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.LogUtil
......@@ -43,7 +42,6 @@ import io.agora.rtm.RtmStatusCode.ConnectionChangeReason.CONNECTION_CHANGE_REASO
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import org.json.JSONObject
import java.util.*
import java.util.concurrent.TimeUnit
......@@ -326,53 +324,6 @@ class YDLavManager {
toUid: String,
content: String
) {
// LogUtil.e("[agora]收到云信的通知消息:$content")
// val agoraInvitationBean = Gson().fromJson(content, AgoraInvitationBean::class.java)
//1发起呼叫 2接受呼叫 3取消呼叫 4拒绝呼叫邀请 5呼叫超时
// when (agoraInvitationBean.callType) {
// "1" -> {
// writeAgoraLog("1收到云信消息通知电话-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// receivedCall(agoraInvitationBean.data, "来自云信")
// }
// "2" -> {
// writeAgoraLog("对方接受了通话邀请,主叫开始加入频道:callType${agoraInvitationBean.callType}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
// FILE_NAME
// )
// val act = ActivityManager.getInstance().getTopTaskActivity()
// if (act is AudioHomeActivity) {
// act.runOnUiThread {
// act.joinChannel()
// }
// }
// }
// "3" -> {
// writeAgoraLog("呼叫邀请被取消:主叫主动取消-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// closePage()
// }
// "4" -> {
// writeAgoraLog("被叫拒绝了通话邀请-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// val act = ActivityManager.getInstance().getTopTaskActivity()
// if (act is AudioHomeActivity) {
// act.runOnUiThread {
// ToastUtil.toastShort("对方已挂断")
// //通话结束或挂断时,上传日志文件
// act.uploadLog()
// act.leaveChannel()
// }
// }
// }
// "5" -> {
// writeAgoraLog("呼叫邀请被取消:呼叫邀请过期-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// //关闭页面
// closePage()
// }
// else -> {
// writeAgoraLog("其它AgoraInvitationBean,${agoraInvitationBean.callType}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// }
// }
}
})
}
......@@ -498,6 +449,7 @@ class YDLavManager {
}
override fun onFailure(msg: String?) {
Apm.reportCustom("agora_login_error", msg ?: "", Exception(msg))
LogUtil.e("[agora]实时消息登录失败:$msg")
writeAgoraLog(
"声网rtm登录失败:$msg-------Time:${
......@@ -714,6 +666,8 @@ class YDLavManager {
* https://docs.agora.io/cn/Voice/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_i_rtc_engine_event_handler.html#a31b2974a574ec45e62bb768e17d1f49e
* */
override fun onConnectionStateChanged(state: Int, reason: Int) {
val msg = "state:${state},reason:${reason}"
Apm.reportCustom("agora_connectionstate_error", msg, Exception(msg))
sdkStatus = state
writeAgoraLog(
"声网rtm登录状态:${state}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
......
......@@ -129,6 +129,7 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_totalDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_notes"
......@@ -232,7 +233,7 @@
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_marginTop="1dp"
android:src="@drawable/audiohome_muteon"
android:src="@drawable/audioim_home_muteon_enable"
android:visibility="visible" />
<TextView
......@@ -302,11 +303,12 @@
android:src="@drawable/audioim_img_hands_free_unuse" />
<TextView
android:id="@+id/hands_free_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hands_free"
android:layout_marginTop="8dp"
android:text="免提"
android:text="扬声器已关"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
......
......@@ -31,6 +31,7 @@ import com.ydl.confide.home.event.ConfideDialogEvent
import com.ydl.confide.home.http.ConfideHomeApi
import com.ydl.confide.router.PhoneCallIn
import com.ydl.utils.WebUrlParamsUtils
import com.ydl.webview.IJavascriptHandler
import com.ydl.webview.ProgressWebView
import com.ydl.webview.TellData
import com.ydl.webview.WebModularServiceUtils
......@@ -42,6 +43,7 @@ import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.event.UserLoginEvent
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -75,7 +77,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
lateinit var layoutBottom: View
lateinit var itemView: View
var bottomSheet :FrameLayout?=null
var mJtoJHandle:IJavascriptHandler?=null
private var behavior: BottomSheetBehavior<*>? = null
......@@ -345,14 +347,13 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
setting.setAllowFileAccess(true)
setting.setBlockNetworkImage(false)
wv_content!!.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
val jtoJHandle = WebModularServiceUtils.getWebService()
wv_content?.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
mJtoJHandle = WebModularServiceUtils.getWebService()
.getJavascripHandler(requireActivity(), tellData = TellData())
wv_content!!.addJavascriptInterface(jtoJHandle, "javascriptHandler")
wv_content?.addJavascriptInterface(mJtoJHandle, "javascriptHandler")
// var jumpurl = "http://192.168.210.152/jy/listenMask?listenerId=257&isFromApp=1"
val url = WebUrlParamsUtils.getSuffix(jumpUrl, jtoJHandle.getUriAppendSuffix())
wv_content.loadUrl(url)
loadUrl()
// wv_content.loadUrl(jumpUrl)
wv_content.setOnTouchListener { p0, p1 -> //canScrollVertically(-1)的值表示是否能向下滚动,false表示已经滚动到顶部
......@@ -418,6 +419,11 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
}
private fun loadUrl() {
val url = WebUrlParamsUtils.getSuffix(jumpUrl, mJtoJHandle?.getUriAppendSuffix())
wv_content?.loadUrl(url)
}
private fun shouldOverridePayUrl(view: WebView, url: String): Boolean {
if (url.startsWith("weixin://")) {
return try {
......@@ -574,4 +580,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
wv_content.destroy()
EventBus.getDefault().unregister(this)
}
fun onEvent(event: UserLoginEvent) {
loadUrl()
}
}
\ No newline at end of file
......@@ -99,7 +99,7 @@ class ExpertIntroActivity : AppCompatActivity() {
binding.viewPager.adapter = adapter
binding.viewPager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
adapter.onSelect(position)
adapter.onSelect(position, lastSelectPos)
if (position == data.size - 1 && lastSelectPos < position) {
loadMore()
}
......
......@@ -166,7 +166,7 @@ internal class IntroAdapter(
ijkVideoView?.pause()
}
fun onSelect(position: Int) {
fun onSelect(position: Int, lastPos:Int) {
curPos = position
onLoadDialStatus(position)
if (!ConfideNetworkUtil.isWifi(context) && !hasAgreePlayWithoutWiFi) {
......@@ -177,6 +177,15 @@ internal class IntroAdapter(
// entry.value.seekTo(0)
entry.value.start()
} else {
if (entry.key == lastPos) {
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_playtime_click",
data[lastPos].confideId ?: "",
if (data[lastPos].isVideo) "1" else "2",
(entry.value.currentPosition / 1000F).toString()
)
}
entry.value.seekTo(0)
entry.value.pause()
}
......
......@@ -577,6 +577,7 @@ class ExpertSearchAdapter(
doctor.id ?: ""
)
}
onExpertClick?.onExpertClick()
//判断是否已登录
if (!ConsultantIn.getUserImpl().loginByOneKeyLogin(context, true)) {
return@setOnClickListener
......
......@@ -11,6 +11,7 @@ import android.os.Build;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.ydl.ydlcommon.utils.DeviceTool;
import com.ydl.ydlcommon.utils.log.AliYunLogConfig;
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper;
import com.yidianling.avchatkit.common.log.LogUtil;
......@@ -543,6 +544,9 @@ public class NetworkUtil {
*/
public static String getActiveMacAddress(Context context) {
if (!DeviceTool.checkHasAgreeSecret()) {
return "";
}
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo info = wifi.getConnectionInfo();
......
......@@ -8,8 +8,6 @@ import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore;
import androidx.viewpager.widget.PagerAdapter;
import androidx.core.view.ViewCompat;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
......@@ -17,6 +15,9 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.core.view.ViewCompat;
import androidx.viewpager.widget.PagerAdapter;
import com.bumptech.glide.Glide;
import com.luck.picture.lib.photoview.PhotoView;
import com.netease.nimlib.sdk.AbortableFuture;
......@@ -31,6 +32,7 @@ import com.netease.nimlib.sdk.msg.constant.AttachStatusEnum;
import com.netease.nimlib.sdk.msg.constant.MsgDirectionEnum;
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.ydlcommon.app.Apm;
import com.yidianling.im.R;
import com.yidianling.nimbase.common.ToastHelper;
import com.yidianling.nimbase.common.activity.ToolBarOptions;
......@@ -335,6 +337,22 @@ public class WatchMessagePictureActivity extends UI {
onDownloadStart(msg);
message = msg; // 下载成功之后,判断是否是同一条消息时需要使用
downloadFuture = NIMClient.getService(MsgService.class).downloadAttachment(msg, false);
downloadFuture.setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void o) {
}
@Override
public void onFailed(int i) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", new Exception(String.valueOf(i)));
}
@Override
public void onException(Throwable throwable) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", throwable);
}
});
}
private boolean isOriginImageHasDownloaded(final IMMessage message) {
......
......@@ -10,7 +10,6 @@ import android.media.MediaPlayer.OnPreparedListener;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.ActionBar;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.SurfaceHolder;
......@@ -23,21 +22,25 @@ import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
import com.netease.nimlib.sdk.AbortableFuture;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.RequestCallback;
import com.netease.nimlib.sdk.msg.MsgService;
import com.netease.nimlib.sdk.msg.MsgServiceObserve;
import com.netease.nimlib.sdk.msg.attachment.VideoAttachment;
import com.netease.nimlib.sdk.msg.constant.AttachStatusEnum;
import com.netease.nimlib.sdk.msg.model.AttachmentProgress;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.ydlcommon.app.Apm;
import com.yidianling.im.R;
import com.yidianling.nimbase.common.ToastHelper;
import com.yidianling.nimbase.common.activity.ToolBarOptions;
import com.yidianling.nimbase.common.activity.UI;
import com.yidianling.nimbase.common.util.file.FileUtil;
import com.yidianling.nimbase.common.util.sys.TimeUtil;
import com.yidianling.im.R;
import com.yidianling.uikit.custom.config.YDLToolBarOptions;
/**
......@@ -499,6 +502,21 @@ public class WatchVideoActivity extends UI implements Callback {
// async download original image
onDownloadStart(message);
downloadFuture = NIMClient.getService(MsgService.class).downloadAttachment(message, false);
downloadFuture.setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void o) {
}
@Override
public void onFailed(int i) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", new Exception(String.valueOf(i)));
}
@Override
public void onException(Throwable throwable) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", throwable);
}
});
downloading = true;
}
}
......
......@@ -4,13 +4,9 @@ import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
......@@ -30,7 +26,6 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.blankj.utilcode.util.SPUtils;
import com.google.gson.Gson;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer;
......@@ -49,28 +44,20 @@ import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.base.config.HttpConfig;
import com.ydl.ydlcommon.data.PlatformDataManager;
import com.ydl.ydlcommon.app.Apm;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.ydl.ydlcommon.ui.LoadingDialogFragment;
import com.ydl.ydlcommon.utils.AnimUtils;
import com.ydl.ydlcommon.utils.LogUtil;
import com.ydl.ydlcommon.utils.NetworkParamsUtils;
import com.ydl.ydlcommon.utils.SharedPreferencesEditor;
import com.ydl.ydlcommon.utils.YdlBuryPointUtil;
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils;
import com.ydl.ydlcommon.utils.log.AliYunLogConfig;
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper;
import com.ydl.ydlcommon.utils.log.LogHelper;
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils;
import com.ydl.ydlcommon.view.CircleImageView;
import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.ydl.ydlcommon.view.dialog.ListDialog;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.bean.RemoveHistory;
import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.event.CloseBottomWebviewEvent;
import com.yidianling.im.event.MultipleAnswerBean;
import com.yidianling.im.event.MultipleSelectedEvent;
......@@ -97,7 +84,6 @@ import com.yidianling.uikit.api.NimUIKitImpl;
import com.yidianling.uikit.business.ait.AitManager;
import com.yidianling.uikit.business.session.activity.YDLBaseMessageActivity;
import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper;
import com.yidianling.uikit.business.session.helper.MessageListPanelHelper;
import com.yidianling.uikit.business.session.module.input.InputPanel;
import com.yidianling.uikit.business.session.module.list.MessageListPanelEx;
import com.yidianling.uikit.business.session.view.ChatPrivateTips;
......@@ -1336,6 +1322,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
public void onFailed(int code) {
if (msg != null) {
sendFailWithBlackList(code, msg);
Apm.INSTANCE.reportCustom("yx_sendmessage_error", "sessionId:" + msg.getSessionId(), new Exception(String.valueOf(code)));
}
}
......
......@@ -7,14 +7,15 @@ import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Handler;
import android.provider.MediaStore;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import android.view.View;
import android.widget.ImageView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.NIMSDK;
import com.netease.nimlib.sdk.Observer;
......@@ -40,6 +41,7 @@ import com.netease.nimlib.sdk.msg.model.TeamMessageReceipt;
import com.netease.nimlib.sdk.robot.model.RobotAttachment;
import com.netease.nimlib.sdk.team.constant.TeamMemberType;
import com.netease.nimlib.sdk.team.model.TeamMember;
import com.ydl.ydlcommon.app.Apm;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.session.extension.CustomAttachLingxiWhichQuestion;
......@@ -838,7 +840,23 @@ public class MessageListPanelEx {
public void doOkAction() {
// 正常情况收到消息后附件会自动下载。如果下载失败,可调用该接口重新下载
if (message.getAttachment() != null && message.getAttachment() instanceof FileAttachment)
NIMClient.getService(MsgService.class).downloadAttachment(message, true);
NIMClient.getService(MsgService.class).downloadAttachment(message, true)
.setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void o) {
}
@Override
public void onFailed(int i) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", new Exception(String.valueOf(i)));
}
@Override
public void onException(Throwable throwable) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", throwable);
}
});
}
};
......@@ -1145,6 +1163,8 @@ public class MessageListPanelEx {
@Override
public void onFailed(int code) {
String sessionId = item.getSessionId();
Apm.INSTANCE.reportCustom("yx_revoke_error", "sessionId:" + sessionId, new Exception(String.valueOf(code)));
if (code == ResponseCode.RES_OVERDUE) {
ToastHelper.showToast(container.activity, R.string.im_revoke_failed);
} else {
......
......@@ -10,18 +10,20 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.RequestCallback;
import com.netease.nimlib.sdk.msg.MsgService;
import com.netease.nimlib.sdk.msg.attachment.AudioAttachment;
import com.netease.nimlib.sdk.msg.constant.AttachStatusEnum;
import com.netease.nimlib.sdk.msg.constant.MsgDirectionEnum;
import com.netease.nimlib.sdk.msg.constant.MsgStatusEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.ydlcommon.app.Apm;
import com.yidianling.im.R;
import com.yidianling.nimbase.business.session.audio.MessageAudioControl;
import com.yidianling.nimbase.common.media.audioplayer.Playable;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.nimbase.common.util.sys.ScreenUtil;
import com.yidianling.nimbase.common.util.sys.TimeUtil;
import com.yidianling.im.R;
import com.yidianling.uikit.api.NimUIKitImpl;
/**
......@@ -71,7 +73,24 @@ public class MsgViewHolderAudio extends MsgViewHolderBase {
if (audioControl != null) {
if (message.getDirect() == MsgDirectionEnum.In && message.getAttachStatus() != AttachStatusEnum.transferred) {
if (message.getAttachStatus() == AttachStatusEnum.fail || message.getAttachStatus() == AttachStatusEnum.def) {
NIMClient.getService(MsgService.class).downloadAttachment(message, false);
NIMClient.getService(MsgService.class).downloadAttachment(message, false)
.setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void o) {
}
@Override
public void onFailed(int i) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", new Exception(String.valueOf(i)));
}
@Override
public void onException(Throwable throwable) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", throwable);
}
});
}
return;
}
......
......@@ -13,12 +13,14 @@ import android.widget.TextView;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.NIMSDK;
import com.netease.nimlib.sdk.RequestCallback;
import com.netease.nimlib.sdk.msg.MsgService;
import com.netease.nimlib.sdk.msg.attachment.FileAttachment;
import com.netease.nimlib.sdk.msg.constant.MsgDirectionEnum;
import com.netease.nimlib.sdk.msg.constant.MsgStatusEnum;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.ydlcommon.app.Apm;
import com.yidianling.im.R;
import com.yidianling.nimbase.common.ui.imageview.HeadImageView;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
......@@ -140,7 +142,23 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem
*/
protected void downloadAttachment() {
if (message.getAttachment() != null && message.getAttachment() instanceof FileAttachment)
NIMClient.getService(MsgService.class).downloadAttachment(message, true);
NIMClient.getService(MsgService.class).downloadAttachment(message, true)
.setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void o) {
}
@Override
public void onFailed(int i) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", new Exception(String.valueOf(i)));
}
@Override
public void onException(Throwable throwable) {
Apm.INSTANCE.reportCustom("yx_attchment_error", "", throwable);
}
});
}
// 设置FrameLayout子控件的gravity参数
......
......@@ -45,7 +45,7 @@ class MediaPlayerManager private constructor() {
mTime = time
}
fun setAudioPath(path: String,isLoop:Boolean = false){
fun setAudioPath(path: String){
val attrs = AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
......@@ -60,9 +60,6 @@ class MediaPlayerManager private constructor() {
mMediaPlayer?.prepareAsync()
mMediaPlayer?.setOnPreparedListener {
listener?.onPrepared(it)
if (isLoop){
mMediaPlayer?.seekTo(0)
}
}
}
......
......@@ -28,7 +28,7 @@ class MediaPlayerTimeUtil {
"$minute:$second"
}
}
}else if (time in 1..59){
}else if (time in 0..59){
second = time
return if (second in 0..9){
"00:0$second"
......
......@@ -13,7 +13,4 @@ public class StatusUtils {
// 是否第一次启动App
public static boolean isFirstStartApp = false;
// 是否使用openInstall
public static boolean isUseOpenInstall = false;
}
......@@ -5,7 +5,6 @@ import android.content.Intent
import android.text.TextUtils
import android.util.Log
import android.view.View
import com.fm.openinstall.OpenInstall
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.data.http.RxUtils
......@@ -32,7 +31,6 @@ import com.yidianling.user.route.UserIn
import com.yidianling.user.safePrivate.FingerPrintCheckActivity
import com.yidianling.user.safePrivate.FingerPrintUtil
import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import com.yidianling.user.ui.login.OneKeyLoginHelp
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
......@@ -187,22 +185,11 @@ class SmsLoginActivity : BaseActivity() {
* 注册流程成功之后,进行百度监测 注册埋点
*/
fun baiduActionBury() {
if (OneKeyLoginHelp.openInstallKey.isNotEmpty() && StatusUtils.isUseOpenInstall) {
ActionCountUtils.baiduCount(
UserBIConstants.APP_REGISTER_PAGE,
UserBIConstants.POSITION_CODE_REGISTER_CLICK,
25,
OneKeyLoginHelp.openInstallKey
)
// 用户注册成功后调用
OpenInstall.reportRegister();
} else {
ActionCountUtils.baiduCount(
UserBIConstants.APP_REGISTER_PAGE,
UserBIConstants.POSITION_CODE_REGISTER_CLICK,
25
)
}
ActionCountUtils.baiduCount(
UserBIConstants.APP_REGISTER_PAGE,
UserBIConstants.POSITION_CODE_REGISTER_CLICK,
25
)
}
//关闭手势解锁页面与指纹解锁页面
......
......@@ -11,7 +11,6 @@ import android.text.method.HideReturnsTransformationMethod
import android.text.method.PasswordTransformationMethod
import android.view.View
import android.view.animation.AnimationUtils
import com.fm.openinstall.OpenInstall
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.StatusBarUtils
......@@ -21,7 +20,6 @@ import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.R
import com.yidianling.user.StatusUtils
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.ui.login.contract.IInputPassWordContract
import com.yidianling.user.ui.login.presenter.InputPassWordPresenterImpl
......@@ -152,17 +150,6 @@ class InputPassWordActivity : BaseMvpActivity<IInputPassWordContract.View,IInput
UserBIConstants.POSITION_PHONE_REGISTER_CLICK,
25
)
if (OneKeyLoginHelp.openInstallKey.isNotEmpty() && StatusUtils.isUseOpenInstall) {
ActionCountUtils.baiduCount(
UserBIConstants.APP_REGISTER_PAGE,
UserBIConstants.POSITION_PHONE_REGISTER_CLICK,
25,
OneKeyLoginHelp.openInstallKey
)
// 用户注册成功后调用
OpenInstall.reportRegister();
}
}
......
......@@ -12,10 +12,7 @@ import android.view.View
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import com.fm.openinstall.OpenInstall
import com.fm.openinstall.listener.AppInstallAdapter
import com.fm.openinstall.model.AppData
import com.meituan.android.walle.WalleChannelReader
import com.blankj.utilcode.util.ToastUtils
import com.mobile.auth.gatewayauth.*
import com.mobile.auth.gatewayauth.model.TokenRet
import com.ydl.ydlcommon.base.BaseActivity
......@@ -32,6 +29,7 @@ import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.R
import com.yidianling.user.StatusUtils
import com.yidianling.user.UserHelper
import com.yidianling.user.api.bean.UserResponseBean
......@@ -71,7 +69,6 @@ object OneKeyLoginHelp {
private var checkBoxHidden = false // 协议勾选框是否展示m-user
var mPrivacyBeforeText = "登录即代表您同意" // 隐私协议文案
private lateinit var mActivity: BaseActivity
var openInstallKey = ""
fun sdkInit(activity: BaseActivity, appType: Int, authType: Int) {
mActivity = activity
......@@ -107,9 +104,6 @@ object OneKeyLoginHelp {
if (!checkBoxHidden) {
mPrivacyBeforeText = "同意"
}
if (appType == YDL_USER_APP) {
getOpenInstallKey()
}
}
/**
......@@ -306,7 +300,8 @@ object OneKeyLoginHelp {
var loginLogo = "ic_ydl_login_logo"
var loginHeight = 40
var loginWidth = 118
var appPrivacyOneTip = "壹点灵用户使用协议"
val appName= mActivity.resources.getString(R.string.user_login_name_start)
var appPrivacyOneTip = "${appName}用户使用协议"
var appPrivacyOne = "https://h5.ydl.com/SDUserProtol"
var appPrivacyTwo = "https://m.ydl.com/Protol/yinsi"
if (mAppType == YDL_EXPERT_APP) {
......@@ -483,12 +478,8 @@ object OneKeyLoginHelp {
"",
"",
25,
openInstallKey
""
)
if (OneKeyLoginHelp.openInstallKey.isNotEmpty() && StatusUtils.isUseOpenInstall) {
// 用户注册成功后调用
OpenInstall.reportRegister()
}
} else {
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
......@@ -545,6 +536,7 @@ object OneKeyLoginHelp {
// }
}
else -> { // 其它失败原因
ToastUtils.showShort("您的网络环境较差,请输入手机号码进行登录。")
mPhoneNumberAuthHelper?.hideLoginLoading()
// 跳转到原生登录界面
mActivity.runOnUiThread {
......@@ -595,21 +587,6 @@ object OneKeyLoginHelp {
}
/**
* CPA(CPS)推广渠道统计
* 获取安装携带的参数
* 注:1、不要在 init 之后,紧接着调用 getInstall,防止网络等问题导致 getInstall 超时,从而获取数据失败
*/
private fun getOpenInstallKey() {
OpenInstall.getInstall(object : AppInstallAdapter() {
override fun onInstall(appData: AppData) {
// 获取渠道数据 转换值同步IOS "AppData{channel='" + this.channel + '\'' + ", data='" + this.data + '\'' + '}'
openInstallKey =
appData.toString().replace("AppData", "").replace("channel", "channelCode")
}
})
}
/**
* @param isOpenDialog true: 使用弹窗展示一键登录
* false: 使用全页面展示一键登录
* @return true:登录。false:未登录
......
......@@ -13,7 +13,6 @@ import android.view.View
import android.view.animation.AnimationUtils
import androidx.core.content.ContextCompat
import com.alibaba.android.arouter.facade.annotation.Route
import com.fm.openinstall.OpenInstall
import com.meituan.android.walle.WalleChannelReader
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper
import com.mobile.auth.gatewayauth.ResultCode
......@@ -56,8 +55,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.user_activity_register_and_login_bottom.*
import kotlinx.android.synthetic.main.user_activity_register_and_login_new.*
import kotlinx.android.synthetic.main.user_activity_register_and_login_new.img_reg_back
import kotlinx.android.synthetic.main.user_activity_register_and_login_new.view_lin
/**
* @author jiucheng
......@@ -160,12 +157,8 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
"",
"",
25,
OneKeyLoginHelp.openInstallKey
""
)
if (OneKeyLoginHelp.openInstallKey.isNotEmpty() && StatusUtils.isUseOpenInstall) {
// 用户注册成功后调用
OpenInstall.reportRegister();
}
}
......@@ -198,7 +191,9 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
}
private fun initView() {
val str = "壹点灵用户使用协议、隐私保护政策"
val name = resources.getString(R.string.user_login_name_start)
val str = "${name}用户使用协议、隐私保护政策"
var start = name.length
val spannableString = SpannableString(str)
spannableString.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
......@@ -217,7 +212,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
)
}
}
}, 3, 9, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
}, start, start+6, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
spannableString.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
......@@ -235,7 +230,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
)
}
}
}, 10, str.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
}, start + 7, str.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
tv_protocol.text = spannableString
tv_protocol.movementMethod = LinkMovementMethod.getInstance()
......@@ -494,21 +489,6 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
}
/**
* 三方登录成功后绑定手机号
*/
private fun umengLoginBindPhone(accessCode: String?) {
val param = BindPhoneJavaParam(
accessCode!!,
countryCode!!,
userPhoneNumber!!,
"",
UserHelper.getUserInfo()!!.uid!!
)
mPresenter.bindPhone(param)
}
/**
* 动画
*/
private fun startAnim() {
......
......@@ -6,13 +6,12 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import androidx.core.content.ContextCompat
import android.text.TextUtils
import android.view.View
import android.view.animation.AnimationUtils
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import com.fm.openinstall.OpenInstall
import androidx.core.content.ContextCompat
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.StatusBarUtils
......@@ -22,7 +21,6 @@ import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.R
import com.yidianling.user.StatusUtils
import com.yidianling.user.UserHelper
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.request.BindPhoneJavaParam
......@@ -271,22 +269,11 @@ class VerificationCodeActivity :
override fun baiduActionBury() {
if (StatusUtils.isUseOpenInstall) {
ActionCountUtils.baiduCount(
UserBIConstants.APP_REGISTER_PAGE,
UserBIConstants.POSITION_CODE_REGISTER_CLICK,
25,
OneKeyLoginHelp.openInstallKey
)
// 用户注册成功后调用
OpenInstall.reportRegister();
} else {
ActionCountUtils.baiduCount(
UserBIConstants.APP_REGISTER_PAGE,
UserBIConstants.POSITION_CODE_REGISTER_CLICK,
25
)
}
ActionCountUtils.baiduCount(
UserBIConstants.APP_REGISTER_PAGE,
UserBIConstants.POSITION_CODE_REGISTER_CLICK,
25
)
}
override fun verificationErrorCode() {
......
......@@ -3,7 +3,6 @@ package com.yidianling.user.ui.login.presenter
import android.annotation.SuppressLint
import android.app.Activity
import android.text.TextUtils
import com.fm.openinstall.OpenInstall
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonOut
......@@ -230,7 +229,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
"",
"",
25,
OneKeyLoginHelp.openInstallKey
""
)
} else {
mView.baiduActionBury(
......@@ -244,11 +243,9 @@ class LoginPresenterImpl(view: ILoginContract.View) :
"",
"",
25,
OneKeyLoginHelp.openInstallKey
""
)
}
// 用户注册成功后调用
OpenInstall.reportRegister()
} else {
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
......
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ResourceName">
<string name="user_login_name_start">心理咨询</string>
</resources>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ResourceName">
<string name="user_login_name_start">壹点灵</string>
</resources>
package com.ydl.ydlcommon.app
import android.content.Context
import com.apm.insight.MonitorCrash
import com.apm.insight.log.VLog
import com.bytedance.apm.insight.ApmInsight
import com.bytedance.apm.insight.ApmInsightInitConfig
import com.bytedance.apm.insight.IDynamicParams
import com.meituan.android.walle.WalleChannelReader
object Apm {
private var crash: MonitorCrash? = null
fun initApm(context: Context, appId: String, vCode: Long, vName: String, debug: Boolean, uidCall: () -> String?) {
val channel = if (debug) "debug" else WalleChannelReader.getChannel(context)
crash = MonitorCrash.init(
context,
appId,
vCode,
vName
)
crash?.config()?.setChannel(channel)
val builder = ApmInsightInitConfig.builder()
.aid(appId)
//.batteryMonitor(true)
//.cpuMonitor(true)
//.fpsMonitor(true)
//.seriousBlockDetect(true)
.blockDetect(true)
// .enableWebViewMonitor(true)
.channel(channel)
.debugMode(debug)
.enableLogRecovery(true)
.setDynamicParams(ApmParams(crash, uidCall))
ApmInsight.getInstance().init(context, builder.build())
VLog.init(context, 20)
}
fun reportCustom(type: String, msg: String, throwable: Throwable) {
crash?.reportCustomErr(msg, type, throwable)
}
}
private class ApmParams(val crash: MonitorCrash?, val uidCall: () -> String?) : IDynamicParams() {
override fun getUserUniqueID(): String? {
return null
}
override fun getAbSdkVersion(): String? {
return null
}
override fun getSsid(): String? {
return null
}
override fun getDid(): String? {
return null
}
override fun getUserId(): String? {
val uid = uidCall.invoke()
crash?.config()?.setUID(uid)
return uid
}
}
\ No newline at end of file
......@@ -4,7 +4,9 @@ import android.annotation.SuppressLint
import android.content.Context
import android.text.TextUtils
import com.facebook.stetho.okhttp3.StethoInterceptor
import com.google.gson.Gson
import com.ydl.pushserver.pushagent.YdlPushAgent
import com.ydl.ydlcommon.app.Apm
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.bean.AuthBean
import com.ydl.ydlcommon.bean.GatewayRequestDTO
......@@ -15,6 +17,7 @@ import com.ydl.ydlcommon.data.http.GsonProvider
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.api.ApiRequestUtil
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
......@@ -23,7 +26,6 @@ import com.ydl.ydlnet.builder.config.OkHttpConfig
import com.ydl.ydlnet.builder.factory.ApiFactory
import com.ydl.ydlnet.builder.interceptor.log.RequestHandler
import com.ydl.ydlnet.builder.interceptor.log.RequestLogInterceptor
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.ToastUtil
......@@ -31,6 +33,8 @@ import io.reactivex.functions.Action
import okhttp3.*
import okio.Buffer
import okio.BufferedSink
import java.io.EOFException
import java.nio.charset.Charset
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
......@@ -141,7 +145,8 @@ class HttpConfig {
commonParams(),
requestHead(appName),
addEncryptionHeaderParamsInterceptor(),
responseErrorInterceptor()
responseErrorInterceptor(),
respErrorInterceptor()
)
.setRequestHandler(getRequestHandler())
.setReadTimeout(15)
......@@ -183,6 +188,53 @@ class HttpConfig {
}
}
private fun respErrorInterceptor(): Interceptor {
return Interceptor {
val req = it.request()
val resp = it.proceed(req)
if (appDebug) return@Interceptor resp
val code = resp.code()
val message = resp.message()
val api = req.url().encodedPath()
if (!resp.isSuccessful) {
Apm.reportCustom("network_request_error", "${api}(${code},${message})", Exception("${api}(${code},${message})"))
} else {
try {
val body = resp.body() ?: return@Interceptor resp
val buffer = body.source().buffer()
if(!isPlaintext(buffer)) return@Interceptor resp
val readString = buffer.clone().readString(Charset.forName("UTF-8"))
val fromJson = Gson().fromJson<BaseAPIResponse<Any>>(readString, BaseAPIResponse::class.java)
if (fromJson.code != "200") {
Apm.reportCustom("network_business_error", "${api}(${fromJson.code},${fromJson.msg})", Exception("${api}(${fromJson.code},${fromJson.msg})"))
}
} catch (throwable: Throwable) {
LogUtil.e(throwable.message)
}
}
return@Interceptor resp
}
}
private fun isPlaintext(buffer: Buffer): Boolean {
return try {
val prefix = Buffer()
val byteCount = if (buffer.size() < 64L) buffer.size() else 64L
buffer.copyTo(prefix, 0L, byteCount)
var i = 0
while (i < 16 && !prefix.exhausted()) {
val codePoint = prefix.readUtf8CodePoint()
if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) {
return false
}
++i
}
true
} catch (var6: EOFException) {
false
}
}
/**
* 接口返回错误日志埋点
*/
......
......@@ -122,7 +122,9 @@ public class DeviceTool {
@SuppressLint("MissingPermission")
public static final String getIMEI() {
Activity topTaskActivity = ActivityManager.Companion.getInstance().getTopTaskActivity();
if (!checkHasAgreeSecret()) {
return "";
}
try {
String imei = "";
RxPermissions rxPermissions = new RxPermissions(topTaskActivity);
......@@ -147,9 +149,19 @@ public class DeviceTool {
}
}
/**
* 检查是否同意隐私协议
* */
public static boolean checkHasAgreeSecret() {
String hasAgreeSecret = SharedPreferencesEditor.getString("hasAgreeSecret");
return "true".equals(hasAgreeSecret);
}
public static String getEncryptionAndroidID() {
if (!checkHasAgreeSecret()) {
return "";
}
try {
@SuppressLint("HardwareIds") String id = Settings.Secure.getString(
RxTool.getContext().getContentResolver(),
......@@ -161,6 +173,9 @@ public class DeviceTool {
}
}
public static String getAndroidID() {
if (!checkHasAgreeSecret()) {
return "";
}
try {
@SuppressLint("HardwareIds") String id = Settings.Secure.getString(
RxTool.getContext().getContentResolver(),
......@@ -251,7 +266,9 @@ public class DeviceTool {
}
public static String getMac(Context context) {
if (!checkHasAgreeSecret()) {
return "02:00:00:00:00:00";
}
String strMac = null;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
......@@ -281,6 +298,9 @@ public class DeviceTool {
*GPRS链接和WIFI链接返回同一个MAC地址
* */
public static String getMacFromHardware() {
if (!checkHasAgreeSecret()) {
return "02:00:00:00:00:00";
}
try {
List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface nif : all) {
......@@ -328,6 +348,9 @@ public class DeviceTool {
* @return
*/
public static String getLocalWifiIpAddress(Context context) {
if (!checkHasAgreeSecret()) {
return "隐私协议未同意,不让获取";
}
try {
WifiManager wifiManager = (WifiManager) context
......@@ -343,6 +366,9 @@ public class DeviceTool {
//GPRS连接下的ip
public static String getLocalGPRSIpAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
NetworkInterface intf = en.nextElement();
......@@ -364,6 +390,9 @@ public class DeviceTool {
* @return
*/
public static String getNewMac() {
if (!checkHasAgreeSecret()) {
return null;
}
try {
List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface nif : all) {
......@@ -390,6 +419,9 @@ public class DeviceTool {
return null;
}
public static String getLocalMacAddressFromWifiInfo(Context context) {
if (!checkHasAgreeSecret()) {
return null;
}
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo winfo = wifi.getConnectionInfo();
String mac = winfo.getMacAddress();
......@@ -400,6 +432,9 @@ public class DeviceTool {
* 获取IPV6地址
* */
public static String getLocalIpV6() {
if (!checkHasAgreeSecret()) {
return null;
}
try {
for (Enumeration<NetworkInterface> en = NetworkInterface
.getNetworkInterfaces(); en.hasMoreElements(); ) {
......@@ -425,7 +460,9 @@ public class DeviceTool {
return null;
}
public static String getMacAddress(Context context) {
if (!checkHasAgreeSecret()) {
return null;
}
// 如果是6.0以下,直接通过wifimanager获取
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
String macAddress0 = getMacAddress0(context);
......@@ -465,6 +502,10 @@ public class DeviceTool {
}
private static String getMacAddress0(Context context) {
if (!checkHasAgreeSecret()) {
return null;
}
if (isAccessWifiStateAuthorized(context)) {
WifiManager wifiMgr = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
......@@ -494,8 +535,9 @@ public class DeviceTool {
Log.e("----->" + "NetInfoManager", "isAccessWifiStateAuthorized:"
+ "access wifi state is enabled");
return true;
} else
} else {
return false;
}
}
private static String loadFileAsString(String fileName) throws Exception {
......@@ -522,6 +564,9 @@ public class DeviceTool {
* @return
*/
public static String getMacAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
String strMacAddr = null;
try {
// 获得IpD地址
......@@ -547,6 +592,9 @@ public class DeviceTool {
* @return
*/
private static InetAddress getLocalInetAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
InetAddress ip = null;
try {
// 列举
......@@ -582,6 +630,9 @@ public class DeviceTool {
* @return
*/
public static String getLocalIpAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
try {
for (Enumeration<NetworkInterface> en = NetworkInterface
.getNetworkInterfaces(); en.hasMoreElements(); ) {
......@@ -601,6 +652,9 @@ public class DeviceTool {
}
public static String getMachineHardwareAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
Enumeration<NetworkInterface> interfaces = null;
try {
interfaces = NetworkInterface.getNetworkInterfaces();
......@@ -646,6 +700,9 @@ public class DeviceTool {
}
public static String getLocalMacAddressFromBusybox() {
if (!checkHasAgreeSecret()) {
return "";
}
String result = "";
String Mac = "";
result = callCmd("busybox ifconfig", "HWaddr");
......
......@@ -434,6 +434,10 @@ class ActionCountUtils {
* @return
*/
fun getIpAddress(context: Context): String {
if (!DeviceTool.checkHasAgreeSecret()) {
return ""
}
// 获取WiFi服务
val wifiManager = context.getSystemService(Context.WIFI_SERVICE) as WifiManager
// 判断WiFi是否开启
......
......@@ -3,7 +3,6 @@ package com.ydl.webview;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
......@@ -35,7 +34,6 @@ import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.ydl.event.ReloadUrlEvent;
import com.ydl.utils.PopUtils;
import com.ydl.utils.ProxyCheckUtils;
import com.ydl.utils.WebUrlParamsUtils;
......@@ -534,7 +532,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
public void openShareMenu(H5JsBean.H5JsCmd.Params params) {
if (params.getShare() != null) {
if (params.getShare().getType().equals("Meditation")){
if ("Meditation".equals(params.getShare().getType())){
shareUrl = params.getShare().getShare_url();
shareTitle = params.getShare().getTitle();
shareDesc = params.getShare().getDesc();
......@@ -1388,7 +1386,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
super.onDestroy();
cancelSendNetLossMessage();
EventBus.getDefault().unregister(this);
super.onDestroy();
if (wv_content != null) {
wv_content.destroy();
}
......
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