ConnectyCube / android-messenger-app

Chat and voice / video calling app using ConnectyCube
https://connectycube.com
Apache License 2.0
51 stars 23 forks source link

Open new User chat #43

Closed vinayappypiellp closed 4 years ago

vinayappypiellp commented 4 years ago

Hi, Can we create new dialog with login or email only as i couldn't know occupantIds, with using roaster listener.?

TatankaConCube commented 4 years ago

@vinayappypiellp you need user id to create new chat dialog. As a solution, you can download user from server by login or e-mail, then download (or create) chat dialog by user id. Please add more information about your use-case and we will try to find better solution for it.

vinayappypiellp commented 4 years ago

@TatankaConCube , my use-case is, I receive user email from an api, and i need to start chat with the email.

TatankaConCube commented 4 years ago

@vinayappypiellp for your case use API to Retrieve user by email, then use

        RequestGetBuilder requestBuilder = new RequestGetBuilder();
        requestBuilder.setLimit(1);
        requestBuilder.in(Consts.DIALOG_OCCUPANTS, userId);

        ConnectycubeRestChatService.getChatDialogs(ConnectycubeDialogType.PRIVATE, requestBuilder).performAsync(new EntityCallback<ArrayList<ConnectycubeChatDialog>>() {
            @Override
            public void onSuccess(ArrayList<ConnectycubeChatDialog> dialogs, Bundle params) {
                ConnectycubeChatDialog targetDialog = dialogs.get(0); 
            }

            @Override
            public void onError(ResponseException exception) {

            }
        }); 

targetDialog - chat dialog which you can use for sending messages.

TatankaConCube commented 4 years ago

feel free to open other questions if you have