Skip to content

Commit ce528aa

Browse files
committed
release: bump to 1.4.0 (versionCode 13); update dialog jumps to GitHub Releases/latest with browser fallback
1 parent 5b8868f commit ce528aa

5 files changed

Lines changed: 32 additions & 6 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ android {
1717
applicationId "com.shuyu.github.kotlin"
1818
minSdkVersion 21
1919
targetSdkVersion 36
20-
versionCode 12
21-
versionName "1.3.0"
20+
versionCode 13
21+
versionName "1.4.0"
2222
javaCompileOptions {
2323
annotationProcessorOptions {
2424
arguments = [AROUTER_MODULE_NAME: project.getName()]

app/src/main/AndroidManifest.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@
1010
android:maxSdkVersion="32" />
1111
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
1212

13+
<queries>
14+
<intent>
15+
<action android:name="android.intent.action.VIEW" />
16+
<category android:name="android.intent.category.BROWSABLE" />
17+
<data android:scheme="https" />
18+
</intent>
19+
<intent>
20+
<action android:name="android.intent.action.VIEW" />
21+
<category android:name="android.intent.category.BROWSABLE" />
22+
<data android:scheme="http" />
23+
</intent>
24+
</queries>
25+
1326
<application
1427
android:name="GSYGithubApplication"
1528
android:allowBackup="true"

app/src/main/java/com/shuyu/github/kotlin/common/compat/AnkoCompat.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ internal fun Fragment.toast(@StringRes resId: Int): Toast =
2424

2525
internal fun Context.browse(url: String, newTask: Boolean = false): Boolean {
2626
return try {
27-
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
27+
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {
28+
addCategory(Intent.CATEGORY_BROWSABLE)
29+
}
2830
if (newTask) {
2931
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
3032
}
31-
startActivity(intent)
32-
true
33+
if (intent.resolveActivity(packageManager) != null) {
34+
startActivity(intent)
35+
true
36+
} else {
37+
toast(com.shuyu.github.kotlin.R.string.noBrowserFound)
38+
false
39+
}
3340
} catch (e: Exception) {
3441
e.printStackTrace()
42+
toast(com.shuyu.github.kotlin.R.string.noBrowserFound)
3543
false
3644
}
3745
}

app/src/main/java/com/shuyu/github/kotlin/module/main/MainDrawerController.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ class MainDrawerController(private val activity: Activity, toolbar: Toolbar,
4949
private val reposRepository: ReposRepository,
5050
globalModel: AppGlobalModel) {
5151

52+
companion object {
53+
const val RELEASE_PAGE_URL = "https://github.com/CarGuo/GSYGithubAppKotlin/releases/latest"
54+
}
55+
5256
internal var drawer: DrawerShim? = null
5357

5458
init {
@@ -171,7 +175,7 @@ class MainDrawerController(private val activity: Activity, toolbar: Toolbar,
171175
override fun onSuccess(result: Release?) {
172176
result?.name?.apply {
173177
showUpdateDialog(activity, this, result.body
174-
?: "", "https://github.com/CarGuo/GSYGithubAppKotlin/releases")
178+
?: "", RELEASE_PAGE_URL)
175179
return
176180
}
177181
if (needTip) {

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
<string name="forkFail">Fxxx 没能成功呢</string>
145145
<string name="listEmpty">暂时还没找到什么(o゚▽゚)o </string>
146146
<string name="browserOpen">浏览器打开</string>
147+
<string name="noBrowserFound">未找到可用的浏览器,无法打开链接</string>
147148
<string name="copy">复制链接</string>
148149
<string name="download">下载</string>
149150
<string name="iosNotSupportDown">IOS不支持下载</string>

0 commit comments

Comments
 (0)