diff --git a/.gitignore b/.gitignore
index 047d4a1..d97f301 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,27 @@
-target/
-app/build/
\ No newline at end of file
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+/target/
+/.idea/
+*.class
+*/local.properties
\ No newline at end of file
diff --git a/README.md b/README.md
index bb6cee5..b6e7c14 100644
--- a/README.md
+++ b/README.md
@@ -181,7 +181,7 @@ https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz/edit#nnzKN
com.farsunset
cim-server-sdk-netty
- 4.2.5
+ 4.2.6
```
@@ -189,5 +189,5 @@ https://www.yuque.com/yuanfangxiyang/ma4ytb/vvy3iz/edit#nnzKN
android端sdk引用
```
- implementation "com.farsunset:cim-android-sdk:4.2.8"
+ implementation "com.farsunset:cim-android-sdk:4.2.10"
```
\ No newline at end of file
diff --git a/cim-client-sdk/cim-android-sdk/pom.xml b/cim-client-sdk/cim-android-sdk/pom.xml
index 3934ad1..5de9687 100755
--- a/cim-client-sdk/cim-android-sdk/pom.xml
+++ b/cim-client-sdk/cim-android-sdk/pom.xml
@@ -6,7 +6,7 @@
com.farsunset
cim-android-sdk
- 4.2.9
+ 4.2.10
jar
${project.groupId}:${project.artifactId}
diff --git a/cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/CIMListenerManager.java b/cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/CIMListenerManager.java
index f459f36..2253375 100644
--- a/cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/CIMListenerManager.java
+++ b/cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/CIMListenerManager.java
@@ -22,21 +22,21 @@
package com.farsunset.cim.sdk.android;
import android.net.NetworkInfo;
-import android.util.Log;
import com.farsunset.cim.sdk.android.model.Message;
import com.farsunset.cim.sdk.android.model.ReplyBody;
import com.farsunset.cim.sdk.android.model.SentBody;
+import java.util.Collections;
import java.util.Comparator;
+import java.util.LinkedList;
import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
/**
* CIM 消息监听器管理
*/
public class CIMListenerManager {
- private static final List cimListeners = new CopyOnWriteArrayList<>();
+ private static final List cimListeners = new LinkedList<>();
private static final ReceiveComparator comparator = new ReceiveComparator();
private CIMListenerManager() {
@@ -47,7 +47,7 @@ public class CIMListenerManager {
if (!cimListeners.contains(listener)) {
cimListeners.add(listener);
- cimListeners.sort(comparator);
+ Collections.sort(cimListeners,comparator);
}
}
@@ -56,32 +56,32 @@ public class CIMListenerManager {
}
public static void notifyOnNetworkChanged(NetworkInfo info) {
- for (CIMEventListener cimListener : cimListeners) {
+ for (CIMEventListener cimListener : getListeners()) {
cimListener.onNetworkChanged(info);
}
}
public static void notifyOnConnectFinished(boolean hasAutoBind) {
- for (CIMEventListener cimListener : cimListeners) {
+ for (CIMEventListener cimListener : getListeners()) {
cimListener.onConnectFinished(hasAutoBind);
}
}
public static void notifyOnMessageReceived(Message message) {
- for (CIMEventListener cimListener : cimListeners) {
+ for (CIMEventListener cimListener : getListeners()) {
cimListener.onMessageReceived(message);
}
}
public static void notifyOnConnectionClosed() {
- for (CIMEventListener cimListener : cimListeners) {
+ for (CIMEventListener cimListener : getListeners()) {
cimListener.onConnectionClosed();
}
}
public static void notifyOnConnectFailed() {
- for (CIMEventListener cimListener : cimListeners) {
+ for (CIMEventListener cimListener : getListeners()) {
cimListener.onConnectFailed();
}
@@ -89,14 +89,14 @@ public class CIMListenerManager {
public static void notifyOnReplyReceived(ReplyBody body) {
- for (CIMEventListener cimListener : cimListeners) {
+ for (CIMEventListener cimListener : getListeners()) {
cimListener.onReplyReceived(body);
}
}
public static void notifyOnSendFinished(SentBody body) {
- for (CIMEventListener cimListener : cimListeners) {
+ for (CIMEventListener cimListener : getListeners()) {
cimListener.onSendFinished(body);
}
}
@@ -105,10 +105,8 @@ public class CIMListenerManager {
cimListeners.clear();
}
- public static void logListenersName() {
- for (CIMEventListener cimListener : cimListeners) {
- Log.i(CIMEventListener.class.getSimpleName(), "#######" + cimListener.getClass().getName() + "#######");
- }
+ public static List getListeners() {
+ return new LinkedList<>(cimListeners);
}
/**
diff --git a/cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/CIMPushService.java b/cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/CIMPushService.java
index 1d598a7..c741110 100644
--- a/cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/CIMPushService.java
+++ b/cim-client-sdk/cim-android-sdk/src/main/java/com/farsunset/cim/sdk/android/CIMPushService.java
@@ -271,13 +271,11 @@ public class CIMPushService extends Service {
channel.enableVibration(false);
channel.setSound(null, null);
notificationManager.createNotificationChannel(channel);
-
- Notification notification = makeNotification(TRANSIENT_NTC_CHANNEL_ID,0,CIMPushService.class.getSimpleName(),null);
-
- startForeground(NOTIFICATION_ID, notification);
-
}
+ Notification notification = makeNotification(TRANSIENT_NTC_CHANNEL_ID,0,CIMPushService.class.getSimpleName(),null);
+
+ startForeground(NOTIFICATION_ID, notification);
}
diff --git a/cim-use-examples/cim-client-android/app/build.gradle b/cim-use-examples/cim-client-android/app/build.gradle
index 408bd3b..37664a0 100644
--- a/cim-use-examples/cim-client-android/app/build.gradle
+++ b/cim-use-examples/cim-client-android/app/build.gradle
@@ -1,23 +1,21 @@
-plugins {
- id 'com.android.application'
-}
+apply plugin: 'com.android.application'
android {
- compileSdkVersion 29
- buildToolsVersion "29.0.3"
+ compileSdkVersion 33
+ buildToolsVersion '33.0.0'
defaultConfig {
applicationId "com.farsunset.cim"
minSdkVersion 23
- targetSdkVersion 29
+ targetSdkVersion 33
versionCode 1
versionName "1.0"
/*
CIM服务器
*/
- buildConfigField("String", "CIM_API_URL", '"http://192.168.31.245:8080"')
- buildConfigField("String", "CIM_SERVER_HOST", '"192.168.31.245"')
+ buildConfigField("String", "CIM_API_URL", '"http://192.168.31.175:8080"')
+ buildConfigField("String", "CIM_SERVER_HOST", '"192.168.31.175"')
buildConfigField("Integer", "CIM_SERVER_PORT", '23456')
}
@@ -28,17 +26,17 @@ android {
}
}
compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
+ sourceCompatibility = '1.8'
+ targetCompatibility = '1.8'
}
}
dependencies {
- implementation "com.farsunset:cim-android-sdk:4.2.8"
- implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation 'com.google.android.material:material:1.2.1'
- implementation 'androidx.annotation:annotation:1.1.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+ implementation "com.farsunset:cim-android-sdk:4.2.10"
+ implementation 'androidx.appcompat:appcompat:1.6.0'
+ implementation 'com.google.android.material:material:1.8.0'
+ implementation 'androidx.annotation:annotation:1.3.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
diff --git a/cim-use-examples/cim-client-android/app/src/main/AndroidManifest.xml b/cim-use-examples/cim-client-android/app/src/main/AndroidManifest.xml
index e918e11..db1721d 100644
--- a/cim-use-examples/cim-client-android/app/src/main/AndroidManifest.xml
+++ b/cim-use-examples/cim-client-android/app/src/main/AndroidManifest.xml
@@ -17,7 +17,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme">
+ android:name="com.farsunset.cim.activity.LoginActivity" android:exported="true">
@@ -32,7 +32,6 @@
@@ -44,7 +43,7 @@
-
+
diff --git a/cim-use-examples/cim-client-android/build.gradle b/cim-use-examples/cim-client-android/build.gradle
index dfbc7c1..b4e4d41 100644
--- a/cim-use-examples/cim-client-android/build.gradle
+++ b/cim-use-examples/cim-client-android/build.gradle
@@ -1,24 +1,27 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
+ mavenCentral()
+ maven{ url'https://maven.aliyun.com/repository/central' }
+ maven{ url'https://maven.aliyun.com/repository/google' }
+ maven{ url'https://maven.aliyun.com/repository/public' }
+ maven{ url'https://maven.aliyun.com/repository/gradle-plugin' }
+ maven { url "https://jitpack.io" }
}
dependencies {
- classpath "com.android.tools.build:gradle:4.1.2"
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath 'com.android.tools.build:gradle:7.4.0'
}
}
-
allprojects {
repositories {
google()
jcenter()
+ mavenCentral()
+ maven { url "https://jitpack.io" }
+ maven{ url'https://maven.aliyun.com/repository/central' }
+ maven{ url'https://maven.aliyun.com/repository/google' }
+ maven{ url'https://maven.aliyun.com/repository/public' }
+ maven{ url'https://maven.aliyun.com/repository/gradle-plugin' }
}
}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
\ No newline at end of file
diff --git a/cim-use-examples/cim-client-android/gradle.properties b/cim-use-examples/cim-client-android/gradle.properties
index 52f5917..39bcbf4 100644
--- a/cim-use-examples/cim-client-android/gradle.properties
+++ b/cim-use-examples/cim-client-android/gradle.properties
@@ -16,4 +16,5 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
-android.enableJetifier=true
\ No newline at end of file
+android.enableJetifier=true
+android.injected.testOnly=false
diff --git a/cim-use-examples/cim-client-android/gradle/wrapper/gradle-wrapper.properties b/cim-use-examples/cim-client-android/gradle/wrapper/gradle-wrapper.properties
index d4ae76a..67a094d 100644
--- a/cim-use-examples/cim-client-android/gradle/wrapper/gradle-wrapper.properties
+++ b/cim-use-examples/cim-client-android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Apr 26 20:11:13 CST 2021
+#Wed Feb 15 10:18:48 CST 2023
distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
+zipStoreBase=GRADLE_USER_HOME