mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
mark auto-fallback to sms as forcedSms
// FREEBIE
This commit is contained in:
parent
4438b4ae69
commit
b715debefc
@ -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
|
||||||
|
@ -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;
|
||||||
|
@ -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) {
|
||||||
|
@ -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.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user