mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-17 18:26:11 +00:00
- Se movió el codigo del intent para importar la BD desde WhatsApp a kms_helperSubs.
This commit is contained in:
@@ -201,38 +201,9 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
ruta = Starter.ruta
|
||||
Starter.tiempos.Initialize
|
||||
kh.guardaAppInfo
|
||||
|
||||
'Revisamos si se disparo el intent de cargar la base de datos desde WhatApp.
|
||||
If kh.traeUsarIntentBDWA Then
|
||||
Private tmpBDWA As Boolean = kh.traeUsarIntentBDWA
|
||||
If Not(in.IsInitialized) Then in = B4XPages.GetNativeParent(Me).GetStartingIntent
|
||||
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 If
|
||||
If kh.traeUsarIntentBDWA Then kh.importaBDDesdeWhatsApp
|
||||
|
||||
' Try 'Intentamos usar "pragma_table_info" para revisar si existe la columna "IMPRESION" en la tabla
|
||||
' c=Starter.skmt.ExecQuery("SELECT COUNT(*) AS fCol FROM pragma_table_info('kmt_info') WHERE name='IMPRESION'")
|
||||
|
||||
@@ -91,6 +91,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=B4XMainPage,cb_geocerca_CheckedChange,809,0,kms_helperSubs,traeUsarGeocerca,873,0,B4XMainPage,i_engranes_Click,652,6,kms_helperSubs,traeUsarCartaPorte,884,0,B4XMainPage,b_aceptarExtras_Click,876,0,kms_helperSubs,RD_Init,58,0,B4XMainPage,cb_importarBDWA_CheckedChange,885,6,B4XMainPage,Class_Globals,110,0,B4XMainPage,B4XPage_Appear,338,6,B4XMainPage,B4XPage_Created,207,6
|
||||
NavigationStack=B4XMainPage,b_aceptarExtras_Click,876,0,kms_helperSubs,RD_Init,58,0,B4XMainPage,cb_importarBDWA_CheckedChange,885,6,B4XMainPage,B4XPage_Appear,338,6,kms_helperSubs,traeUsarIntentBDWA,893,0,kms_helperSubs,Class_Globals,22,0,B4XMainPage,Class_Globals,109,0,kms_helperSubs,importaBDDesdeWhatsApp,949,6,kms_helperSubs,revisaImpresa,930,0,B4XMainPage,B4XPage_Created,200,6
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,28,11,3,26,23,29,12,4,13
|
||||
|
||||
@@ -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