Don't sync groups when there are no groups.

Fixes #3882
// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-08-06 10:20:13 -07:00
parent 716ed94ca1
commit 973ed7686b

View File

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.jobs;
import android.content.Context; import android.content.Context;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.util.Log;
import org.thoughtcrime.securesms.crypto.MasterSecret; import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.DatabaseFactory;
@ -32,6 +33,7 @@ import javax.inject.Inject;
public class MultiDeviceGroupUpdateJob extends MasterSecretJob implements InjectableType { public class MultiDeviceGroupUpdateJob extends MasterSecretJob implements InjectableType {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final String TAG = MultiDeviceGroupUpdateJob.class.getSimpleName();
@Inject @Inject
transient TextSecureCommunicationModule.TextSecureMessageSenderFactory messageSenderFactory; transient TextSecureCommunicationModule.TextSecureMessageSenderFactory messageSenderFactory;
@ -65,7 +67,11 @@ public class MultiDeviceGroupUpdateJob extends MasterSecretJob implements Inject
out.close(); out.close();
sendUpdate(messageSender, contactDataFile); if (contactDataFile.exists() && contactDataFile.length() > 0) {
sendUpdate(messageSender, contactDataFile);
} else {
Log.w(TAG, "No groups present for sync message...");
}
} finally { } finally {
if (contactDataFile != null) contactDataFile.delete(); if (contactDataFile != null) contactDataFile.delete();