Commit a857dba2 authored by Margaux Clerc's avatar Margaux Clerc

Add upload/send log from settings

parent da417060
[net]
download_bw=380
upload_bw=380
firewall_policy=0
[sip]
default_proxy=0
......
......@@ -25,6 +25,7 @@ using System.Threading.Tasks;
using System.Xml.Linq;
using Windows.Storage;
using BelledonneCommunications.Linphone.Native;
using Windows.ApplicationModel.Email;
namespace Linphone.Model
{
......@@ -74,15 +75,17 @@ namespace Linphone.Model
return false;
}
internal static void ReportExceptions(string url)
internal static async void ReportExceptions(string url)
{
Debug.WriteLine(url);
try
{
/* string subject = "Logs report";
string subject = "Logs report";
string body = "";
body += "Version of the app: " + Core.Version;
body += "\r\n--------------------\r\n";
Debug.WriteLine(IsolatedStorageFile.GetUserStoreForApplication().ToString());
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
if (store.FileExists(exceptionsFileName))
......@@ -97,17 +100,18 @@ namespace Linphone.Model
if (url != "")
{
body += "\r\n" + url;
}*/
/* EmailComposeTask email = new EmailComposeTask();
email.To = "linphone-wphone@belledonne-communications.com";
email.Subject = subject;
email.Body = body;
email.Show();*/
}
var emailMessage = new EmailMessage();
emailMessage.Body = body;
emailMessage.Subject = subject;
emailMessage.To.Add(new EmailRecipient("linphone-wphone@belledonne-communications.com"));
await EmailManager.ShowComposeNewEmailAsync(emailMessage);
DeleteFile();
}
catch (Exception) { }
}
internal static void DeleteFile()
{
try
......
......@@ -51,6 +51,7 @@ namespace Linphone.Model
{
if (_core == null)
{
EnableLogCollection(true);
LpConfig config = new LpConfig(GetConfigPath(),GetFactoryConfigPath());
_core = new Core(this, config);
}
......@@ -135,6 +136,13 @@ namespace Linphone.Model
LinphoneManager.Instance.Core.IsIterateEnabled = true;
}
public void EnableLogCollection(bool enable)
{
Core.LogCollectionEnabled = enable ? LogCollectionState.EnabledWithoutPreviousLogHandler : LogCollectionState.Disabled;
Core.LogCollectionPath = ApplicationData.Current.LocalFolder.Path;
}
public void AddPushInformationsToContactParams()
{
if (Core.DefaultProxyConfig != null && channel != null)
......@@ -694,10 +702,15 @@ namespace Linphone.Model
void CoreListener.LogCollectionUploadProgressIndication(int offset, int total)
{
if (LogUploadProgressIndicationEH != null)
if (CoreDispatcher == null) return;
#pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
CoreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
LogUploadProgressIndicationEH(offset, total);
}
if (LogUploadProgressIndicationEH != null)
{
LogUploadProgressIndicationEH(offset, total);
}
});
}
void CoreListener.LogCollectionUploadStateChanged(LogCollectionUploadState state, string info)
......
......@@ -194,7 +194,7 @@ namespace Linphone.Model
try
{
Config.SetInt(ApplicationSection, LogLevelKeyName, Convert.ToInt32(GetNew(LogLevelKeyName)));
//LinphoneManager.Instance.ConfigureLogger();
LinphoneManager.Instance.ConfigureLog(LogLevel);
}
catch
{
......
......@@ -136,7 +136,7 @@
<StackPanel
x:Name="BugReportUploadPopup"
Grid.RowSpan="2"
Background="Black"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Visibility="Collapsed">
......
......@@ -21,6 +21,7 @@ using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using Windows.ApplicationModel.Resources;
using Windows.UI.Xaml;
using BelledonneCommunications.Linphone.Native;
namespace Linphone.Views
{
......@@ -109,8 +110,7 @@ namespace Linphone.Views
_settings.DebugEnabled = (bool)Debug.IsOn;
_settings.Save();
//LinphoneManager.Instance.ConfigureLogger();
}
/// <summary>
......@@ -128,8 +128,8 @@ namespace Linphone.Views
protected override void OnNavigatedFrom(NavigationEventArgs nee)
{
base.OnNavigatedFrom(nee);
// LinphoneManager.Instance.LogUploadProgressIndicationEH -= LogUploadProgressIndication;
// BugReportUploadPopup.Visibility = Visibility.Collapsed;
LinphoneManager.Instance.LogUploadProgressIndicationEH -= LogUploadProgressIndication;
BugReportUploadPopup.Visibility = Visibility.Collapsed;
}
/// <summary>
......@@ -169,42 +169,39 @@ namespace Linphone.Views
}
private void LogUploadProgressIndication(int offset, int total)
{
/* BaseModel.UIDispatcher.BeginInvoke(() =>
{
BugReportUploadProgressBar.Maximum = total;
if (offset <= total)
{
BugReportUploadProgressBar.Maximum = total;
if (offset <= total)
{
BugReportUploadProgressBar.Value = offset;
}
});*/
BugReportUploadProgressBar.Value = offset;
}
}
private void SendLogs_Click(object sender, RoutedEventArgs e)
{
saveSettingsOnLeave = false;
//BugReportUploadPopup.Visibility = Visibility.Visible;
//LinphoneManager.Instance.LogUploadProgressIndicationEH += LogUploadProgressIndication;
//LinphoneManager.Instance.LinphoneCore.UploadLogCollection();
BugReportUploadPopup.Visibility = Visibility.Visible;
LinphoneManager.Instance.LogUploadProgressIndicationEH += LogUploadProgressIndication;
LinphoneManager.Instance.Core.UploadLogCollection();
}
private void Debug_Checked(object sender, RoutedEventArgs e)
{
//_settings.LogLevel = OutputTraceLevel.Message;
//SendLogs.IsEnabled = true;
//ResetLogs.IsEnabled = true;
_settings.LogLevel = OutputTraceLevel.Message;
SendLogs.IsEnabled = true;
ResetLogs.IsEnabled = true;
}
private void Debug_Unchecked(object sender, RoutedEventArgs e)
{
//_settings.LogLevel = OutputTraceLevel.None;
//SendLogs.IsEnabled = false;
//ResetLogs.IsEnabled = false;
_settings.LogLevel = OutputTraceLevel.None;
SendLogs.IsEnabled = false;
ResetLogs.IsEnabled = false;
}
private void ResetLogs_Click(object sender, RoutedEventArgs e)
{
//LinphoneManager.Instance.LinphoneCoreFactory.ResetLogCollection();
LinphoneManager.Instance.resetLogCollection();
}
}
}
\ No newline at end of file
......@@ -87,7 +87,7 @@
</Grid.ColumnDefinitions>
<SwapChainPanel x:Name="VideoSwapChainPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Grid.RowSpan="3"/>
<SwapChainPanel x:Name="PreviewSwapChainPanel" Grid.Column="2" Grid.Row="3" RenderTransformOrigin="0.5,0.5">
<SwapChainPanel x:Name="PreviewSwapChainPanel" Grid.Column="2" Grid.Row="3" Width="120" Height="160" RenderTransformOrigin="0.5,0.5">
<SwapChainPanel.RenderTransform>
<CompositeTransform ScaleX="-1"/>
</SwapChainPanel.RenderTransform>
......
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