Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ object IntentHelper {
}
}

fun openLinkFromHref(context: Context, fragmentManager: FragmentManager, link: String) {
fun openLinkFromHref(context: Context, fragmentManager: FragmentManager, link: String, forceDefaultOpen: Boolean = false) {
val resolveInfoList = getResolveInfo(context, link)

if (resolveInfoList.isEmpty()) {
if (resolveInfoList.isEmpty() || forceDefaultOpen) {
try {
context.startActivity(getResolveIntent(link))
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class AboutActivity : BaseActivity() {
}

companion object {
private const val DONATE_URL = "https://github.com/libre-tube/LibreTube#donate"
const val DONATE_URL = "https://github.com/libre-tube/LibreTube#donate"
private const val WEBSITE_URL = "https://libretube.dev"
private const val GITHUB_URL = "https://github.com/libre-tube/LibreTube"
private const val PIPED_GITHUB_URL = "https://github.com/TeamPiped/Piped"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,16 @@ class MainActivity : BaseActivity() {
true
}

R.id.action_donate -> {
IntentHelper.openLinkFromHref(
this,
supportFragmentManager,
AboutActivity.DONATE_URL,
forceDefaultOpen = true
)
true
}

else -> super.onOptionsItemSelected(item)
}
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/menu/action_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
android:title="@string/help"
app:showAsAction="never" />

<item
android:id="@+id/action_donate"
android:title="@string/donate"
app:showAsAction="never" />

<item
android:id="@+id/action_about"
android:title="@string/about"
Expand Down