Search in sources :

Example 11 with AbstractObject

use of net.iGap.network.AbstractObject in project iGap-Android by KianIranian-STDG.

the class MessageController method getStories.

public void getStories(int contactCount) {
    AbstractObject req = null;
    IG_RPC.Get_Stories get_stories = new IG_RPC.Get_Stories();
    get_stories.offset = 0;
    get_stories.limit = contactCount;
    req = get_stories;
    getRequestManager().sendRequest(req, (response, error) -> {
        if (error == null) {
            IG_RPC.Res_Get_Stories res = (IG_RPC.Res_Get_Stories) response;
            if (res.stories.size() > 0) {
                getMessageDataStorage().updateUserAddedStoryWithStoryObjects(res.stories);
            }
        } else {
        }
    });
}
Also used : IG_RPC(net.iGap.network.IG_RPC) AbstractObject(net.iGap.network.AbstractObject)

Example 12 with AbstractObject

use of net.iGap.network.AbstractObject in project iGap-Android by KianIranian-STDG.

the class MessageController method pinMessage.

public void pinMessage(long roomId, long messageId, long documentId, int chatType) {
    AbstractObject req = null;
    if (chatType == GROUP_VALUE) {
        IG_RPC.Group_pin_message group_pin_message = new IG_RPC.Group_pin_message();
        group_pin_message.roomId = roomId;
        group_pin_message.messageId = messageId;
        group_pin_message.documentId = documentId;
        req = group_pin_message;
    } else if (chatType == ProtoGlobal.Room.Type.CHANNEL_VALUE) {
        IG_RPC.Channel_pin_message channel_pin_message = new IG_RPC.Channel_pin_message();
        channel_pin_message.messageId = messageId;
        channel_pin_message.documentId = documentId;
        channel_pin_message.roomId = roomId;
        req = channel_pin_message;
    }
    getRequestManager().sendRequest(req, (response, error) -> {
        if (response != null) {
            onPinMessageResponse(response);
        } else {
            IG_RPC.Error err = (IG_RPC.Error) error;
            FileLog.e("Pin message -> Major: " + err.minor + " Minor: " + err.minor);
        }
    });
}
Also used : IG_RPC(net.iGap.network.IG_RPC) AbstractObject(net.iGap.network.AbstractObject)

Example 13 with AbstractObject

use of net.iGap.network.AbstractObject in project iGap-Android by KianIranian-STDG.

the class MessageController method deleteSelectedMessage.

public void deleteSelectedMessage(int roomType, long roomId, ArrayList<Long> messageIds, ArrayList<Long> documentIds, ArrayList<Long> bothMessageIds) {
    AbstractObject req = null;
    boolean bothDelete = false;
    for (int i = 0; i < messageIds.size(); i++) {
        if (bothMessageIds != null && bothMessageIds.contains(messageIds.get(i))) {
            bothDelete = true;
        }
        if (roomType == CHAT_VALUE) {
            IG_RPC.Chat_Delete_Message chat_delete_message = new IG_RPC.Chat_Delete_Message();
            chat_delete_message.roomId = roomId;
            chat_delete_message.messageId = messageIds.get(i);
            chat_delete_message.documentId = documentIds.get(i);
            chat_delete_message.both = bothDelete;
            req = chat_delete_message;
        } else if (roomType == GROUP_VALUE) {
            IG_RPC.Group_Delete_Message group_delete_message = new IG_RPC.Group_Delete_Message();
            group_delete_message.roomId = roomId;
            group_delete_message.messageId = messageIds.get(i);
            group_delete_message.documentId = documentIds.get(i);
            req = group_delete_message;
        } else if (roomType == ProtoGlobal.Room.Type.CHANNEL_VALUE) {
            IG_RPC.Channel_Delete_Message channel_delete_message = new IG_RPC.Channel_Delete_Message();
            channel_delete_message.roomId = roomId;
            channel_delete_message.messageId = messageIds.get(i);
            channel_delete_message.documentId = documentIds.get(i);
            req = channel_delete_message;
        }
        getRequestManager().sendRequest(req, (response, error) -> {
            if (response != null) {
                onDeleteMessageResponse(response, false);
            } else {
                IG_RPC.Error e = (IG_RPC.Error) error;
                FileLog.e("Delete Message -> Major:" + e.major + "Minor:" + e.minor);
            }
        });
    }
}
Also used : IG_RPC(net.iGap.network.IG_RPC) AbstractObject(net.iGap.network.AbstractObject)

Example 14 with AbstractObject

use of net.iGap.network.AbstractObject in project iGap-Android by KianIranian-STDG.

the class MessageController method addMyRoomStory.

public void addMyRoomStory(List<ProtoStoryUserAddNew.StoryAddRequest> storyObjects, long roomId) {
    isSendingRoomStory = true;
    HttpUploader.isMultiUpload = false;
    HttpUploader.isRoomMultiUpload = false;
    AbstractObject request = null;
    IG_RPC.Story_Room_Add_New story_room_add_new = new IG_RPC.Story_Room_Add_New();
    story_room_add_new.storyAddRequests = storyObjects;
    story_room_add_new.roomId = roomId;
    request = story_room_add_new;
    getRequestManager().sendRequest(request, (response, error) -> {
        if (error == null) {
            IG_RPC.Res_Story_Room_Add_New res = (IG_RPC.Res_Story_Room_Add_New) response;
            getMessageDataStorage().updateRoomAddedStory(res.stories);
            MessageController.isSendingRoomStory = false;
        } else {
            IG_RPC.Error err = (IG_RPC.Error) error;
            MessageController.isSendingRoomStory = false;
            G.runOnUiThread(() -> EventManager.getInstance(AccountManager.selectedAccount).postEvent(EventManager.STORY_UPLOADED_FAILED));
        }
    });
}
Also used : IG_RPC(net.iGap.network.IG_RPC) AbstractObject(net.iGap.network.AbstractObject)

Aggregations

AbstractObject (net.iGap.network.AbstractObject)14 IG_RPC (net.iGap.network.IG_RPC)14 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)6 RecyclerView (androidx.recyclerview.widget.RecyclerView)6 View (android.view.View)5 HelperFragment (net.iGap.helper.HelperFragment)5 RecyclerListView (net.iGap.module.customView.RecyclerListView)5 AnimatorSet (android.animation.AnimatorSet)3 Color (android.graphics.Color)3 Drawable (android.graphics.drawable.Drawable)3 Bundle (android.os.Bundle)3 Gravity (android.view.Gravity)3 ViewGroup (android.view.ViewGroup)3 FrameLayout (android.widget.FrameLayout)3 LinearLayout (android.widget.LinearLayout)3 IconView (net.iGap.messenger.ui.components.IconView)3 StatusTextFragment (net.iGap.story.StatusTextFragment)3 StoryPagerFragment (net.iGap.story.StoryPagerFragment)3 ValueAnimator (android.animation.ValueAnimator)2 Intent (android.content.Intent)2