mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 17:08:34 +03:00
Don’t try to set notification level if we can’t do it
This commit is contained in:
parent
d492e8040b
commit
238cab78b1
1 changed files with 40 additions and 38 deletions
|
@ -70,45 +70,47 @@ public class DatabaseStorageModule implements StorageModule {
|
|||
if (!key.equals("message_notification_level")) {
|
||||
arbitraryStorageUtils.storeStorageSetting(accountIdentifier, key, value, conversationToken);
|
||||
} else {
|
||||
int intValue;
|
||||
switch (value) {
|
||||
case "never":
|
||||
intValue = 3;
|
||||
break;
|
||||
case "mention":
|
||||
intValue = 2;
|
||||
break;
|
||||
case "always":
|
||||
intValue = 1;
|
||||
break;
|
||||
default:
|
||||
intValue = 0;
|
||||
if (conversationUser.hasSpreedCapabilityWithName("notification-levels")) {
|
||||
int intValue;
|
||||
switch (value) {
|
||||
case "never":
|
||||
intValue = 3;
|
||||
break;
|
||||
case "mention":
|
||||
intValue = 2;
|
||||
break;
|
||||
case "always":
|
||||
intValue = 1;
|
||||
break;
|
||||
default:
|
||||
intValue = 0;
|
||||
}
|
||||
|
||||
ncApi.setNotificationLevel(ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken()),
|
||||
ApiUtils.getUrlForSettingNotificationlevel(conversationUser.getBaseUrl(), conversationToken),
|
||||
intValue)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribe(new Observer<GenericOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GenericOverall genericOverall) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ncApi.setNotificationLevel(ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken()),
|
||||
ApiUtils.getUrlForSettingNotificationlevel(conversationUser.getBaseUrl(), conversationToken),
|
||||
intValue)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribe(new Observer<GenericOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GenericOverall genericOverall) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue