Skip to content

Commit

Permalink
improve lib paho mqtt and update code sdk to support this library
Browse files Browse the repository at this point in the history
  • Loading branch information
Arief Nur Putranto committed Jan 17, 2023
1 parent 17ba4bf commit 5ff0e63
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 30 deletions.
2 changes: 0 additions & 2 deletions chat-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>

<application>
<receiver
android:name=".service.QiscusStartServiceReceiver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ public void onActivityCreated(Activity activity, Bundle savedInstanceState) {

@Override
public void onActivityStarted(Activity activity) {
AlarmManager alarmMgr = (AlarmManager) activity.getSystemService(Context.ALARM_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (!alarmMgr.canScheduleExactAlarms()) {
QiscusCore.setIsExactAlarmDisable(true);
} else {
QiscusCore.setIsExactAlarmDisable(false);
}
}

foreground = true;

Expand Down Expand Up @@ -104,9 +96,7 @@ private void startActivityTransitionTimer() {

private void check(){
if (!foreground) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
QiscusPusherApi.getInstance().disconnect();
}
QiscusPusherApi.getInstance().disconnect();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,14 +532,6 @@ public static void setEnableDisableRealtime(Boolean enableDisableRealtime){
enableRealtime = enableDisableRealtime;
}

public static void setIsExactAlarmDisable(Boolean isExactAlarmDisable){
forceDisableRealtimeFromExactAlarm = isExactAlarmDisable;
}

public static boolean getIsExactAlarmDisable() {
return forceDisableRealtimeFromExactAlarm;
}

/**
* enableSync
* Checker for enable or disable sync
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ private void eventReport(String moduleName, String event, String message) {

public void connect() {
if (QiscusCore.hasSetupUser() && !connecting && QiscusAndroidUtil.isNetworkAvailable()
&& QiscusCore.getEnableRealtime() && QiscusCore.getStatusRealtimeEnableDisable() && !QiscusCore.getIsExactAlarmDisable()) {
&& QiscusCore.getEnableRealtime() && QiscusCore.getStatusRealtimeEnableDisable()) {
connecting = true;
qiscusAccount = QiscusCore.getQiscusAccount();
MqttConnectOptions mqttConnectOptions = new MqttConnectOptions();
Expand Down Expand Up @@ -465,10 +465,6 @@ public void restartConnection() {
return;
}

if (QiscusCore.getIsExactAlarmDisable()){
QiscusLogger.print(TAG, "QiscusPusherApi... " + "Disconnect manually from client (exact alarm is false)");
return;
}

if (connecting) {
QiscusLogger.print(TAG, "Connecting... " + "connectingFromRestartConnection");
Expand Down
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ext {

qiscusMqttDeps = [
client : "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0",
android: "com.qiscus.mqtt:android:1.1.6"
android: "com.qiscus.mqtt:android:1.1.7"
]

okHttpDeps = [
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.1'
implementation 'com.qiscus.sdk:chat-core:1.6.2'
}
```

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ chatVersionPatch=3
# === qiscus chat-core library version ===
chatCoreVersionMajor=1
chatCoreVersionMinor=6
chatCoreVersionPatch=1
chatCoreVersionPatch=2

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

libraryGroupId=com.qiscus.sdk
libraryArtifactId=chat-core
libraryVersion=1.6.1
libraryVersion=1.6.2

libraryGroupIdChat=com.qiscus.sdk
libraryArtifactIdChat=chat
Expand Down

0 comments on commit 5ff0e63

Please sign in to comment.