mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
Merge branch 'dev' into multi-device-integration
This commit is contained in:
commit
dde4ee6e36
@ -186,6 +186,7 @@ dependencies {
|
||||
implementation "com.squareup.okhttp3:okhttp:3.12.1"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation "nl.komponents.kovenant:kovenant:$kovenant_version"
|
||||
implementation "nl.komponents.kovenant:kovenant-android:$kovenant_version"
|
||||
implementation "com.github.lelloman:android-identicons:$identicon_version"
|
||||
implementation "com.prof.rssparser:rssparser:$rss_parser_version"
|
||||
implementation "com.mixpanel.android:mixpanel-android:$mixpanel_version"
|
||||
@ -194,7 +195,7 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
def canonicalVersionCode = 14
|
||||
def canonicalVersionCode = 15
|
||||
def canonicalVersionName = "1.2.0"
|
||||
|
||||
def postFixSize = 10
|
||||
|
@ -101,6 +101,9 @@ import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import network.loki.messenger.BuildConfig;
|
||||
|
||||
import static nl.komponents.kovenant.android.KovenantAndroid.startKovenant;
|
||||
import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant;
|
||||
|
||||
/**
|
||||
* Will be called once when the TextSecure process is created.
|
||||
*
|
||||
@ -139,6 +142,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
LokiGroupChatAPI.Companion.setDebugMode(BuildConfig.DEBUG); // Loki - Set debug mode if needed
|
||||
startKovenant();
|
||||
Log.i(TAG, "onCreate()");
|
||||
initializeSecurityProvider();
|
||||
initializeLogging();
|
||||
@ -196,6 +200,12 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
if (lokiLongPoller != null) { lokiLongPoller.stopIfNeeded(); }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
stopKovenant();
|
||||
super.onTerminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectDependencies(Object object) {
|
||||
if (object instanceof InjectableType) {
|
||||
|
@ -150,8 +150,8 @@ public class InputPanel extends LinearLayout
|
||||
composeText.setMediaListener(listener);
|
||||
}
|
||||
|
||||
public void setQuote(@NonNull GlideRequests glideRequests, long id, @NonNull Recipient author, @NonNull String body, @NonNull SlideDeck attachments) {
|
||||
this.quoteView.setQuote(glideRequests, id, author, body, false, attachments);
|
||||
public void setQuote(@NonNull GlideRequests glideRequests, long id, @NonNull Recipient author, @NonNull String body, @NonNull SlideDeck attachments, @NonNull Recipient conversationRecipient) {
|
||||
this.quoteView.setQuote(glideRequests, id, author, body, false, attachments, conversationRecipient);
|
||||
this.quoteView.setVisibility(View.VISIBLE);
|
||||
|
||||
if (this.linkPreview.getVisibility() == View.VISIBLE) {
|
||||
|
@ -28,6 +28,7 @@ import org.thoughtcrime.securesms.mms.Slide;
|
||||
import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientModifiedListener;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.thoughtcrime.securesms.util.ThemeUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.signalservice.loki.api.LokiGroupChatAPI;
|
||||
@ -58,6 +59,7 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener
|
||||
private long id;
|
||||
private Recipient author;
|
||||
private String body;
|
||||
private Recipient conversationRecipient;
|
||||
private TextView mediaDescriptionText;
|
||||
private TextView missingLinkText;
|
||||
private SlideDeck attachments;
|
||||
@ -145,7 +147,8 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener
|
||||
@NonNull Recipient author,
|
||||
@Nullable String body,
|
||||
boolean originalMissing,
|
||||
@NonNull SlideDeck attachments)
|
||||
@NonNull SlideDeck attachments,
|
||||
@NonNull Recipient conversationRecipient)
|
||||
{
|
||||
if (this.author != null) this.author.removeListener(this);
|
||||
|
||||
@ -153,6 +156,7 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener
|
||||
this.author = author;
|
||||
this.body = body;
|
||||
this.attachments = attachments;
|
||||
this.conversationRecipient = conversationRecipient;
|
||||
|
||||
author.addListener(this);
|
||||
setQuoteAuthor(author);
|
||||
@ -193,6 +197,18 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener
|
||||
if (quoteeDisplayName.equals(author.getAddress().toString())) {
|
||||
quoteeDisplayName = DatabaseFactory.getLokiUserDatabase(getContext()).getServerDisplayName(LokiGroupChatAPI.getPublicChatServer() + "." + LokiGroupChatAPI.getPublicChatServerID(), author.getAddress().toString());
|
||||
}
|
||||
|
||||
// If we're in a group then try and use the display name in the group
|
||||
if (conversationRecipient.isGroupRecipient()) {
|
||||
try {
|
||||
String serverId = GroupUtil.getDecodedStringId(conversationRecipient.getAddress().serialize());
|
||||
String senderDisplayName = DatabaseFactory.getLokiUserDatabase(getContext()).getServerDisplayName(serverId, author.getAddress().serialize());
|
||||
if (senderDisplayName != null) { quoteeDisplayName = senderDisplayName; }
|
||||
} catch (Exception e) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
authorView.setText(isOwnNumber ? getContext().getString(R.string.QuoteView_you) : quoteeDisplayName);
|
||||
|
||||
// We use the raw color resource because Android 4.x was struggling with tints here
|
||||
|
@ -2151,7 +2151,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
|
||||
private void updateInputPanel() {
|
||||
boolean hasPendingFriendRequest = DatabaseFactory.getLokiThreadDatabase(this).hasPendingFriendRequest(threadId);
|
||||
boolean hasPendingFriendRequest = !recipient.isGroupRecipient() && DatabaseFactory.getLokiThreadDatabase(this).hasPendingFriendRequest(threadId);
|
||||
inputPanel.setEnabled(!hasPendingFriendRequest);
|
||||
int hintID = hasPendingFriendRequest ? R.string.activity_conversation_pending_friend_request_hint : R.string.activity_conversation_default_hint;
|
||||
inputPanel.setHint(getResources().getString(hintID));
|
||||
@ -2750,7 +2750,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
messageRecord.getDateSent(),
|
||||
author,
|
||||
body,
|
||||
slideDeck);
|
||||
slideDeck,
|
||||
recipient);
|
||||
|
||||
} else if (messageRecord.isMms() && !((MmsMessageRecord) messageRecord).getLinkPreviews().isEmpty()) {
|
||||
LinkPreview linkPreview = ((MmsMessageRecord) messageRecord).getLinkPreviews().get(0);
|
||||
@ -2764,13 +2765,15 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
messageRecord.getDateSent(),
|
||||
author,
|
||||
messageRecord.getBody(),
|
||||
slideDeck);
|
||||
slideDeck,
|
||||
recipient);
|
||||
} else {
|
||||
inputPanel.setQuote(GlideApp.with(this),
|
||||
messageRecord.getDateSent(),
|
||||
author,
|
||||
messageRecord.getBody(),
|
||||
messageRecord.isMms() ? ((MmsMessageRecord) messageRecord).getSlideDeck() : new SlideDeck());
|
||||
messageRecord.isMms() ? ((MmsMessageRecord) messageRecord).getSlideDeck() : new SlideDeck(),
|
||||
recipient);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ public class ConversationItem extends LinearLayout
|
||||
if (current.isMms() && !current.isMmsNotification() && ((MediaMmsMessageRecord)current).getQuote() != null) {
|
||||
Quote quote = ((MediaMmsMessageRecord)current).getQuote();
|
||||
//noinspection ConstantConditions
|
||||
quoteView.setQuote(glideRequests, quote.getId(), Recipient.from(context, quote.getAuthor(), true), quote.getText(), quote.isOriginalMissing(), quote.getAttachment());
|
||||
quoteView.setQuote(glideRequests, quote.getId(), Recipient.from(context, quote.getAuthor(), true), quote.getText(), quote.isOriginalMissing(), quote.getAttachment(), conversationRecipient);
|
||||
quoteView.setVisibility(View.VISIBLE);
|
||||
quoteView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
|
||||
|
@ -969,7 +969,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
}
|
||||
}));
|
||||
}
|
||||
} if (LinkPreviewUtil.isWhitelistedMediaUrl(body)) {
|
||||
} else if (LinkPreviewUtil.isWhitelistedMediaUrl(body)) {
|
||||
new LinkPreviewRepository(context).fetchGIF(context, body, attachmentOrNull -> Util.runOnMain(() -> {
|
||||
if (attachmentOrNull.isPresent()) {
|
||||
Attachment attachment = attachmentOrNull.get();
|
||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.loki
|
||||
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import org.thoughtcrime.securesms.database.Address
|
||||
import org.thoughtcrime.securesms.database.Database
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
||||
@ -18,6 +19,11 @@ class LokiMessageDatabase(context: Context, helper: SQLCipherOpenHelper) : Datab
|
||||
@JvmStatic val createTableCommand = "CREATE TABLE $tableName ($messageID INTEGER PRIMARY KEY, $serverID INTEGER DEFAULT 0, $friendRequestStatus INTEGER DEFAULT 0);"
|
||||
}
|
||||
|
||||
override fun getServerIDFromQuote(quoteID: Long, author: String): Long? {
|
||||
val message = DatabaseFactory.getMmsSmsDatabase(context).getMessageFor(quoteID, Address.fromSerialized(author))
|
||||
return if (message != null) getServerID(message.getId()) else null
|
||||
}
|
||||
|
||||
fun getServerID(messageID: Long): Long? {
|
||||
val database = databaseHelper.readableDatabase
|
||||
return database.get(tableName, "${Companion.messageID} = ?", arrayOf( messageID.toString() )) { cursor ->
|
||||
|
Loading…
Reference in New Issue
Block a user