mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Update ktlint to 1.5.0.
This commit is contained in:
@@ -48,22 +48,19 @@ class SystemEmojiDrawable(emoji: CharSequence) : Drawable() {
|
||||
companion object {
|
||||
private val textPaint: TextPaint = TextPaint()
|
||||
|
||||
private fun getStaticLayout(emoji: CharSequence): StaticLayout =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
StaticLayout.Builder.obtain(emoji, 0, emoji.length, textPaint, Int.MAX_VALUE).build()
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
StaticLayout(emoji, textPaint, Int.MAX_VALUE, Layout.Alignment.ALIGN_NORMAL, 0f, 0f, true)
|
||||
}
|
||||
private fun getStaticLayout(emoji: CharSequence): StaticLayout = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
StaticLayout.Builder.obtain(emoji, 0, emoji.length, textPaint, Int.MAX_VALUE).build()
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
StaticLayout(emoji, textPaint, Int.MAX_VALUE, Layout.Alignment.ALIGN_NORMAL, 0f, 0f, true)
|
||||
}
|
||||
|
||||
private fun getProcessedEmoji(emoji: CharSequence): CharSequence =
|
||||
try {
|
||||
EmojiCompat.get().process(emoji) ?: emoji
|
||||
} catch (e: IllegalStateException) {
|
||||
emoji
|
||||
}
|
||||
private fun getProcessedEmoji(emoji: CharSequence): CharSequence = try {
|
||||
EmojiCompat.get().process(emoji) ?: emoji
|
||||
} catch (e: IllegalStateException) {
|
||||
emoji
|
||||
}
|
||||
|
||||
private fun StaticLayout.getBounds(): RectF =
|
||||
RectF(getLineLeft(0), 0f, getLineRight(0), getLineDescent(0) - getLineAscent(0).toFloat())
|
||||
private fun StaticLayout.getBounds(): RectF = RectF(getLineLeft(0), 0f, getLineRight(0), getLineDescent(0) - getLineAscent(0).toFloat())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,14 +36,11 @@ sealed class DSLSettingsText {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun from(@StringRes stringId: Int, @ColorInt textColor: Int): DSLSettingsText =
|
||||
FromResource(stringId, listOf(ColorModifier(textColor)))
|
||||
fun from(@StringRes stringId: Int, @ColorInt textColor: Int): DSLSettingsText = FromResource(stringId, listOf(ColorModifier(textColor)))
|
||||
|
||||
fun from(@StringRes stringId: Int, vararg modifiers: Modifier): DSLSettingsText =
|
||||
FromResource(stringId, modifiers.toList())
|
||||
fun from(@StringRes stringId: Int, vararg modifiers: Modifier): DSLSettingsText = FromResource(stringId, modifiers.toList())
|
||||
|
||||
fun from(charSequence: CharSequence, vararg modifiers: Modifier): DSLSettingsText =
|
||||
FromCharSequence(charSequence, modifiers.toList())
|
||||
fun from(charSequence: CharSequence, vararg modifiers: Modifier): DSLSettingsText = FromCharSequence(charSequence, modifiers.toList())
|
||||
}
|
||||
|
||||
interface Modifier {
|
||||
|
||||
@@ -267,7 +267,8 @@ class BackupStateObserver(
|
||||
Log.d(TAG, "[getNetworkBackupState][subscriptionStateMismatchDetected] No purchase found in Google Play Billing: $purchaseResult")
|
||||
false
|
||||
}
|
||||
} || SignalStore.backup.backupTierInternalOverride == MessageBackupTier.PAID
|
||||
} ||
|
||||
SignalStore.backup.backupTierInternalOverride == MessageBackupTier.PAID
|
||||
|
||||
Log.d(TAG, "[getNetworkBackupState][subscriptionStateMismatchDetected] googlePlayBillingSubscriptionIsActiveAndWillRenew: $googlePlayBillingSubscriptionIsActiveAndWillRenew")
|
||||
|
||||
|
||||
@@ -75,32 +75,31 @@ class ChangeNumberRepository(
|
||||
return accountManager.whoAmI
|
||||
}
|
||||
|
||||
suspend fun ensureDecryptionsDrained(timeout: Duration = 15.seconds) =
|
||||
withTimeoutOrNull(timeout) {
|
||||
suspendCancellableCoroutine {
|
||||
val drainedListener = object : Runnable {
|
||||
override fun run() {
|
||||
AppDependencies
|
||||
.incomingMessageObserver
|
||||
.removeDecryptionDrainedListener(this)
|
||||
Log.d(TAG, "Decryptions drained.")
|
||||
it.resume(true)
|
||||
}
|
||||
}
|
||||
|
||||
it.invokeOnCancellation { cancellationCause ->
|
||||
suspend fun ensureDecryptionsDrained(timeout: Duration = 15.seconds) = withTimeoutOrNull(timeout) {
|
||||
suspendCancellableCoroutine {
|
||||
val drainedListener = object : Runnable {
|
||||
override fun run() {
|
||||
AppDependencies
|
||||
.incomingMessageObserver
|
||||
.removeDecryptionDrainedListener(drainedListener)
|
||||
Log.d(TAG, "Decryptions draining canceled.", cancellationCause)
|
||||
.removeDecryptionDrainedListener(this)
|
||||
Log.d(TAG, "Decryptions drained.")
|
||||
it.resume(true)
|
||||
}
|
||||
}
|
||||
|
||||
it.invokeOnCancellation { cancellationCause ->
|
||||
AppDependencies
|
||||
.incomingMessageObserver
|
||||
.addDecryptionDrainedListener(drainedListener)
|
||||
Log.d(TAG, "Waiting for decryption drain.")
|
||||
.removeDecryptionDrainedListener(drainedListener)
|
||||
Log.d(TAG, "Decryptions draining canceled.", cancellationCause)
|
||||
}
|
||||
|
||||
AppDependencies
|
||||
.incomingMessageObserver
|
||||
.addDecryptionDrainedListener(drainedListener)
|
||||
Log.d(TAG, "Waiting for decryption drain.")
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
fun changeLocalNumber(e164: String, pni: ServiceId.PNI) {
|
||||
|
||||
@@ -140,11 +140,12 @@ class NotificationsSettingsViewModel(private val sharedPreferences: SharedPrefer
|
||||
)
|
||||
|
||||
private fun canEnableNotifications(): Boolean {
|
||||
val areNotificationsDisabledBySystem = Build.VERSION.SDK_INT >= 26 && (
|
||||
!NotificationChannels.getInstance().isMessageChannelEnabled ||
|
||||
!NotificationChannels.getInstance().isMessagesChannelGroupEnabled ||
|
||||
!NotificationChannels.getInstance().areNotificationsEnabled()
|
||||
)
|
||||
val areNotificationsDisabledBySystem = Build.VERSION.SDK_INT >= 26 &&
|
||||
(
|
||||
!NotificationChannels.getInstance().isMessageChannelEnabled ||
|
||||
!NotificationChannels.getInstance().isMessagesChannelGroupEnabled ||
|
||||
!NotificationChannels.getInstance().areNotificationsEnabled()
|
||||
)
|
||||
|
||||
return !areNotificationsDisabledBySystem
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ object InAppDonations {
|
||||
InAppPaymentType.ONE_TIME_GIFT -> true
|
||||
InAppPaymentType.RECURRING_DONATION -> true
|
||||
InAppPaymentType.RECURRING_BACKUP -> false
|
||||
} && !LocaleRemoteConfig.isPayPalDisabled()
|
||||
} &&
|
||||
!LocaleRemoteConfig.isPayPalDisabled()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user