mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-26 09:47:43 +00:00
8fc690d8e0
Fixes #4549 // FREEBIE
41 lines
1.2 KiB
Java
41 lines
1.2 KiB
Java
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;
|
|
|
|
import org.thoughtcrime.securesms.service.KeyCachingService;
|
|
import org.thoughtcrime.securesms.util.DirectoryHelper;
|
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
|
|
|
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)
|
|
{
|
|
Log.w(TAG, "onPerformSync(" + authority +")");
|
|
|
|
if (TextSecurePreferences.isPushRegistered(getContext())) {
|
|
try {
|
|
DirectoryHelper.refreshDirectory(getContext(), KeyCachingService.getMasterSecret(getContext()));
|
|
} catch (IOException e) {
|
|
Log.w(TAG, e);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|