Updates to About Controller

Removed option to disable crash reports
Added What's new: linking to the github release
Link to website
Fixed Build Time
Added open source licenese
This commit is contained in:
Jay 2020-04-30 21:33:02 -04:00
parent 879a9c735c
commit 5ce1b8dd50
6 changed files with 69 additions and 21 deletions

View File

@ -5,6 +5,7 @@ import java.time.format.DateTimeFormatter
plugins { plugins {
id("com.android.application") id("com.android.application")
id("com.google.android.gms.oss-licenses-plugin")
kotlin("android") kotlin("android")
kotlin("android.extensions") kotlin("android.extensions")
kotlin("kapt") kotlin("kapt")
@ -243,6 +244,8 @@ dependencies {
// Text distance // Text distance
implementation("info.debatty:java-string-similarity:1.2.1") implementation("info.debatty:java-string-similarity:1.2.1")
implementation("com.google.android.gms:play-services-oss-licenses:17.0.0")
} }
tasks.preBuild { tasks.preBuild {

View File

@ -116,6 +116,13 @@
android:name=".extension.util.ExtensionInstallActivity" android:name=".extension.util.ExtensionInstallActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/> android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.OSS" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/Theme.OSS" />
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider" android:authorities="${applicationId}.provider"

View File

@ -6,6 +6,7 @@ import android.net.Uri
import android.os.Bundle import android.os.Bundle
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
@ -51,12 +52,16 @@ class SettingsAboutController : SettingsController() {
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
titleRes = R.string.about titleRes = R.string.about
switchPreference { preference {
key = "acra.enable" titleRes = R.string.website
titleRes = R.string.send_crash_report val url = "https://tachiyomi.org"
summaryRes = R.string.helps_fix_bugs summary = url
defaultValue = true onClick {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
}
} }
preference { preference {
title = "Discord" title = "Discord"
val url = "https://discord.gg/tachiyomi" val url = "https://discord.gg/tachiyomi"
@ -75,23 +80,45 @@ class SettingsAboutController : SettingsController() {
startActivity(intent) startActivity(intent)
} }
} }
preference { preferenceCategory {
titleRes = R.string.version preference {
summary = if (BuildConfig.DEBUG) titleRes = R.string.whats_new
"r" + BuildConfig.COMMIT_COUNT onClick {
else val intent = Intent(
BuildConfig.VERSION_NAME Intent.ACTION_VIEW, Uri.parse(
if (BuildConfig.DEBUG) {
if (isUpdaterEnabled) { "https://github.com/Jays2Kings/tachiyomiJ2K/commits/master"
onClick { checkVersion() } } else {
"https://github.com/Jays2Kings/tachiyomiJ2K/releases/tag/v${BuildConfig.VERSION_NAME}"
}
)
)
startActivity(intent)
}
} }
} preference {
preference { titleRes = R.string.version
titleRes = R.string.build_time summary = if (BuildConfig.DEBUG) "r" + BuildConfig.COMMIT_COUNT
summary = getFormattedBuildTime() else BuildConfig.VERSION_NAME
onClick { if (isUpdaterEnabled) {
ChangelogDialogController().showDialog(router) onClick { checkVersion() }
}
}
preference {
titleRes = R.string.build_time
summary = getFormattedBuildTime()
onClick {
ChangelogDialogController().showDialog(router)
}
}
preference {
titleRes = R.string.open_source_licenses
onClick {
startActivity(Intent(activity, OssLicensesMenuActivity::class.java))
}
} }
} }
} }
@ -159,7 +186,7 @@ class SettingsAboutController : SettingsController() {
private fun getFormattedBuildTime(): String { private fun getFormattedBuildTime(): String {
try { try {
val inputDf = SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'", Locale.US) val inputDf = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.getDefault())
inputDf.timeZone = TimeZone.getTimeZone("UTC") inputDf.timeZone = TimeZone.getTimeZone("UTC")
val buildTime = inputDf.parse(BuildConfig.BUILD_TIME) ?: return BuildConfig.BUILD_TIME val buildTime = inputDf.parse(BuildConfig.BUILD_TIME) ?: return BuildConfig.BUILD_TIME

View File

@ -532,6 +532,9 @@
<string name="build_time">Build time</string> <string name="build_time">Build time</string>
<string name="send_crash_report">Send crash reports</string> <string name="send_crash_report">Send crash reports</string>
<string name="helps_fix_bugs">Helps fix any bugs. No sensitive data will be sent</string> <string name="helps_fix_bugs">Helps fix any bugs. No sensitive data will be sent</string>
<string name="whats_new">What\'s new in this release</string>
<string name="website">Website</string>
<string name="open_source_licenses">Open source licenses</string>
<!-- Login dialog --> <!-- Login dialog -->
<string name="log_in_to_">Log in to %1$s</string> <string name="log_in_to_">Log in to %1$s</string>

View File

@ -76,4 +76,10 @@
<item name="android:windowLightStatusBar">false</item> <item name="android:windowLightStatusBar">false</item>
<item name="android:windowLightNavigationBar" tools:targetApi="27">false</item> <item name="android:windowLightNavigationBar" tools:targetApi="27">false</item>
</style> </style>
<style name="Theme.OSS" parent="Theme.MaterialComponents.DayNight">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@android:color/black</item>
<item name="android:colorEdgeEffect">@color/colorAccent</item>
</style>
</resources> </resources>

View File

@ -16,6 +16,8 @@ pluginManagement {
useModule("com.google.gms:google-services:4.3.3") useModule("com.google.gms:google-services:4.3.3")
}else if(requested.id.id.equals("com.github.zellius.shortcut-helper")){ }else if(requested.id.id.equals("com.github.zellius.shortcut-helper")){
useModule("com.github.zellius:android-shortcut-gradle-plugin:0.1.2") useModule("com.github.zellius:android-shortcut-gradle-plugin:0.1.2")
}else if(requested.id.id.equals("com.google.android.gms.oss-licenses-plugin")){
useModule("com.google.android.gms:oss-licenses-plugin:0.10.2")
} }
} }