mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Point to GitHub releases for stable changelogs
This commit is contained in:
		| @@ -89,7 +89,7 @@ object Migrations { | ||||
|                     preferences.librarySortingMode().set(LibrarySort.ALPHA) | ||||
|                 } | ||||
|             } | ||||
|             return !BuildConfig.DEBUG | ||||
|             return true | ||||
|         } | ||||
|         return false | ||||
|     } | ||||
|   | ||||
| @@ -1,31 +0,0 @@ | ||||
| package eu.kanade.tachiyomi.ui.main | ||||
|  | ||||
| import android.app.Dialog | ||||
| import android.content.Context | ||||
| import android.os.Bundle | ||||
| import android.util.AttributeSet | ||||
| import com.afollestad.materialdialogs.MaterialDialog | ||||
| import com.afollestad.materialdialogs.customview.customView | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.ui.base.controller.DialogController | ||||
| import it.gmariotti.changelibs.library.view.ChangeLogRecyclerView | ||||
|  | ||||
| class ChangelogDialogController : DialogController() { | ||||
|  | ||||
|     override fun onCreateDialog(savedViewState: Bundle?): Dialog { | ||||
|         val activity = activity!! | ||||
|         val view = WhatsNewRecyclerView(activity) | ||||
|         return MaterialDialog(activity) | ||||
|             .title(R.string.changelog) | ||||
|             .customView(view = view) | ||||
|             .positiveButton(R.string.action_close) | ||||
|     } | ||||
|  | ||||
|     class WhatsNewRecyclerView(context: Context) : ChangeLogRecyclerView(context) { | ||||
|         override fun initAttrs(attrs: AttributeSet?, defStyle: Int) { | ||||
|             mRowLayoutId = R.layout.changelog_row_layout | ||||
|             mRowHeaderLayoutId = R.layout.changelog_header_layout | ||||
|             mChangeLogFileResourceId = R.raw.changelog_release | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -3,7 +3,9 @@ package eu.kanade.tachiyomi.ui.main | ||||
| import android.app.Activity | ||||
| import android.app.SearchManager | ||||
| import android.content.Intent | ||||
| import android.net.Uri | ||||
| import android.os.Bundle | ||||
| import android.view.Gravity | ||||
| import android.view.View | ||||
| import android.view.ViewGroup | ||||
| import android.widget.Toast | ||||
| @@ -15,7 +17,9 @@ import com.bluelinelabs.conductor.Router | ||||
| import com.bluelinelabs.conductor.RouterTransaction | ||||
| import com.google.android.material.appbar.AppBarLayout | ||||
| import com.google.android.material.behavior.HideBottomViewOnScrollBehavior | ||||
| import com.google.android.material.snackbar.Snackbar | ||||
| import com.google.android.material.tabs.TabLayout | ||||
| import eu.kanade.tachiyomi.BuildConfig | ||||
| import eu.kanade.tachiyomi.Migrations | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.notification.NotificationReceiver | ||||
| @@ -38,6 +42,7 @@ import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController | ||||
| import eu.kanade.tachiyomi.util.lang.launchIO | ||||
| import eu.kanade.tachiyomi.util.lang.launchUI | ||||
| import eu.kanade.tachiyomi.util.system.toast | ||||
| import eu.kanade.tachiyomi.util.view.snack | ||||
| import java.util.Date | ||||
| import java.util.concurrent.TimeUnit | ||||
| import kotlinx.coroutines.delay | ||||
| @@ -144,9 +149,22 @@ class MainActivity : BaseActivity<MainActivityBinding>() { | ||||
|         syncActivityViewWithController(router.backstack.lastOrNull()?.controller()) | ||||
|  | ||||
|         if (savedInstanceState == null) { | ||||
|             // Show changelog if needed | ||||
|             if (Migrations.upgrade(preferences)) { | ||||
|                 ChangelogDialogController().showDialog(router) | ||||
|             // Show changelog prompt on update | ||||
|             if (Migrations.upgrade(preferences) && !BuildConfig.DEBUG) { | ||||
|                 binding.controllerContainer.snack(getString(R.string.updated_version, BuildConfig.VERSION_NAME), Snackbar.LENGTH_INDEFINITE) { | ||||
|                     setAction(R.string.whats_new) { | ||||
|                         val url = "https://github.com/inorichi/tachiyomi/releases/tag/v${BuildConfig.VERSION_NAME}" | ||||
|                         val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) | ||||
|                         startActivity(intent) | ||||
|                     } | ||||
|  | ||||
|                     // Ensure the snackbar sits above the bottom nav | ||||
|                     val layoutParams = view.layoutParams as CoordinatorLayout.LayoutParams | ||||
|                     layoutParams.anchorId = binding.bottomNav.id | ||||
|                     layoutParams.anchorGravity = Gravity.TOP | ||||
|                     layoutParams.gravity = Gravity.TOP | ||||
|                     view.layoutParams = layoutParams | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.data.updater.UpdateChecker | ||||
| import eu.kanade.tachiyomi.data.updater.UpdateResult | ||||
| import eu.kanade.tachiyomi.data.updater.UpdaterService | ||||
| import eu.kanade.tachiyomi.ui.base.controller.DialogController | ||||
| import eu.kanade.tachiyomi.ui.main.ChangelogDialogController | ||||
| import eu.kanade.tachiyomi.ui.setting.SettingsController | ||||
| import eu.kanade.tachiyomi.util.lang.launchNow | ||||
| import eu.kanade.tachiyomi.util.lang.toDateTimestampString | ||||
| @@ -67,15 +66,17 @@ class AboutController : SettingsController() { | ||||
|             } | ||||
|         } | ||||
|         preference { | ||||
|             titleRes = R.string.changelog | ||||
|             titleRes = R.string.whats_new | ||||
|  | ||||
|             onClick { | ||||
|                 if (BuildConfig.DEBUG) { | ||||
|                     val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/inorichi/tachiyomi/commits/dev")) | ||||
|                     startActivity(intent) | ||||
|                 val url = if (BuildConfig.DEBUG) { | ||||
|                     "https://github.com/inorichi/tachiyomi/commits/dev" | ||||
|                 } else { | ||||
|                     ChangelogDialogController().showDialog(router) | ||||
|                     "https://github.com/inorichi/tachiyomi/releases/tag/v${BuildConfig.VERSION_NAME}" | ||||
|                 } | ||||
|  | ||||
|                 val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) | ||||
|                 startActivity(intent) | ||||
|             } | ||||
|         } | ||||
|         if (BuildConfig.DEBUG) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user