From 1bd1be4c39e363ffa6197287c0346570cd384667 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Thu, 1 Jun 2023 14:12:29 +0800 Subject: [PATCH] fix bug of init httpdnsclient --- .../com/mogo/cloud/socket/SocketManager.java | 19 ++++++++-------- gradle.properties | 22 +++++++++---------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/foudations/mogo-socket/src/main/java/com/mogo/cloud/socket/SocketManager.java b/foudations/mogo-socket/src/main/java/com/mogo/cloud/socket/SocketManager.java index f75cc3b..af0e797 100644 --- a/foudations/mogo-socket/src/main/java/com/mogo/cloud/socket/SocketManager.java +++ b/foudations/mogo-socket/src/main/java/com/mogo/cloud/socket/SocketManager.java @@ -14,7 +14,6 @@ import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.MessageLiteOrBuilder; import com.mogo.cloud.passport.MoGoAiCloudClient; -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.cloud.socket.entity.MsgBody; import com.mogo.cloud.socket.internal.InternalSocketManager; import com.mogo.cloud.socket.third.ThirdSocketManager; @@ -34,13 +33,10 @@ import java.util.concurrent.ConcurrentHashMap; */ public class SocketManager implements IMogoCloudSocketManager { - private static volatile SocketManager mInstance; - private MoGoAiCloudClientConfig cloudClientConfig; - private static final String TAG = "SocketManager"; + private static volatile SocketManager mInstance; private SocketManager() { - cloudClientConfig = MoGoAiCloudClient.getInstance().getAiCloudClientConfig(); } public static SocketManager getInstance() { @@ -76,7 +72,7 @@ public class SocketManager implements IMogoCloudSocketManager { @Override public void init(Context context, String sn, double lat, double lon) { - if (cloudClientConfig.isThirdLogin()) { + if (check()) { ThirdSocketManager.getInstance().init(context, sn, lat, lon); } else { InternalSocketManager.getInstance().init(context); @@ -85,7 +81,7 @@ public class SocketManager implements IMogoCloudSocketManager { @Override public void reConnect() { - if (cloudClientConfig.isThirdLogin()) { + if (check()) { ThirdSocketManager.getInstance().reConnect(); } } @@ -163,7 +159,7 @@ public class SocketManager implements IMogoCloudSocketManager { } final byte[] pb = convertToPBBytes(body.getMsgType(), body.getContent()); - if (cloudClientConfig.isThirdLogin()) { + if (check()) { ThirdSocketManager.getInstance().sendMsg(appId, pb, headerType, true, body.getMsgId()); } else { InternalSocketManager.getInstance().sendMsg(pb, headerType, true, body.getMsgId()); @@ -275,11 +271,16 @@ public class SocketManager implements IMogoCloudSocketManager { } public synchronized void release() { - if (cloudClientConfig.isThirdLogin()) { + if (check()) { ThirdSocketManager.getInstance().release(); } else { InternalSocketManager.getInstance().release(); } } + private boolean check(){ + return (MoGoAiCloudClient.getInstance().getAiCloudClientConfig()!= null + && MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isThirdLogin()); + } + } diff --git a/gradle.properties b/gradle.properties index 063f34b..73abba0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -36,24 +36,24 @@ PASSWORD=xintai2018 RELEASE=true # AI CLOUD 云平台 # 工具类 -MOGO_UTILS_VERSION=1.4.7.7 +MOGO_UTILS_VERSION=1.4.7.8 # 网络请求 -MOGO_NETWORK_VERSION=1.4.7.7 +MOGO_NETWORK_VERSION=1.4.7.8 # 鉴权 -MOGO_PASSPORT_VERSION=1.4.7.7 +MOGO_PASSPORT_VERSION=1.4.7.8 # 常链接 -MOGO_SOCKET_VERSION=1.4.7.7 +MOGO_SOCKET_VERSION=1.4.7.8 # 数据采集 -MOGO_REALTIME_VERSION=1.4.7.7 +MOGO_REALTIME_VERSION=1.4.7.8 # 探路,道路事件发布,获取 -MOGO_TANLU_VERSION=1.4.7.7 +MOGO_TANLU_VERSION=1.4.7.8 # 直播推流 -MOGO_LIVE_VERSION=1.4.7.7 +MOGO_LIVE_VERSION=1.4.7.8 # 直播拉流 -MOGO_TRAFFICLIVE_VERSION=1.4.7.7 +MOGO_TRAFFICLIVE_VERSION=1.4.7.8 # 定位服务 -MOGO_LOCATION_VERSION=1.4.7.7 +MOGO_LOCATION_VERSION=1.4.7.8 # 远程通讯模块 -MOGO_TELEMATIC_VERSION=1.4.7.7 +MOGO_TELEMATIC_VERSION=1.4.7.8 # v2x -MOGO_V2X_VERSION=1.4.7.7 +MOGO_V2X_VERSION=1.4.7.8