Search in sources :

Example 1 with Inviter

use of com.fanap.podchat.mainmodel.Inviter in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method replyFileMessage.

private void replyFileMessage() {
    String messageContent = "Hello! just be happy!! : ) ";
    long threadId = TEST_THREAD_ID;
    long messageId = 114334;
    Uri fileUri = getUri();
    Inviter inviter = new Inviter();
    inviter.setName("Sample Name for meta data test");
    String meta = gson.toJson(inviter);
    RequestReplyFileMessage fileMessage = new RequestReplyFileMessage.Builder(messageContent, threadId, messageId, fileUri, this, // required
    TextMessageType.Constants.POD_SPACE_PICTURE).systemMetaData(meta).setUserGroupHashCode(// required
    TEST_THREAD_HASH).setImageHc("200").setImageWc("100").setImageXc("5").setImageYc("5").build();
    presenter.replyFileMessage(fileMessage, new ProgressHandler.sendFileMessage() {

        @Override
        public void onProgressUpdate(String uniqueId, int progress, int totalBytesSent, int totalBytesToSend) {
            Log.e("CHAT_SDK_UPLOAD", "Progress %" + progress);
        }
    });
}
Also used : Inviter(com.fanap.podchat.mainmodel.Inviter) ProgressHandler(com.fanap.podchat.ProgressHandler) RequestReplyFileMessage(com.fanap.podchat.requestobject.RequestReplyFileMessage) Uri(android.net.Uri)

Example 2 with Inviter

use of com.fanap.podchat.mainmodel.Inviter in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method editMessage.

private void editMessage() {
    Inviter inviter = new Inviter();
    inviter.setName("farhad");
    // String meta = "\"{\\\"actionType\\\":1,\\\"data\\\":\\\"{\\\"amount\\\":1500,\\\"description\\\":\\\"\\\",\\\"id\\\":161,\\\"state\\\":2,\\\"destUserId\\\":1900896}\\\"}\"";
    JsonObject a = new JsonObject();
    // 
    a.addProperty("actionType", 7);
    a.addProperty("amount", 12);
    a.addProperty("id", 161);
    a.addProperty("state", 2);
    a.addProperty("destUserId", 1900897);
    // a.addProperty("name", "farhad");
    // a.addProperty("family", "kheirkhah");
    // a.addProperty("phoneNumber", "989157770684");
    String meta = gson.toJson(a);
    // message id
    presenter.editMessage(// message id
    TEST_THREAD_ID, // message new content
    "1111", meta, null);
}
Also used : Inviter(com.fanap.podchat.mainmodel.Inviter) JsonObject(com.google.gson.JsonObject)

Example 3 with Inviter

use of com.fanap.podchat.mainmodel.Inviter in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method createThread.

private void createThread() {
    /**
     * int TO_BE_USER_SSO_ID = 1;
     * int TO_BE_USER_CONTACT_ID = 2;
     * int TO_BE_USER_CELLPHONE_NUMBER = 3;
     * int TO_BE_USER_USERNAME = 4;
     * int TO_BE_USER_ID = 5; // just for p2p
     */
    /**
     *"create thread"
     * This is Invitee object
     * ---->private int id;
     * ---->private int idType;
     *
     * createThreadTypes = {
     *NORMAL: 0,
     *OWNER_GROUP: 1,
     *PUBLIC_GROUP: 2,
     *CHANNEL_GROUP: 4,
     *CHANNEL: 8
     *       }
     */
    // Invitee[] invite = new Invitee[]{
    // new Invitee(2951, 2)
    // , new Invitee(1967, 2)
    // ,new Invitee(123, 5)
    // , new Invitee(824, 2)
    // };
    /**
     * CHANNEL_GROUP: 4,
     */
    // Invitee[] invite = new Invitee[]{
    // //       new Invitee(3361, 2)
    // //       , new Invitee(3102, 2)
    // //       new Invitee(091, 1),
    // //       new Invitee("22835", InviteType.Constants.TO_BE_USER_CONTACT_ID),
    // new Invitee("29782", InviteType.Constants.TO_BE_USER_CONTACT_ID),
    // //       new Invitee("27774", InviteType.Constants.TO_BE_USER_CONTACT_ID),
    // //       new Invitee("22835", InviteType.Constants.TO_BE_USER_CONTACT_ID),
    // //       new Invitee(5638, 2),
    // //       new Invitee("z.mohammadi", InviteType.Constants.TO_BE_USER_USERNAME),
    // //      new Invitee("p.khoshghadam", InviteType.Constants.TO_BE_USER_USERNAME),
    // //      new Invitee("m.hasanpour", InviteType.Constants.TO_BE_USER_USERNAME),
    // //      new Invitee("z.ershad", InviteType.Constants.TO_BE_USER_USERNAME),
    // //      new Invitee("samira.amiri", InviteType.Constants.TO_BE_USER_USERNAME),
    // //      new Invitee("s.heydarizadeh", InviteType.Constants.TO_BE_USER_USERNAME),
    // //      new Invitee("p.pahlavani", InviteType.Constants.TO_BE_USER_USERNAME),
    // //      new Invitee("ma.amjadi", InviteType.Constants.TO_BE_USER_USERNAME),
    // //       new Invitee(5638, 2),
    // };
    Inviter inviterw = new Inviter();
    inviterw.setName("this is sample metadata");
    String metac = gson.toJson(inviterw);
    List<Invitee> invite = new ArrayList<>();
    // add by user SSO_ID
    // invite.add(new Invitee(122, 1));  //user jiji
    // invite.add(new Invitee("121", 1)); // user zizi
    // invite.add(new Invitee("63270", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // invite.add(new Invitee("63271", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // integration users
    // invite.add(new Invitee("63256", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // invite.add(new Invitee("63255", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // invite.add(new Invitee("63253", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // sand box users
    // 52620 farhad
    // 52979 masoud
    // 52987 khodam
    // invite.add(new Invitee("52620", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    invite.add(new Invitee("63254", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // invite.add(new Invitee("52987", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // invite.add(new Invitee("1", InviteType.Constants.TO_BE_USER_ID)); //amjadi
    // invite.add(new Invitee("80618", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // invite.add(new Invitee(9981084527L, 3)); zizi cellphone
    // invite.add(new Invitee(123, 5)); //user fifi
    // invite.add(new Invitee(121, 5)); // user zizi
    // invite.add(new Invitee(122, 1));  //user jiji
    RequestUploadImage requestUploadImage = new RequestUploadImage.Builder(ChatActivity.this, getUri()).sethC(140).setwC(140).build();
    RequestCreateThread requestCreateThread = new RequestCreateThread.Builder(ThreadType.Constants.NORMAL, invite).title("Test Thread ByAhmad" + (new Date().getTime() / 1000)).build();
    presenter.createThread(requestCreateThread);
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) RequestUploadImage(com.fanap.podchat.requestobject.RequestUploadImage) Inviter(com.fanap.podchat.mainmodel.Inviter) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) RequestCreateThread(com.fanap.podchat.requestobject.RequestCreateThread) Date(java.util.Date)

Aggregations

Inviter (com.fanap.podchat.mainmodel.Inviter)3 Uri (android.net.Uri)1 ProgressHandler (com.fanap.podchat.ProgressHandler)1 Invitee (com.fanap.podchat.mainmodel.Invitee)1 RequestCreateThread (com.fanap.podchat.requestobject.RequestCreateThread)1 RequestReplyFileMessage (com.fanap.podchat.requestobject.RequestReplyFileMessage)1 RequestUploadImage (com.fanap.podchat.requestobject.RequestUploadImage)1 GsonBuilder (com.google.gson.GsonBuilder)1 JsonObject (com.google.gson.JsonObject)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1