Update ktlint to 1.5.0.

This commit is contained in:
jeffrey-signal
2025-12-05 09:48:22 -06:00
committed by GitHub
parent cc381513ef
commit 109fc7f1fa
24 changed files with 1254 additions and 385 deletions

View File

@@ -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())
}
}

View File

@@ -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 {

View File

@@ -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")

View File

@@ -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) {

View File

@@ -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
}

View File

@@ -50,7 +50,8 @@ object InAppDonations {
InAppPaymentType.ONE_TIME_GIFT -> true
InAppPaymentType.RECURRING_DONATION -> true
InAppPaymentType.RECURRING_BACKUP -> false
} && !LocaleRemoteConfig.isPayPalDisabled()
} &&
!LocaleRemoteConfig.isPayPalDisabled()
}
/**