mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 14:24:43 -07:00
Added App Center events for the export of screenshot, this only stored which export was used and no sensitive information.
This commit is contained in:
parent
59d00d8174
commit
51041f0f83
3 changed files with 39 additions and 4 deletions
|
@ -45,7 +45,7 @@ namespace Greenshot.Addons.Extensions
|
|||
/// Find the matching IDestination
|
||||
/// </summary>
|
||||
/// <param name="destinations">IEnumerable of IDestination</param>
|
||||
/// <param name="destination">strng with the destination</param>
|
||||
/// <param name="destination">string with the destination</param>
|
||||
/// <returns>IDestination or null</returns>
|
||||
public static IDestination Find(this IEnumerable<IDestination> destinations, string destination)
|
||||
{
|
||||
|
|
32
src/Greenshot/Helpers/AppCenterExtensions.cs
Normal file
32
src/Greenshot/Helpers/AppCenterExtensions.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System.Collections.Generic;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Microsoft.AppCenter.Analytics;
|
||||
|
||||
namespace Greenshot.Helpers
|
||||
{
|
||||
public static class AppCenterExtensions
|
||||
{
|
||||
public static void HandleAppCenterEvent(this ExportInformation exportInformation)
|
||||
{
|
||||
if (exportInformation == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (exportInformation.IsError)
|
||||
{
|
||||
Analytics.TrackEvent("ExportError", new Dictionary<string, string> {
|
||||
{ "DestinationDescription", exportInformation.DestinationDescription },
|
||||
{ "Destination", exportInformation.DestinationDesignation},
|
||||
{ "ErrorMessage", exportInformation.ErrorMessage}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Analytics.TrackEvent("Export", new Dictionary<string, string> {
|
||||
{ "DestinationDescription", exportInformation.DestinationDescription },
|
||||
{ "Destination", exportInformation.DestinationDesignation}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -433,11 +433,11 @@ namespace Greenshot.Helpers
|
|||
{
|
||||
if (filename.ToLower().EndsWith("." + OutputFormats.greenshot))
|
||||
{
|
||||
|
||||
var surface = ImageOutput.SurfaceFactory();
|
||||
surface = ImageOutput.LoadGreenshotSurface(filename, surface);
|
||||
surface.CaptureDetails = _capture.CaptureDetails;
|
||||
_destinationHolder.SortedActiveDestinations.Find("Editor")?.ExportCaptureAsync(true, surface, _capture.CaptureDetails).Wait();
|
||||
var exportInformation = _destinationHolder.SortedActiveDestinations.Find("Editor")?.ExportCaptureAsync(true, surface, _capture.CaptureDetails).Result;
|
||||
exportInformation.HandleAppCenterEvent();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -627,7 +627,9 @@ namespace Greenshot.Helpers
|
|||
|
||||
if (captureDetails.HasDestination(typeof(PickerDestination).GetDesignation()))
|
||||
{
|
||||
_destinationHolder.SortedActiveDestinations.Find(typeof(PickerDestination))?.ExportCaptureAsync(false, surface, captureDetails).Wait();
|
||||
var exportInformation = _destinationHolder.SortedActiveDestinations.Find(typeof(PickerDestination))?.ExportCaptureAsync(false, surface, captureDetails).Result;
|
||||
exportInformation.HandleAppCenterEvent();
|
||||
|
||||
captureDetails.CaptureDestinations.Clear();
|
||||
canDisposeSurface = false;
|
||||
}
|
||||
|
@ -652,6 +654,7 @@ namespace Greenshot.Helpers
|
|||
Log.Info().WriteLine("Calling destination {0}", destination.Description);
|
||||
|
||||
var exportInformation = destination.ExportCaptureAsync(false, surface, captureDetails).Result;
|
||||
exportInformation.HandleAppCenterEvent();
|
||||
if ("Editor".Equals(destination.Designation) && exportInformation.ExportMade)
|
||||
{
|
||||
canDisposeSurface = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue