2015-07-14 14:31:03 -07:00
|
|
|
package org.thoughtcrime.securesms.contacts;
|
|
|
|
|
|
|
|
import android.accounts.Account;
|
|
|
|
import android.content.AbstractThreadedSyncAdapter;
|
|
|
|
import android.content.ContentProviderClient;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.SyncResult;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.util.Log;
|
|
|
|
|
2015-10-27 12:18:02 -07:00
|
|
|
import org.thoughtcrime.securesms.service.KeyCachingService;
|
2015-07-14 14:31:03 -07:00
|
|
|
import org.thoughtcrime.securesms.util.DirectoryHelper;
|
2015-11-16 12:03:47 -08:00
|
|
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
2015-07-14 14:31:03 -07:00
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
public class ContactsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|
|
|
|
|
|
|
private static final String TAG = ContactsSyncAdapter.class.getSimpleName();
|
|
|
|
|
|
|
|
public ContactsSyncAdapter(Context context, boolean autoInitialize) {
|
|
|
|
super(context, autoInitialize);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onPerformSync(Account account, Bundle extras, String authority,
|
|
|
|
ContentProviderClient provider, SyncResult syncResult)
|
|
|
|
{
|
2015-11-06 10:50:47 -08:00
|
|
|
Log.w(TAG, "onPerformSync(" + authority +")");
|
|
|
|
|
2015-11-16 12:03:47 -08:00
|
|
|
if (TextSecurePreferences.isPushRegistered(getContext())) {
|
|
|
|
try {
|
|
|
|
DirectoryHelper.refreshDirectory(getContext(), KeyCachingService.getMasterSecret(getContext()));
|
|
|
|
} catch (IOException e) {
|
|
|
|
Log.w(TAG, e);
|
|
|
|
}
|
2015-07-14 14:31:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|