Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
' Dim n As Notification
' n.Initialize
' n.Icon = "icon"
' n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
' n.Notify(1)
Dim title As String = Message.GetData.get("title")
Dim body As String = Message.GetData.get("body")
Select title
Case "NEWORDER"
If IsPaused(pedidos) = False Then
CallSubDelayed(pedidos,"Activity_Resume")
mp.Initialize
mp.Load(File.DirAssets,"orderArrived.wav")
mp.Play
Else
' 'Notify insistent
' Dim n As NB6
' n.Initialize("newOrder","Pedido Chegando","HIGH")
' n.SmallIcon(LoadBitmap(File.DirAssets,"golunchrestaurantesIco-48x48.png"))
' n.AutoCancel(True)
' n.OnlyAlertOnce(False)
' n.Build("Novo Pedido","Chegou mais um pedido!!!","",pedidos).Notify(1)
CallSubDelayed(newOrder,"orderUpdate")
End If
Case "ORDERSTATUSCHANGE"
If IsPaused(pedidos) = False Then
CallSubDelayed(pedidos,"Activity_Resume")
End If
If IsPaused(orderDetail) = False Then
Dim orderId As Long = body
If orderDetail.orderId = orderId Then
refreshDetail(orderId)
End If
End If
End Select
End Sub