mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 11:03:07 +00:00
Merge branch 'dev' of https://github.com/loki-project/session-android into store-permission-refactoring
This commit is contained in:
@@ -30,6 +30,8 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.hardware.Camera;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
@@ -61,6 +63,7 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
@@ -158,6 +161,7 @@ import org.thoughtcrime.securesms.loki.database.LokiThreadDatabaseDelegate;
|
||||
import org.thoughtcrime.securesms.loki.database.LokiUserDatabase;
|
||||
import org.thoughtcrime.securesms.loki.protocol.ClosedGroupsProtocol;
|
||||
import org.thoughtcrime.securesms.loki.protocol.SessionManagementProtocol;
|
||||
import org.thoughtcrime.securesms.loki.utilities.GeneralUtilitiesKt;
|
||||
import org.thoughtcrime.securesms.loki.utilities.MentionManagerUtilities;
|
||||
import org.thoughtcrime.securesms.loki.views.MentionCandidateSelectionView;
|
||||
import org.thoughtcrime.securesms.loki.views.ProfilePictureView;
|
||||
@@ -235,7 +239,6 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -737,10 +740,13 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
if (recipient.getExpireMessages() > 0) {
|
||||
inflater.inflate(R.menu.conversation_expiring_on, menu);
|
||||
|
||||
final MenuItem item = menu.findItem(R.id.menu_expiring_messages);
|
||||
final View actionView = MenuItemCompat.getActionView(item);
|
||||
final TextView badgeView = actionView.findViewById(R.id.expiration_badge);
|
||||
final MenuItem item = menu.findItem(R.id.menu_expiring_messages);
|
||||
final View actionView = MenuItemCompat.getActionView(item);
|
||||
final ImageView iconView = actionView.findViewById(R.id.menu_badge_icon);
|
||||
final TextView badgeView = actionView.findViewById(R.id.expiration_badge);
|
||||
|
||||
@ColorInt int color = GeneralUtilitiesKt.getColorWithID(getResources(), R.color.text, getTheme());
|
||||
iconView.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
|
||||
badgeView.setText(ExpirationUtil.getExpirationAbbreviatedDisplayValue(this, recipient.getExpireMessages()));
|
||||
actionView.setOnClickListener(v -> onOptionsItemSelected(item));
|
||||
} else {
|
||||
|
||||
@@ -5,14 +5,16 @@ import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.thoughtcrime.securesms.BindableConversationItem;
|
||||
import org.thoughtcrime.securesms.VerifyIdentityActivity;
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyParcelable;
|
||||
@@ -20,6 +22,7 @@ import org.thoughtcrime.securesms.database.IdentityDatabase;
|
||||
import org.thoughtcrime.securesms.database.IdentityDatabase.IdentityRecord;
|
||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.loki.utilities.GeneralUtilitiesKt;
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientModifiedListener;
|
||||
@@ -135,12 +138,13 @@ public class ConversationUpdateItem extends LinearLayout
|
||||
}
|
||||
|
||||
private void setTimerRecord(final MessageRecord messageRecord) {
|
||||
@ColorInt int color = GeneralUtilitiesKt.getColorWithID(getResources(), R.color.text, getContext().getTheme());
|
||||
if (messageRecord.getExpiresIn() > 0) {
|
||||
icon.setImageResource(R.drawable.ic_timer);
|
||||
icon.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY));
|
||||
icon.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
|
||||
} else {
|
||||
icon.setImageResource(R.drawable.ic_timer_disabled);
|
||||
icon.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY));
|
||||
icon.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
|
||||
}
|
||||
|
||||
title.setText(ExpirationUtil.getExpirationDisplayValue(getContext(), (int)(messageRecord.getExpiresIn() / 1000)));
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.whispersystems.signalservice.loki.protocol.sessionmanagement.SessionM
|
||||
import org.whispersystems.signalservice.loki.protocol.shelved.multidevice.MultiDeviceProtocol
|
||||
import org.whispersystems.signalservice.loki.protocol.shelved.syncmessages.SyncMessagesProtocol
|
||||
import org.whispersystems.signalservice.loki.utilities.toHexString
|
||||
import java.io.IOException
|
||||
|
||||
class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListener, SeedReminderViewDelegate, NewConversationButtonSetViewDelegate {
|
||||
private lateinit var glide: GlideRequests
|
||||
@@ -361,10 +362,17 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
||||
val isClosedGroup = recipient.address.isClosedGroup
|
||||
// Send a leave group message if this is an active closed group
|
||||
if (isClosedGroup && DatabaseFactory.getGroupDatabase(this).isActive(recipient.address.toGroupString())) {
|
||||
val groupPublicKey = ClosedGroupsProtocol.doubleDecodeGroupID(recipient.address.toString()).toHexString()
|
||||
val isSSKBasedClosedGroup = DatabaseFactory.getSSKDatabase(this).isSSKBasedClosedGroup(groupPublicKey)
|
||||
var isSSKBasedClosedGroup: Boolean
|
||||
var groupPublicKey: String?
|
||||
try {
|
||||
groupPublicKey = ClosedGroupsProtocol.doubleDecodeGroupID(recipient.address.toString()).toHexString()
|
||||
isSSKBasedClosedGroup = DatabaseFactory.getSSKDatabase(this).isSSKBasedClosedGroup(groupPublicKey)
|
||||
} catch (e: IOException) {
|
||||
groupPublicKey = null
|
||||
isSSKBasedClosedGroup = false
|
||||
}
|
||||
if (isSSKBasedClosedGroup) {
|
||||
ClosedGroupsProtocol.leave(this, groupPublicKey)
|
||||
ClosedGroupsProtocol.leave(this, groupPublicKey!!)
|
||||
} else if (!ClosedGroupsProtocol.leaveLegacyGroup(this, recipient)) {
|
||||
Toast.makeText(this, R.string.activity_home_leaving_group_failed_message, Toast.LENGTH_LONG).show()
|
||||
return@setPositiveButton
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.concurrent.TimeUnit
|
||||
class BackgroundPollWorker : PersistentAlarmManagerListener() {
|
||||
|
||||
companion object {
|
||||
private val pollInterval = TimeUnit.MINUTES.toMillis(15)
|
||||
private val pollInterval = TimeUnit.MINUTES.toMillis(30)
|
||||
|
||||
@JvmStatic
|
||||
fun schedule(context: Context) {
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package org.thoughtcrime.securesms.loki.todo
|
||||
|
||||
import android.graphics.*
|
||||
import android.graphics.drawable.Drawable
|
||||
|
||||
/**
|
||||
* Basically a [Bitmap] wrapper, the [Bitmap] size must be known when instantiating it
|
||||
* but when drawing it will draw the [Bitmap] to fit the canvas.
|
||||
*/
|
||||
abstract class IdenticonDrawable(width: Int, height: Int, hash: Long) : Drawable() {
|
||||
private val bitmapRect: Rect = Rect(0, 0, width, height)
|
||||
private val destinationRect: Rect = Rect(0, 0, width, height)
|
||||
private val bitmap: Bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
||||
private val canvas: Canvas = Canvas(bitmap)
|
||||
private val bitmapPaint = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
|
||||
var hash: Long = hash
|
||||
set(value) {
|
||||
field = value
|
||||
onSetHash(value)
|
||||
invalidateBitmap()
|
||||
}
|
||||
|
||||
protected fun invalidateBitmap() {
|
||||
drawBitmap(canvas)
|
||||
invalidateSelf()
|
||||
}
|
||||
|
||||
protected abstract fun drawBitmap(canvas: Canvas)
|
||||
|
||||
protected open fun onSetHash(newHash: Long) = Unit
|
||||
|
||||
override fun draw(canvas: Canvas) {
|
||||
destinationRect.set(0, 0, canvas.width, canvas.height)
|
||||
canvas.drawBitmap(bitmap, bitmapRect, destinationRect, bitmapPaint)
|
||||
}
|
||||
|
||||
override fun setAlpha(i: Int) {
|
||||
bitmapPaint.alpha = i
|
||||
}
|
||||
|
||||
override fun setColorFilter(colorFilter: ColorFilter?) {
|
||||
bitmapPaint.colorFilter = colorFilter
|
||||
}
|
||||
|
||||
override fun getOpacity(): Int {
|
||||
return bitmapPaint.alpha
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package org.thoughtcrime.securesms.loki.todo
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto
|
||||
|
||||
class JazzIdenticonContactPhoto(val hexEncodedPublicKey: String) : FallbackContactPhoto {
|
||||
override fun asDrawable(context: Context, color: Int): Drawable {
|
||||
return asDrawable(context, color, false)
|
||||
}
|
||||
|
||||
override fun asDrawable(context: Context, color: Int, inverted: Boolean): Drawable {
|
||||
val targetSize = context.resources.getDimensionPixelSize(R.dimen.contact_photo_target_size)
|
||||
return JazzIdenticonDrawable(targetSize, targetSize, hexEncodedPublicKey)
|
||||
}
|
||||
|
||||
override fun asCallCard(context: Context): Drawable? {
|
||||
return AppCompatResources.getDrawable(context, R.drawable.ic_person_large)
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
package org.thoughtcrime.securesms.loki.todo
|
||||
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import kotlin.math.*
|
||||
|
||||
class JazzIdenticonDrawable(width: Int, height: Int, hash: Long) : IdenticonDrawable(width, height, hash) {
|
||||
|
||||
constructor(width: Int, height: Int, hashString: String): this(width, height, 0) {
|
||||
val hexRegex = Regex("^[0-9A-Fa-f]+\$")
|
||||
if (hashString.length >= 12 && hashString.matches(hexRegex)) {
|
||||
hash = hashString.substring(0 until 12).toLong(16)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
var colors = listOf(
|
||||
"#01888c", // teal
|
||||
"#fc7500", // bright orange
|
||||
"#034f5d", // dark teal
|
||||
"#E784BA", // light pink
|
||||
"#81C8B6", // bright green
|
||||
"#c7144c", // raspberry
|
||||
"#f3c100", // goldenrod
|
||||
"#1598f2", // lightning blue
|
||||
"#2465e1", // sail blue
|
||||
"#f19e02" // gold
|
||||
).map{ Color.parseColor(it) }
|
||||
}
|
||||
|
||||
private var generator: RNG = RNG(hash)
|
||||
private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.FILL }
|
||||
|
||||
// Settings
|
||||
private val wobble: Float = 30f
|
||||
private val shapeCount = 4
|
||||
|
||||
init {
|
||||
invalidateBitmap()
|
||||
}
|
||||
|
||||
override fun onSetHash(newHash: Long) {
|
||||
super.onSetHash(newHash)
|
||||
generator = RNG(newHash)
|
||||
invalidateBitmap()
|
||||
}
|
||||
|
||||
override fun drawBitmap(canvas: Canvas) {
|
||||
generator.reset()
|
||||
|
||||
val newColors = hueShift(colors)
|
||||
val shuffled = shuffleList(newColors)
|
||||
|
||||
canvas.drawColor(shuffled[0])
|
||||
for (i in 0 until shapeCount) {
|
||||
drawSquare(canvas, shuffled[i + 1], i, shapeCount - 1)
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawSquare(canvas: Canvas, color: Int, index: Int, total: Int) {
|
||||
val size = min(canvas.width, canvas.height)
|
||||
val center = (size / 2).toFloat()
|
||||
val firstRotation = generator.nextFloat()
|
||||
val angle = PI * 2 * firstRotation
|
||||
|
||||
val a = size / total.toFloat()
|
||||
val b = generator.nextFloat()
|
||||
val c = index.toFloat() * a
|
||||
val velocity = a * b + c
|
||||
|
||||
val tx = cos(angle) * velocity
|
||||
val ty = sin(angle) * velocity
|
||||
|
||||
// Third random is a shape rotation on top of all that
|
||||
val secondRotation = generator.nextFloat()
|
||||
val rotation = (firstRotation * 360f) + (secondRotation * 180f)
|
||||
|
||||
// Paint it!
|
||||
canvas.save()
|
||||
|
||||
paint.color = color
|
||||
canvas.translate(tx.toFloat(), ty.toFloat())
|
||||
canvas.rotate(rotation.round(1), center, center)
|
||||
canvas.drawRect(0f, 0f, canvas.width.toFloat(), canvas.height.toFloat(), paint)
|
||||
|
||||
canvas.restore()
|
||||
}
|
||||
|
||||
private fun hueShift(colors: List<Int>): List<Int> {
|
||||
val amount = generator.nextFloat() * 30 - wobble / 2
|
||||
|
||||
return colors.map { color ->
|
||||
val red = Color.red(color)
|
||||
val green = Color.green(color)
|
||||
val blue = Color.blue(color)
|
||||
|
||||
val hsv = FloatArray(3)
|
||||
Color.RGBToHSV(red, green, blue, hsv)
|
||||
|
||||
// Normalise between 0 and 360
|
||||
var newHue = hsv[0] + round(amount)
|
||||
if (newHue < 0) { newHue += 360 }
|
||||
if (newHue > 360) { newHue -= 360 }
|
||||
|
||||
hsv[0] = newHue
|
||||
Color.HSVToColor(hsv)
|
||||
}
|
||||
}
|
||||
|
||||
private fun <T> shuffleList(list: List<T>): List<T> {
|
||||
var currentIndex = list.count()
|
||||
val newList = list.toMutableList()
|
||||
while (currentIndex > 0) {
|
||||
val randomIndex = generator.next().toInt() % currentIndex
|
||||
currentIndex -= 1
|
||||
|
||||
// Swap
|
||||
val temp = newList[currentIndex]
|
||||
newList[currentIndex] = newList[randomIndex]
|
||||
newList[randomIndex] = temp
|
||||
}
|
||||
|
||||
return newList
|
||||
}
|
||||
}
|
||||
|
||||
private fun Float.round(decimals: Int): Float {
|
||||
var multiplier = 1f
|
||||
repeat(decimals) { multiplier *= 10 }
|
||||
return round(this * multiplier) / multiplier
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package org.thoughtcrime.securesms.loki.todo
|
||||
|
||||
class RNG(hash: Long) {
|
||||
private var seed: Long
|
||||
private val initial: Long
|
||||
|
||||
private val maxInt32 = Int.MAX_VALUE.toLong()
|
||||
|
||||
init {
|
||||
seed = hash % maxInt32
|
||||
if (seed <= 0) {
|
||||
seed = maxInt32 - 1
|
||||
}
|
||||
initial = seed
|
||||
}
|
||||
|
||||
fun next(): Long {
|
||||
val newSeed = (seed * 16807) % maxInt32
|
||||
seed = newSeed
|
||||
return seed
|
||||
}
|
||||
|
||||
fun nextFloat(): Float {
|
||||
return (next() - 1).toFloat() / (maxInt32 - 1)
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
seed = initial
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.thoughtcrime.securesms.loki.todo
|
||||
package org.thoughtcrime.securesms.loki.utilities
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.*
|
||||
@@ -30,7 +30,7 @@ object AvatarPlaceholderGenerator {
|
||||
val colorSecondary = changeColorHueBy(colorPrimary, 12f)
|
||||
|
||||
val labelText = when {
|
||||
!TextUtils.isEmpty(displayName) -> extractLabel(displayName!!)
|
||||
!TextUtils.isEmpty(displayName) -> extractLabel(displayName!!.capitalize())
|
||||
!TextUtils.isEmpty(hashString) -> extractLabel(hashString)
|
||||
else -> EMPTY_LABEL
|
||||
}
|
||||
@@ -29,10 +29,10 @@ class NewConversationButtonSetView : RelativeLayout {
|
||||
var delegate: NewConversationButtonSetViewDelegate? = null
|
||||
|
||||
// region Convenience
|
||||
private val sessionButtonExpandedPosition: PointF get() { return PointF(width.toFloat() / 2 - sessionButton.expandedSize / 2, 0.0f) }
|
||||
private val closedGroupButtonExpandedPosition: PointF get() { return PointF(width.toFloat() - closedGroupButton.expandedSize, height.toFloat() - bottomMargin - closedGroupButton.expandedSize) }
|
||||
private val openGroupButtonExpandedPosition: PointF get() { return PointF(0.0f, height.toFloat() - bottomMargin - openGroupButton.expandedSize) }
|
||||
private val buttonRestPosition: PointF get() { return PointF(width.toFloat() / 2 - mainButton.expandedSize / 2, height.toFloat() - bottomMargin - mainButton.expandedSize) }
|
||||
private val sessionButtonExpandedPosition: PointF get() { return PointF(width.toFloat() / 2 - sessionButton.expandedSize / 2 - sessionButton.shadowMargin, 0.0f) }
|
||||
private val closedGroupButtonExpandedPosition: PointF get() { return PointF(width.toFloat() - closedGroupButton.expandedSize - 2 * closedGroupButton.shadowMargin, height.toFloat() - bottomMargin - closedGroupButton.expandedSize - 2 * closedGroupButton.shadowMargin) }
|
||||
private val openGroupButtonExpandedPosition: PointF get() { return PointF(0.0f, height.toFloat() - bottomMargin - openGroupButton.expandedSize - 2 * openGroupButton.shadowMargin) }
|
||||
private val buttonRestPosition: PointF get() { return PointF(width.toFloat() / 2 - mainButton.expandedSize / 2 - mainButton.shadowMargin, height.toFloat() - bottomMargin - mainButton.expandedSize - 2 * mainButton.shadowMargin) }
|
||||
// endregion
|
||||
|
||||
// region Settings
|
||||
@@ -60,8 +60,9 @@ class NewConversationButtonSetView : RelativeLayout {
|
||||
|
||||
val expandedSize by lazy { resources.getDimension(R.dimen.new_conversation_button_expanded_size) }
|
||||
val collapsedSize by lazy { resources.getDimension(R.dimen.new_conversation_button_collapsed_size) }
|
||||
private val expandedImageViewPosition by lazy { PointF(0.0f, 0.0f) }
|
||||
private val collapsedImageViewPosition by lazy { PointF((expandedSize - collapsedSize) / 2, (expandedSize - collapsedSize) / 2) }
|
||||
val shadowMargin by lazy { toPx(6, resources).toFloat() }
|
||||
private val expandedImageViewPosition by lazy { PointF(shadowMargin, shadowMargin) }
|
||||
private val collapsedImageViewPosition by lazy { PointF(shadowMargin + (expandedSize - collapsedSize) / 2, shadowMargin + (expandedSize - collapsedSize) / 2) }
|
||||
|
||||
private val imageView by lazy {
|
||||
val result = NewConversationButtonImageView(context)
|
||||
@@ -95,7 +96,7 @@ class NewConversationButtonSetView : RelativeLayout {
|
||||
this.iconID = iconID
|
||||
this.isMain = isMain
|
||||
disableClipping()
|
||||
val size = resources.getDimension(R.dimen.new_conversation_button_expanded_size).toInt()
|
||||
val size = resources.getDimension(R.dimen.new_conversation_button_expanded_size).toInt() + 2 * shadowMargin.toInt()
|
||||
val layoutParams = LayoutParams(size, size)
|
||||
this.layoutParams = layoutParams
|
||||
addView(imageView)
|
||||
|
||||
@@ -13,7 +13,7 @@ import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.contacts.avatars.ProfileContactPhoto
|
||||
import org.thoughtcrime.securesms.database.Address
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||
import org.thoughtcrime.securesms.loki.todo.AvatarPlaceholderGenerator
|
||||
import org.thoughtcrime.securesms.loki.utilities.AvatarPlaceholderGenerator
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
|
||||
@@ -222,9 +222,9 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||
Recipient recipients = DatabaseFactory.getThreadDatabase(context)
|
||||
.getRecipientForThreadId(threadId);
|
||||
|
||||
if (isVisible && recipients != null && SessionMetaProtocol.shouldSendReadReceipt(recipients.getAddress())) {
|
||||
if (isVisible && recipients != null) {
|
||||
List<MarkedMessageInfo> messageIds = threads.setRead(threadId, false);
|
||||
MarkReadReceiver.process(context, messageIds);
|
||||
if (SessionMetaProtocol.shouldSendReadReceipt(recipients.getAddress())) { MarkReadReceiver.process(context, messageIds); }
|
||||
}
|
||||
|
||||
if (!TextSecurePreferences.isNotificationsEnabled(context) ||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.thoughtcrime.securesms.contacts.avatars.ContactColors;
|
||||
import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto;
|
||||
import org.thoughtcrime.securesms.contacts.avatars.GeneratedContactPhoto;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.loki.todo.AvatarPlaceholderGenerator;
|
||||
import org.thoughtcrime.securesms.loki.utilities.AvatarPlaceholderGenerator;
|
||||
import org.thoughtcrime.securesms.loki.utilities.NotificationUtilities;
|
||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.thoughtcrime.securesms.recipients;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -43,7 +44,6 @@ import org.thoughtcrime.securesms.database.RecipientDatabase.RegisteredState;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase.UnidentifiedAccessMode;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase.VibrateState;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.loki.todo.JazzIdenticonContactPhoto;
|
||||
import org.thoughtcrime.securesms.loki.utilities.ProfilePictureModifiedEvent;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientProvider.RecipientDetails;
|
||||
@@ -465,15 +465,10 @@ public class Recipient implements RecipientModifiedListener {
|
||||
}
|
||||
|
||||
public synchronized @NonNull FallbackContactPhoto getFallbackContactPhoto() {
|
||||
// TODO: I believe this is now completely unused
|
||||
if (isResolving()) return new TransparentContactPhoto();
|
||||
else if (isGroupRecipient()) return new GeneratedContactPhoto(name, R.drawable.ic_profile_default);
|
||||
else {
|
||||
String userPublicKey = TextSecurePreferences.getLocalNumber(context);
|
||||
String publicKey = address.serialize();
|
||||
String userMasterPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context);
|
||||
String publicKeyToUse = (publicKey.equalsIgnoreCase(userPublicKey) && userMasterPublicKey != null) ? userMasterPublicKey : publicKey;
|
||||
return new JazzIdenticonContactPhoto(publicKeyToUse);
|
||||
}
|
||||
else { return new TransparentContactPhoto(); }
|
||||
}
|
||||
|
||||
public synchronized @Nullable ContactPhoto getContactPhoto() {
|
||||
|
||||
Reference in New Issue
Block a user