Delay processing FCM uninstalled feedback

Check to make sure client is not still active before unregistering,
since FCM feedback seems to be often erroneous
This commit is contained in:
Moxie Marlinspike
2019-05-06 21:06:18 -07:00
parent 92ca8862e1
commit 4d9c9206cf
13 changed files with 259 additions and 63 deletions

View File

@@ -17,6 +17,7 @@ import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.Device;
import org.whispersystems.textsecuregcm.util.Constants;
import org.whispersystems.textsecuregcm.util.Util;
import java.io.IOException;
import java.util.HashMap;
@@ -111,19 +112,20 @@ public class GCMSender implements Managed {
GcmMessage message = (GcmMessage)result.getContext();
logger.warn("Got GCM unregistered notice! " + message.getGcmId());
// Optional<Account> account = getAccountForEvent(message);
//
// if (account.isPresent()) {
// Device device = account.get().getDevice(message.getDeviceId()).get();
Optional<Account> account = getAccountForEvent(message);
if (account.isPresent()) {
Device device = account.get().getDevice(message.getDeviceId()).get();
device.setUninstalledFeedbackTimestamp(Util.todayInMillis());
// device.setGcmId(null);
// device.setFetchesMessages(false);
//
// accountsManager.update(account.get());
//
accountsManager.update(account.get());
// if (!account.get().isActive()) {
// directoryQueue.deleteRegisteredUser(account.get().getNumber());
// }
// }
}
unregistered.mark();
}