Refactoring

pull/152/head
M66B 7 years ago
parent fd9a27f4cd
commit fe6fa7a2d5

@ -20,7 +20,6 @@ package eu.faircode.email;
*/ */
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
@ -115,7 +114,7 @@ public class EntityOperation {
db.folder().setFolderSyncState(fid, "requested"); db.folder().setFolderSyncState(fid, "requested");
if (folder.account == null) // Outbox if (folder.account == null) // Outbox
context.startService(new Intent(context, ServiceSend.class)); ServiceSend.start(context);
Log.i("Queued sync folder=" + folder); Log.i("Queued sync folder=" + folder);
} }
@ -227,7 +226,7 @@ public class EntityOperation {
db.message().setMessageUiHide(message.id, true); db.message().setMessageUiHide(message.id, true);
else if (SEND.equals(name)) else if (SEND.equals(name))
context.startService(new Intent(context, ServiceSend.class)); ServiceSend.start(context);
} catch (JSONException ex) { } catch (JSONException ex) {
Log.e(ex); Log.e(ex);
} }

@ -51,7 +51,7 @@ public class ReceiverAutostart extends BroadcastReceiver {
return; return;
if (db.operation().getOperations(outbox.id).size() > 0) if (db.operation().getOperations(outbox.id).size() > 0)
context.startService(new Intent(context, ServiceSend.class)); ServiceSend.start(context);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);

@ -412,4 +412,8 @@ public class ServiceSend extends LifecycleService {
db.identity().setIdentityState(ident.id, null); db.identity().setIdentityState(ident.id, null);
} }
} }
static void start(Context context) {
context.startService(new Intent(context, ServiceSend.class));
}
} }

Loading…
Cancel
Save