26 lines
851 B
Java
Raw Normal View History

package org.thoughtcrime.securesms.notifications;
import android.content.Context;
import android.support.annotation.NonNull;
import org.thoughtcrime.securesms.database.RecipientDatabase;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
public enum ReplyMethod {
GroupMessage,
SecureMessage,
UnsecuredSmsMessage;
public static @NonNull ReplyMethod forRecipient(Context context, Recipient recipient) {
if (recipient.isGroupRecipient()) {
return ReplyMethod.GroupMessage;
} else if (TextSecurePreferences.isPushRegistered(context) && recipient.getRegistered() == RecipientDatabase.RegisteredState.REGISTERED && !recipient.isForceSmsSelection()) {
return ReplyMethod.SecureMessage;
} else {
return ReplyMethod.UnsecuredSmsMessage;
}
}
}