Initial fix for regression test failure 1.1

pull/1473/head
alansley 2 months ago
parent 0e7a981386
commit a865409684

@ -106,6 +106,7 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity() {
setShowWhenLocked(true)
setTurnScreenOn(true)
}
window.addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
or WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD

@ -1,5 +1,6 @@
package org.thoughtcrime.securesms.conversation.v2.utilities
import android.app.Application
import android.content.Context
import android.graphics.Typeface
import android.text.Spannable

@ -349,11 +349,17 @@ public class DefaultMessageNotifier implements MessageNotifier {
builder.setThread(notifications.get(0).getRecipient());
builder.setMessageCount(notificationState.getMessageCount());
MentionManagerUtilities.INSTANCE.populateUserPublicKeyCacheIfNeeded(notifications.get(0).getThreadId(),context);
// TODO: Removing highlighting mentions in the notification because this context is the libsession one which
// TODO: doesn't have access to the `R.attr.message_sent_text_color` and `R.attr.message_received_text_color`
// TODO: attributes to perform the colour lookup. Also, it makes little sense to highlight the mentions using
// TODO: the app theme as it may result in insufficient contrast with the notification background which will
// TODO: be using the SYSTEM theme.
builder.setPrimaryMessageBody(recipient, notifications.get(0).getIndividualRecipient(),
MentionUtilities.highlightMentions(text == null ? "" : text,
notifications.get(0).getThreadId(),
context),
//MentionUtilities.highlightMentions(text == null ? "" : text, notifications.get(0).getThreadId(), context), // Removing hightlighting mentions -ACL
text == null ? "" : text,
notifications.get(0).getSlideDeck());
builder.setContentIntent(notifications.get(0).getPendingIntent(context));
builder.setDeleteIntent(notificationState.getDeleteIntent(context));
builder.setOnlyAlertOnce(!signal);

@ -746,9 +746,9 @@ class WebRtcCallService : LifecycleService(), CallManager.WebRtcListener {
}
if (!CallNotificationBuilder.areNotificationsEnabled(this) && type == TYPE_INCOMING_PRE_OFFER) {
// start an intent for the fullscreen
// Start an intent for the fullscreen call actiity
val foregroundIntent = Intent(this, WebRtcCallActivity::class.java)
.setFlags(FLAG_ACTIVITY_NEW_TASK or FLAG_ACTIVITY_BROUGHT_TO_FRONT)
.setFlags(FLAG_ACTIVITY_NEW_TASK or FLAG_ACTIVITY_BROUGHT_TO_FRONT or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
.setAction(WebRtcCallActivity.ACTION_FULL_SCREEN_INTENT)
startActivity(foregroundIntent)
}

@ -19,6 +19,7 @@ import android.view.inputmethod.InputMethodManager
import androidx.annotation.AttrRes
import androidx.annotation.ColorRes
import androidx.core.graphics.applyCanvas
import org.session.libsignal.utilities.Log
import kotlin.math.roundToInt
fun View.contains(point: PointF): Boolean {
@ -38,15 +39,19 @@ fun Context.getAccentColor() = getColorFromAttr(R.attr.colorAccent)
// Method to grab the appropriate attribute for a message colour.
// Note: This is an attribute, NOT a resource Id - see `getColorResourceIdFromAttr` for that.
@AttrRes
fun getMessageTextColourAttr(messageIsOutgoing: Boolean): Int =
if (messageIsOutgoing) R.attr.message_sent_text_color else R.attr.message_received_text_color
fun getMessageTextColourAttr(messageIsOutgoing: Boolean): Int {
return if (messageIsOutgoing) R.attr.message_sent_text_color else R.attr.message_received_text_color
}
// Method to get an actual R.id.<SOME_COLOUR> resource Id from an attribute such as R.attr.message_sent_text_color etc.
@ColorRes
fun getColorResourceIdFromAttr(context: Context, attr: Int): Int {
val typedValue = TypedValue()
context.theme.resolveAttribute(attr, typedValue, true)
return typedValue.resourceId
val outTypedValue = TypedValue()
val successfullyFoundAttribute = context.theme.resolveAttribute(attr, outTypedValue, true)
if (successfullyFoundAttribute) { return outTypedValue.resourceId }
Log.w("ViewUtils", "Could not find colour attribute $attr in theme - using grey as a safe fallback")
return R.color.gray50
}
fun View.animateSizeChange(@DimenRes startSizeID: Int, @DimenRes endSizeID: Int, animationDuration: Long = 250) {

@ -842,7 +842,7 @@ interface TextSecurePreferences {
getDefaultSharedPreferences(context).edit().putString(key, value).apply()
}
private fun getIntegerPreference(context: Context, key: String, defaultValue: Int): Int {
fun getIntegerPreference(context: Context, key: String, defaultValue: Int): Int {
return getDefaultSharedPreferences(context).getInt(key, defaultValue)
}

Loading…
Cancel
Save