fixed duplicate-recieve
This commit is contained in:
parent
27b45098f0
commit
6f7529fc9b
@ -283,10 +283,7 @@ public class ServerCommunication
|
|||||||
|
|
||||||
SCNApp.refreshAccountTab();
|
SCNApp.refreshAccountTab();
|
||||||
|
|
||||||
if (json_int(json, "unack_count")>0)
|
if (json_int(json, "unack_count")>0) ServerCommunication.requery(id, key, loader);
|
||||||
{
|
|
||||||
ServerCommunication.requery(id, key, loader);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("SC:info", e.toString());
|
Log.e("SC:info", e.toString());
|
||||||
@ -432,12 +429,12 @@ public class ServerCommunication
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ack(int id, String key, CMessage msg)
|
public static void ack(int id, String key, long msg_scn_id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(BASE_URL + "ack.php?user_id=" + id + "&user_key=" + key + "&scn_msg_id=" + msg.SCN_ID)
|
.url(BASE_URL + "ack.php?user_id=" + id + "&user_key=" + key + "&scn_msg_id=" + msg_scn_id)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
client.newCall(request).enqueue(new Callback() {
|
client.newCall(request).enqueue(new Callback() {
|
||||||
|
@ -50,15 +50,15 @@ public class FBMService extends FirebaseMessagingService
|
|||||||
|
|
||||||
public static void recieveData(long time, String title, String content, PriorityEnum prio, long scn_id, boolean alwaysAck)
|
public static void recieveData(long time, String title, String content, PriorityEnum prio, long scn_id, boolean alwaysAck)
|
||||||
{
|
{
|
||||||
CMessage msg = CMessageList.inst().add(scn_id, time, title, content, prio);
|
|
||||||
|
|
||||||
if (CMessageList.inst().isAck(scn_id))
|
if (CMessageList.inst().isAck(scn_id))
|
||||||
{
|
{
|
||||||
Log.w("FB::MessageReceived", "Recieved ack-ed message: " + scn_id);
|
Log.w("FB::MessageReceived", "Recieved ack-ed message: " + scn_id);
|
||||||
if (alwaysAck) ServerCommunication.ack(SCNSettings.inst().user_id, SCNSettings.inst().user_key, msg);
|
if (alwaysAck) ServerCommunication.ack(SCNSettings.inst().user_id, SCNSettings.inst().user_key, scn_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMessage msg = CMessageList.inst().add(scn_id, time, title, content, prio);
|
||||||
|
|
||||||
if (SCNApp.isBackground())
|
if (SCNApp.isBackground())
|
||||||
{
|
{
|
||||||
NotificationService.inst().showBackground(msg);
|
NotificationService.inst().showBackground(msg);
|
||||||
@ -68,6 +68,6 @@ public class FBMService extends FirebaseMessagingService
|
|||||||
NotificationService.inst().showForeground(msg);
|
NotificationService.inst().showForeground(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerCommunication.ack(SCNSettings.inst().user_id, SCNSettings.inst().user_key, msg);
|
ServerCommunication.ack(SCNSettings.inst().user_id, SCNSettings.inst().user_key, scn_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user