通知提醒设置新增个播开播通知设置

This commit is contained in:
huangjian
2022-07-18 15:27:11 +08:00
parent 1cfdd1e5a0
commit bd0a210804
4 changed files with 82 additions and 25 deletions

View File

@@ -25,6 +25,8 @@ public interface ISettingsModel extends IModel {
Single<String> setSysMsgNotify(boolean sysMsgNotify);
Single<String> setAttentionMsgNotify(boolean attentionMsgNotify);
Single<SysAccount> getSysAccount();
Single<String> interactiveMsgNotify(boolean interactiveMsgNotify);

View File

@@ -28,6 +28,10 @@ public class SettingsModel implements ISettingsModel {
private static SettingsModel instance;
private final Api api;
private SettingsModel() {
api = RxNet.create(Api.class);
}
public static ISettingsModel get() {
if (instance == null) {
synchronized (SettingsModel.class) {
@@ -39,10 +43,6 @@ public class SettingsModel implements ISettingsModel {
return instance;
}
private SettingsModel() {
api = RxNet.create(Api.class);
}
@Override
public Single<ServiceResult<String>> showLocation(long uid, boolean showLocation) {
return api.showLocation(uid, showLocation);
@@ -79,25 +79,31 @@ public class SettingsModel implements ISettingsModel {
.compose(RxHelper.handleIgnoreData()));
}
@Override
public Single<String> setAttentionMsgNotify(boolean attentionMsgNotify) {
return api.apiAttentionMsgNotify(AuthModel.get().getCurrentUid(), attentionMsgNotify)
.compose(RxHelper.handleIgnoreData());
}
private Single<Boolean> setNotifyAccount(String account, boolean notify) {
return Single.create((SingleOnSubscribe<Boolean>) e ->
NIMClient.getService(FriendService.class).setMessageNotify(account, notify)
.setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
e.onSuccess(notify);
}
NIMClient.getService(FriendService.class).setMessageNotify(account, notify)
.setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
e.onSuccess(notify);
}
@Override
public void onFailed(int code) {
e.onError(new Throwable("设置不提醒用户出错code=" + code));
}
@Override
public void onFailed(int code) {
e.onError(new Throwable("设置不提醒用户出错code=" + code));
}
@Override
public void onException(Throwable exception) {
e.onError(exception);
}
}))
@Override
public void onException(Throwable exception) {
e.onError(exception);
}
}))
.observeOn(AndroidSchedulers.mainThread());
}
@@ -136,8 +142,14 @@ public class SettingsModel implements ISettingsModel {
Single<ServiceResult<JsonElement>> apiSysMsgNotify(@Query("uid") long uid,
@Query("sysMsgNotify") boolean sysMsgNotify);
@FormUrlEncoded
@POST("/user/singleBroadcastMsgNotify")
Single<ServiceResult<JsonElement>> apiAttentionMsgNotify(@Field("uid") long uid,
@Field("msgNotify") boolean sysMsgNotify);
/**
* 获得小秘书和系统通知uid
*
* @return
*/
@GET("client/prop")
@@ -145,7 +157,7 @@ public class SettingsModel implements ISettingsModel {
@POST("user/interactiveMsgNotify")
Single<ServiceResult<JsonElement>> interactiveMsgNotify(@Query("uid") long uid,
@Query("interactiveMsgNotify") boolean interactiveMsgNotify);
@Query("interactiveMsgNotify") boolean interactiveMsgNotify);
}
}

View File

@@ -766,6 +766,8 @@ public class UserInfo implements Serializable {
* 互动消息通知true:提醒
*/
private boolean interactiveMsgNotify = true;
private boolean singleBroadcastMsgNotify;
}
/**