Kotlin 1.9.0 (#3835)

Update to Kotlin 1.9.0 and migrate to newer language idioms.

- Remove unnecessary @OptIn for features migrated to mainstream
- Use `data object` where appropriate
- Use new enum `entries` property
This commit is contained in:
Goooler 2023-08-02 15:04:24 +08:00 committed by GitHub
commit 40bd95d752
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 44 additions and 71 deletions

View file

@ -20,7 +20,6 @@ package com.keylesspalace.tusky.util
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlin.time.Duration
import kotlin.time.ExperimentalTime
import kotlin.time.TimeMark
import kotlin.time.TimeSource
@ -54,7 +53,6 @@ import kotlin.time.TimeSource
* @param timeout Emissions within this duration of the last emission are filtered
* @param timeSource Used to measure elapsed time. Normally only overridden in tests
*/
@OptIn(ExperimentalTime::class)
fun <T> Flow<T>.throttleFirst(
timeout: Duration,
timeSource: TimeSource = TimeSource.Monotonic

View file

@ -19,7 +19,7 @@ import android.text.TextPaint
import android.text.style.URLSpan
import android.view.View
open class NoUnderlineURLSpan constructor(val url: String) : URLSpan(url) {
open class NoUnderlineURLSpan(val url: String) : URLSpan(url) {
// This should not be necessary. But if you don't do this the [StatusLengthTest] tests
// fail. Without this, accessing the `url` property, or calling `getUrl()` (which should

View file

@ -128,7 +128,7 @@ private fun findPattern(string: String, fromIndex: Int): FindCharsResult {
val result = FindCharsResult()
for (i in fromIndex..string.lastIndex) {
val c = string[i]
for (matchType in FoundMatchType.values()) {
for (matchType in FoundMatchType.entries) {
val finder = finders[matchType]
if (finder!!.searchCharacter == c &&
(