diff --git a/README.md b/README.md index 3f9c332b..9e66648c 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Second, you need to add SDK dependencies inside your app .gradle. Then, you need ``` dependencies { ... - implementation 'com.qiscus.sdk:chat-core:1.8.1' + implementation 'com.qiscus.sdk:chat-core:1.8.2' } ``` diff --git a/chat-core/src/main/java/com/qiscus/sdk/chat/core/data/remote/QiscusInterceptor.java b/chat-core/src/main/java/com/qiscus/sdk/chat/core/data/remote/QiscusInterceptor.java index ec379d83..9217be0b 100644 --- a/chat-core/src/main/java/com/qiscus/sdk/chat/core/data/remote/QiscusInterceptor.java +++ b/chat-core/src/main/java/com/qiscus/sdk/chat/core/data/remote/QiscusInterceptor.java @@ -122,7 +122,11 @@ private static void autoRefreshToken(int code, JSONObject jsonObject) throws JSO QiscusCore.refreshToken(new QiscusCore.SetRefreshTokenListener() { @Override public void onSuccess(QiscusRefreshToken refreshToken) { - + EventBus.getDefault().post( + new QiscusRefreshTokenEvent( + 200, "Success" + ) + ); } @Override diff --git a/chat-core/src/main/java/com/qiscus/sdk/chat/core/event/QiscusRefreshTokenEvent.java b/chat-core/src/main/java/com/qiscus/sdk/chat/core/event/QiscusRefreshTokenEvent.java index 6f2f2308..e05cdfed 100644 --- a/chat-core/src/main/java/com/qiscus/sdk/chat/core/event/QiscusRefreshTokenEvent.java +++ b/chat-core/src/main/java/com/qiscus/sdk/chat/core/event/QiscusRefreshTokenEvent.java @@ -5,9 +5,11 @@ public class QiscusRefreshTokenEvent { // default code public static final int UNAUTHORIZED = 401; public static final int EXPIRED_TOKEN = 403; + public static final int SUCCESS_AUTO_REFRESH_TOKEN = 200; // default message public static String TOKEN_EXPIRED_MESSAGE = "Unauthorized. Token is expired"; public static String UNAUTHORIZED_MESSAGE = "Unauthorized"; + public static String SUCCESS_AUTO_REFRESH_TOKEN_MESSAGE = "Success"; private final int code; private final String message; @@ -32,4 +34,9 @@ public boolean isTokenExpired() { public boolean isUnauthorized() { return (code == UNAUTHORIZED || code == EXPIRED_TOKEN) && message.equals(UNAUTHORIZED_MESSAGE); } + + public boolean isSuccessAutoRefreshToken() { + return code == SUCCESS_AUTO_REFRESH_TOKEN && message.equals(SUCCESS_AUTO_REFRESH_TOKEN_MESSAGE); + } + } diff --git a/docs/index.md b/docs/index.md index c2d5b751..ff320738 100644 --- a/docs/index.md +++ b/docs/index.md @@ -80,7 +80,7 @@ Secondly, you need to add SDK dependencies inside your app .gradle. Then, you ne ``` dependencies { ... - implementation 'com.qiscus.sdk:chat-core:1.8.1' + implementation 'com.qiscus.sdk:chat-core:1.8.2' } ``` diff --git a/gradle.properties b/gradle.properties index 550c094f..abf1eb08 100644 --- a/gradle.properties +++ b/gradle.properties @@ -43,7 +43,7 @@ chatVersionPatch=0 # === qiscus chat-core library version === chatCoreVersionMajor=1 chatCoreVersionMinor=8 -chatCoreVersionPatch=1 +chatCoreVersionPatch=2 # === qiscus default base url BASE_URL_SERVER="https://api.qiscus.com/" @@ -59,7 +59,7 @@ android.useAndroidX=true libraryGroupId=com.qiscus.sdk libraryArtifactId=chat-core -libraryVersion=1.8.1 +libraryVersion=1.8.2 libraryGroupIdChat=com.qiscus.sdk libraryArtifactIdChat=chat