From cf93616b4b605480fed122e762fecf2917f14f9c Mon Sep 17 00:00:00 2001 From: Jose Alberto Guerra Ugalde Date: Wed, 12 Feb 2025 12:49:07 -0600 Subject: [PATCH] - VERSION 5.02.05 - Se cambio el timer del envio de la ubicacion a 300 seg (5 minutos) --- B4A/C_Cliente.bas | 51 +++++++++++++++++++++++++++++++++++ B4A/Guna Vistas V3.1.b4a.meta | 4 +-- B4A/Starter.bas | 2 +- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/B4A/C_Cliente.bas b/B4A/C_Cliente.bas index 2ebffec..b41599b 100644 --- a/B4A/C_Cliente.bas +++ b/B4A/C_Cliente.bas @@ -5238,6 +5238,57 @@ Sub EnviarPDFWhatsAppNumero(NumeroTelefono As String) End If End Sub +Sub EnviarPDFWhatsAppNumero2(NumeroTelefono As String) + If NumeroTelefono.Length = 10 Then NumeroTelefono = "521" & NumeroTelefono ' Agregamos el 521 si es que falta. + ' Ruta del archivo PDF + Dim RutaArchivo As String = Starter.fFileProvider.SharedFolder & "/" & archivoTicketPDF + Log(RutaArchivo) + + ' Verificar si el archivo existe + If File.Exists(Starter.fFileProvider.SharedFolder, archivoTicketPDF) Then + ' Paso 1: Abrir WhatsApp con el número específico + Dim UriWhatsApp As String = "https://wa.me/" & NumeroTelefono + Dim IntentWhatsApp As Intent + IntentWhatsApp.Initialize(IntentWhatsApp.ACTION_VIEW, UriWhatsApp) + + ' Verificar si WhatsApp está instalado +' If IntentWhatsApp.ResolveActivity(PackageManager) Is Nothing Then +' ToastMessageShow("WhatsApp no está instalado.", True) +' Return +' End If + + ' Iniciar el Intent para abrir WhatsApp + StartActivity(IntentWhatsApp) + + ' Paso 2: Mostrar un mensaje para compartir el archivo manualmente + ToastMessageShow("Por favor, comparte el archivo manualmente en WhatsApp.", True) + + ' Esperar un momento para que WhatsApp se abra + Sleep(3000) + + ' Paso 3: Compartir el archivo desde tu aplicación + Dim Uri0 As Object = Starter.fFileProvider.GetFileUri(archivoTicketPDF) + + ' Crear un Intent para compartir el archivo + Dim Intent1 As Intent + Intent1.Initialize(Intent1.ACTION_SEND, "") + + ' Establecer el tipo MIME del archivo (PDF) + Intent1.SetType("application/pdf") + + ' Agregar el URI del archivo al Intent + Intent1.PutExtra("android.intent.extra.STREAM", Uri0) + + ' Establecer permisos de lectura para la aplicación que recibe el archivo + Intent1.Flags = 1 ' FLAG_GRANT_READ_URI_PERMISSION + + ' Iniciar el Intent para compartir el archivo + StartActivity(Intent1) + Else + ToastMessageShow("El archivo PDF no existe.", True) + End If +End Sub + Private Sub b_envioPDF_Click PDFGENERAR EnviarPDFWhatsAppNumero(et_numeroPDF.Text) diff --git a/B4A/Guna Vistas V3.1.b4a.meta b/B4A/Guna Vistas V3.1.b4a.meta index 3b4e095..f0debc1 100644 --- a/B4A/Guna Vistas V3.1.b4a.meta +++ b/B4A/Guna Vistas V3.1.b4a.meta @@ -77,11 +77,11 @@ ModuleClosedNodes26= ModuleClosedNodes27= ModuleClosedNodes3= ModuleClosedNodes4=5,8,9,10,11,12,13 -ModuleClosedNodes5=175,176,177,180,181 +ModuleClosedNodes5=175,176,177,180 ModuleClosedNodes6= ModuleClosedNodes7=5,6,8,9,10,11 ModuleClosedNodes8= ModuleClosedNodes9= -NavigationStack=C_Cliente,Class_Globals,109,0,C_Cliente,b_enviarTicket_Click,5162,0,C_Cliente,b_geopass_Click,1188,0,C_Cliente,Guardar_Click,2140,0,C_Cliente,Impresion2,2299,0,C_Cliente,Impresion,2501,0,C_Cliente,B_GUARDA_C_Click,2784,0,C_Cliente,b_codigoAutorizacion_Click,4934,0,C_Cliente,b_envioPDF_Click,5242,6,C_Cliente,JobDone,1281,6 +NavigationStack=C_Cliente,B_GUARDA_C_Click,2784,0,C_Cliente,b_codigoAutorizacion_Click,4934,0,Main,Process_Globals,18,0,B4XMainPage,B4XPage_Created,170,0,C_Cliente,enviaTicket,5194,0,Starter,Application_Error,138,0,Starter,Process_Globals,18,0,C_Cliente,EnviarPDFWhatsAppNumero2,5196,0,C_Cliente,EnviarPDFWhatsAppNumero,5196,0 SelectedBuild=0 VisibleModules=25,2,14,26,5,10,15,20,4 diff --git a/B4A/Starter.bas b/B4A/Starter.bas index de2e229..82e9d67 100644 --- a/B4A/Starter.bas +++ b/B4A/Starter.bas @@ -22,7 +22,7 @@ Sub Process_Globals Dim server As String = "http://187.189.244.154:1782" ' Dim server As String = "http://10.0.0.205:1782" 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