diff --git a/app/build.gradle b/app/build.gradle index 5ea7f0fd1..9ea14c4f5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,6 +5,8 @@ plugins { alias(libs.plugins.kotlin.kapt) alias(libs.plugins.kotlin.parcelize) alias(libs.plugins.aboutlibraries) + + id "app.pachli.plugins.markdown2resource" } apply from: 'gitTools.gradle' @@ -139,6 +141,10 @@ aboutLibraries { prettyPrint = true } +markdown2resource { + files = [ layout.projectDirectory.file('../PRIVACY.md') ] +} + // library versions are in PROJECT_ROOT/gradle/libs.versions.toml dependencies { implementation libs.kotlinx.coroutines.android diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index f46fb7cd5..9f8bb0d86 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -47,7 +47,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -2064,17 +2064,6 @@ column="9"/> - - - - + diff --git a/app/src/main/java/app/pachli/AboutActivity.kt b/app/src/main/java/app/pachli/AboutActivity.kt index 9a0c1c397..b5e69a285 100644 --- a/app/src/main/java/app/pachli/AboutActivity.kt +++ b/app/src/main/java/app/pachli/AboutActivity.kt @@ -73,7 +73,11 @@ class AboutActivity : BottomSheetActivity(), Injectable { binding.aboutLicenseInfoTextView.setClickableTextWithoutUnderlines(R.string.about_pachli_license) binding.aboutWebsiteInfoTextView.setClickableTextWithoutUnderlines(R.string.about_project_site) binding.aboutBugsFeaturesInfoTextView.setClickableTextWithoutUnderlines(R.string.about_bug_feature_request_site) - binding.aboutPrivacyPolicyTextView.setClickableTextWithoutUnderlines(R.string.about_privacy_policy) + + binding.aboutPrivacyPolicyTextView.setOnClickListener { + val intent = Intent(this, PrivacyPolicyActivity::class.java) + startActivity(intent) + } binding.appProfileButton.setOnClickListener { viewUrl(BuildConfig.SUPPORT_ACCOUNT_URL) diff --git a/app/src/main/java/app/pachli/PrivacyPolicyActivity.kt b/app/src/main/java/app/pachli/PrivacyPolicyActivity.kt new file mode 100644 index 000000000..53ea5fe88 --- /dev/null +++ b/app/src/main/java/app/pachli/PrivacyPolicyActivity.kt @@ -0,0 +1,32 @@ +/* + * Copyright 2023 Pachli Association + * + * This file is a part of Pachli. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * Pachli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Pachli; if not, + * see . + */ + +package app.pachli + +import android.os.Bundle +import android.util.Base64 +import app.pachli.databinding.ActivityPrivacyPolicyBinding + +class PrivacyPolicyActivity : BaseActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val binding = ActivityPrivacyPolicyBinding.inflate(layoutInflater) + setContentView(binding.root) + val encoded = Base64.encodeToString(markdownR.html.PRIVACY_md.toByteArray(), Base64.NO_PADDING) + binding.policy.loadData(encoded, "text/html", "base64") + } +} diff --git a/app/src/main/java/app/pachli/di/ActivitiesModule.kt b/app/src/main/java/app/pachli/di/ActivitiesModule.kt index bf2f1a6aa..8285d818f 100644 --- a/app/src/main/java/app/pachli/di/ActivitiesModule.kt +++ b/app/src/main/java/app/pachli/di/ActivitiesModule.kt @@ -21,6 +21,7 @@ import app.pachli.EditProfileActivity import app.pachli.LicenseActivity import app.pachli.ListsActivity import app.pachli.MainActivity +import app.pachli.PrivacyPolicyActivity import app.pachli.SplashActivity import app.pachli.StatusListActivity import app.pachli.TabPreferenceActivity @@ -128,4 +129,7 @@ abstract class ActivitiesModule { @ContributesAndroidInjector abstract fun contributesEditFilterActivity(): EditFilterActivity + + @ContributesAndroidInjector + abstract fun contributesPrivacyPolicyActivity(): PrivacyPolicyActivity } diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 1c0d93ce2..07eb791c0 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -169,19 +169,18 @@ app:layout_constraintStart_toStartOf="@+id/aboutWebsiteInfoTextView" app:layout_constraintTop_toBottomOf="@id/aboutWebsiteInfoTextView" /> - -