Skip to content

Commit c7178a2

Browse files
author
ariefnurputranto
committed
handle close realtime connection without affecting sync interval 30s and bump up version 1.3.33
1 parent 203cd50 commit c7178a2

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Second, you need to add SDK dependencies inside your app .gradle. Then, you need
5454
```
5555
dependencies {
5656
...
57-
implementation 'com.qiscus.sdk:chat-core:1.3.32'
57+
implementation 'com.qiscus.sdk:chat-core:1.3.33'
5858
}
5959
```
6060

chat-core/src/main/java/com/qiscus/sdk/chat/core/service/QiscusSyncJobService.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,13 @@ public void run() {
8282
private void newSchedule(Context context) {
8383
QiscusLogger.print(TAG, "Job started...");
8484

85-
if (QiscusCore.hasSetupUser() && !QiscusPusherApi.getInstance().isConnected()
86-
&& QiscusCore.getStatusRealtimeEnableDisable()) {
87-
QiscusAndroidUtil.runOnUIThread(() -> QiscusPusherApi.getInstance().restartConnection());
88-
scheduleSync();
85+
if (QiscusCore.hasSetupUser() && !QiscusPusherApi.getInstance().isConnected()) {
86+
if (QiscusCore.getStatusRealtimeEnableDisable()) {
87+
QiscusAndroidUtil.runOnUIThread(() -> QiscusPusherApi.getInstance().restartConnection());
88+
scheduleSync();
89+
} else {
90+
scheduleSync();
91+
}
8992
}
9093

9194
syncJob(context);

chat-core/src/main/java/com/qiscus/sdk/chat/core/service/QiscusSyncService.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,16 @@ private void scheduleSync() {
103103
timer.schedule(new TimerTask() {
104104
public void run() {
105105
// time ran out.
106-
if (QiscusCore.hasSetupUser() && !QiscusPusherApi.getInstance().isConnected()
107-
&& QiscusCore.getStatusRealtimeEnableDisable()) {
108-
QiscusAndroidUtil.runOnUIThread(() -> QiscusPusherApi.getInstance().restartConnection());
109-
if (QiscusCore.isOnForeground()) {
110-
syncComments();
106+
if (QiscusCore.hasSetupUser() && !QiscusPusherApi.getInstance().isConnected()) {
107+
if (QiscusCore.getStatusRealtimeEnableDisable()) {
108+
QiscusAndroidUtil.runOnUIThread(() -> QiscusPusherApi.getInstance().restartConnection());
109+
if (QiscusCore.isOnForeground()) {
110+
syncComments();
111+
}
112+
} else {
113+
if (QiscusCore.isOnForeground()) {
114+
syncComments();
115+
}
111116
}
112117
}
113118

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ chatVersionPatch=0
4141
# === qiscus chat-core library version ===
4242
chatCoreVersionMajor=1
4343
chatCoreVersionMinor=3
44-
chatCoreVersionPatch=32
44+
chatCoreVersionPatch=33
4545

4646
# === qiscus default base url
4747
BASE_URL_SERVER="https://api.qiscus.com/"
@@ -57,7 +57,7 @@ android.enableR8=true
5757

5858
libraryGroupId=com.qiscus.sdk
5959
libraryArtifactId=chat-core
60-
libraryVersion=1.3.32
60+
libraryVersion=1.3.33
6161

6262
libraryGroupIdChat=com.qiscus.sdk
6363
libraryArtifactIdChat=chat

0 commit comments

Comments
 (0)