diff --git a/ImprimirPolizas/App.config b/ImprimirPolizas/App.config index 193aecc..7eae298 100644 --- a/ImprimirPolizas/App.config +++ b/ImprimirPolizas/App.config @@ -1,6 +1,18 @@ - + + + + + + + + + + + + + \ No newline at end of file diff --git a/ImprimirPolizas/ImprimirPolizas.csproj b/ImprimirPolizas/ImprimirPolizas.csproj index 3e2be31..1627d78 100644 --- a/ImprimirPolizas/ImprimirPolizas.csproj +++ b/ImprimirPolizas/ImprimirPolizas.csproj @@ -74,6 +74,15 @@ ..\packages\BouncyCastle.1.8.9\lib\BouncyCastle.Crypto.dll + + ..\packages\Coroutine.NET.1.4.0\lib\netstandard2.0\Coroutine.NET.dll + + + ..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + ..\packages\Microsoft.Web.WebView2.1.0.1823.32\lib\net45\Microsoft.Web.WebView2.Core.dll @@ -90,11 +99,81 @@ ..\packages\PdfiumViewer.2.13.0.0\lib\net20\PdfiumViewer.dll + + ..\packages\Segment.Analytics.CSharp.2.3.4\lib\netstandard2.0\Segment.Analytics.CSharp.dll + + + ..\packages\Serialization.NET.1.4.0\lib\netstandard2.0\Serialization.NET.dll + + + ..\packages\Sovran.NET.1.4.0\lib\netstandard2.0\Sovran.NET.dll + ..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + True + + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + True + True + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + True + True + + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll + True + True + + + ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + + + ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + True + True + + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + True + True + + + ..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll + + + ..\packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + @@ -102,7 +181,6 @@ - diff --git a/ImprimirPolizas/Properties/AssemblyInfo.cs b/ImprimirPolizas/Properties/AssemblyInfo.cs index f2448c8..0e15c03 100644 --- a/ImprimirPolizas/Properties/AssemblyInfo.cs +++ b/ImprimirPolizas/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.2.0")] -[assembly: AssemblyFileVersion("1.1.2.0")] +[assembly: AssemblyVersion("1.1.3.0")] +[assembly: AssemblyFileVersion("1.1.3.0")] diff --git a/ImprimirPolizas/ScTools.cs b/ImprimirPolizas/ScTools.cs index 7803cdb..9828b52 100644 --- a/ImprimirPolizas/ScTools.cs +++ b/ImprimirPolizas/ScTools.cs @@ -26,7 +26,7 @@ public enum DownloadOpt policy = 1, policyCard = 2, paymentTC = 3, - paymentProof = 5, + paymentReceipt = 5, coupons = 6, invoice = 7, } @@ -99,7 +99,7 @@ public static string GetFileName(string pcNumber, DownloadOpt opt) case DownloadOpt.policy: fileName += "FrentePoliza.pdf"; break; - case DownloadOpt.paymentProof: + case DownloadOpt.paymentReceipt: fileName += "ComprobantePago.pdf"; break; case DownloadOpt.policyCard: @@ -146,7 +146,7 @@ public static string GetOptionName(DownloadOpt opt) { case ScTools.DownloadOpt.policy: return "Frente de póliza"; - case ScTools.DownloadOpt.paymentProof: + case ScTools.DownloadOpt.paymentReceipt: return "Comprobante de pago"; case ScTools.DownloadOpt.policyCard: return "Tarjeta Seguro Obligatorio"; diff --git a/ImprimirPolizas/frmMain.cs b/ImprimirPolizas/frmMain.cs index b961dfa..10f3997 100644 --- a/ImprimirPolizas/frmMain.cs +++ b/ImprimirPolizas/frmMain.cs @@ -7,7 +7,11 @@ using System.Runtime.CompilerServices; using System.Threading.Tasks; using System.Windows.Forms; +using Newtonsoft.Json.Linq; using PdfiumViewer; +using Segment.Analytics; +using Segment.Serialization; +using static ImprimirPolizas.ScTools; namespace ImprimirPolizas { @@ -21,6 +25,10 @@ private enum IconState Ready = 1, Error = 2, } + static readonly Configuration SegmentConfig = new Configuration("3agF8DVa82eZaBk1GYxaiYqhAi2f9fv1", + flushAt: 20, + flushInterval: 30); + Analytics analytics = new Analytics(SegmentConfig); public frmMain() { @@ -29,6 +37,7 @@ public frmMain() private void Form1_Load(object sender, EventArgs e) { + analytics.Track("app_open"); EnableWhenReady(); // Verificar disponibilidad servidor // Habilitar opciones iniciales options[0] = (int)ScTools.DownloadOpt.policy; @@ -225,6 +234,7 @@ private async void BtnPrint_Click(object sender, EventArgs e) SetIconStatus(opt, IconState.Ready); // Se actualizan las estadísticas pero sin esperar respuesta _ = ScTools.UpdateStats(opt == ScTools.DownloadOpt.policy, rbPrint.Checked); + TrackAction(opt, rbPrint.Checked); // Send Analytics } catch (Exception ex) { @@ -268,7 +278,7 @@ private void SetIconStatus(ScTools.DownloadOpt opt, IconState icon) case ScTools.DownloadOpt.policyCard: pbCard.Image = img; break; - case ScTools.DownloadOpt.paymentProof: + case ScTools.DownloadOpt.paymentReceipt: pbPayment.Image = img; break; case ScTools.DownloadOpt.coupons: @@ -362,7 +372,7 @@ private void ChkPaymentProof_CheckedChanged(object sender, EventArgs e) EnableBtnPrint(); if (chkPaymentProof.Checked) { - options[2] = (int)ScTools.DownloadOpt.paymentProof; + options[2] = (int)ScTools.DownloadOpt.paymentReceipt; } else { @@ -416,6 +426,7 @@ private void FrmMain_FormClosed(object sender, FormClosedEventArgs e) private void LnkDownloads_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { + analytics.Track("btn_download_click"); OpenDownloadsFolder(); } @@ -445,5 +456,42 @@ private void chkInvoice_CheckedChanged(object sender, EventArgs e) } } + private void TrackAction(ScTools.DownloadOpt opt, bool isPrinting) + { + string eventName = isPrinting ? "print_" : "download_"; + eventName += GetDocName(opt); + analytics.Track(eventName, new JsonObject + { + ["document"] = GetDocName(opt), + }); + } + + private string GetDocName(ScTools.DownloadOpt opt) + { + string docName; + switch (opt) + { + case DownloadOpt.policy: + docName = "policy"; + break; + case DownloadOpt.paymentReceipt: + docName = "paymentReceipt"; + break; + case DownloadOpt.policyCard: + docName = "policyCard"; + break; + case DownloadOpt.coupons: + docName = "coupons"; + break; + case DownloadOpt.invoice: + docName = "invoice"; + break; + default: + docName = "unknown"; + break; + } + return docName; + } + } } diff --git a/ImprimirPolizas/packages.config b/ImprimirPolizas/packages.config index 0820a54..6a3b783 100644 --- a/ImprimirPolizas/packages.config +++ b/ImprimirPolizas/packages.config @@ -2,9 +2,30 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/autoupdater.xml b/autoupdater.xml index f230bc4..e4865cd 100644 --- a/autoupdater.xml +++ b/autoupdater.xml @@ -1,6 +1,6 @@ - 1.1.2.0 - https://github.com/FacuMasino/imprimir-polizas-utility/releases/download/v1.1.2/ImprimirPolizasV1.1.2.zip + 1.1.3.0 + https://github.com/FacuMasino/imprimir-polizas-utility/releases/download/v1.1.3/ImprimirPolizasV1.1.3.zip true \ No newline at end of file