Search in sources :

Example 1 with DefaultSmsReminder

use of org.thoughtcrime.securesms.components.reminder.DefaultSmsReminder in project Signal-Android by WhisperSystems.

the class ConversationListFragment method updateReminders.

private void updateReminders() {
    reminderView.hide();
    new AsyncTask<Context, Void, Optional<? extends Reminder>>() {

        @Override
        protected Optional<? extends Reminder> doInBackground(Context... params) {
            final Context context = params[0];
            if (ExpiredBuildReminder.isEligible()) {
                return Optional.of(new ExpiredBuildReminder(context));
            } else if (OutdatedBuildReminder.isEligible()) {
                return Optional.of(new OutdatedBuildReminder(context));
            } else if (DefaultSmsReminder.isEligible(context)) {
                return Optional.of(new DefaultSmsReminder(context));
            } else if (Util.isDefaultSmsProvider(context) && SystemSmsImportReminder.isEligible(context)) {
                return Optional.of((new SystemSmsImportReminder(context, masterSecret)));
            } else if (PushRegistrationReminder.isEligible(context)) {
                return Optional.of((new PushRegistrationReminder(context, masterSecret)));
            } else if (ShareReminder.isEligible(context)) {
                return Optional.of(new ShareReminder(context));
            } else if (DozeReminder.isEligible(context)) {
                return Optional.of(new DozeReminder(context));
            } else {
                return Optional.absent();
            }
        }

        @Override
        protected void onPostExecute(Optional<? extends Reminder> reminder) {
            if (reminder.isPresent() && getActivity() != null && !isRemoving()) {
                reminderView.showReminder(reminder.get());
            }
        }
    }.execute(getActivity());
}
Also used : Context(android.content.Context) PushRegistrationReminder(org.thoughtcrime.securesms.components.reminder.PushRegistrationReminder) ShareReminder(org.thoughtcrime.securesms.components.reminder.ShareReminder) DozeReminder(org.thoughtcrime.securesms.components.reminder.DozeReminder) ShareReminder(org.thoughtcrime.securesms.components.reminder.ShareReminder) DefaultSmsReminder(org.thoughtcrime.securesms.components.reminder.DefaultSmsReminder) ExpiredBuildReminder(org.thoughtcrime.securesms.components.reminder.ExpiredBuildReminder) DozeReminder(org.thoughtcrime.securesms.components.reminder.DozeReminder) SystemSmsImportReminder(org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder) OutdatedBuildReminder(org.thoughtcrime.securesms.components.reminder.OutdatedBuildReminder) PushRegistrationReminder(org.thoughtcrime.securesms.components.reminder.PushRegistrationReminder) Reminder(org.thoughtcrime.securesms.components.reminder.Reminder) Optional(org.whispersystems.libsignal.util.guava.Optional) DefaultSmsReminder(org.thoughtcrime.securesms.components.reminder.DefaultSmsReminder) ExpiredBuildReminder(org.thoughtcrime.securesms.components.reminder.ExpiredBuildReminder) OutdatedBuildReminder(org.thoughtcrime.securesms.components.reminder.OutdatedBuildReminder) SystemSmsImportReminder(org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder)

Aggregations

Context (android.content.Context)1 DefaultSmsReminder (org.thoughtcrime.securesms.components.reminder.DefaultSmsReminder)1 DozeReminder (org.thoughtcrime.securesms.components.reminder.DozeReminder)1 ExpiredBuildReminder (org.thoughtcrime.securesms.components.reminder.ExpiredBuildReminder)1 OutdatedBuildReminder (org.thoughtcrime.securesms.components.reminder.OutdatedBuildReminder)1 PushRegistrationReminder (org.thoughtcrime.securesms.components.reminder.PushRegistrationReminder)1 Reminder (org.thoughtcrime.securesms.components.reminder.Reminder)1 ShareReminder (org.thoughtcrime.securesms.components.reminder.ShareReminder)1 SystemSmsImportReminder (org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder)1 Optional (org.whispersystems.libsignal.util.guava.Optional)1