Hello everyone, so i have this notification bell, whenever new order go in the notification will be displayed like with a ticking sound. But right now for every few sec eventho all the order already done, the bell still running. i set the value of NonViewed in class global as Dim NonViewed As Int = 0. Any idea how to solve this ?
B4X:
Sub TopViewed
Dim m As Map = UTILS.apiTokenMap
m.Put("count",1)
m.Put("total_price",1)
' If IsViewing = True Then
m.Put("viewed", 1)
' End If
Dim params As String
params = UTILS.convertJson(m)
Dim jobVerif As HttpJob
jobVerif.Initialize("", Me)
jobVerif.PostString(Main.apiSetting.url & "Shop/SumCountViewed",params)
jobVerif.GetRequest.SetContentType("application/json")
Wait For (jobVerif) JobDone(Job As HttpJob)
' Log(Job.GetString)
If jobVerif.Success Then
Dim parser As JSONParser
parser.Initialize(Job.GetString)
Dim rRoot As Map = parser.NextObject
total_price =rRoot.Get("total_price")
NonViewed = rRoot.Get("viewed")
count = rRoot.Get("count")
End If
jobVerif.Release
End Sub
B4X:
Sub NonveiwedTimer_Tick
Try
TopViewed
lblNotificationNumber.Text = NonViewed
If IsViewing <> True Then
If NonViewed > 0 Then
TakeOff.Play
For i = 1 To 5
Sleep(200)
btnNotification.Text = ""
Sleep(200)
btnNotification.Text = Chr(0xF0F3)
Next
TakeOff.Play
End If
End If
btnNotification.Text = Chr(0xF0F3)
Catch
Log(LastException)
End Try
End Sub