parent
12845da91a
commit
a0ed0842a0
@ -0,0 +1,7 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
public class TextSecureExpiredException extends Exception {
|
||||||
|
public TextSecureExpiredException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package org.thoughtcrime.securesms.components;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.provider.Telephony;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.R;
|
||||||
|
import org.thoughtcrime.securesms.TextSecureExpiredException;
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
|
public class ExpiredBuildReminder extends Reminder {
|
||||||
|
|
||||||
|
private static final String TAG = ExpiredBuildReminder.class.getSimpleName();
|
||||||
|
|
||||||
|
public ExpiredBuildReminder() {
|
||||||
|
super(R.drawable.ic_dialog_alert_holo_dark,
|
||||||
|
R.string.reminder_header_expired_build,
|
||||||
|
R.string.reminder_header_expired_build_details);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDismissable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEligible(Context context) {
|
||||||
|
return !Util.isBuildFresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue