Skip to content

Commit

Permalink
Merge branch 'release/1.0.169'
Browse files Browse the repository at this point in the history
  • Loading branch information
Grigory Fedorov committed Apr 6, 2017
2 parents 106356e + bb64c57 commit 88d86d5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions xabber/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 340
versionName '1.0.168'
versionCode 341
versionName '1.0.169'
}

lintOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.xabber.android.data.connection;

import android.support.annotation.NonNull;
import android.util.Log;

import com.xabber.android.data.account.AccountErrorEvent;
import com.xabber.android.data.account.AccountItem;
Expand Down Expand Up @@ -62,7 +63,7 @@ public void run() {
LogManager.i(this, "No network connection");
}
}
}, "Connection thread for " + connectionItem.getAccount());
});
thread.setPriority(Thread.MIN_PRIORITY);
thread.setDaemon(true);
}
Expand Down Expand Up @@ -122,14 +123,17 @@ void connectAndLogin() {
com.xabber.android.data.account.AccountManager.getInstance().addAccountError(accountErrorEvent);
com.xabber.android.data.account.AccountManager.getInstance().setEnabled(connectionItem.getAccount(), false);
EventBus.getDefault().postSticky(accountErrorEvent);
} catch (XMPPException | SmackException | IOException e) {

// catching RuntimeExceptions seems to be strange, but we got a lot of error coming from
// Smack or mini DSN client inside of Smack.
} catch (XMPPException | SmackException | IOException | RuntimeException e) {
LogManager.exception(this, e);

if (!((AccountItem)connectionItem).isSuccessfulConnectionHappened()) {
LogManager.i(this, "There was no successful connection, disabling account");

AccountErrorEvent accountErrorEvent = new AccountErrorEvent(connectionItem.getAccount(),
AccountErrorEvent.Type.CONNECTION, e.getMessage());
AccountErrorEvent.Type.CONNECTION, Log.getStackTraceString(e));

com.xabber.android.data.account.AccountManager.getInstance().addAccountError(accountErrorEvent);
com.xabber.android.data.account.AccountManager.getInstance().setEnabled(connectionItem.getAccount(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,22 +243,18 @@ protected boolean onPacket(UserJid bareAddress, Stanza stanza) {
notify = false;
}

Realm realm = MessageDatabaseManager.getInstance().getNewBackgroundRealm();
Realm realm = MessageDatabaseManager.getInstance().getRealmUiThread();
final MessageItem sameMessage = realm
.where(MessageItem.class)
.equalTo(MessageItem.Fields.STANZA_ID, stanzaId)
.findFirst();

try {
// Server send our own message back
if (sameMessage != null) {
realm.beginTransaction();
sameMessage.setDelivered(true);
realm.commitTransaction();
return true;
}
} finally {
realm.close();
// Server send our own message back
if (sameMessage != null) {
realm.beginTransaction();
sameMessage.setDelivered(true);
realm.commitTransaction();
return true;
}

if (isSelf(resource)) { // Own message from other client
Expand Down
1 change: 1 addition & 0 deletions xabber/src/main/res/layout/dialog_account_error.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textSize="14sp"
android:textIsSelectable="true"
tools:text="TextView" />
</ScrollView>

Expand Down

0 comments on commit 88d86d5

Please sign in to comment.