Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #351 from matrix-org/feature/hss_2
Browse files Browse the repository at this point in the history
MatrixError mResourceLimitExceededError is now managed in MxDataHandler (element-hq/riot-android#2547)
  • Loading branch information
bmarty authored Aug 30, 2018
2 parents e97219d + 70ba1d3 commit 63a0e2d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Improvements:

Bugfix:
- Removing room from 'low priority' or 'favorite' does not work (vector-im/riot-android#2526)
- MatrixError mResourceLimitExceededError is now managed in MxDataHandler (vector-im/riot-android#2547)

API Change:
- MxSession constructor is now private. Please use MxSession.Builder() to create a MxSession
Expand Down
23 changes: 23 additions & 0 deletions matrix-sdk/src/main/java/org/matrix/androidsdk/MXDataHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.google.gson.Gson;
Expand Down Expand Up @@ -170,6 +171,10 @@ public interface RequestNetworkErrorListener {
// groups manager
private GroupsManager mGroupsManager;

// Resource limit exceeded error
@Nullable
private MatrixError mResourceLimitExceededError;

/**
* Default constructor.
*
Expand Down Expand Up @@ -402,6 +407,16 @@ public void onSSLCertificateError(UnrecognizedCertificateException exception) {
}
}

/**
* Get the last resource limit exceeded error if any or null
*
* @return the last resource limit exceeded error if any or null
*/
@Nullable
public MatrixError getResourceLimitExceededError() {
return mResourceLimitExceededError;
}

/**
* Get the session's current user. The MyUser object provides methods for updating user properties which are not possible for other users.
*
Expand Down Expand Up @@ -1945,6 +1960,9 @@ public void run() {

@Override
public void onLiveEventsChunkProcessed(final String startToken, final String toToken) {
// reset the resource limit exceeded error
mResourceLimitExceededError = null;

refreshUnreadCounters();

if (null != mCryptoEventsListener) {
Expand Down Expand Up @@ -2167,6 +2185,11 @@ public void onInitialSyncComplete(String toToken) {

@Override
public void onSyncError(final MatrixError matrixError) {
// Store the resource limit exceeded error
if (MatrixError.RESOURCE_LIMIT_EXCEEDED.equals(matrixError.errcode)) {
mResourceLimitExceededError = matrixError;
}

final List<IMXEventListener> eventListeners = getListenersSnapshot();

mUiHandler.post(new Runnable() {
Expand Down

0 comments on commit 63a0e2d

Please sign in to comment.