徐勤民 3 dienas atpakaļ
vecāks
revīzija
a0addf7935

+ 10 - 0
.idea/deploymentTargetSelector.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="deploymentTargetSelector">
+    <selectionStates>
+      <SelectionState runConfigName="app">
+        <option name="selectionMode" value="DROPDOWN" />
+      </SelectionState>
+    </selectionStates>
+  </component>
+</project>

+ 2 - 0
.idea/gradle.xml

@@ -4,6 +4,7 @@
   <component name="GradleSettings">
     <option name="linkedExternalProjectsSettings">
       <GradleProjectSettings>
+        <option name="testRunner" value="CHOOSE_PER_TEST" />
         <option name="externalProjectPath" value="$PROJECT_DIR$" />
         <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
         <option name="modules">
@@ -17,5 +18,6 @@
         <option name="resolveExternalAnnotations" value="false" />
       </GradleProjectSettings>
     </option>
+    <option name="parallelModelFetch" value="true" />
   </component>
 </project>

+ 2 - 2
.idea/misc.xml

@@ -1,6 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="ExternalStorageConfigurationManager" enabled="true" />
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build/classes" />
   </component>
   <component name="ProjectType">

+ 17 - 0
.idea/runConfigurations.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RunConfigurationProducerService">
+    <option name="ignoredProducers">
+      <set>
+        <option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
+        <option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
+        <option value="com.intellij.execution.junit.PatternConfigurationProducer" />
+        <option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
+        <option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
+        <option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
+        <option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
+        <option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
+      </set>
+    </option>
+  </component>
+</project>

+ 7 - 7
SzyxImSdk/build.gradle

@@ -36,15 +36,15 @@ android {
 
 dependencies {
 
-    implementation 'androidx.appcompat:appcompat:1.4.2'
-    implementation 'com.google.android.material:material:1.5.0'
+    implementation 'androidx.appcompat:appcompat:1.7.0'
+    implementation 'com.google.android.material:material:1.12.0'
     testImplementation 'junit:junit:4.13.2'
-    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
-    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
+    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
 
     //数据库相关
-    implementation("androidx.room:room-runtime:2.5.0")
-    annotationProcessor ("androidx.room:room-compiler:2.5.0")
+    implementation("androidx.room:room-runtime:2.6.1")
+    annotationProcessor ("androidx.room:room-compiler:2.6.1")
 
     // 网络相关
     //Rxjava
@@ -60,6 +60,6 @@ dependencies {
     implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
 
     //gson
-    implementation 'com.google.code.gson:gson:2.9.0'
+    implementation 'com.google.code.gson:gson:2.10.1'
 
 }

+ 2 - 2
SzyxImSdk/src/main/java/cn/org/bjca/trust/android/lib/im/im/manager/ImManager.java

@@ -305,7 +305,7 @@ public class ImManager implements IMInterface {
 
             @Override
             public void failed(int code, String error) {
-                callback.failed(4001, error);
+                callback.failed(code, error);
             }
         });
 
@@ -402,7 +402,7 @@ public class ImManager implements IMInterface {
                     String msgId3 = (String) msg.obj;
                     RequestImCallback imCallback = requestMap.get(msgId3);
                     if (null != imCallback) {
-                        imCallback.failed(4001, "发送超时");
+                        imCallback.failed(400504, "发送超时");
                         requestMap.remove(msgId3);
                     }
                     break;

+ 25 - 58
SzyxImSdk/src/main/java/cn/org/bjca/trust/android/lib/im/request/RequestManager.java

@@ -13,56 +13,20 @@ import cn.org.bjca.trust.android.lib.im.im.msg.ResultMessage;
 
 public class RequestManager implements RequestInterface {
 
-
     @Override
     public <T> void request(String path, Object data, Class<T> clazz, RequestCallback<T> callback) {
-
-        RequestMessage rm = new RequestMessage(path, GsonImplHelp.get().toJson(data));
-
-        IMHelper.getInstance().request(rm, new RequestImCallback() {
-
-            @Override
-            public void success(ResultMessage message) {
-                Type type = TypeBuilder
-                        .newInstance(HttpResult.class)
-                        .addTypeParam(clazz)
-                        .build();
-                HttpResult<T> h = GsonImplHelp.get().toObject(message.getBody(), type);
-                if (h.getCode() == 200) {
-                    callback.success(h);
-                } else {
-                    callback.failed(h.getCode(), h.getMsg());
-                }
-            }
-
-            @Override
-            public void failed(int code, String error) {
-                if (null != callback) {
-                    callback.standby(new RequestCallback<T>() {
-                        @Override
-                        public void success(HttpResult<T> result) {
-                            callback.success(result);
-                        }
-
-                        @Override
-                        public void failed(int code, String error) {
-                            callback.failed(code, error);
-                        }
-
-                        @Override
-                        public void standby(RequestCallback<T> imCallback) {
-
-                        }
-                    });
-
-                }
-            }
-
-        });
+        performRequest(path, data, clazz, callback);
     }
 
     @Override
     public <T> void requestList(String path, Object data, Class<T> clazz, RequestCallback<List<T>> callback) {
+        performRequest(path, data, TypeBuilder.newInstance(List.class).addTypeParam(clazz).build(), callback);
+    }
+
+    private <T> void performRequest(String path, Object data, Type type, RequestCallback<T> callback) {
+        if (callback == null) {
+            return;
+        }
 
         RequestMessage rm = new RequestMessage(path, GsonImplHelp.get().toJson(data));
 
@@ -70,23 +34,25 @@ public class RequestManager implements RequestInterface {
 
             @Override
             public void success(ResultMessage message) {
-                Type type = TypeBuilder
-                        .newInstance(HttpResult.class)
-                        .beginSubType(List.class)
-                        .addTypeParam(clazz)
-                        .endSubType()
-                        .build();
-                HttpResult<List<T>> h = GsonImplHelp.get().toObject(message.getBody(), type);
-                if (h.getCode() == 200) {
-                    callback.success(h);
-                } else {
-                    callback.failed(h.getCode(), h.getMsg());
+                try {
+                    if (message == null || message.getBody() == null) {
+                        callback.failed(-1, "Empty response");
+                        return;
+                    }
+                    HttpResult<T> h = GsonImplHelp.get().toObject(message.getBody(), TypeBuilder.newInstance(HttpResult.class).addTypeParam(type).build());
+                    if (h == null || h.getCode() != 200) {
+                        callback.failed(h != null ? h.getCode() : -1, h != null ? h.getMsg() : "Unknown error");
+                    } else {
+                        callback.success(h);
+                    }
+                } catch (Exception e) {
+                    callback.failed(-1, "Error parsing response: " + e.getMessage());
                 }
             }
 
             @Override
             public void failed(int code, String error) {
-                if (null != callback) {
+                if (code == 400504) {
                     callback.standby(new RequestCallback<List<T>>() {
                         @Override
                         public void success(HttpResult<List<T>> result) {
@@ -103,10 +69,11 @@ public class RequestManager implements RequestInterface {
 
                         }
                     });
-
+                } else {
+                    callback.failed(code, error);
                 }
             }
-
         });
     }
+
 }

+ 3 - 3
gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
-#Tue May 16 10:36:25 CST 2023
+#Thu Jan 09 14:11:49 CST 2025
 distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
 distributionPath=wrapper/dists
-zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
 zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists