fix:新增设置设备方法

This commit is contained in:
SL 2024-12-30 15:55:15 +08:00
parent ea8c1f0443
commit ce1086b471
3 changed files with 20 additions and 7 deletions

View File

@ -1,6 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintUnsafeImplicitIntentLaunch" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,com.wukong.im.db.WKDBHelper,rawQuery" />
</inspection_tool>

View File

@ -18,7 +18,7 @@ import com.xinbida.wukongim.utils.CryptoUtils;
* 5/20/21 5:25 PM
*/
public class WKIM {
private final String Version = "V1.2.3";
private final String Version = "V1.3.3";
private WKIM() {
@ -34,6 +34,7 @@ public class WKIM {
private boolean isDebug = false;
private boolean isWriteLog = false;
private String deviceId = "";
public boolean isDebug() {
return isDebug;
@ -43,6 +44,10 @@ public class WKIM {
return isWriteLog;
}
public String getDeviceID(){
return deviceId;
}
public void setWriteLog(boolean isWriteLog) {
this.isWriteLog = isWriteLog;
}
@ -60,7 +65,9 @@ public class WKIM {
public String getVersion() {
return Version;
}
public void setDeviceId(String deviceID){
this.deviceId = deviceID;
}
/**
* 初始化IM
*

View File

@ -1330,6 +1330,11 @@ public class MsgManager extends BaseManager {
}
public String createClientMsgNO() {
return UUID.randomUUID().toString().replaceAll("-", "") + "1";
String deviceId = WKIM.getInstance().getDeviceID();
if (TextUtils.isEmpty(deviceId)) {
deviceId = "unknown";
}
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
return uuid + "_" + deviceId + "_1";
}
}