Commit 3d50d345 authored by Ghislain MARY's avatar Ghislain MARY

Add popup to ask confirmation to the user when the remote party adds video and...

Add popup to ask confirmation to the user when the remote party adds video and the automatically accept policy is not set.
parent 34533cc5
......@@ -30,6 +30,16 @@ namespace Linphone
void PauseStateChanged(LinphoneCall call, bool isCallPaused);
}
public interface CallUpdatedByRemoteListener
{
/// <summary>
/// Called when the call is updated by the remote party.
/// </summary>
/// <param name="call">The call that has been updated</param>
/// <param name="isVideoAdded">A boolean telling whether the remote party added video</param>
void CallUpdatedByRemote(LinphoneCall call, bool isVideoAdded);
}
/// <summary>
/// Model view for each page implementing the call controller listener to adjust displayed page depending on call events.
/// </summary>
......@@ -45,6 +55,11 @@ namespace Linphone
/// </summary>
public PauseChangedListener PauseListener { get; set; }
/// <summary>
/// Specific listener for any view which want to be notifiedd when the call is updated by the remote party.
/// </summary>
public CallUpdatedByRemoteListener CallUpdatedByRemoteListener { get; set; }
/// <summary>
/// Public constructor.
/// </summary>
......@@ -110,6 +125,17 @@ namespace Linphone
this.PauseListener.PauseStateChanged(call, isCallPaused);
}
/// <summary>
/// Called when the call is updated by the remote party.
/// </summary>
/// <param name="call">The call that has been updated</param>
/// <param name="isVideoAdded">A boolean telling whether the remote party added video</param>
public void CallUpdatedByRemote(LinphoneCall call, bool isVideoAdded)
{
if (this.CallUpdatedByRemoteListener != null)
this.CallUpdatedByRemoteListener.CallUpdatedByRemote(call, isVideoAdded);
}
/// <summary>
/// Actualises the listener when the pages changes.
/// </summary>
......

using Linphone.Core;
using Linphone.Core;
namespace Linphone.Model
{
......@@ -26,6 +25,13 @@ namespace Linphone.Model
/// <summary>
/// Called when the call changes its state to paused or resumed.
/// </summary>
void PauseStateChanged(LinphoneCall call, bool isCallPaused);
void PauseStateChanged(LinphoneCall call, bool isCallPaused);
/// <summary>
/// Called when the call is updated by the remote party.
/// </summary>
/// <param name="call">The call that has been updated</param>
/// <param name="isVideoAdded">A boolean telling whether the remote party added video</param>
void CallUpdatedByRemote(LinphoneCall call, bool isVideoAdded);
}
}
......@@ -685,6 +685,23 @@ namespace Linphone.Model
TileManager.Instance.UpdateTileWithMissedCalls(LinphoneCore.GetMissedCallsCount());
});
}
else if (state == LinphoneCallState.UpdatedByRemote)
{
Boolean videoAdded = false;
VideoPolicy policy = LinphoneManager.Instance.LinphoneCore.GetVideoPolicy();
LinphoneCallParams remoteParams = call.GetRemoteParams();
LinphoneCallParams localParams = call.GetCurrentParamsCopy();
if (!policy.AutomaticallyAccept && remoteParams.IsVideoEnabled() && !localParams.IsVideoEnabled() && !LinphoneManager.Instance.LinphoneCore.IsInConference())
{
LinphoneManager.Instance.LinphoneCore.DeferCallUpdate(call);
videoAdded = true;
}
BaseModel.UIDispatcher.BeginInvoke(() =>
{
if (CallListener != null)
CallListener.CallUpdatedByRemote(call, videoAdded);
});
}
}
/// <summary>
......
......@@ -849,6 +849,24 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Video activation.
/// </summary>
public static string VideoActivationPopupCaption {
get {
return ResourceManager.GetString("VideoActivationPopupCaption", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You have been proposed video, would you like to accept it?.
/// </summary>
public static string VideoActivationPopupContent {
get {
return ResourceManager.GetString("VideoActivationPopupContent", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Video enabled.
/// </summary>
......
......@@ -395,4 +395,10 @@ http://www.linphone.org/m/help
<data name="Video" xml:space="preserve">
<value>video</value>
</data>
<data name="VideoActivationPopupCaption" xml:space="preserve">
<value>Video activation</value>
</data>
<data name="VideoActivationPopupContent" xml:space="preserve">
<value>You have been proposed video, would you like to accept it?</value>
</data>
</root>
\ No newline at end of file
using Linphone.Core;
using Linphone.Model;
using Linphone.Resources;
using Microsoft.Xna.Framework.GamerServices;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
......@@ -15,7 +17,7 @@ namespace Linphone.Views
/// <summary>
/// InCall page, displayed for both incoming and outgoing calls.
/// </summary>
public partial class InCall : BasePage, MuteChangedListener, PauseChangedListener
public partial class InCall : BasePage, MuteChangedListener, PauseChangedListener, CallUpdatedByRemoteListener
{
private const string speakerOn = "/Assets/AppBar/speaker.png";
private const string speakerOff = "/Assets/AppBar/speaker.png";
......@@ -57,6 +59,7 @@ namespace Linphone.Views
base.OnNavigatedTo(nee);
this.ViewModel.MuteListener = this;
this.ViewModel.PauseListener = this;
this.ViewModel.CallUpdatedByRemoteListener = this;
if (NavigationContext.QueryString.ContainsKey("sip"))
{
......@@ -215,6 +218,34 @@ namespace Linphone.Views
}
}
/// <summary>
/// Called when the call is updated by the remote party.
/// </summary>
/// <param name="call">The call that has been updated</param>
/// <param name="isVideoAdded">A boolean telling whether the remote party added video</param>
public void CallUpdatedByRemote(LinphoneCall call, bool isVideoAdded)
{
if (isVideoAdded)
{
Guide.BeginShowMessageBox(AppResources.VideoActivationPopupCaption,
AppResources.VideoActivationPopupContent,
new List<String> { "Accept", "Dismiss" },
0,
MessageBoxIcon.Alert,
asyncResult =>
{
int? res = Guide.EndShowMessageBox(asyncResult);
LinphoneCallParams parameters = call.GetCurrentParamsCopy();
if (res == 0)
{
parameters.EnableVideo(true);
}
LinphoneManager.Instance.LinphoneCore.AcceptCallUpdate(call, parameters);
},
null);
}
}
private void timerTick(Object state)
{
try
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment