Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(onboarding): add privacy policy to onboarding. #1288

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
1fd6545
feat(onboarding): add privacy policy to onboarding.
Dark25 Jan 14, 2024
913f3ae
delete firebase and crashlytics.
Dark25 Jan 14, 2024
76d2089
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Jan 15, 2024
aceb340
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Jan 15, 2024
68803b7
unnecessary space
Dark25 Jan 15, 2024
09659d9
Merge remote-tracking branch 'origin/privacy-policy-to-onboarding' in…
Dark25 Jan 15, 2024
353896b
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Jan 15, 2024
0c148dd
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Jan 21, 2024
cc52762
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Jan 23, 2024
6f4ffb7
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Jan 28, 2024
b9afad8
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Feb 7, 2024
56c6c5b
Merge branch 'master' into privacy-policy-to-onboarding
Dark25 Mar 10, 2024
0b81b45
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Apr 15, 2024
b00546d
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 May 10, 2024
f09fc78
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 May 26, 2024
482a536
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 May 29, 2024
69184ae
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Jun 6, 2024
d857675
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Jun 15, 2024
0ef6e34
Merge branch 'aniyomiorg:master' into privacy-policy-to-onboarding
Dark25 Jun 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fun OnboardingScreen(
var currentStep by rememberSaveable { mutableIntStateOf(0) }
val steps = remember {
listOf(
PrivacyPolicyStep(),
ThemeStep(),
StorageStep(),
PermissionStep(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
package eu.kanade.presentation.more.onboarding

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.ClickableText
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Checkbox
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource

class PrivacyPolicyStep : OnboardingStep {
private var _isComplete by mutableStateOf(false)

override val isComplete: Boolean
get() = _isComplete

@Composable
override fun Content() {
var isAgreed by remember { mutableStateOf(false) }
val scrollState = rememberScrollState()

val isScrolledToEnd = remember(scrollState) {
derivedStateOf {
val maxScroll = scrollState.maxValue
scrollState.value >= maxScroll
}
}

Column(modifier = Modifier.fillMaxSize()) {
Box(
modifier = Modifier
.height(500.dp)
.padding(16.dp)
.verticalScroll(scrollState),
) {
Column {
PrivacyPolicyIntro()
PrivacyInformationCollectionUse()
}
}

// Agreement Checkbox
Row(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text(
stringResource(MR.strings.onboarding_privacy_agree_to_terms),
style = TextStyle(
fontSize = 18.sp,
),
)
Checkbox(
enabled = isScrolledToEnd.value,
checked = isAgreed,
onCheckedChange = {
isAgreed = it
_isComplete = it
},
)
}
}
}

@Composable
fun HeadingText(text: String, modifier: Modifier = Modifier) {
Text(
modifier = modifier,
text = text,
style = TextStyle(fontSize = 20.sp, fontWeight = FontWeight.Bold),
)
}

@Composable
fun BodyText(text: String, modifier: Modifier = Modifier) {
Text(
modifier = modifier,
text = text,
style = TextStyle(fontSize = 16.sp),
)
}

@Composable
fun HorizontalDivider() {
HorizontalDivider(color = Color.Gray)
}

@Composable
fun Spacer(size: Int, modifier: Modifier = Modifier) {
Spacer(modifier = modifier.height(size.dp))
}

@Composable
fun BulletPoint(text: String, url: String, modifier: Modifier = Modifier) {
val uriHandler = LocalUriHandler.current

val annotatedString = buildAnnotatedString {
withStyle(style = SpanStyle(color = Color(0xFF0645AD), fontSize = 16.sp)) {
append("• $text")
}
addStringAnnotation(
tag = "URL",
annotation = url,
start = 2,
end = 2 + text.length,
)
}

ClickableText(
modifier = modifier,
text = annotatedString,
onClick = { offset ->
annotatedString.getStringAnnotations(tag = "URL", start = offset, end = offset)
.firstOrNull()?.let { annotation ->
uriHandler.openUri(annotation.item)
}
},
style = TextStyle(fontSize = 16.sp),
)
}

@Composable
fun MoreInfoText(url: String, modifier: Modifier = Modifier) {
val uriHandler = LocalUriHandler.current

val annotatedString = buildAnnotatedString {
withStyle(style = SpanStyle(color = Color(0xFF0645AD), fontSize = 16.sp)) {
append(stringResource(MR.strings.learn_more))
}
addStringAnnotation(
tag = "URL",
annotation = url,
start = 0,
end = stringResource(MR.strings.learn_more).length,
)
}

ClickableText(
text = annotatedString,
modifier = modifier,
onClick = { offset ->
annotatedString.getStringAnnotations(tag = "URL", start = offset, end = offset)
.firstOrNull()?.let { annotation ->
uriHandler.openUri(annotation.item)
}
},
style = TextStyle(fontSize = 16.sp),
)
}

@Composable
fun PrivacyPolicyIntro(modifier: Modifier = Modifier) {
Column(modifier = modifier) {
HeadingText(stringResource(MR.strings.privacy_policy))
Spacer(20)

BodyText(stringResource(MR.strings.onboarding_privacy_intro))
Spacer(10)

BodyText(stringResource(MR.strings.onboarding_privacy_info_overview))
Spacer(10)

BodyText(stringResource(MR.strings.onboarding_privacy_agreement_acknowledgement))
Spacer(20)

HorizontalDivider()
Spacer(20)
}
}

@Composable
fun PrivacyInformationCollectionUse(modifier: Modifier = Modifier) {
Column(modifier = modifier) {
HeadingText(stringResource(MR.strings.onboarding_privacy_information_collection_use))
Spacer(20)

BodyText(stringResource(MR.strings.onboarding_privacy_information_collection_use_intro))
Spacer(10)

BodyText(stringResource(MR.strings.onboarding_privacy_information_collection_use_data))
Spacer(10)

Spacer(20)
HorizontalDivider()
Spacer(20)

MoreInfoText("https://aniyomi.org/privacy/")
}
}
}
7 changes: 7 additions & 0 deletions i18n/src/commonMain/resources/MR/base/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@
<string name="onboarding_permission_action_grant">Grant</string>
<string name="onboarding_guides_new_user">New to %s? We recommend checking out the getting started guide.</string>
<string name="onboarding_guides_returning_user">Reinstalling %s?</string>
<string name="onboarding_privacy_agree_to_terms">I agree to the Privacy Policy</string>
<string name="onboarding_privacy_intro">Aniyomi is an Open Source app. This SERVICE is provided at no cost and is intended for use as is.</string>
<string name="onboarding_privacy_info_overview">This page details our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our Service.</string>
<string name="onboarding_privacy_agreement_acknowledgement">If you choose to use our Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that we collect is used for providing and improving the Service. We will not use or share your information with anyone except as described in this Privacy Policy.</string>
<string name="onboarding_privacy_information_collection_use">Information Collection and Use</string>
<string name="onboarding_privacy_information_collection_use_intro">For a better experience, while using our Service, we may require you to provide us with certain personally identifiable information. The information that we request will be retained by us and used as described in this privacy policy.</string>
<string name="onboarding_privacy_information_collection_use_data">Links to the privacy policy of third-party service providers used by the app:</string>
<!-- Preferences -->
<!-- Subsections -->
<string name="pref_category_general">General</string>
Expand Down
Loading