房间相册 公屏消息 解锁

This commit is contained in:
wzq
2023-10-18 13:14:49 +08:00
parent 2074039de2
commit b75ba89d75
15 changed files with 171 additions and 49 deletions

View File

@@ -74,6 +74,7 @@ import com.yizhuan.xchat_android_core.family.bean.FamilyInfo;
import com.yizhuan.xchat_android_core.family.event.FamilyMineEvent;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
import com.yizhuan.xchat_android_core.gift.event.UpdateKnapFreeGiftDataEvent;
import com.yizhuan.xchat_android_core.helper.AtProxy;
import com.yizhuan.xchat_android_core.im.custom.bean.ActivityTimerAttachment;
@@ -663,7 +664,6 @@ public final class IMNetEaseManager {
//自定義消息
CustomAttachment customAttachment = (CustomAttachment) msg.getAttachment();
if (customAttachment.getFirst() == CUSTOM_MSG_HEADER_TYPE_AUCTION
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_ROOM_TIP
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_FOLLOW_ROOM
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SEND_MAGIC
@@ -761,17 +761,24 @@ public final class IMNetEaseManager {
case CUSTOM_MSG_HEADER_TYPE_GIFT:
if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_GIFT) {
GiftAttachment giftAttachment = (GiftAttachment) attachment;
GiftInfo giftInfo = giftAttachment.getGiftReceiveInfo().getGift();
GiftReceiveInfo giftReceiveInfo = giftAttachment.getGiftReceiveInfo();
GiftInfo giftInfo = giftReceiveInfo.getGift();
// 兼容舊版發過來的giftAttachment沒有發送giftInfo的問題
giftInfo = giftInfo == null ?
GiftModel.get().findGiftInfoById(giftAttachment.getGiftReceiveInfo().getGiftId()) : giftInfo;
giftAttachment.getGiftReceiveInfo().setGift(giftInfo);
GiftModel.get().findGiftInfoById(giftReceiveInfo.getGiftId()) : giftInfo;
giftReceiveInfo.setGift(giftInfo);
GiftModel.get().addNewGift(giftInfo);
messages.add(msg);
gift = true;
if (!giftReceiveInfo.isRoomAlbum()) {
addMessages(msg);
}
} else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_LUCKY_GIFT) {
messages.add(msg);
gift = true;
addMessages(msg);
} else {
addMessages(msg);
}
break;
case CUSTOM_MSG_HEADER_TYPE_MULTI_GIFT:
@@ -1823,7 +1830,19 @@ public final class IMNetEaseManager {
public void addMessagesImmediately(ChatRoomMessage msg) {
if (AvRoomDataManager.get().mCurrentRoomInfo != null && AvRoomDataManager.get().mCurrentRoomInfo.isCloseScreen())
return;
if (msg != null && !checkNoNeedMsg(msg)) {
if (msg == null) {
return;
}
if (msg.getAttachment() != null && msg.getAttachment() instanceof GiftAttachment) {
GiftAttachment attachment = (GiftAttachment) msg.getAttachment();
if (attachment.getGiftReceiveInfo().isRoomAlbum()) {
return;
}
}
if (!checkNoNeedMsg(msg)) {
noticeReceiverMessageImmediately(msg);
}
}

View File

@@ -27,4 +27,6 @@ public class GiftReceiveInfo implements Serializable {
//礼物值
private List<IndexGiftValue> giftValueVos;
private long currentTime;
private boolean isRoomAlbum;
}

View File

@@ -52,6 +52,7 @@ public class GiftAttachment extends CustomAttachment {
giftReceiveInfo.setGiftNum(data.getIntValue("giftNum"));
giftReceiveInfo.setTargetNick(data.getString("targetNick"));
giftReceiveInfo.setTargetAvatar(data.getString("targetAvatar"));
giftReceiveInfo.setRoomAlbum(data.getBoolean("isRoomAlbum"));
JSONObject giftJson = null;
if (data.containsKey("gift")) {
giftJson = data.getJSONObject("gift");
@@ -92,6 +93,7 @@ public class GiftAttachment extends CustomAttachment {
object.put("targetNick", giftReceiveInfo.getTargetNick());
object.put("targetAvatar", giftReceiveInfo.getTargetAvatar());
object.put("giftInfo", giftReceiveInfo.getGift());
object.put("isRoomAlbum", giftReceiveInfo.isRoomAlbum());
if (giftReceiveInfo.getGiftValueVos() != null) {
object.put("giftValueVos", giftReceiveInfo.getGiftValueVos());
}

View File

@@ -27,7 +27,7 @@ data class User(
val phone: String,
val phoneAreaCode: String,
val platformRole: Int,
val uid: Int,
val uid: Long,
val updateTime: String,
val useStatus: Int
)

View File

@@ -227,6 +227,8 @@ public final class AvRoomDataManager {
@Getter
private boolean hasRoomAlbum;
private List<Integer> unlockedRoomAlbumPhotos = new ArrayList<>();
private AvRoomDataManager() {
mRoomManagerList = new ArrayList<>();
mRoomFixedMemberList = new ArrayList<>();
@@ -1324,6 +1326,18 @@ public final class AvRoomDataManager {
}
}
public void setUnlockedRoomAlbumPhotos(List<Integer> unlockedRoomAlbumPhotos) {
this.unlockedRoomAlbumPhotos = unlockedRoomAlbumPhotos;
}
public List<Integer> getUnlockedRoomAlbumPhotos() {
return unlockedRoomAlbumPhotos;
}
public void addUnlockedRoomAlbumPhoto(int photoId) {
unlockedRoomAlbumPhotos.add(photoId);
}
private static final class Helper {
private static final AvRoomDataManager INSTANCE = new AvRoomDataManager();
}

View File

@@ -775,13 +775,6 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
.compose(RxHelper.handleSchedulers());
}
@Override
public Single<String> unlockRoomPhoto(long roomUid, int photoId) {
return mRoomService.unlockRoomPhoto(roomUid, photoId)
.compose(RxHelper.handleStringData())
.compose(RxHelper.handleSchAndExce());
}
public Single<String> addIsomerism() {
return mRoomService.addIsomerism(AuthModel.get().getCurrentUid(), AvRoomDataManager.get().getRoomId())
.compose(RxHelper.singleMainResult());
@@ -1195,9 +1188,6 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
@POST("/roomFirstChargeWindow/update")
Single<ServiceResult<String>> postFirstCharge(@Field("roomUid") long roomUid);
@FormUrlEncoded
@POST("roomAlbum/unlockPhoto")
Single<ServiceResult<String>> unlockRoomPhoto(@Field("roomUid") long roomUid, @Field("id") int photoId);
}
}

View File

@@ -179,5 +179,4 @@ public interface IRoomBaseModel extends IModel {
*/
Single<RoomInfo> closeScreen(long roomId, boolean isCloseScreen);
Single<String> unlockRoomPhoto(long roomUid, int photoId);
}