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

Commit

Permalink
Merge branch 'release/0.9.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Oct 10, 2018
2 parents e6f0976 + d3cb3b6 commit 0236850
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 55 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Changes to Matrix Android SDK in 0.9.11 (2018-10-10)
=======================================================

Bugfix:
- Add a setter to set MXDataHandler to MXFileStore

Changes to Matrix Android SDK in 0.9.10 (2018-10-08)
=======================================================

Expand Down
48 changes: 20 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=matrix.android.sdk&metric=alert_status)](https://sonarcloud.io/dashboard?id=matrix.android.sdk) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=matrix.android.sdk&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=matrix.android.sdk) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=matrix.android.sdk&metric=bugs)](https://sonarcloud.io/dashboard?id=matrix.android.sdk)
[![Jenkins](https://img.shields.io/jenkins/s/https/matrix.org/jenkins/view/MatrixView/job/MatrixAndroidSDKDevelop.svg)](https://matrix.org/jenkins/view/MatrixView/job/MatrixAndroidSDKDevelop/)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=matrix.android.sdk&metric=alert_status)](https://sonarcloud.io/dashboard?id=matrix.android.sdk)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=matrix.android.sdk&metric=vulnerabilities)](https://sonarcloud.io/project/issues?id=matrix.android.sdk&resolved=false&types=VULNERABILITY)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=matrix.android.sdk&metric=bugs)](https://sonarcloud.io/project/issues?id=matrix.android.sdk&resolved=false&types=BUG)

matrix-android-sdk
==================
Expand All @@ -19,20 +22,14 @@ Basic usage is:

Bugs / Feature Requests
-----------------------
Think you've found a bug? Want a new feature on the client? Please open an issue
on JIRA:

- Create an account and login to https://matrix.org/jira
- Navigate to the ``SYAND`` project.
- Click **Create Issue** - Please be as descriptive as possible, with reproduction
steps if possible.

All issues in JIRA are **public**.
Think you've found a bug? Please check if an issue
does not exist yet, then, if not, open an issue on this Github repo. If an issue already
exists, feel free to upvote for it.

Contributing
------------
Want to fix a bug or add a new feature? Check JIRA first to see if someone else is
handling this issue. If no one is actively working on the issue, then please fork
Want to fix a bug or add a new feature? Check if there is an corresponding opened issue.
If no one is actively working on the issue, then please fork
the ``develop`` branch when writing your fix, and open a pull request when you're
ready. Do not base your pull requests off ``master``.

Expand All @@ -41,7 +38,9 @@ Logging in
To log in, use an instance of the login API client.

```java
HomeServerConnectionConfig hsConfig = new HomeServerConnectionConfig(Uri.parse("https://matrix.org"));
HomeServerConnectionConfig hsConfig = new HomeServerConnectionConfig.Builder()
.withHomeServerUri(Uri.parse("https://matrix.org"))
.build();
new LoginRestClient(hsConfig).loginWithUser(username, password, new SimpleApiCallback<Credentials>());
```

Expand All @@ -52,7 +51,8 @@ Starting the matrix session
The session represents one user's session with a particular home server. There can potentially be multiple sessions for handling multiple accounts.

```java
MXSession session = new MXSession(hsConfig, new MXDataHandler(store, credentials), getApplicationContext());
MXSession session = new MXSession.Builder(hsConfig, new MXDataHandler(store, credentials), getApplicationContext())
.build();
```

sets up a session for interacting with the home server.
Expand Down Expand Up @@ -109,18 +109,6 @@ MXDataHandler dataHandler = new MXDataHandler(new MXMemoryStore());

creates a data handler with the default in-memory storage implementation.

### Setting up the session

```java
MXSession session = new MXSession(credentials, dataHandler);
```

### Starting the event stream

```java
session.startEventStream();
```

### Registering a listener
To be informed of events, the app needs to implement an event listener.

Expand Down Expand Up @@ -217,9 +205,13 @@ content can now be found.

**See the sample app and Javadoc for more details.**

References
----------
- [Matrix home page](https://matrix.org)
- [Matrix api documentation](https://matrix.org/docs/spec/client_server/latest.html)
- [Matrix api](https://matrix.org/docs/api/client-server/)

License
-------
Apache 2.0

[Matrix]:http://matrix.org
[matrix api]:http://matrix.org/docs/api/client-server/
4 changes: 2 additions & 2 deletions matrix-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 910
versionName "0.9.10"
versionCode 911
versionName "0.9.11"
resValue "string", "flavor_description", "SDKApp"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

import android.content.Context;
import android.os.HandlerThread;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;

import org.matrix.androidsdk.HomeServerConnectionConfig;
import org.matrix.androidsdk.MXDataHandler;
import org.matrix.androidsdk.data.Room;
import org.matrix.androidsdk.data.RoomAccountData;
import org.matrix.androidsdk.data.RoomState;
Expand Down Expand Up @@ -145,6 +147,9 @@ public class MXFileStore extends MXMemoryStore {
// True if file encryption is enabled
private final boolean mEnableFileEncryption;

// The dataHandler
private MXDataHandler mMXDataHandler;

/**
* Create the file store dirtrees
*/
Expand Down Expand Up @@ -221,7 +226,9 @@ private void createDirTree(String userId) {
* @param enableFileEncryption set to true to enable file encryption.
* @param context the context.
*/
public MXFileStore(HomeServerConnectionConfig hsConfig, boolean enableFileEncryption, Context context) {
public MXFileStore(HomeServerConnectionConfig hsConfig,
boolean enableFileEncryption,
Context context) {
setContext(context);

mEnableFileEncryption = enableFileEncryption;
Expand Down Expand Up @@ -275,6 +282,10 @@ public MXFileStore(HomeServerConnectionConfig hsConfig, boolean enableFileEncryp
}
}

public void setDataHandler(@NonNull final MXDataHandler dataHandler) {
mMXDataHandler = dataHandler;
}

/**
* Killed the background thread.
*
Expand Down Expand Up @@ -1239,7 +1250,7 @@ private boolean loadRoomMessages(final String roomId) {
// succeeds to extract the message list
if (null != events) {
// create the room object
final Room room = new Room(getDataHandler(), this, roomId);
final Room room = new Room(mMXDataHandler, this, roomId);
// do not wait that the live state update
room.setReadyState(true);
storeRoom(room);
Expand Down Expand Up @@ -1355,7 +1366,7 @@ private boolean loadRoomsMessages() {

} catch (Exception e) {
succeed = false;
Log.e(LOG_TAG, "loadRoomToken failed : " + e.getMessage(), e);
Log.e(LOG_TAG, "loadRoomsMessages failed : " + e.getMessage(), e);
}

return succeed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import android.support.annotation.Nullable;
import android.text.TextUtils;

import org.matrix.androidsdk.MXDataHandler;
import org.matrix.androidsdk.data.Room;
import org.matrix.androidsdk.data.RoomAccountData;
import org.matrix.androidsdk.data.RoomSummary;
Expand Down Expand Up @@ -107,9 +106,6 @@ public class MXMemoryStore implements IMXStore {
protected long mUserDisplayNameTs;
protected long mUserAvatarUrlTs;

// DataHandler -- added waiting to be refactored
private MXDataHandler mDataHandler;

/**
* Initialization method.
*/
Expand Down Expand Up @@ -1645,22 +1641,4 @@ public String getAntivirusServerPublicKey() {
public void setMetricsListener(MetricsListener metricsListener) {
mMetricsListener = metricsListener;
}

/**
* Get the associated dataHandler
*
* @return the associated dataHandler
*/
protected MXDataHandler getDataHandler() {
return mDataHandler;
}

/**
* Update the associated dataHandler
*
* @param dataHandler the dataHandler
*/
public void setDataHandler(final MXDataHandler dataHandler) {
mDataHandler = dataHandler;
}
}

0 comments on commit 0236850

Please sign in to comment.