Fix quote messages & friend request handling

This commit is contained in:
Niels Andriesse 2019-07-24 15:05:39 +10:00
parent 4374a902be
commit 7598830a1b
14 changed files with 46 additions and 31 deletions

View File

@ -569,15 +569,15 @@
<provider android:name="org.thoughtcrime.securesms.providers.PartProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="network.loki.messenger.securesms" />
android:authorities="network.loki.provider.securesms" />
<provider android:name="org.thoughtcrime.securesms.providers.MmsBodyProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="network.loki.messenger.securesms.mms" />
android:authorities="network.loki.provider.securesms.mms" />
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="network.loki.messenger.securesms.fileprovider"
android:authorities="network.loki.securesms.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
@ -586,15 +586,15 @@
</provider>
<provider android:name="org.thoughtcrime.securesms.database.DatabaseContentProviders$Conversation"
android:authorities="network.loki.messenger.securesms.database.conversation"
android:authorities="network.loki.securesms.database.conversation"
android:exported="false" />
<provider android:name="org.thoughtcrime.securesms.database.DatabaseContentProviders$ConversationList"
android:authorities="network.loki.messenger.securesms.database.conversationlist"
android:authorities="network.loki.securesms.database.conversationlist"
android:exported="false" />
<provider android:name="org.thoughtcrime.securesms.database.DatabaseContentProviders$Attachment"
android:authorities="network.loki.messenger.securesms.database.attachment"
android:authorities="network.loki.securesms.database.attachment"
android:exported="false" />
<receiver android:name="org.thoughtcrime.securesms.service.BootReceiver">

View File

@ -191,7 +191,8 @@
<org.thoughtcrime.securesms.loki.FriendRequestView
android:id="@+id/friend_request_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:visibility="gone" />
</LinearLayout>

View File

@ -148,7 +148,8 @@
<org.thoughtcrime.securesms.loki.FriendRequestView
android:id="@+id/friend_request_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:visibility="gone" />
</LinearLayout>

View File

@ -14,11 +14,11 @@ import android.support.annotation.Nullable;
public class DatabaseContentProviders {
public static class ConversationList extends NoopContentProvider {
public static final Uri CONTENT_URI = Uri.parse("content://network.loki.messenger.securesms.database.conversationlist");
public static final Uri CONTENT_URI = Uri.parse("content://network.loki.securesms.database.conversationlist");
}
public static class Conversation extends NoopContentProvider {
private static final String CONTENT_URI_STRING = "content://network.loki.messenger.securesms.database.conversation/";
private static final String CONTENT_URI_STRING = "content://network.loki.securesms.database.conversation/";
public static Uri getUriForThread(long threadId) {
return Uri.parse(CONTENT_URI_STRING + threadId);
@ -26,7 +26,7 @@ public class DatabaseContentProviders {
}
public static class Attachment extends NoopContentProvider {
public static final Uri CONTENT_URI = Uri.parse("content://network.loki.messenger.securesms.database.attachment");
public static final Uri CONTENT_URI = Uri.parse("content://network.loki.securesms.database.attachment");
}
private static abstract class NoopContentProvider extends ContentProvider {

View File

@ -28,7 +28,6 @@ import org.signal.libsignal.metadata.ProtocolUntrustedIdentityException;
import org.signal.libsignal.metadata.SelfSendException;
import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.ConversationListActivity;
import network.loki.messenger.R;
import org.thoughtcrime.securesms.attachments.Attachment;
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
import org.thoughtcrime.securesms.attachments.PointerAttachment;
@ -125,6 +124,8 @@ import java.util.List;
import javax.inject.Inject;
import network.loki.messenger.R;
public class PushDecryptJob extends BaseJob implements InjectableType {
public static final String KEY = "PushDecryptJob";

View File

@ -198,7 +198,7 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType {
}
try {
rotateSenderCertificateIfNecessary();
// rotateSenderCertificateIfNecessary();
SignalServiceAddress address = getPushAddress(message.getRecipient().getAddress());
List<SignalServiceAttachment> serviceAttachments = getAttachmentPointersFor(message.getAttachments());

View File

@ -10,6 +10,7 @@ import android.widget.TextView
import network.loki.messenger.R;
import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.database.model.MessageRecord
import org.thoughtcrime.securesms.database.model.SmsMessageRecord
import org.whispersystems.signalservice.loki.messaging.LokiMessageFriendRequestStatus
class FriendRequestView(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : LinearLayout(context, attrs, defStyleAttr) {
@ -88,6 +89,8 @@ class FriendRequestView(context: Context, attrs: AttributeSet?, defStyleAttr: In
val database = DatabaseFactory.getLokiMessageFriendRequestDatabase(context)
val contactID = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(message!!.threadId)!!.address.toString()
val contactDisplayName = DatabaseFactory.getLokiUserDisplayNameDatabase(context).getDisplayName(contactID) ?: contactID
val isTextMessage = message is SmsMessageRecord
if (!isTextMessage) return
if (!message!!.isOutgoing) {
val friendRequestStatus = database.getFriendRequestStatus(message!!.id)
visibility = if (friendRequestStatus == LokiMessageFriendRequestStatus.NONE) View.GONE else View.VISIBLE

View File

@ -19,8 +19,8 @@ import java.io.InputStream;
public class PartAuthority {
private static final String PART_URI_STRING = "content://network.loki.messenger.securesms/part";
private static final String THUMB_URI_STRING = "content://network.loki.messenger.securesms/thumb";
private static final String PART_URI_STRING = "content://network.loki.provider.securesms/part";
private static final String THUMB_URI_STRING = "content://network.loki.provider.securesms/thumb";
private static final Uri PART_CONTENT_URI = Uri.parse(PART_URI_STRING);
private static final Uri THUMB_CONTENT_URI = Uri.parse(THUMB_URI_STRING);

View File

@ -20,7 +20,9 @@ import org.thoughtcrime.securesms.database.MessagingDatabase.SyncMessageId;
import org.thoughtcrime.securesms.jobs.MultiDeviceReadUpdateJob;
import org.thoughtcrime.securesms.jobs.SendReadReceiptJob;
import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.loki.LokiThreadDatabase;
import org.thoughtcrime.securesms.service.ExpiringMessageManager;
import org.whispersystems.signalservice.loki.messaging.LokiThreadFriendRequestStatus;
import java.util.LinkedList;
import java.util.List;
@ -84,6 +86,11 @@ public class MarkReadReceiver extends BroadcastReceiver {
.collect(Collectors.groupingBy(SyncMessageId::getAddress));
for (Address address : addressMap.keySet()) {
LokiThreadDatabase threadDatabase = DatabaseFactory.getLokiThreadDatabase(context);
long threadID = threadDatabase.getThreadID(address.serialize());
LokiThreadFriendRequestStatus friendRequestStatus = threadDatabase.getFriendRequestStatus(threadID);
if (friendRequestStatus != LokiThreadFriendRequestStatus.FRIENDS) { return; }
List<Long> timestamps = Stream.of(addressMap.get(address)).map(SyncMessageId::getTimetamp).toList();
ApplicationContext.getInstance(context)

View File

@ -25,7 +25,6 @@ import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Executor;
/**
* Allows for the creation and retrieval of blobs.
@ -37,7 +36,7 @@ public class BlobProvider {
private static final String MULTI_SESSION_DIRECTORY = "multi_session_blobs";
private static final String SINGLE_SESSION_DIRECTORY = "single_session_blobs";
public static final Uri CONTENT_URI = Uri.parse("content://network.loki.messenger.securesms/blob");
public static final Uri CONTENT_URI = Uri.parse("content://network.loki.provider.securesms/blob");
public static final String AUTHORITY = "org.thoughtcrime.securesms";
public static final String PATH = "blob/*/*/*/*/*";

View File

@ -6,14 +6,13 @@ import android.content.UriMatcher;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.thoughtcrime.securesms.logging.Log;
import android.webkit.MimeTypeMap;
import org.thoughtcrime.securesms.crypto.AttachmentSecret;
import org.thoughtcrime.securesms.crypto.AttachmentSecretProvider;
import org.thoughtcrime.securesms.crypto.ClassicDecryptingPartInputStream;
import org.thoughtcrime.securesms.crypto.ModernDecryptingPartInputStream;
import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.util.FileProviderUtil;
import java.io.File;
@ -31,7 +30,7 @@ public class DeprecatedPersistentBlobProvider {
private static final String TAG = DeprecatedPersistentBlobProvider.class.getSimpleName();
private static final String URI_STRING = "content://network.loki.messenger.securesms/capture-new";
private static final String URI_STRING = "content://network.loki.provider.securesms/capture-new";
public static final Uri CONTENT_URI = Uri.parse(URI_STRING);
public static final String AUTHORITY = "org.thoughtcrime.securesms";
public static final String EXPECTED_PATH_OLD = "capture/*/*/#";

View File

@ -33,7 +33,7 @@ import java.io.OutputStream;
public class MmsBodyProvider extends ContentProvider {
private static final String TAG = MmsBodyProvider.class.getSimpleName();
private static final String CONTENT_URI_STRING = "content://network.loki.messenger.securesms.mms/mms";
private static final String CONTENT_URI_STRING = "content://network.loki.provider.securesms.mms/mms";
public static final Uri CONTENT_URI = Uri.parse(CONTENT_URI_STRING);
private static final int SINGLE_ROW = 1;

View File

@ -46,7 +46,7 @@ public class PartProvider extends ContentProvider {
private static final String TAG = PartProvider.class.getSimpleName();
private static final String CONTENT_URI_STRING = "content://network.loki.messenger.securesms/part";
private static final String CONTENT_URI_STRING = "content://network.loki.provider.securesms/part";
private static final Uri CONTENT_URI = Uri.parse(CONTENT_URI_STRING);
private static final int SINGLE_ROW = 1;

View File

@ -204,15 +204,19 @@ public class MessageSender {
}
private static boolean isPushMediaSend(Context context, Recipient recipient) {
if (!TextSecurePreferences.isPushRegistered(context)) {
return false;
}
if (recipient.isGroupRecipient()) {
return false;
}
return isPushDestination(context, recipient);
return true;
// Loki - Original code
// ========
// if (!TextSecurePreferences.isPushRegistered(context)) {
// return false;
// }
//
// if (recipient.isGroupRecipient()) {
// return false;
// }
//
// return isPushDestination(context, recipient);
// ========
}
private static boolean isGroupPushSend(Recipient recipient) {