# Vivox Event Callbacks

### Login Setup

Callback that requests Android/iOS mic Permission and chooses the Text-To-Speech Voice for the current login session

```csharp
    private void OnLoggedInSetup(ILoginSession loginSession)
    {
        EasyVivoxUtilities.RequestAndroidMicPermission();
        EasyVivoxUtilities.RequestIOSMicrophoneAccess();
        ChooseVoiceGender(_settings.VoiceGender, loginSession);
    }
```



The rest are pretty self-explanatory so making nicer docs for this is not a priority at the moment

```csharp
    #region Login / Logout Callbacks


    protected virtual void OnLoggingIn(ILoginSession loginSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"Logging In : {loginSession.LoginSessionId.DisplayName}");
    }

    protected virtual void OnLoggedIn(ILoginSession loginSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"Logged in : {loginSession.LoginSessionId.DisplayName}  : Presence = {loginSession.Presence.Status}");
    }

    protected virtual void OnLoggingOut(ILoginSession loginSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"Logging out : {loginSession.LoginSessionId.DisplayName}  : Presence = {loginSession.Presence.Status}");
    }

    protected virtual void OnLoggedOut(ILoginSession loginSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"Logged out : {loginSession.LoginSessionId.DisplayName}  : Presence = {loginSession.Presence.Status}");
    }



    private void OnLoggedInSetup(ILoginSession loginSession)
    {
        EasyVivoxUtilities.RequestAndroidMicPermission();
        EasyVivoxUtilities.RequestIOSMicrophoneAccess();
        ChooseVoiceGender(_settings.VoiceGender, loginSession);
    }


    // todo add Extra/Multiple Login callbacks to EasyLogin

    protected virtual void OnLoginAdded(AccountId accountId)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"LoginSession Added : For user {accountId.Name}");
    }

    protected virtual void OnLoginRemoved(AccountId accountId)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"Login Removed : For user {accountId}");
    }

    protected virtual void OnLoginUpdated(ILoginSession loginSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"LoginSession has been Updated : {loginSession.LoginSessionId.DisplayName} : Presence = {loginSession.Presence.Status}");
    }


    #endregion


    #region Audio / Text / Channel Callbacks


    protected virtual void OnChannelConnecting(IChannelSession channelSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{channelSession.Channel.Name} Is Connecting");
    }

    protected virtual void OnChannelConnected(IChannelSession channelSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
        {
            Debug.Log($"{channelSession.Channel.Name} Has Connected");
            Debug.Log($"Channel Type == {channelSession.Channel.Type}");
        }
    }

    protected virtual void OnChannelDisconnecting(IChannelSession channelSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{channelSession.Channel.Name} Is Disconnecting");
    }

    protected virtual void OnChannelDisconnected(IChannelSession channelSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{channelSession.Channel.Name} Has Disconnected");
        _channel.RemoveChannelSession(channelSession.Channel.Name);
    }



protected virtual void OnAudioChannelConnecting(IChannelSession channelSession)
{
    if (_settings.LogEasyManagerEventCallbacks)
        Debug.Log($"{channelSession.Channel.Name} Audio Is Connecting In Channel");
}

protected virtual void OnAudioChannelConnected(IChannelSession channelSession)
{
    if (_settings.LogEasyManagerEventCallbacks)
        Debug.Log($"{channelSession.Channel.Name} Audio Has Connected In Channel");
}

protected virtual void OnAudioChannelDisconnecting(IChannelSession channelSession)
{
    if (_settings.LogEasyManagerEventCallbacks)
        Debug.Log($"{channelSession.Channel.Name} Audio Is Disconnecting In Channel");
}

protected virtual void OnAudioChannelDisconnected(IChannelSession channelSession)
{
    if (_settings.LogEasyManagerEventCallbacks)
        Debug.Log($"{channelSession.Channel.Name} Audio Has Disconnected In Channel");
}




    protected virtual void OnTextChannelConnecting(IChannelSession channelSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{channelSession.Channel.Name} Text Is Connecting In Channel");
    }

    protected virtual void OnTextChannelConnected(IChannelSession channelSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{channelSession.Channel.Name} Text Has Connected In Channel");
    }

    protected virtual void OnTextChannelDisconnecting(IChannelSession channelSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{channelSession.Channel.Name} Text Is Disconnecting In Channel");
    }

    protected virtual void OnTextChannelDisconnected(IChannelSession channelSession)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{channelSession.Channel.Name} Text Has Disconnected In Channel");
    }



    #endregion


    #region Local User Mute Callbacks

    protected virtual void OnLocalUserMuted()
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log("Local User is Muted");
    }

    protected virtual void OnLocalUserUnmuted()
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log("Local User is Unmuted");
    }

    #endregion

    #region User Callbacks


    protected virtual void OnUserJoinedChannel(IParticipant participant)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{participant.Account.DisplayName} Has Joined The Channel");
    }

    protected virtual void OnUserLeftChannel(IParticipant participant)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{participant.Account.DisplayName} Has Left The Channel");

    }

    protected virtual void OnUserValuesUpdated(IParticipant participant)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{participant.Account.DisplayName} Has updated itself in the channel");

    }

    protected virtual void OnUserMuted(IParticipant participant)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{participant.Account.DisplayName} Is Muted : (Muted For All : {participant.IsMutedForAll})");

    }

    protected virtual void OnUserUnmuted(IParticipant participant)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{participant.Account.DisplayName} Is Unmuted : (Muted For All : {participant.IsMutedForAll})");

    }

    protected virtual void OnUserSpeaking(IParticipant participant)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{participant.Account.DisplayName} Is Speaking : Audio Energy {participant.AudioEnergy}");

    }

    protected virtual void OnUserNotSpeaking(IParticipant participant)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"{participant.Account.DisplayName} Is Not Speaking");
    }


    #endregion


    #region Message Callbacks


    protected virtual void OnChannelMessageRecieved(IChannelTextMessage textMessage)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"From {textMessage.Sender.DisplayName} : {textMessage.ReceivedTime} : {textMessage.Message}");
    }

    protected virtual void OnEventMessageRecieved(IChannelTextMessage textMessage)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"Event Message From {textMessage.Sender.DisplayName} : {textMessage.ReceivedTime} : {textMessage.ApplicationStanzaNamespace} : {textMessage.ApplicationStanzaBody} : {textMessage.Message}");
    }

    protected virtual void OnDirectMessageRecieved(IDirectedTextMessage directedTextMessage)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"Recived Message From : {directedTextMessage.Sender.DisplayName} : {directedTextMessage.ReceivedTime} : {directedTextMessage.Message}");
    }

    protected virtual void OnDirectMessageFailed(IFailedDirectedTextMessage failedMessage)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"Failed To Send Message From : {failedMessage.Sender}");
    }




    #endregion


    #region Text-to-Speech Callbacks

    protected virtual void OnTTSMessageAdded(ITTSMessageQueueEventArgs ttsArgs)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"TTS Message Has Been Added : {ttsArgs.Message.Text}");
    }

    protected virtual void OnTTSMessageRemoved(ITTSMessageQueueEventArgs ttsArgs)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"TTS Message Has Been Removed : {ttsArgs.Message.Text}");
    }

    protected virtual void OnTTSMessageUpdated(ITTSMessageQueueEventArgs ttsArgs)
    {
        if (_settings.LogEasyManagerEventCallbacks)
            Debug.Log($"TTS Message Has Been Updated : {ttsArgs.Message.Text}");
    }


    #endregion
```
