mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-03 23:58:55 +01:00 
			
		
		
		
	Show parsed Markdown for new version info (closes #6940)
This commit is contained in:
		@@ -234,6 +234,7 @@ dependencies {
 | 
			
		||||
        exclude(group = "androidx.viewpager", module = "viewpager")
 | 
			
		||||
    }
 | 
			
		||||
    implementation(libs.insetter)
 | 
			
		||||
    implementation(libs.markwon)
 | 
			
		||||
 | 
			
		||||
    // Conductor
 | 
			
		||||
    implementation(libs.bundles.conductor)
 | 
			
		||||
 
 | 
			
		||||
@@ -121,6 +121,7 @@ class AboutController : SettingsController(), NoAppBarElevationController {
 | 
			
		||||
                    is AppUpdateResult.NoNewUpdate -> {
 | 
			
		||||
                        activity?.toast(R.string.update_check_no_new_updates)
 | 
			
		||||
                    }
 | 
			
		||||
                    else -> {}
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error: Exception) {
 | 
			
		||||
                activity?.toast(error.message)
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.R
 | 
			
		||||
import eu.kanade.tachiyomi.data.updater.AppUpdateResult
 | 
			
		||||
import eu.kanade.tachiyomi.data.updater.AppUpdateService
 | 
			
		||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
 | 
			
		||||
import io.noties.markwon.Markwon
 | 
			
		||||
 | 
			
		||||
class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundle) {
 | 
			
		||||
 | 
			
		||||
@@ -16,15 +17,18 @@ class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundl
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    override fun onCreateDialog(savedViewState: Bundle?): Dialog {
 | 
			
		||||
        val releaseBody = (args.getString(BODY_KEY) ?: "")
 | 
			
		||||
            .replace("""---(\R|.)*Checksums(\R|.)*""".toRegex(), "")
 | 
			
		||||
        val info = Markwon.create(activity!!).toMarkdown(releaseBody)
 | 
			
		||||
 | 
			
		||||
        return MaterialAlertDialogBuilder(activity!!)
 | 
			
		||||
            .setTitle(R.string.update_check_notification_update_available)
 | 
			
		||||
            .setMessage(args.getString(BODY_KEY) ?: "")
 | 
			
		||||
            .setMessage(info)
 | 
			
		||||
            .setPositiveButton(R.string.update_check_confirm) { _, _ ->
 | 
			
		||||
                val appContext = applicationContext
 | 
			
		||||
                if (appContext != null) {
 | 
			
		||||
                applicationContext?.let { context ->
 | 
			
		||||
                    // Start download
 | 
			
		||||
                    val url = args.getString(URL_KEY) ?: ""
 | 
			
		||||
                    AppUpdateService.start(appContext, url)
 | 
			
		||||
                    AppUpdateService.start(context, url)
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            .setNegativeButton(R.string.update_check_ignore, null)
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ class ThemesPreferenceAdapter(private val clickListener: OnItemClickListener) :
 | 
			
		||||
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ThemeViewHolder {
 | 
			
		||||
        val themeResIds = ThemingDelegate.getThemeResIds(themes[viewType], preferences.themeDarkAmoled().get())
 | 
			
		||||
        val themedContext = themeResIds.fold(parent.context) {
 | 
			
		||||
                context, themeResId ->
 | 
			
		||||
            context, themeResId ->
 | 
			
		||||
            ContextThemeWrapper(context, themeResId)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -56,6 +56,8 @@ image-decoder = "com.github.tachiyomiorg:image-decoder:7481a4a"
 | 
			
		||||
 | 
			
		||||
natural-comparator = "com.github.gpanther:java-nat-sort:natural-comparator-1.1"
 | 
			
		||||
 | 
			
		||||
markwon = "io.noties.markwon:core:4.6.2"
 | 
			
		||||
 | 
			
		||||
material = "com.google.android.material:material:1.7.0-alpha01"
 | 
			
		||||
androidprocessbutton = "com.github.dmytrodanylyk.android-process-button:library:1.0.4"
 | 
			
		||||
flexible-adapter-core = "com.github.arkon.FlexibleAdapter:flexible-adapter:c8013533"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user