' Query update FCM token - Returns true if FCM tokens are the same or the FCM token updated successfully.
private Sub QueryUpdateFcm(customerId As Int, fcmToken As String)As ResumableSub
Dim fcmUpdatedOk As Boolean = False
Dim jobGet As HttpJob: jobGet.Initialize("UseWebApi", Me)
jobGet.Download(modEposWeb.URL_CUSTOMER_API & "/" & customerId & "?" & modEposWeb.API_QUERY & "=" & modEposWeb.API_GET_FCMTOKEN)
jobGet.GetRequest.SetHeader("Accept-Encoding","utf8") ' <<<< INSERTED TO ENCODE TO UTF-8 (don't work either)
wait for (jobGet) jobDone(jobGet As HttpJob)
If jobGet.Success And jobGet.Response.StatusCode = 200 Then
Dim webFcmToken As String = jobGet.GetString
If fcmToken = webFcmToken Then ' <<<< ALWAYS FAILS
fcmUpdatedOk = True
Else
Dim jobPut As HttpJob: jobPut.Initialize("UseWebApi", Me)
jobPut.PutString(modEposWeb.URL_CUSTOMER_API & "/" & customerId & "?" & modEposWeb.API_SETTING & "=" & _
modEposWeb.API_GET_FCMTOKEN & "&" & modEposWeb.API_SETTING_1 & "=" & fcmToken, "")
Wait For (jobPut) jobDone (jobPut As HttpJob)
If jobPut.Success And jobPut.Response.StatusCode = 200 Then
fcmUpdatedOk = True
End If
jobPut.Release
End If
End If
jobGet.Release
Return fcmUpdatedOk
End Sub