Skip to content

Commit

Permalink
- Fix URL opening behavior to display chooser dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
DesarrolloAntonio committed Apr 23, 2024
1 parent 5c88c1d commit a535ac3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ android.nonTransitiveRClass=true
compileSdkVersion=34
minSdkVersion=21
targetSdkVersion=34
versionCode=34
versionName=1.21
versionCode=35
versionName=1.21.1
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.desarrollodroide.pagekeeper.extensions
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.widget.Toast
import androidx.core.content.FileProvider
import java.io.File

Expand All @@ -18,14 +17,11 @@ fun Context.shareText(text: String) {

fun Context.openUrlInBrowser(url: String) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
if (intent.resolveActivity(packageManager) != null) {
startActivity(intent)
} else {
Toast.makeText(this, "Error opening URL", Toast.LENGTH_SHORT).show()
}
val chooser = Intent.createChooser(intent, "Open with")
startActivity(chooser)
}


fun Context.shareEpubFile(file: File) {
val uri = FileProvider.getUriForFile(this, "${applicationContext.packageName}.provider", file)

Expand Down

0 comments on commit a535ac3

Please sign in to comment.