mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-25 04:35:12 +00:00
show changelog after app update
This commit is contained in:
parent
e6f04a95c8
commit
1ea32c75ff
1 changed files with 19 additions and 0 deletions
|
@ -11,20 +11,25 @@ import android.view.MenuInflater
|
|||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.crowdin.platform.util.inflateWithCrowdin
|
||||
import com.google.android.flexbox.FlexboxLayoutManager
|
||||
import com.google.android.flexbox.JustifyContent
|
||||
import com.vanced.manager.BuildConfig.VERSION_CODE
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.adapter.ExpandableAppListAdapter
|
||||
import com.vanced.manager.adapter.LinkAdapter
|
||||
import com.vanced.manager.adapter.SponsorAdapter
|
||||
import com.vanced.manager.core.ui.base.BindingFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
import com.vanced.manager.databinding.FragmentHomeBinding
|
||||
import com.vanced.manager.ui.dialogs.AppInfoDialog
|
||||
import com.vanced.manager.ui.dialogs.DialogContainer.installAlertBuilder
|
||||
import com.vanced.manager.ui.viewmodels.HomeViewModel
|
||||
import com.vanced.manager.ui.viewmodels.HomeViewModelFactory
|
||||
import com.vanced.manager.utils.isFetching
|
||||
import com.vanced.manager.utils.manager
|
||||
|
||||
class HomeFragment : BindingFragment<FragmentHomeBinding>() {
|
||||
|
||||
|
@ -56,6 +61,20 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>() {
|
|||
homeRefresh.setOnRefreshListener { viewModel.fetchData() }
|
||||
isFetching.observe(viewLifecycleOwner) { homeRefresh.isRefreshing = it }
|
||||
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
if (prefs.contains("LastVersionCode")) {
|
||||
if (prefs.getInt("LastVersionCode", -1) < VERSION_CODE) {
|
||||
showDialog(
|
||||
AppInfoDialog.newInstance(
|
||||
appName = getString(R.string.app_name),
|
||||
appIcon = R.mipmap.ic_launcher,
|
||||
changelog = manager.value?.string("changelog")
|
||||
)
|
||||
)
|
||||
prefs.edit().putInt("LastVersionCode", VERSION_CODE).apply()
|
||||
}
|
||||
} else prefs.edit().putInt("LastVersionCode", VERSION_CODE).apply()
|
||||
|
||||
recyclerAppList.apply {
|
||||
layoutManager = LinearLayoutManager(requireActivity())
|
||||
adapter = ExpandableAppListAdapter(requireActivity(), viewModel /*, tooltip*/)
|
||||
|
|
Loading…
Reference in a new issue