2014-08-04 20:13:47 +00:00
|
|
|
package org.thoughtcrime.securesms.components;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View.OnClickListener;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.R;
|
|
|
|
import org.thoughtcrime.securesms.RegistrationActivity;
|
|
|
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
2014-11-03 23:16:04 +00:00
|
|
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
2014-08-04 20:13:47 +00:00
|
|
|
|
|
|
|
public class PushRegistrationReminder extends Reminder {
|
|
|
|
|
|
|
|
public PushRegistrationReminder(final Context context, final MasterSecret masterSecret) {
|
|
|
|
super(R.drawable.ic_push_registration_reminder,
|
|
|
|
R.string.reminder_header_push_title,
|
|
|
|
R.string.reminder_header_push_text);
|
|
|
|
|
|
|
|
final OnClickListener okListener = new OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
Intent intent = new Intent(context, RegistrationActivity.class);
|
|
|
|
intent.putExtra("master_secret", masterSecret);
|
2014-12-14 19:42:26 +00:00
|
|
|
intent.putExtra("cancel_button", true);
|
2014-08-04 20:13:47 +00:00
|
|
|
context.startActivity(intent);
|
|
|
|
}
|
|
|
|
};
|
2015-03-11 21:23:45 +00:00
|
|
|
|
2014-08-04 20:13:47 +00:00
|
|
|
setOkListener(okListener);
|
2015-03-11 21:23:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isDismissable() {
|
|
|
|
return false;
|
2014-08-04 20:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isEligible(Context context) {
|
2015-03-11 21:23:45 +00:00
|
|
|
return !TextSecurePreferences.isPushRegistered(context);
|
2014-08-04 20:13:47 +00:00
|
|
|
}
|
|
|
|
}
|