From 62e50ae310fb018deef87cd2f9609a682fdf8404 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Wed, 5 Jun 2024 16:06:04 +0800 Subject: [PATCH] =?UTF-8?q?fix[=E5=A3=B0=E7=BD=91APPId]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/CommonAppConfig.java | 26 +++++++++---------- .../faceunity/agora/SWAuManager.java | 4 +-- .../beautyapi/faceunity/agora/SWManager.java | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java index fb294a2ef..9f78b5fac 100644 --- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java +++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java @@ -80,18 +80,26 @@ public class CommonAppConfig { public static String SWToken = ""; //声网Token public static final String SWChannelPrefix = "g"; //测试服 - //public static final String SWAPPId = "4cf0376582d742ac8a96778b25b1079e"; + public static final String SWAPPId_debug = "4cf0376582d742ac8a96778b25b1079e"; //正式服 public static final String SWAPPId = "d4a5879524d74c20a7bdd667b0f2ca21"; + public static String getSwAppId() { + if (BuildConfig.DEBUG) { + return SWAPPId_debug; + } else { + return SWAPPId; + } + } /** * 获取通道 + * * @return */ public static String getChannelName() { - return SWChannelPrefix+ getInstance().getUid(); + return SWChannelPrefix + getInstance().getUid(); } private CommonAppConfig() { @@ -135,8 +143,7 @@ public class CommonAppConfig { public String getUid() { if (TextUtils.isEmpty(mUid)) { - String[] uidAndToken = SpUtil.getInstance() - .getMultiStringValue(new String[]{SpUtil.UID, SpUtil.TOKEN}); + String[] uidAndToken = SpUtil.getInstance().getMultiStringValue(new String[]{SpUtil.UID, SpUtil.TOKEN}); if (uidAndToken != null) { if (!TextUtils.isEmpty(uidAndToken[0]) && !TextUtils.isEmpty(uidAndToken[1])) { mUid = uidAndToken[0]; @@ -327,9 +334,7 @@ public class CommonAppConfig { mUid = null; mToken = null; mLoginIM = false; - SpUtil.getInstance().removeValue( - SpUtil.UID, SpUtil.TOKEN, SpUtil.USER_INFO, SpUtil.IM_LOGIN - ); + SpUtil.getInstance().removeValue(SpUtil.UID, SpUtil.TOKEN, SpUtil.USER_INFO, SpUtil.IM_LOGIN); } @@ -365,12 +370,7 @@ public class CommonAppConfig { mProvince = null; mCity = null; mDistrict = null; - SpUtil.getInstance().removeValue( - SpUtil.LOCATION_LNG, - SpUtil.LOCATION_LAT, - SpUtil.LOCATION_PROVINCE, - SpUtil.LOCATION_CITY, - SpUtil.LOCATION_DISTRICT); + SpUtil.getInstance().removeValue(SpUtil.LOCATION_LNG, SpUtil.LOCATION_LAT, SpUtil.LOCATION_PROVINCE, SpUtil.LOCATION_CITY, SpUtil.LOCATION_DISTRICT); } diff --git a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWAuManager.java b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWAuManager.java index 3ac3ec00f..f64ea9637 100644 --- a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWAuManager.java +++ b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWAuManager.java @@ -103,7 +103,7 @@ public class SWAuManager extends BaseCacheManager { // 创建 RtcEngineConfig 对象,并进行配置 RtcEngineConfig config = new RtcEngineConfig(); config.mContext = mContext; - config.mAppId = CommonAppConfig.SWAPPId; + config.mAppId = CommonAppConfig.getSwAppId(); config.mEventHandler = mRtcEventHandler; // 创建并初始化 RtcEngine mRtcEngine = (RtcEngineEx) RtcEngineEx.create(config); @@ -125,7 +125,7 @@ public class SWAuManager extends BaseCacheManager { if(mRtcEngine==null){ RtcEngineConfig config = new RtcEngineConfig(); config.mContext = mContext; - config.mAppId = CommonAppConfig.SWAPPId; + config.mAppId = CommonAppConfig.getSwAppId(); config.mEventHandler = mEventHandler; // 创建并初始化 RtcEngine mRtcEngine = (RtcEngineEx) RtcEngineEx.create(config); diff --git a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java index 1dbcc7308..80711372a 100644 --- a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java +++ b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java @@ -95,7 +95,7 @@ public class SWManager extends BaseCacheManager { // 创建 RtcEngineConfig 对象,并进行配置 RtcEngineConfig config = new RtcEngineConfig(); config.mContext = mContext; - config.mAppId = CommonAppConfig.SWAPPId; + config.mAppId = CommonAppConfig.getSwAppId(); config.mEventHandler = mRtcEventHandler; // 创建并初始化 RtcEngine mRtcEngine = (RtcEngineEx) RtcEngineEx.create(config);