use of net.iGap.request.RequestGroupAvatarAdd in project iGap-Android by KianIranian-STDG.
the class FragmentNewGroupViewModel method getRoom.
private void getRoom(final long roomId, final ProtoGlobal.Room.Type typeCreate, boolean isGroup) {
G.onClientGetRoomResponse = new OnClientGetRoomResponse() {
@Override
public void onClientGetRoomResponse(final ProtoGlobal.Room room, ProtoClientGetRoom.ClientGetRoomResponse.Builder builder, RequestClientGetRoom.IdentityClientGetRoom identity) {
if (identity.createRoomMode != RequestClientGetRoom.CreateRoomMode.requestFromOwner) {
return;
}
try {
G.handler.post(new Runnable() {
@Override
public void run() {
if (existAvatar) {
showProgressBar();
if (room.getType() == ProtoGlobal.Room.Type.GROUP) {
new RequestGroupAvatarAdd().groupAvatarAdd(roomId, token);
} else {
new RequestChannelAvatarAdd().channelAvatarAdd(roomId, token);
}
} else {
hideProgressBar();
if (isGroup) {
createdRoomId.postValue(roomId);
} else {
goToContactGroupPage.setValue(new ContactGroupFragmentModel(roomId, room.getGroupRoomExtra().getParticipantsCountLimitLabel(), typeCreate.toString(), true));
}
}
}
});
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
@Override
public void onError(int majorCode, int minorCode) {
hideProgressBar();
}
@Override
public void onTimeOut() {
hideProgressBar();
}
};
new RequestClientGetRoom().clientGetRoom(roomId, RequestClientGetRoom.CreateRoomMode.requestFromOwner);
}
use of net.iGap.request.RequestGroupAvatarAdd in project iGap-Android by KianIranian-STDG.
the class EditGroupViewModel method uploadAvatar.
public void uploadAvatar(String path) {
long avatarId = SUID.id().get();
long lastUploadedAvatarId = avatarId + 1L;
Uploader.getInstance().upload(UploadObject.createForAvatar(lastUploadedAvatarId, path, null, ProtoGlobal.RoomMessageType.IMAGE, new OnUploadListener() {
@Override
public void onProgress(String id, int progress) {
showUploadProgressLiveData.postValue(View.VISIBLE);
}
@Override
public void onFinish(String id, String token) {
new RequestGroupAvatarAdd().groupAvatarAdd(roomId, token);
}
@Override
public void onError(String id) {
showUploadProgressLiveData.postValue(View.GONE);
}
}));
}
Aggregations