From dde7af5066a642280561bda5f963842b8454e955 Mon Sep 17 00:00:00 2001 From: Jose Alberto Guerra Ugalde Date: Fri, 26 Dec 2025 14:19:35 -0600 Subject: [PATCH] =?UTF-8?q?VERSION=205.12.16=20-=20Se=20agreg=C3=B3=20el?= =?UTF-8?q?=20codigo=20para=20los=20recordatorios=20a=20las=2013:00=20y=20?= =?UTF-8?q?a=20las=2014:00.=20-=20Se=20cambio=20el=20timer=20para=20la=20u?= =?UTF-8?q?bicacion=20en=20tiempo=20real=20a=205=20minutos=20(estaba=20en?= =?UTF-8?q?=2010=20seg)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B4A/B4XMainPage.bas | 12 +++++ B4A/C_Cliente.bas | 1 + B4A/C_Clientes.bas | 3 +- B4A/C_NoVenta.bas | 1 + B4A/C_NuevoCliente.bas | 1 + B4A/C_Principal.bas | 7 ++- B4A/C_Productos.bas | 1 + B4A/C_Productosdev.bas | 1 + B4A/C_Recordatorio.bas | 84 +++++++++++++++++++++++++++++++ B4A/C_TicketsDia.bas | 7 +-- B4A/Files/login.bal | Bin 22649 -> 22649 bytes B4A/Starter.bas | 26 +++++++++- B4A/TG.b4a | 37 +++++++------- B4A/TG.b4a.meta | 29 ++++++----- B4A/_git_tag.ps1 | 110 +++++++++++++++++++++++++++++++++++++++++ 15 files changed, 283 insertions(+), 37 deletions(-) create mode 100644 B4A/C_Recordatorio.bas create mode 100644 B4A/_git_tag.ps1 diff --git a/B4A/B4XMainPage.bas b/B4A/B4XMainPage.bas index c32a02b..a657422 100644 --- a/B4A/B4XMainPage.bas +++ b/B4A/B4XMainPage.bas @@ -18,6 +18,9 @@ Version=9.85 '###################### PUSH TORTOISE GIT ######################################################### 'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=TortoiseGitProc&Args=/command:commit&Args=/path:"./../../"&Args=/closeonend:2 '########################################################################################################### + '###################### PUSH TORTOISE GIT CON TAG ################################################## + 'Ctrl + clic para Git: ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=-ExecutionPolicy&Args=Bypass&Args=-File&Args=..\_git_tag.ps1&Args=%22%PROJECT%%22&Args=%22%PROJECT_NAME%%22 + '########################################################################################################### #End Region 'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=github&Args=..\..\ @@ -128,6 +131,8 @@ Sub Class_Globals Private B_Can_Monto As Button Private B_Aceptar_Monto As Button Private ET_Add_Monto As EditText + Dim recordatorio As C_Recordatorio + Dim pantallaActual As B4XView End Sub Public Sub Initialize @@ -177,6 +182,7 @@ Private Sub B4XPage_Created (Root1 As B4XView) ' B4XPages.AddPageAndCreate("respaldoDiario", respaldoDiario) ruta = Starter.ruta Provider.Initialize + recordatorio.Initialize(Root) ' Subs.borraArribaDe100Errores ' Para Websockets ' Subs.borraArribaDe600RenglonesBitacora ' Para Websockets If File.Exists(ruta, "kmt.db") = False Then @@ -393,6 +399,7 @@ Private Sub B4XPage_Created (Root1 As B4XView) End Sub Sub B4XPage_Appear + B4XPages.mainpage.pantallaActual = Root Log(recarga) If Starter.muestraProgreso = 1 Then muestraProgreso("Descargando actualización") @@ -1376,3 +1383,8 @@ End Sub Private Sub p_add_monto_Click End Sub + + +Private Sub p_ticketsdia_LongClick + +End Sub \ No newline at end of file diff --git a/B4A/C_Cliente.bas b/B4A/C_Cliente.bas index 5c48244..75dea44 100644 --- a/B4A/C_Cliente.bas +++ b/B4A/C_Cliente.bas @@ -268,6 +268,7 @@ End Sub 'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. Sub B4XPage_Appear + B4XPages.mainpage.pantallaActual = Root b_inicioFinVenta.Left = 1 b_inicioFinVenta.Width = Root.Width - 2dip b_inicioFinVenta.BringToFront diff --git a/B4A/C_Clientes.bas b/B4A/C_Clientes.bas index 2433353..0bd91a3 100644 --- a/B4A/C_Clientes.bas +++ b/B4A/C_Clientes.bas @@ -70,6 +70,7 @@ Private Sub B4XPage_Created (Root1 As B4XView) End Sub Sub B4XPage_Appear + B4XPages.mainpage.pantallaActual = Root l_baseodia.Text = "Clientes del día de visita" CHECK = 0 busca.Text = "" @@ -87,7 +88,7 @@ Sub B4XPage_Appear ' Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$) GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation) End If - + CustomListView1.Clear For i = 0 To c.RowCount - 1 c.Position = i diff --git a/B4A/C_NoVenta.bas b/B4A/C_NoVenta.bas index a939236..b718fb5 100644 --- a/B4A/C_NoVenta.bas +++ b/B4A/C_NoVenta.bas @@ -54,6 +54,7 @@ End Sub 'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. Sub B4XPage_Appear + B4XPages.mainpage.pantallaActual = Root e_comm.Text="" tgl.Initialize If Not(Starter.gps.GPSEnabled) Then diff --git a/B4A/C_NuevoCliente.bas b/B4A/C_NuevoCliente.bas index af4c21f..9f73114 100644 --- a/B4A/C_NuevoCliente.bas +++ b/B4A/C_NuevoCliente.bas @@ -99,6 +99,7 @@ End Sub 'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. Sub B4XPage_Appear + B4XPages.mainpage.pantallaActual = Root et_direccion.Text = "" E_NOMBRE.Text = "" ET_Atiende.Text = "" diff --git a/B4A/C_Principal.bas b/B4A/C_Principal.bas index 041c067..aaced98 100644 --- a/B4A/C_Principal.bas +++ b/B4A/C_Principal.bas @@ -399,6 +399,7 @@ Sub getTableColumnList(db As SQL, table As String) As String 'ignore End Sub Sub B4XPage_Appear + B4XPages.mainpage.pantallaActual = Root ' nvo_cliente.Enabled = False rd.respaldaPedido rd.respaldaInventarios @@ -2700,7 +2701,7 @@ Sub connecta_Click cmd.Initialize cmd.Name = "select_ruta_TGUERRERAS4" - cmd.Parameters = Array As Object(ALMACEN, e_ruta.text,usuario) + cmd.Parameters = Array As Object(ALMACEN, e_ruta.text, usuario, Application.VersionName) ' Log($"${ALMACEN},${e_ruta.text},${imei}"$) reqManager.ExecuteQuery(cmd , 0, "ruta") @@ -2734,6 +2735,10 @@ Sub connecta_Click ' End If End Sub +Private Sub connecta_LongClick + B4XPages.MainPage.recordatorio.agregaPanelRecordatorio(Root) +End Sub + Sub BUSCA_Click B4XPages.ShowPage("TicketsDia") End Sub diff --git a/B4A/C_Productos.bas b/B4A/C_Productos.bas index acd12d3..27e9ddc 100644 --- a/B4A/C_Productos.bas +++ b/B4A/C_Productos.bas @@ -143,6 +143,7 @@ End Sub 'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. Sub B4XPage_Appear + B4XPages.mainpage.pantallaActual = Root Log(B4XPages.MainPage.tipo_venta) If B4XPages.MainPage.tipo_venta = "PREVENTA_CONTADO" Or B4XPages.MainPage.tipo_venta = "ABORDO" Then Starter.tabla = "CAT_GUNAPROD" diff --git a/B4A/C_Productosdev.bas b/B4A/C_Productosdev.bas index 670cbf4..b354524 100644 --- a/B4A/C_Productosdev.bas +++ b/B4A/C_Productosdev.bas @@ -143,6 +143,7 @@ End Sub 'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. Sub B4XPage_Appear + B4XPages.mainpage.pantallaActual = Root Log(B4XPages.MainPage.tipo_venta) If B4XPages.MainPage.tipo_venta = "PREVENTA_CONTADO" Or B4XPages.MainPage.tipo_venta = "ABORDO" Then Starter.tabla = "CAT_GUNAPROD" diff --git a/B4A/C_Recordatorio.bas b/B4A/C_Recordatorio.bas new file mode 100644 index 0000000..2079eb3 --- /dev/null +++ b/B4A/C_Recordatorio.bas @@ -0,0 +1,84 @@ +B4A=true +Group=Default Group +ModulesStructureVersion=1 +Type=Class +Version=12.8 +@EndOfDesignText@ +Sub Class_Globals + Private Root As B4XView 'ignore + Private xui As XUI 'ignore + Dim panelSombra As Panel 'Panel de sombra. + Dim panelActual As Panel + Private Root2 As B4XView + Private b_Aceptar As Button +End Sub + +'You can add more parameters here. +Public Sub Initialize (Root1 As B4XView) As Object + Root = Root1 + Return Me +End Sub + +'This event will be called once, before the page becomes visible. +Private Sub B4XPage_Created (Root1 As B4XView) + Root = Root1 + + 'load the layout to Root + +End Sub + +'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. + +Sub agregaPanelRecordatorio (vRoot As B4XView) 'ignore +' vRoot.GetAllViewsRecursive + For Each v As B4XView In vRoot.GetAllViewsRecursive +' Log("Tag: " & v.Tag) + If v.Tag.As(String) = "panelSombra" Then + Log("--> " & v.tag) + v.RemoveViewFromParent + End If + Next + Try + Private su As StringUtils + panelSombra.Initialize("panelSombra") + panelSombra.Tag = "panelSombra" + Private cd As ColorDrawable + cd.Initialize(Colors.ARGB(125, 98, 98, 98), 0) + panelSombra.Background = cd + Private panelX As Panel 'Panel de la pregunta. + panelX.Initialize("pMsg") + panelActual = panelX + Private lbl As Label 'Etiqueta de la pregunta. + lbl.Initialize("") + + Private cs As CSBuilder + cs.Initialize + lbl.Text = cs.bold.color(Colors.red).append("¡¡ATENCION!!").pop.pop.bold.Append(CRLF & CRLF & "Recuerda enviar tu venta.").PopAll + lbl.TextSize = 18 + lbl.Gravity = Gravity.CENTER_HORIZONTAL + lbl.Left = (vRoot.Width / 2) - (lbl.Width/2) + lbl.TextColor = Colors.Black + cd.Initialize2(Colors.white, 20, 1, Colors.Gray) 'Borde y esquinas redondeadas del panel de la pregunta. + panelX.Background = cd + panelSombra.AddView(panelX, 100, 20%y, 80%x, 120dip) + panelX.Left = (vRoot.Width / 2) - (panelX.Width / 2) + vRoot.AddView(panelSombra, 0, 0, 100%x, 100%y) 'add the panel to the layout + panelX.AddView(lbl, 20dip, 20dip, (panelX.Width * 0.9), 40dip) 'Agregamos la etiqueta al panel. + lbl.Height = panelX.Height - 5 + panelSombra.Width = vRoot.Width + panelSombra.Height = vRoot.Height + panelSombra.Elevation = 100 + panelSombra.BringToFront + Catch + Log(LastException) + End Try +End Sub + +'Oculta el panel de la pregunta. +Sub ocultPanelRecordatorio + If panelSombra.IsInitialized Then panelSombra.RemoveView +End Sub + +Sub panelSombra_Click + If panelSombra.IsInitialized Then panelSombra.RemoveView +End Sub \ No newline at end of file diff --git a/B4A/C_TicketsDia.bas b/B4A/C_TicketsDia.bas index 1ccb039..a8f923e 100644 --- a/B4A/C_TicketsDia.bas +++ b/B4A/C_TicketsDia.bas @@ -55,6 +55,7 @@ End Sub 'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. Sub B4XPage_Appear + B4XPages.mainpage.pantallaActual = Root nombre_boton = "NOVENTA" c=B4XPages.MainPage.skmt.ExecQuery("select PC_CLIENTE,PC_MONTO,PC_NOART,(select CAT_CL_NOMBRE from kmt_info where cat_cl_codigo = pc_cliente UNION select CAT_CL_NOMBRE from kmt_info2 where cat_cl_codigo = pc_cliente ) as NOMBRE FROM PEDIDO_CLIENTE ORDER BY PC_FECHA asc") Dim noArticulos As Int = 0 @@ -160,6 +161,6 @@ Sub b_noventa_Click End If End Sub -Private Sub p_ticketsdia_Click - -End Sub \ No newline at end of file +'Private Sub p_ticketsdia_Click +' B4XPages.MainPage.recordatorio.agregaPanelRecordatorio(Root) +'End Sub \ No newline at end of file diff --git a/B4A/Files/login.bal b/B4A/Files/login.bal index ed1e732758efda6472381662a6651c79b818d051..2903de4e1a84af3dd75a51858099a46ed94771df 100644 GIT binary patch delta 31 lcmeylf$`@C#tppMlNEx6Hp^?LGJzPA<+V9C&)2=B1pvap3pxM* delta 31 lcmeylf$`@C#tppMlNBU|Hp^?LGJzPA<+V9C&)2=B1pvFc3dR5c diff --git a/B4A/Starter.bas b/B4A/Starter.bas index 9ba2d45..825c06b 100644 --- a/B4A/Starter.bas +++ b/B4A/Starter.bas @@ -25,7 +25,7 @@ Sub Process_Globals ' Dim DBReqServer As String = "http://10.0.0.205:1783" ' Dim DBReqServer As String = "http://192.168.100.10:1781" Dim Timer1 As Timer - Dim Interval As Int = 10 + Dim Interval As Int = 300 Dim ruta As String = File.DirInternal 'Para los Logs Private logs As StringBuilder @@ -39,6 +39,8 @@ Sub Process_Globals Private BTAdmin As BluetoothAdmin Public BluetoothState As Boolean Dim enVenta As Boolean = False + Dim ultimoRecordatorio As String = "" + Dim timerRecordatorio As Timer End Sub Sub Service_Create @@ -71,6 +73,8 @@ Sub Service_Start (StartingIntent As Intent) ' Log(marcaCel) If s.traeDBReqServerDeBD(skmt) <> "N/A" And s.traeDBReqServerDeBD(skmt) <> "" Then DBReqServer = s.traeDBReqServerDeBD(skmt) reqManager.Initialize(Me, DBReqServer) + timerRecordatorio.Initialize("timerRecordatorio", 10 * 1000) + timerRecordatorio.Enabled = True Log($"Starter - |${DBReqServer}|"$) End Sub @@ -159,4 +163,24 @@ Sub JobDone(Job As HttpJob) 'Verificamos que el usuario guardado en BD sea VALIDO. End If +End Sub + +Private Sub timerRecordatorio_Tick + '10:30, 13:00 y 15:30 +' Log($"${DateTime.GetHour(DateTime.now)}:${DateTime.GetMinute(DateTime.now)}"$) + Log("Revisando la hora - UltimoRecordatorio: " & ultimoRecordatorio) + If ultimoRecordatorio <> DateTime.GetHour(DateTime.now) & DateTime.GetMinute(DateTime.now) Then + If (DateTime.GetHour(DateTime.now) = 13 And DateTime.GetMinute(DateTime.now) = 0) _ 'Recordatorio de las 13:00 + Or (DateTime.GetHour(DateTime.now) = 14 And DateTime.GetMinute(DateTime.now) = 0) Then 'Recordatorio de las 14:00 + Log("¡¡MANDAMOS RECORDATORIO!!") + If Not(B4XPages.GetManager.IsForeground) Then + Subs.notiHigh("¡¡ATENCION!!", "Recuerda enviar tu venta.", Main) + Else + If B4XPages.MainPage.IsInitialized And B4XPages.MainPage.pantallaActual.IsInitialized Then + B4XPages.MainPage.recordatorio.agregaPanelRecordatorio(B4XPages.MainPage.pantallaActual) + End If + End If + ultimoRecordatorio = DateTime.GetHour(DateTime.now) & DateTime.GetMinute(DateTime.now) + End If + End If End Sub \ No newline at end of file diff --git a/B4A/TG.b4a b/B4A/TG.b4a index 29ecdc7..29a9bca 100644 --- a/B4A/TG.b4a +++ b/B4A/TG.b4a @@ -1093,24 +1093,25 @@ Module13=C_Principal Module14=C_Productos Module15=C_Productosdev Module16=C_Promos -Module17=C_RespaldoDiario -Module18=C_Subs -Module19=C_tabulador +Module17=C_Recordatorio +Module18=C_RespaldoDiario +Module19=C_Subs Module2=B4XMainPage -Module20=C_TicketsDia -Module21=C_UpdateAvailable -Module22=DBRequestManager -Module23=EscPosPrinter -Module24=FileHandler -Module25=ManageExternalStorage -Module26=MAPA_CLIENTE -Module27=MAPA_RUTAS -Module28=NotificationService -Module29=Pendientes +Module20=C_tabulador +Module21=C_TicketsDia +Module22=C_UpdateAvailable +Module23=DBRequestManager +Module24=EscPosPrinter +Module25=FileHandler +Module26=ManageExternalStorage +Module27=MAPA_CLIENTE +Module28=MAPA_RUTAS +Module29=NotificationService Module3=BatteryUtilities -Module30=Starter -Module31=Subs -Module32=Tracker +Module30=Pendientes +Module31=Starter +Module32=Subs +Module33=Tracker Module4=C_Cliente Module5=C_Clientes Module6=C_Cuestionario @@ -1119,13 +1120,13 @@ Module8=C_Mapas Module9=C_Nota NumberOfFiles=525 NumberOfLibraries=34 -NumberOfModules=32 +NumberOfModules=33 Version=12.8 @EndOfDesignText@ #Region Project Attributes #ApplicationLabel: TGUERRERAS #VersionCode: 1 - #VersionName: 5.12.15 + #VersionName: 5.12.16 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: portrait #CanInstallToExternalStorage: False diff --git a/B4A/TG.b4a.meta b/B4A/TG.b4a.meta index 1daafba..5458edc 100644 --- a/B4A/TG.b4a.meta +++ b/B4A/TG.b4a.meta @@ -25,6 +25,7 @@ ModuleBookmarks3=1 ModuleBookmarks30= ModuleBookmarks31= ModuleBookmarks32= +ModuleBookmarks33= ModuleBookmarks4= ModuleBookmarks5= ModuleBookmarks6= @@ -58,6 +59,7 @@ ModuleBreakpoints3= ModuleBreakpoints30= ModuleBreakpoints31= ModuleBreakpoints32= +ModuleBreakpoints33= ModuleBreakpoints4= ModuleBreakpoints5= ModuleBreakpoints6= @@ -66,37 +68,38 @@ ModuleBreakpoints8= ModuleBreakpoints9= ModuleClosedNodes0= ModuleClosedNodes1= -ModuleClosedNodes10= -ModuleClosedNodes11= +ModuleClosedNodes10=1,2,3 +ModuleClosedNodes11=1,3 ModuleClosedNodes12= -ModuleClosedNodes13= -ModuleClosedNodes14= -ModuleClosedNodes15= +ModuleClosedNodes13=3,4,5,6 +ModuleClosedNodes14=1,3 +ModuleClosedNodes15=1,3 ModuleClosedNodes16= ModuleClosedNodes17= ModuleClosedNodes18= ModuleClosedNodes19= -ModuleClosedNodes2= +ModuleClosedNodes2=4 ModuleClosedNodes20= -ModuleClosedNodes21= +ModuleClosedNodes21=3 ModuleClosedNodes22= ModuleClosedNodes23= ModuleClosedNodes24= ModuleClosedNodes25= ModuleClosedNodes26= ModuleClosedNodes27= -ModuleClosedNodes28= +ModuleClosedNodes28=2,3,4 ModuleClosedNodes29= ModuleClosedNodes3= ModuleClosedNodes30= -ModuleClosedNodes31= +ModuleClosedNodes31=3,4,6,7,8,9,10,11,12,13 ModuleClosedNodes32= -ModuleClosedNodes4= -ModuleClosedNodes5= +ModuleClosedNodes33= +ModuleClosedNodes4=2,4 +ModuleClosedNodes5=1,2,3 ModuleClosedNodes6= ModuleClosedNodes7= ModuleClosedNodes8= ModuleClosedNodes9= -NavigationStack=Subs,traeUsuarioDeBD,781,0,Subs,traeFecha,770,0,C_Productos,Busca_TextChanged,1483,0,C_Productos,LlenaProdsLL,1509,6,C_Cliente,MODS,0,0,C_Cliente,gest_Click,673,0,C_Mapas,Class_Globals,0,0,MAPA_RUTAS,PointInPolygon,473,0,C_Principal,JobDone,1959,0,C_Principal,cargar_Click,1399,0 +NavigationStack=Starter,Service_Start,66,0,Starter,Timer1_Tick,77,0,Diseñador Visual,ticketsdia.bal,-100,1,B4XMainPage,Class_Globals,130,0,Starter,timerRecordatorio_Tick,167,5,C_Principal,B4XPage_Appear,395,0,Diseñador Visual,login.bal,-100,2,C_Principal,connecta_Click,2706,2,Starter,JobDone,146,0,Starter,Process_Globals,21,0 SelectedBuild=0 -VisibleModules=2,4,31,14,13,5,30,17,15,22,8,26,27 +VisibleModules=31,2,13,4,32,14,5,18,15,23,17,21,11,10,28 diff --git a/B4A/_git_tag.ps1 b/B4A/_git_tag.ps1 new file mode 100644 index 0000000..89e7105 --- /dev/null +++ b/B4A/_git_tag.ps1 @@ -0,0 +1,110 @@ +# --- SCRIPT DE AUTODESCUBRIMIENTO CON GUI MEJORADA --- + +# Cargar librería visual +Add-Type -AssemblyName System.Windows.Forms +Add-Type -AssemblyName System.Drawing + +# 1. AUTODESCUBRIMIENTO +$projectPath = $PSScriptRoot +Write-Host "Ruta: $projectPath" + +$b4aFileItem = Get-ChildItem -Path $projectPath -Filter "*.b4a" | Select-Object -First 1 + +if (-Not $b4aFileItem) { + [System.Windows.Forms.MessageBox]::Show("No hay archivo .b4a en esta carpeta.", "Error", "OK", "Error") + return +} + +$b4aFile = $b4aFileItem.FullName +$projectName = $b4aFileItem.BaseName +Write-Host "Proyecto: $projectName" + +# 2. LIMPIEZA +# $objectsPath = Join-Path $projectPath "Objects" +# if (Test-Path $objectsPath) { + # Write-Host "Limpiando Objects..." + # Remove-Item -Path "$objectsPath\*" -Recurse -Force -ErrorAction SilentlyContinue +# } + +# 3. LEER VERSIÓN +$versionLine = Get-Content $b4aFile | Select-String "#VersionName:" +if (-Not $versionLine) { Write-Error "Falta #VersionName"; return } +$version = ($versionLine -split ":")[1].Trim() +$tagName = "v$version" + +Set-Location $projectPath + +# 4. COMMIT +$oldCommit = git rev-parse HEAD + +Write-Host "----------------------------------------" +Write-Host "Versión: $version" +Write-Host "Abriendo TortoiseGit..." + +# Argumentos limpios +$pathArg = '/path:"{0}"' -f $projectPath +$msgArg = '/logmsg:"VERSION {0}"' -f $version +$cmdArg = "/command:commit" + +$process = Start-Process "TortoiseGitProc.exe" -ArgumentList $cmdArg, $pathArg, $msgArg -Wait -PassThru + +$newCommit = git rev-parse HEAD + +# 5. VALIDACIÓN +if ($oldCommit -eq $newCommit) { + Write-Warning "Commit cancelado." + git tag -d $tagName 2>$null # Borra tag local previo si existe para actualizarlo al nuevo commit + return +} + +Write-Host ">> Commit detectado." + +# 6. GESTIÓN DE TAGS (VISUAL TOPMOST) +Write-Host "git ls-remote --tags origin $tagName" +$remoteTagInfo = git ls-remote --tags origin $tagName + +if ($remoteTagInfo) { + # --- TRUCO PARA QUE LA VENTANA SALGA AL FRENTE --- + # Creamos un formulario invisible que esté "Siempre Visible" (TopMost) + Write-Host "Recibimos remoteTagInfo" + $topForm = New-Object System.Windows.Forms.Form + $topForm.TopMost = $true + $topForm.Opacity = 0 # Invisible + $topForm.ShowInTaskbar = $false + $topForm.StartPosition = "CenterScreen" + $topForm.Show() + $topForm.Activate() + + [System.Console]::Beep(1000, 200) + [System.Console]::Beep(1000, 200) + + $msgBody = "El tag '$tagName' YA EXISTE en GitHub.`n`nDeseas SOBRESCRIBIRLO?`n`nSi = Borrar anterior y actualizar (Force Push).`nNo = Subir solo codigo (mantener tag viejo)." + $msgTitle = "⚠️ Conflicto de Versiones - $projectName" + + # El mensaje ahora es "hijo" del formulario invisible, heredando su propiedad TopMost + Write-Host "Preguntamos que hacer con el tag" + $respuesta = [System.Windows.Forms.MessageBox]::Show($topForm, $msgBody, $msgTitle, "YesNo", "Warning") + + $topForm.Dispose() # Limpiamos el formulario invisible + + if ($respuesta -eq "Yes") { + Write-Host "Sobrescribiendo..." + git tag -d $tagName 2>$null + git tag -a $tagName -m "Release version $version (Updated)" + + git push origin + git push origin $tagName --force + Write-Host ">> Tag actualizado (Force Push)." + } else { + Write-Host "Conservando tag anterior..." + git push origin + Write-Host ">> Código subido." + } +} else { + # Tag Nuevo + git tag -a $tagName -m "Release version $version" + git push origin --follow-tags + Write-Host ">> Versión publicada." +} + +Write-Host "----------------------------------------" \ No newline at end of file