47 lines
1.2 KiB
Java
47 lines
1.2 KiB
Java
package org.mercury_im.messenger.persistence.room.repository;
|
|
|
|
import org.jxmpp.jid.EntityBareJid;
|
|
import org.mercury_im.messenger.persistence.repository.AvatarRepository;
|
|
import org.mercury_im.messenger.persistence.room.dao.AvatarDao;
|
|
import org.mercury_im.messenger.persistence.room.model.RoomAvatarModel;
|
|
|
|
import javax.inject.Inject;
|
|
|
|
import io.reactivex.Maybe;
|
|
import io.reactivex.Single;
|
|
|
|
public class IAvatarRepository implements AvatarRepository<RoomAvatarModel> {
|
|
|
|
private final AvatarDao dao;
|
|
|
|
@Inject
|
|
public IAvatarRepository(AvatarDao dao) {
|
|
this.dao = dao;
|
|
}
|
|
|
|
@Override
|
|
public RoomAvatarModel newAvatarModel() {
|
|
return new RoomAvatarModel();
|
|
}
|
|
|
|
@Override
|
|
public Maybe<RoomAvatarModel> getAvatarById(long avatarId) {
|
|
return dao.getAvatarById(avatarId);
|
|
}
|
|
|
|
@Override
|
|
public Maybe<RoomAvatarModel> getAvatarByEntityId(long entityId) {
|
|
return dao.getAvatarByEntityId(entityId);
|
|
}
|
|
|
|
@Override
|
|
public Maybe<RoomAvatarModel> getAvatarByJid(EntityBareJid jid) {
|
|
return dao.getAvatarByJid(jid);
|
|
}
|
|
|
|
@Override
|
|
public Single<Long> updateOrInsertAvatar(RoomAvatarModel avatarModel) {
|
|
return dao.insert(avatarModel);
|
|
}
|
|
}
|