Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Issue #8319: Update to Kotlin 1.4 and Coroutines 1.3.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
pocmo committed Sep 10, 2020
1 parent 22fd318 commit ca3e255
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Dependencies.kt
Expand Up @@ -4,8 +4,8 @@

// Synchronized version numbers for dependencies used by (some) modules
object Versions {
const val kotlin = "1.3.71"
const val coroutines = "1.3.5"
const val kotlin = "1.4.0"
const val coroutines = "1.3.9"

const val junit = "4.12"
const val robolectric = "4.1"
Expand Down
Expand Up @@ -215,7 +215,7 @@ class UrlMatcher {
jsonReader -> loadCategories(jsonReader, categoryMap)
}

var whiteList: WhiteList? = null
var whiteList: WhiteList?
JsonReader(white).use { jsonReader -> whiteList = WhiteList.fromJson(jsonReader) }
return UrlMatcher(enabledCategories, supportedCategories, categoryMap, whiteList)
}
Expand Down
Expand Up @@ -60,7 +60,7 @@ private fun IconRequest.Resource.Type.rank(): Int {
}

private val IconRequest.Resource.maxSize: Int
get() = sizes.asSequence().map { size -> size.minLength }.max() ?: 0
get() = sizes.asSequence().map { size -> size.minLength }.maxOrNull() ?: 0

private val IconRequest.Resource.isContainerType: Boolean
get() = mimeType != null && containerTypes.contains(mimeType)
Expand Down
Expand Up @@ -15,7 +15,7 @@ internal fun List<Pair<Int, Int>>.findBestSize(targetSize: Int, maxSize: Int, ma
x >= targetSize && y >= targetSize && x <= maxSize && y <= maxSize
}.filter { (x, y) ->
x == y
}.minBy { (x, _) ->
}.minByOrNull { (x, _) ->
x
}

Expand All @@ -33,7 +33,7 @@ internal fun List<Pair<Int, Int>>.findBestSize(targetSize: Int, maxSize: Int, ma
downScaledY >= targetSize &&
downScaledX <= maxSize &&
downScaledY <= maxSize
}.minBy { (x, _) ->
}.minByOrNull { (x, _) ->
x
}

Expand All @@ -51,7 +51,7 @@ internal fun List<Pair<Int, Int>>.findBestSize(targetSize: Int, maxSize: Int, ma
upscaledY >= targetSize &&
upscaledX <= maxSize &&
upscaledY <= maxSize
}.maxBy { (x, _) ->
}.maxByOrNull { (x, _) ->
x
}

Expand Down
Expand Up @@ -117,7 +117,7 @@ class InMemoryHistoryStorage : HistoryStorage {
}
// Calculate maxScore so that we can invert our scoring.
// Lower Levenshtein distance should produce a higher score.
val maxScore = urlMatches.maxBy { it.score }?.score ?: return@synchronized listOf()
val maxScore = urlMatches.maxByOrNull { it.score }?.score ?: return@synchronized listOf()

// TODO exclude non-matching results entirely? Score that implies complete mismatch.
matchedUrls.asSequence().sortedBy { it.value }.map {
Expand All @@ -126,8 +126,8 @@ class InMemoryHistoryStorage : HistoryStorage {
}

override fun getAutocompleteSuggestion(query: String): HistoryAutocompleteResult? = synchronized(pages) {
segmentAwareDomainMatch(query, pages.keys)?.let { urlMatch ->
return HistoryAutocompleteResult(
return segmentAwareDomainMatch(query, pages.keys)?.let { urlMatch ->
HistoryAutocompleteResult(
query, urlMatch.matchedSegment, urlMatch.url, AUTOCOMPLETE_SOURCE_NAME, pages.size)
}
}
Expand Down
Expand Up @@ -54,7 +54,7 @@ fun List<MenuCandidate>.findNestedMenuCandidate(id: Int): NestedMenuCandidate? =
/**
* Select the highlight with the highest priority.
*/
fun Sequence<MenuEffect>.max() = maxBy {
fun Sequence<MenuEffect>.max() = maxByOrNull {
// Select the highlight with the highest priority
when (it) {
is HighPriorityHighlightEffect -> 2
Expand Down
Expand Up @@ -220,8 +220,7 @@ internal class RustPushConnection(
// Query for the scope so that we can notify observers who the decrypted message is for.
val scope = pushApi.dispatchInfoForChid(channelId)?.scope

scope?.let {

if (scope != null) {
if (body == null) {
return DecryptedMessage(scope, null)
}
Expand All @@ -235,6 +234,8 @@ internal class RustPushConnection(
)

return DecryptedMessage(scope, data)
} else {
return null
}
}

Expand Down
Expand Up @@ -86,23 +86,23 @@ internal class CrashListAdapter(
val text = StringBuilder()

text.append(crashWithReports.crash.uuid)
text.appendln()
text.appendLine()
text.append(crashWithReports.crash.stacktrace.lines().first())
text.appendln()
text.appendLine()

crashWithReports.reports.forEach { report ->
val service = crashReporter.getCrashReporterServiceById(report.serviceId)
text.append(" * ")
text.append(service?.name ?: report.serviceId)
text.append(": ")
text.append(service?.createCrashReportUrl(report.reportId) ?: "<No URL>")
text.appendln()
text.appendLine()
}

text.append("----")
text.appendln()
text.appendLine()
text.append(crashWithReports.crash.stacktrace)
text.appendln()
text.appendLine()

val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
Expand Down
Expand Up @@ -46,7 +46,7 @@ class SampleApplication : Application() {
return
}

val httpClient = ConceptFetchHttpUploader(lazy { HttpURLConnectionClient() as Client })
val httpClient = ConceptFetchHttpUploader(lazy { HttpURLConnectionClient() })
val config = Configuration(httpClient = httpClient)
// IMPORTANT: the following lines initialize the Glean SDK but disable upload
// of pings. If, for testing purposes, upload is required to be on, change the
Expand Down
Expand Up @@ -53,7 +53,7 @@ class CrashApplication : Application() {
).install(this)

// Initialize Glean for recording by the GleanCrashReporterService
val httpClient = ConceptFetchHttpUploader(lazy { HttpURLConnectionClient() as Client })
val httpClient = ConceptFetchHttpUploader(lazy { HttpURLConnectionClient() })
val config = Configuration(httpClient = httpClient)
Glean.initialize(applicationContext, uploadEnabled = true, configuration = config)
}
Expand Down

0 comments on commit ca3e255

Please sign in to comment.