mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-20 19:49:12 +00:00
- Se movió el codigo del intent para importar la BD desde WhatsApp a kms_helperSubs.
This commit is contained in:
@@ -26,6 +26,8 @@ Sub Class_Globals
|
||||
Dim RD_fechaRestauracion As String = ""
|
||||
Private fechaRestauracion As String = ""
|
||||
Private khdb As SQL
|
||||
Dim in As Intent
|
||||
Dim intentUsado As Boolean = False
|
||||
End Sub
|
||||
|
||||
'Inicializa la clase "kms_helperSubs", el tercer parametro es la base de datos que se va a usar.
|
||||
@@ -932,6 +934,39 @@ Sub revisaImpresa As Boolean
|
||||
Return imp
|
||||
End Sub
|
||||
|
||||
' Se revisa si hay una intención (intent) de abrir una base de datos y si es así, entonces se importa esa base de datos.
|
||||
Sub importaBDDesdeWhatsApp
|
||||
Private tmpBDWA As Boolean = traeUsarIntentBDWA
|
||||
If Not(in.IsInitialized) Then in = B4XPages.GetNativeParent(B4XPages.MainPage).GetStartingIntent ' Si se usa esta funcion en Mainpage, se pone "Me" en lugar de B4XPages.MainPage.
|
||||
If Not(intentUsado) And in <> Null Then
|
||||
' Log(in)
|
||||
intentUsado = True
|
||||
' Log(in.As(String))
|
||||
If in.GetData <> Null Then
|
||||
Dim XmlData As String
|
||||
XmlData = in.GetData
|
||||
Try
|
||||
Dim OutStr As OutputStream = File.OpenOutput(File.DirInternal,"kmt.db",False)
|
||||
Dim InStr As InputStream = File.OpenInput("ContentDir",XmlData)
|
||||
File.Copy2(InStr,OutStr)
|
||||
LogColor("BD copiada a interna.", Colors.Blue)
|
||||
OutStr.Close
|
||||
If in.As(String).Contains("whatsapp") Then ToastMessageShow("BD cargada desde Whatsapp", False)
|
||||
Catch
|
||||
Log(LastException)
|
||||
End Try
|
||||
' ExitApplication
|
||||
Starter.skmt.ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'IMPORTAR_BD_WA'")
|
||||
Starter.skmt.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('IMPORTAR_BD_WA', '${tmpBDWA}')"$)
|
||||
Private a As Cursor = Starter.skmt.ExecQuery($"select CAT_VA_VALOR from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'APP_NAME'"$)
|
||||
If a.RowCount > 0 Then
|
||||
a.Position = 0
|
||||
ToastMessageShow($"BD de "${a.GetString("CAT_VA_VALOR")}" cargada."$, True)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'################ Manage External Storage (MES) #########################
|
||||
'
|
||||
''Inicializa "Manage External Storage" (MES), que nos da acceso a la tarjeta de memoria en Android 11+
|
||||
|
||||
Reference in New Issue
Block a user