Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1e0f0a4 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Display Exodus Privacy report request button again

parent fd2f214f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -117,6 +117,10 @@ data class Application(
            }
        }
    }

    fun hasExodusPrivacyRating(): Boolean {
        return this.reportId.toInt() != -1
    }
}

val Application.shareUri: Uri
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ class AppPrivacyInfoRepositoryImpl @Inject constructor(
        }

        val reports = fetchReports(application.package_name)
        if (reports.isEmpty()) {
        if (reports.firstOrNull()?.handle != application.package_name) {
            return Result.error("Could not fetch reports for ${application.package_name}")
        }

+4 −0
Original line number Diff line number Diff line
@@ -79,6 +79,10 @@ class PrivacyInfoViewModel @Inject constructor(
    }

    fun shouldRequestExodusReport(application: Application?): Boolean {
        if (application?.hasExodusPrivacyRating() == false)  {
            return true
        }

        if (application?.isFree != true) {
            return false
        }
+10 −2
Original line number Diff line number Diff line
@@ -303,9 +303,17 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) {
    }

    private fun openBrowser() {
        val url = generateExodusUrl()
        val application = applicationViewModel.getApplication()
        val packageName = application?.package_name ?: return

        val url = if (application.hasExodusPrivacyRating()) {
            ExodusUriGenerator.buildReportUri(packageName)
        } else {
            ExodusUriGenerator.buildRequestReportUri(packageName)
        }

        val intent = Intent(Intent.ACTION_VIEW).apply {
            data = Uri.parse(url)
            data = url
        }

        if (intent.resolveActivity(requireContext().packageManager) == null) {
+2 −17
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ class ApplicationListRVAdapter(
            appPrivacyScoreLayout.isVisible = false
            return
        }
        if (searchApp.ratings.privacyScore != -1.0) {
        if (searchApp.hasExodusPrivacyRating() && searchApp.ratings.privacyScore != -1.0) {
            appPrivacyScore.text = view.context.getString(
                R.string.privacy_rating_out_of,
                searchApp.ratings.privacyScore.toInt().toString()
@@ -395,23 +395,8 @@ class ApplicationListRVAdapter(
        searchApp: Application,
        view: View
    ) {
        if (searchApp.privacyScore > -1) {
            showPrivacyScoreOnAvailableData(searchApp, view)
        } else {
        showPrivacyScoreAfterFetching(searchApp, view)
    }
    }

    private fun ApplicationListItemBinding.showPrivacyScoreOnAvailableData(
        searchApp: Application,
        view: View
    ) {
        showPrivacyScore()
        appPrivacyScore.text = view.context.getString(
            R.string.privacy_rating_out_of,
            searchApp.privacyScore.toString()
        )
    }

    private fun ApplicationListItemBinding.showPrivacyScoreAfterFetching(
        searchApp: Application,