Skip to content

Commit

Permalink
fix(android): Call toString on versionName (#1480)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahqsoftwares authored Feb 7, 2025
1 parent 0023e83 commit ce98c34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/wry-activity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Fixed an issue that could cause `Return type mismatch: expected 'kotlin.String', actual 'kotlin.String?'` errors.
4 changes: 2 additions & 2 deletions src/android/kotlin/WryActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ abstract class WryActivity : AppCompatActivity() {
try {
@Suppress("DEPRECATION")
val info = packageManager.getPackageInfo(webViewPackage, 0)
return info.versionName
return info.versionName.toString()
} catch (ex: Exception) {
Logger.warn("Unable to get package info for '$webViewPackage'$ex")
}

try {
@Suppress("DEPRECATION")
val info = packageManager.getPackageInfo("com.android.webview", 0)
return info.versionName
return info.versionName.toString()
} catch (ex: Exception) {
Logger.warn("Unable to get package info for 'com.android.webview'$ex")
}
Expand Down

0 comments on commit ce98c34

Please sign in to comment.