session-android/src/org/thoughtcrime/securesms/jobs/SendJob.java

30 lines
996 B
Java
Raw Normal View History

package org.thoughtcrime.securesms.jobs;
import android.content.Context;
import org.thoughtcrime.securesms.BuildConfig;
import org.thoughtcrime.securesms.TextSecureExpiredException;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.jobqueue.JobParameters;
public abstract class SendJob extends MasterSecretJob {
public SendJob(Context context, JobParameters parameters) {
super(context, parameters);
}
@Override
public final void onRun(MasterSecret masterSecret) throws Exception {
if (!Util.isBuildFresh()) {
throw new TextSecureExpiredException(String.format("TextSecure expired (build %d, now %d)",
BuildConfig.BUILD_TIMESTAMP,
System.currentTimeMillis()));
}
onSend(masterSecret);
}
protected abstract void onSend(MasterSecret masterSecret) throws Exception;
}