Upgrade to Kotlin 1.7.20

Also run formatter and address some deprecation warnings.
This commit is contained in:
arkon
2022-10-11 22:40:02 -04:00
parent b1e104319f
commit 26a42ba9c0
22 changed files with 42 additions and 46 deletions

View File

@@ -243,7 +243,13 @@ fun Context.openInBrowser(uri: Uri, forceDefaultBrowser: Boolean = false) {
fun Context.defaultBrowserPackageName(): String? {
val browserIntent = Intent(Intent.ACTION_VIEW, "http://".toUri())
return packageManager.resolveActivity(browserIntent, PackageManager.MATCH_DEFAULT_ONLY)
val resolveInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
packageManager.resolveActivity(browserIntent, PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY.toLong()))
} else {
@Suppress("DEPRECATION")
packageManager.resolveActivity(browserIntent, PackageManager.MATCH_DEFAULT_ONLY)
}
return resolveInfo
?.activityInfo?.packageName
?.takeUnless { it in DeviceUtil.invalidDefaultBrowsers }
}