Skip to content

Commit

Permalink
fix app install intent handling
Browse files Browse the repository at this point in the history
  • Loading branch information
crc-32 committed Feb 8, 2025
1 parent 63fe642 commit 8611dee
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions android/app/src/main/kotlin/io/rebble/cobble/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,16 @@ class MainActivity : AppCompatActivity() {
private fun handleIntent(intent: Intent) {
val uri = intent.data
if (intent.scheme == "content" && uri != null) {
if (uri.path?.endsWith("pbw") == true) {
Logging.d("Received pbw install intent")
val fileSize = contentResolver.openAssetFileDescriptor(uri, "r").use {
it?.length
}
if (fileSize == null || fileSize > 10_000_000) {
Logging.e("Invalid PBW file size, ignoring")
return
}
val cachedUri = cacheIncomingPbw(uri)
navHostController?.navigate("${Routes.DIALOG_APP_INSTALL}?uri=$cachedUri")
Logging.d("Received pbw install intent")
val fileSize = contentResolver.openAssetFileDescriptor(uri, "r").use {
it?.length
}
if (fileSize == null || fileSize > 10_000_000) {
Logging.e("Invalid PBW file size, ignoring")
return
}
val cachedUri = cacheIncomingPbw(uri)
navHostController?.navigate("${Routes.DIALOG_APP_INSTALL}?uri=$cachedUri")
} else {
if (intent.hasExtra("navigationPath")) {
navHostController?.navigate(intent.getStringExtra("navigationPath")!!)
Expand Down

0 comments on commit 8611dee

Please sign in to comment.