mirror of
https://github.com/KeymonSoft/Monitor-Keymon.git
synced 2026-04-17 21:06:19 +00:00
- VERSION 4.12.14
- Se actualizo la libreria ReplyAuto para que no mande mensajes de "notification_removed"
This commit is contained in:
@@ -18,10 +18,13 @@ Sub Class_Globals
|
||||
' Dim rutaHrsAtras As Int = 48
|
||||
' Dim rutaInicioHoy As String = ""
|
||||
Private subsLogs As Boolean = False
|
||||
Dim logoKeymon As Bitmap
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize As Object
|
||||
' smiley = LoadBitmapResize(File.DirAssets, "smiley.png", 24dip, 24dip, False)
|
||||
logoKeymon = LoadBitmapResize(File.DirAssets, "logo_keymon.png", 24dip, 24dip, False)
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
@@ -418,7 +421,7 @@ Sub CreateNotification (Body As String) As Notification
|
||||
End Sub
|
||||
|
||||
'Genera una notificacion con importancia alta
|
||||
Sub notiHigh(title As String, body As String, id As String, activity As Object) 'ignore
|
||||
Sub notiHigh0(title As String, body As String, id As String, activity As Object) 'ignore
|
||||
activity = Main
|
||||
Private notif As Notification
|
||||
notif.Initialize2(notif.IMPORTANCE_HIGH)
|
||||
@@ -432,8 +435,22 @@ Sub notiHigh(title As String, body As String, id As String, activity As Object)
|
||||
notif.Notify(id)
|
||||
End Sub
|
||||
|
||||
'Genera una notificacion con importancia alta
|
||||
Sub notiHigh(title As String, body As String, id As String, activity As Object) 'ignore
|
||||
activity = Main
|
||||
Private notification As NB6
|
||||
notification.Initialize("Errores", "Errores", "HIGH").AutoCancel(True).SmallIcon(logoKeymon)
|
||||
If Starter.logger Then Log("notiHigh: "&title)
|
||||
notification.Build(title, body, "", Main).Notify(id)
|
||||
' notif.AutoCancel = True
|
||||
' If logger Then Log("notiHigh: "&title)
|
||||
' notif.SetInfo(title, body, activity)
|
||||
' Log("notiHigh SetInfo")
|
||||
' notif.Notify(id)
|
||||
End Sub
|
||||
|
||||
'Regresa el objeto de una notificacion con importancia baja
|
||||
Sub notiLowReturn(title As String, Body As String, id As Int) As Notification 'ignore
|
||||
Sub notiLowReturn0(title As String, Body As String, id As Int) As Notification 'ignore
|
||||
Private notification As Notification
|
||||
notification.Initialize2(notification.IMPORTANCE_LOW)
|
||||
' Log("notiLowReturn: "&title)
|
||||
@@ -446,6 +463,22 @@ Sub notiLowReturn(title As String, Body As String, id As Int) As Notification 'i
|
||||
Return notification
|
||||
End Sub
|
||||
|
||||
'Regresa el objeto de una notificacion con importancia minima
|
||||
Sub notiLowReturn(title As String, Body As String, id As Int) As NB6 'ignore
|
||||
Private notification As NB6
|
||||
' notification.Initialize2(notification.IMPORTANCE_MIN)
|
||||
notification.Initialize("Normal", "Normal", "LOW").SmallIcon(logoKeymon)
|
||||
If Starter.logger Then Log("notiLowReturn: "&title)
|
||||
' notification.Icon = "icon"
|
||||
' notification.Sound = False
|
||||
' notification.Vibrate = False
|
||||
notification.Build(title, Body, "", Main).Notify(id)
|
||||
' notification.SetInfo(title, Body, Main)
|
||||
' notification.n(id)
|
||||
' Log("notiLowReturn SetInfo")
|
||||
Return notification
|
||||
End Sub
|
||||
|
||||
Sub ping
|
||||
Private ph As Phone
|
||||
Wait For (ph.ShellAsync("ping", Array As String("-c 1","-W 5", "8.8.8.8"))) Complete (Success As Boolean, ExitValue As Int, StdOut As String, StdErr As String)
|
||||
@@ -500,4 +533,20 @@ Sub borraArribaDeXXXErrores(limite As Int) 'ignore
|
||||
Starter.skmt.ExecNonQuery($"DELETE FROM error_log WHERE fecha NOT in (SELECT fecha FROM error_log ORDER BY fecha desc LIMIT ${limite})"$)
|
||||
Starter.skmt.ExecNonQuery("vacuum;")
|
||||
' if starter.logger then Log("Borramos mas de 100 de errorLog")
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Sub CheckAndRequestNotificationPermission As ResumableSub
|
||||
Dim p As Phone
|
||||
If p.SdkVersion < 33 Then Return True
|
||||
Dim ctxt As JavaObject
|
||||
ctxt.InitializeContext
|
||||
Dim targetSdkVersion As Int = ctxt.RunMethodJO("getApplicationInfo", Null).GetField("targetSdkVersion")
|
||||
If targetSdkVersion < 33 Then Return True
|
||||
Dim NotificationsManager As JavaObject = ctxt.RunMethod("getSystemService", Array("notification"))
|
||||
Dim NotificationsEnabled As Boolean = NotificationsManager.RunMethod("areNotificationsEnabled", Null)
|
||||
If NotificationsEnabled Then Return True
|
||||
Dim rp As RuntimePermissions
|
||||
rp.CheckAndRequest(rp.PERMISSION_POST_NOTIFICATIONS)
|
||||
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean) 'change to Activity_PermissionResult if non-B4XPages.
|
||||
Return Result
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user