mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-19 11:09:13 +00:00
- Se agrego un mensaje (Toast) que indica de que aplicacion es la base de datos se cargo desde WhatsApp.
- Se movió´el codigo de la carga de BD de WhatsApp a B4XPage_Created, para que si se carga una base de datos de OTRA aplicación, y no tiene las tablas correctas, se pueda cargar la base correcta sin que truene ña aplicación.
This commit is contained in:
@@ -200,8 +200,39 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Panel1.Top = 0 : Panel1.left = 0
|
||||
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
|
||||
|
||||
' 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'")
|
||||
@@ -343,37 +374,6 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
End Sub
|
||||
|
||||
Sub B4XPage_Appear
|
||||
Log("LLAMAMOS traeUsarIntentBDWA")
|
||||
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
|
||||
' ToastMessageShow(XmlData, False)
|
||||
' Send_Make_somthing(in)
|
||||
' Activity.Finish
|
||||
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
|
||||
End If
|
||||
End If
|
||||
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}')"$)
|
||||
|
||||
End If
|
||||
MES1.Initialize(Me, "MES1")
|
||||
Log("SDK: " & device.SdkVersion)
|
||||
' Get the device SDK version
|
||||
@@ -454,15 +454,15 @@ Sub B4XPage_Appear
|
||||
D.Close
|
||||
D = Starter.skmt.ExecQuery("select COUNT(*) AS CUANTOS from version")
|
||||
D.Position = 0
|
||||
If D.GetString("CUANTOS") > 0 Then
|
||||
c = Starter.skmt.ExecQuery("select NOVERSION from version")
|
||||
c.Position = 0
|
||||
If c.GetString("NOVERSION") <> "2.95" Then
|
||||
Msgbox("INSTALAR NUEVO APK" ,"AVISO") 'ignore
|
||||
B4XPage_Appear
|
||||
End If
|
||||
c.Close
|
||||
End If
|
||||
' If D.GetString("CUANTOS") > 0 Then
|
||||
' c = Starter.skmt.ExecQuery("select NOVERSION from version")
|
||||
' c.Position = 0
|
||||
' If c.GetString("NOVERSION") <> "2.95" Then
|
||||
' Msgbox("INSTALAR NUEVO APK" ,"AVISO") 'ignore
|
||||
' B4XPage_Appear
|
||||
' End If
|
||||
' c.Close
|
||||
' End If
|
||||
' Log(">>>>>> FECHA")
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_fecha"
|
||||
|
||||
@@ -61,7 +61,7 @@ ModuleBreakpoints7=
|
||||
ModuleBreakpoints8=
|
||||
ModuleBreakpoints9=
|
||||
ModuleClosedNodes0=
|
||||
ModuleClosedNodes1=4
|
||||
ModuleClosedNodes1=
|
||||
ModuleClosedNodes10=
|
||||
ModuleClosedNodes11=
|
||||
ModuleClosedNodes12=
|
||||
@@ -91,6 +91,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=Visual Designer,login.bal,-100,6,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,kms_helperSubs,traeUsarIntentBDWA,893,4,B4XMainPage,B4XPage_Appear,402,6
|
||||
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
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,28,11,3,26,23,29,12,4,13
|
||||
|
||||
Reference in New Issue
Block a user