Fix#5084: Tapping on GitHub icon opens app when installed (#5171)

This commit is contained in:
Eduardo Isai Martínez Méndez 2023-03-09 20:45:32 -06:00 committed by GitHub
parent b048e099c0
commit ce1a0b88c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -101,7 +101,14 @@ public class AboutActivity extends BaseActivity {
}
public void launchGithub(View view) {
Utils.handleWebUrl(this, Uri.parse(Urls.GITHUB_REPO_URL));
Intent intent;
try {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Urls.GITHUB_REPO_URL));
intent.setPackage(Urls.GITHUB_PACKAGE_NAME);
startActivity(intent);
} catch (Exception e) {
Utils.handleWebUrl(this, Uri.parse(Urls.GITHUB_REPO_URL));
}
}
public void launchWebsite(View view) {

View file

@ -3,6 +3,7 @@ package fr.free.nrw.commons
internal object Urls {
const val NEW_ISSUE_URL = "https://github.com/commons-app/apps-android-commons/issues"
const val GITHUB_REPO_URL = "https://github.com/commons-app/apps-android-commons"
const val GITHUB_PACKAGE_NAME = "com.github.android"
const val WEBSITE_URL = "https://commons-app.github.io"
const val CREDITS_URL = "https://github.com/commons-app/apps-android-commons/blob/master/CREDITS"
const val USER_GUIDE_URL = "https://commons-app.github.io/docs.html"