Search in sources :

Example 1 with RequestChannelAvatarAdd

use of net.iGap.request.RequestChannelAvatarAdd 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);
}
Also used : RequestChannelAvatarAdd(net.iGap.request.RequestChannelAvatarAdd) ProtoGlobal(net.iGap.proto.ProtoGlobal) OnClientGetRoomResponse(net.iGap.observers.interfaces.OnClientGetRoomResponse) RequestClientGetRoom(net.iGap.request.RequestClientGetRoom) OnClientGetRoomResponse(net.iGap.observers.interfaces.OnClientGetRoomResponse) RequestGroupAvatarAdd(net.iGap.request.RequestGroupAvatarAdd)

Aggregations

OnClientGetRoomResponse (net.iGap.observers.interfaces.OnClientGetRoomResponse)1 ProtoGlobal (net.iGap.proto.ProtoGlobal)1 RequestChannelAvatarAdd (net.iGap.request.RequestChannelAvatarAdd)1 RequestClientGetRoom (net.iGap.request.RequestClientGetRoom)1 RequestGroupAvatarAdd (net.iGap.request.RequestGroupAvatarAdd)1