mark auto-fallback to sms as forcedSms

// FREEBIE
This commit is contained in:
Jake McGinty 2014-04-03 16:20:23 -07:00 committed by Moxie Marlinspike
parent 4438b4ae69
commit b715debefc
4 changed files with 9 additions and 9 deletions

View File

@ -23,9 +23,8 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AbsListView; import android.widget.AbsListView;
import android.widget.CursorAdapter; import android.support.v4.widget.CursorAdapter;
import org.thoughtcrime.securesms.util.GroupUtil;
import org.whispersystems.textsecure.crypto.MasterSecret; import org.whispersystems.textsecure.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.MmsSmsColumns; import org.thoughtcrime.securesms.database.MmsSmsColumns;
@ -33,7 +32,6 @@ import org.thoughtcrime.securesms.database.MmsSmsDatabase;
import org.thoughtcrime.securesms.database.SmsDatabase; import org.thoughtcrime.securesms.database.SmsDatabase;
import org.thoughtcrime.securesms.database.model.MessageRecord; import org.thoughtcrime.securesms.database.model.MessageRecord;
import org.thoughtcrime.securesms.util.LRUCache; import org.thoughtcrime.securesms.util.LRUCache;
import org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
import java.util.Collections; import java.util.Collections;
@ -67,14 +65,13 @@ public class ConversationAdapter extends CursorAdapter implements AbsListView.Re
public ConversationAdapter(Context context, MasterSecret masterSecret, public ConversationAdapter(Context context, MasterSecret masterSecret,
Handler failedIconClickHandler, boolean groupThread, boolean pushDestination) Handler failedIconClickHandler, boolean groupThread, boolean pushDestination)
{ {
super(context, null); super(context, null, true);
this.context = context; this.context = context;
this.masterSecret = masterSecret; this.masterSecret = masterSecret;
this.failedIconClickHandler = failedIconClickHandler; this.failedIconClickHandler = failedIconClickHandler;
this.groupThread = groupThread; this.groupThread = groupThread;
this.pushDestination = pushDestination; this.pushDestination = pushDestination;
this.inflater = (LayoutInflater)context this.inflater = LayoutInflater.from(context);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
} }
@Override @Override

View File

@ -16,7 +16,7 @@ import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CursorAdapter; import android.support.v4.widget.CursorAdapter;
import android.widget.ListView; import android.widget.ListView;
import com.actionbarsherlock.app.SherlockListFragment; import com.actionbarsherlock.app.SherlockListFragment;

View File

@ -281,8 +281,9 @@ public class MmsDatabase extends Database implements MmsSmsColumns {
notifyConversationListeners(getThreadIdForMessage(messageId)); notifyConversationListeners(getThreadIdForMessage(messageId));
} }
public void markAsForcedSms(long id) { public void markAsForcedSms(long messageId) {
updateMailboxBitmask(id, 0, Types.MESSAGE_FORCE_SMS_BIT); updateMailboxBitmask(messageId, 0, Types.MESSAGE_FORCE_SMS_BIT);
notifyConversationListeners(getThreadIdForMessage(messageId));
} }
public void markAsPendingSecureSmsFallback(long messageId) { public void markAsPendingSecureSmsFallback(long messageId) {

View File

@ -167,6 +167,7 @@ public class UniversalTransport {
if (!isSmsFallbackApprovalRequired) { if (!isSmsFallbackApprovalRequired) {
Log.w("UniversalTransport", "Falling back to MMS"); Log.w("UniversalTransport", "Falling back to MMS");
DatabaseFactory.getMmsDatabase(context).markAsForcedSms(mediaMessage.getDatabaseMessageId());
return mmsTransport.deliver(mediaMessage); return mmsTransport.deliver(mediaMessage);
} else if (!Session.hasEncryptCapableSession(context, masterSecret, recipient)) { } else if (!Session.hasEncryptCapableSession(context, masterSecret, recipient)) {
Log.w("UniversalTransport", "Marking message as pending insecure SMS fallback"); Log.w("UniversalTransport", "Marking message as pending insecure SMS fallback");
@ -188,6 +189,7 @@ public class UniversalTransport {
if (!isSmsFallbackApprovalRequired) { if (!isSmsFallbackApprovalRequired) {
Log.w("UniversalTransport", "Falling back to SMS"); Log.w("UniversalTransport", "Falling back to SMS");
DatabaseFactory.getSmsDatabase(context).markAsForcedSms(smsMessage.getId());
smsTransport.deliver(smsMessage); smsTransport.deliver(smsMessage);
} else if (!Session.hasEncryptCapableSession(context, masterSecret, recipient)) { } else if (!Session.hasEncryptCapableSession(context, masterSecret, recipient)) {
Log.w("UniversalTransport", "Marking message as pending insecure fallback."); Log.w("UniversalTransport", "Marking message as pending insecure fallback.");