AppDetails: Show warning if app in unavailable for the device

This commit is contained in:
Rahul Patel
2024-12-16 23:12:56 +05:30
parent d85bcfd2ac
commit 5d7d7c5ffa

View File

@@ -217,6 +217,10 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
updateAppHeader(app) // Re-inflate the app details, as web data may vary.
updateExtraDetails(app)
if (app.versionCode == 0) {
warnAppUnavailable(app)
}
// Fetch App Reviews
viewModel.fetchAppReviews(app.packageName)
@@ -225,8 +229,6 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
// Fetch Exodus Privacy Report
viewModel.fetchAppReport(app.packageName)
} else {
toast(getString(R.string.status_unavailable))
// TODO: Redirect to App Unavailable Fragment
@@ -1032,6 +1034,13 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
}
}
private fun warnAppUnavailable(app: App) {
AuroraApp.events.send(InstallerEvent.Failed(app.packageName).apply {
error = getString(R.string.status_unavailable)
extra = getString(R.string.toast_app_unavailable)
})
}
/* App Review Helpers */
private fun addAvgReviews(number: Int, max: Long, rating: Long): RelativeLayout {