Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bensmiley committed Apr 13, 2020
1 parent 73a3172 commit 2b9330d
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 28 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ repositories {
Then add this to your `dependencies` area:

```
compile 'co.chatsdk.chatsdk:chat-sdk-core:4.8.9'
compile 'co.chatsdk.chatsdk:chat-sdk-ui:4.8.9'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-adapter:4.8.9'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-file-storage:4.8.9'
compile 'co.chatsdk.chatsdk:chat-sdk-core:4.8.12'
compile 'co.chatsdk.chatsdk:chat-sdk-ui:4.8.12'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-adapter:4.8.12'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-file-storage:4.8.12'
```

You may also need to enable Java 8:
Expand Down Expand Up @@ -316,7 +316,7 @@ Then add the following to your `build.gradle`
*Gradle*

```
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-push:4.8.9.3'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-push:4.8.12'
```

[*Manual Import*](https://github.com/chat-sdk/chat-sdk-android#adding-modules-manually)
Expand Down Expand Up @@ -440,7 +440,7 @@ The free modules are located in the main [Github repository](https://github.com/
Add the following to your `build.gradle`

```
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-ui:4.8.9'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-ui:4.8.12'
```

##### Enable the module
Expand All @@ -465,7 +465,7 @@ Add the following to your `build.gradle`
*Gradle*

```
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-social-login:4.8.9'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-social-login:4.8.12'
```

[*Manual Import*](https://github.com/chat-sdk/chat-sdk-android#adding-modules-manually)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/co/chatsdk/android/app/AppObj.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void onCreate() {
config.pushNotificationsForPublicChatRoomsEnabled(false);

config.setDevelopmentModeEnabled(false);
config.setDisablePresence(false);
config.setDisablePresence(true);
config.setDisableProfileUpdateOnAuthentication(false);
config.setDisablePublicThreads(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ public Completable authenticateWithUser(final FirebaseUser user) {
completeAuthentication(userWrapper.getModel());
if (value.isEmpty() && !ChatSDK.config().disableProfileUpdateOnAuthentication) {
return userWrapper.push();
} else {
userWrapper.deserialize(value);
}
return Completable.complete();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.net.URI;
import java.net.URL;
import java.util.Date;
import java.util.concurrent.Callable;

import co.chatsdk.core.base.AbstractCoreHandler;
import co.chatsdk.core.dao.User;
Expand All @@ -27,11 +28,13 @@
import co.chatsdk.core.utils.DisposableList;
import co.chatsdk.firebase.wrappers.UserWrapper;
import io.reactivex.Completable;
import io.reactivex.CompletableSource;
import io.reactivex.Observer;
import io.reactivex.Single;
import io.reactivex.SingleOnSubscribe;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import timber.log.Timber;
Expand Down Expand Up @@ -100,34 +103,40 @@ public void onComplete() {
}

public Completable setUserOnline() {
if (!ChatSDK.config().disablePresence) {
User current = ChatSDK.currentUser();
if (current != null && StringUtils.isNotEmpty(current.getEntityID())) {
return UserWrapper.initWithModel(currentUserModel()).goOnline();
return Completable.defer(() -> {
if (!ChatSDK.config().disablePresence) {
User current = ChatSDK.currentUser();
if (current != null && StringUtils.isNotEmpty(current.getEntityID())) {
return UserWrapper.initWithModel(currentUserModel()).goOnline();
}
}
return Completable.complete();
}).doOnComplete(() -> {
if (ChatSDK.hook() != null) {
ChatSDK.hook().executeHook(HookEvent.UserDidConnect, null).subscribe(new CrashReportingCompletableObserver());;
}
}
return Completable.complete();
}).subscribeOn(Schedulers.io());
}

public Completable setUserOffline() {
if (!ChatSDK.config().disablePresence) {
User current = ChatSDK.currentUser();
return Completable.defer(() -> {
if (!ChatSDK.config().disablePresence) {

Completable completable = Completable.complete();
if (ChatSDK.hook() != null) {
completable = ChatSDK.hook().executeHook(HookEvent.UserWillDisconnect, null);
}
User current = ChatSDK.currentUser();

if (current != null && StringUtils.isNotEmpty(current.getEntityID())) {
// Update the last online figure then go offline
return completable.concatWith(updateLastOnline()
.concatWith(UserWrapper.initWithModel(currentUserModel()).goOffline()));
Completable completable = Completable.complete();
if (ChatSDK.hook() != null) {
completable = ChatSDK.hook().executeHook(HookEvent.UserWillDisconnect, null);
}

if (current != null && !current.getEntityID().isEmpty()) {
// Update the last online figure then go offline
return completable.concatWith(updateLastOnline()
.concatWith(UserWrapper.initWithModel(current).goOffline()));
}
}
}
return Completable.complete();
return Completable.complete();
}).subscribeOn(Schedulers.io());
}

public void goOffline() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private Long long_ (Map<String, Object> value, String key) {
if (user == null)
{
user = ChatSDK.db().fetchOrCreateEntityWithEntityID(User.class, senderID);
UserWrapper.initWithModel(user).once();
ChatSDK.core().userOn(user).subscribe(new CrashReportingCompletableObserver());
}

model.setSender(user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void metaOff() {
}


void deserialize(Map<String, Object> value){
public void deserialize(Map<String, Object> value){

if (value != null)
{
Expand Down

0 comments on commit 2b9330d

Please sign in to comment.