Search in sources :

Example 1 with VoiceChannel

use of com.waz.api.VoiceChannel in project wire-android by wireapp.

the class ScalaConversationStore method hasOngoingCallInCurrentConversation.

@Override
public boolean hasOngoingCallInCurrentConversation() {
    if (selectedConversation == null) {
        return false;
    }
    VoiceChannel voiceChannel = selectedConversation.getVoiceChannel();
    if (voiceChannel == null) {
        return false;
    }
    VoiceChannelState state = voiceChannel.getState();
    return state != VoiceChannelState.NO_ACTIVE_USERS && state != VoiceChannelState.UNKNOWN;
}
Also used : VoiceChannelState(com.waz.api.VoiceChannelState) VoiceChannel(com.waz.api.VoiceChannel)

Example 2 with VoiceChannel

use of com.waz.api.VoiceChannel in project wire-android by wireapp.

the class MainActivity method startCall.

private void startCall(final boolean withVideo) {
    final IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation();
    if (currentConversation == null) {
        return;
    }
    final VoiceChannel voiceChannel = currentConversation.getVoiceChannel();
    if (currentConversation.hasUnjoinedCall() && voiceChannel.isVideoCall() != withVideo) {
        ViewUtils.showAlertDialog(this, getString(R.string.calling__cannot_start__ongoing_different_kind__title, currentConversation.getName()), getString(R.string.calling__cannot_start__ongoing_different_kind__message), getString(R.string.calling__cannot_start__button), null, true);
        return;
    }
    if (currentConversation.getType() == IConversation.Type.GROUP && currentConversation.getUsers().size() >= 5) {
        int users = currentConversation.getUsers().size();
        ViewUtils.showAlertDialog(this, getString(R.string.group_calling_title), getString(R.string.group_calling_message, users), getString(R.string.group_calling_confirm), getString(R.string.group_calling_cancel), new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                injectJava(CallPermissionsController.class).startCall(new ConvId(voiceChannel.getConversation().getId()), withVideo);
            }
        }, null);
        return;
    } else {
        injectJava(CallPermissionsController.class).startCall(new ConvId(voiceChannel.getConversation().getId()), withVideo);
    }
}
Also used : CallPermissionsController(com.waz.zclient.calling.controllers.CallPermissionsController) DialogInterface(android.content.DialogInterface) VoiceChannel(com.waz.api.VoiceChannel) IConversation(com.waz.api.IConversation) ConvId(com.waz.model.ConvId) Paint(android.graphics.Paint)

Aggregations

VoiceChannel (com.waz.api.VoiceChannel)2 DialogInterface (android.content.DialogInterface)1 Paint (android.graphics.Paint)1 IConversation (com.waz.api.IConversation)1 VoiceChannelState (com.waz.api.VoiceChannelState)1 ConvId (com.waz.model.ConvId)1 CallPermissionsController (com.waz.zclient.calling.controllers.CallPermissionsController)1