Skip to content

Commit 67aad31

Browse files
authored
Merge pull request #119 from Wottrich/master
Sync with develop
2 parents 8b51f5c + 14d79f6 commit 67aad31

File tree

19 files changed

+214
-11
lines changed

19 files changed

+214
-11
lines changed

app/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ plugins {
66
android {
77
defaultConfig {
88
applicationId = "wottrich.github.io.androidsmartchecklist"
9-
versionCode = 8
10-
versionName = "2.0.0"
9+
versionCode = 9
10+
versionName = "2.0.1"
1111
multiDexEnabled = true
12+
13+
buildConfigField("String", "PRIVACY_POLICY_URL", "\"https://github.com/Wottrich/android-smart-checklist/blob/master/privacity_rules.txt\"")
1214
}
1315

1416
buildTypes {
@@ -57,6 +59,7 @@ dependencies {
5759
implementation(project(path = ":features:task:impl"))
5860
implementation(project(path = ":features:newchecklist:impl"))
5961
implementation(project(path = ":features:quicklychecklist:impl"))
62+
implementation(project(path = ":ui-privacy-policy:impl"))
6063
implementation(project(path = ":ui-aboutus"))
6164
implementation(project(path = ":ui-support"))
6265
testImplementation(project(path = ":test-tools"))

app/src/main/java/wottrich/github/io/smartchecklist/di/AppDefaultModule.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ import wottrich.github.io.smartchecklist.android.SmartChecklistNavigation
1010
import wottrich.github.io.smartchecklist.navigation.AppNavigator
1111
import wottrich.github.io.smartchecklist.navigation.OpenPlayStoreNavigator
1212
import wottrich.github.io.smartchecklist.navigation.OpenPlayStoreNavigatorImpl
13+
import wottrich.github.io.smartchecklist.navigation.PrivacyPolicy
14+
import wottrich.github.io.smartchecklist.navigation.PrivacyPolicyImpl
1315

1416
val appDefaultModule = module {
1517
single<ClipboardManager> {
1618
androidContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
1719
}
1820
single<OpenPlayStoreNavigator> { OpenPlayStoreNavigatorImpl(androidContext()) }
21+
single<PrivacyPolicy> { PrivacyPolicyImpl(androidContext()) }
1922
single { AppNavigator(getAll<SmartChecklistNavigation>()) }
2023

2124
getKoin().setProperty(AppProperties.VERSION_NAME, BuildConfig.VERSION_NAME)

app/src/main/java/wottrich/github/io/smartchecklist/di/NavigationModule.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import wottrich.github.io.smartchecklist.navigation.HomeContextNavigator
88
val navigationModule = module {
99
single {
1010
HomeContextNavigator(
11-
get(),
12-
getProperty(AppProperties.VERSION_NAME),
13-
getProperty(AppProperties.VERSION_CODE)
11+
openPlayStoreNavigator = get(),
12+
privacyPolicy = get(),
13+
versionName = getProperty(AppProperties.VERSION_NAME),
14+
versionCode = getProperty(AppProperties.VERSION_CODE)
1415
)
1516
} bind SmartChecklistNavigation::class
1617
}

app/src/main/java/wottrich/github/io/smartchecklist/navigation/HomeContextNavigator.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import wottrich.github.io.smartchecklist.presentation.ui.checklistsettings.Check
1313
import wottrich.github.io.smartchecklist.presentation.ui.content.HomeScreen
1414
import wottrich.github.io.smartchecklist.uiaboutus.data.model.AboutUsContentModel
1515
import wottrich.github.io.smartchecklist.uiaboutus.presentation.ui.AboutUsScreen
16+
import wottrich.github.io.smartchecklist.uiprivacypolicy.ui.PrivacyPolicyScreen
1617

1718
@OptIn(ExperimentalMaterialNavigationApi::class)
1819
class HomeContextNavigator(
1920
private val openPlayStoreNavigator: OpenPlayStoreNavigator,
21+
private val privacyPolicy: PrivacyPolicy,
2022
private val versionName: String,
2123
private val versionCode: String
2224
) : SmartChecklistNavigation {
@@ -47,6 +49,21 @@ class HomeContextNavigator(
4749
},
4850
onVersionAppClick = {
4951
openPlayStoreNavigator.openPlayStore()
52+
},
53+
onPrivacyPolicyClick = {
54+
navHostController.navigate(NavigationHome.Destinations.PrivacyPolicyScreen.route)
55+
}
56+
)
57+
}
58+
composable(
59+
route = NavigationHome.Destinations.PrivacyPolicyScreen.route
60+
) {
61+
PrivacyPolicyScreen(
62+
onOpenPrivacyPolicy = {
63+
privacyPolicy.openPrivacyPolicy()
64+
},
65+
onBackButton = {
66+
navHostController.popBackStack()
5067
}
5168
)
5269
}
@@ -95,6 +112,8 @@ object NavigationHome {
95112
object HomeScreen : Destinations(route = "HomeScreen")
96113

97114
object AboutUsScreen : Destinations(route = "AboutUsScreen")
115+
116+
data object PrivacyPolicyScreen : Destinations(route = "PrivacyPolicyScreen")
98117
}
99118

100119
sealed class Navigation(val route: String) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package wottrich.github.io.smartchecklist.navigation
2+
3+
interface PrivacyPolicy {
4+
fun openPrivacyPolicy()
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package wottrich.github.io.smartchecklist.navigation
2+
3+
import android.content.Context
4+
import android.content.Intent
5+
import android.net.Uri
6+
import wottrich.github.io.smartchecklist.BuildConfig
7+
8+
class PrivacyPolicyImpl(private val context: Context) : PrivacyPolicy {
9+
private val url = BuildConfig.PRIVACY_POLICY_URL
10+
override fun openPrivacyPolicy() {
11+
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).also {
12+
it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
13+
}
14+
context.startActivity(browserIntent)
15+
}
16+
}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ include ':test-tools'
3333
include ':ui-aboutus'
3434
include ':ui-support'
3535
include ':datasource:public'
36+
include ':ui-privacy-policy:impl'

ui-aboutus/src/main/java/wottrich/github/io/smartchecklist/uiaboutus/presentation/ui/AboutUsScreen.kt

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,26 @@ import androidx.compose.material.Text
1414
import androidx.compose.runtime.Composable
1515
import androidx.compose.ui.Modifier
1616
import androidx.compose.ui.res.stringResource
17-
import wottrich.github.io.smartchecklist.uiaboutus.R.string
1817
import wottrich.github.io.smartchecklist.uiaboutus.data.model.AboutUsContentModel
1918
import wottrich.github.io.smartchecklist.baseui.TopBarContent
2019
import wottrich.github.io.smartchecklist.baseui.icons.ArrowBackIcon
2120
import wottrich.github.io.smartchecklist.baseui.ui.ApplicationTheme
21+
import wottrich.github.io.smartchecklist.uiaboutus.R
2222

2323
@OptIn(ExperimentalMaterialApi::class)
2424
@Composable
2525
fun AboutUsScreen(
2626
model: AboutUsContentModel,
2727
onBackButton: () -> Unit,
28-
onVersionAppClick: () -> Unit
28+
onVersionAppClick: () -> Unit,
29+
onPrivacyPolicyClick: () -> Unit,
2930
) {
3031
ApplicationTheme {
3132
Screen(
3233
model = model,
3334
onBackButton = onBackButton,
34-
onVersionAppClick = onVersionAppClick
35+
onVersionAppClick = onVersionAppClick,
36+
onPrivacyPolicyClick = onPrivacyPolicyClick
3537
)
3638
}
3739
}
@@ -41,13 +43,14 @@ fun AboutUsScreen(
4143
private fun Screen(
4244
model: AboutUsContentModel,
4345
onBackButton: () -> Unit,
44-
onVersionAppClick: () -> Unit
46+
onVersionAppClick: () -> Unit,
47+
onPrivacyPolicyClick: () -> Unit
4548
) {
4649
Scaffold(
4750
topBar = {
4851
TopBarContent(
4952
title = {
50-
Text(stringResource(string.about_us_screen_title))
53+
Text(stringResource(R.string.about_us_screen_title))
5154
},
5255
navigationIcon = {
5356
ArrowBackIcon()
@@ -61,6 +64,7 @@ private fun Screen(
6164
versionApp = model.getVersionApp(),
6265
onClick = onVersionAppClick
6366
)
67+
privacyPolicyItem(onPrivacyPolicyClick)
6468
}
6569
}
6670
}
@@ -77,7 +81,26 @@ private fun LazyListScope.versionAppItem(versionApp: String, onClick: () -> Unit
7781
Text(versionApp)
7882
},
7983
secondaryText = {
80-
Text(stringResource(id = string.about_us_screen_app_version_label))
84+
Text(stringResource(id = R.string.about_us_screen_app_version_label))
85+
}
86+
)
87+
Divider(
88+
modifier = Modifier.fillMaxWidth()
89+
)
90+
}
91+
}
92+
}
93+
94+
@OptIn(ExperimentalMaterialApi::class)
95+
private fun LazyListScope.privacyPolicyItem(onClick: () -> Unit) {
96+
item {
97+
Column(
98+
modifier = Modifier.fillMaxWidth()
99+
) {
100+
ListItem(
101+
modifier = Modifier.clickable { onClick() },
102+
text = {
103+
Text(stringResource(id = R.string.about_us_screen_privacy_policy_label))
81104
}
82105
)
83106
Divider(

ui-aboutus/src/main/res/values-pt-rBR/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<resources>
33
<string name="about_us_screen_title">Sobre nós</string>
44
<string name="about_us_screen_app_version_label">Versão do app</string>
5+
<string name="about_us_screen_privacy_policy_label">Política de Privacidade</string>
56
</resources>

ui-aboutus/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<resources>
33
<string name="about_us_screen_title">About us</string>
44
<string name="about_us_screen_app_version_label">App version</string>
5+
<string name="about_us_screen_privacy_policy_label">Privacy policy</string>
56
</resources>

ui-privacy-policy/impl/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
plugins {
2+
id("wottrich.github.io.smartchecklist.feature.impl")
3+
}
4+
5+
android {
6+
namespace = "wottrich.github.io.smartchecklist.uiprivacypolicy"
7+
}
8+
9+
dependencies {
10+
implementation(libs.bundles.compose.default)
11+
implementation(libs.bundles.koin.default)
12+
implementation(project(path = ":datasource:public"))
13+
implementation(project(path = ":baseui"))
14+
testImplementation(project(path = ":test-tools"))
15+
testImplementation(libs.bundles.test.default)
16+
}

ui-privacy-policy/impl/consumer-rules.pro

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package wottrich.github.io.smartchecklist.uiprivacypolicy.ui
2+
3+
import androidx.compose.foundation.layout.Column
4+
import androidx.compose.foundation.layout.fillMaxWidth
5+
import androidx.compose.foundation.layout.padding
6+
import androidx.compose.material.MaterialTheme
7+
import androidx.compose.material.Scaffold
8+
import androidx.compose.material.Text
9+
import androidx.compose.runtime.Composable
10+
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.res.stringResource
12+
import androidx.compose.ui.tooling.preview.Preview
13+
import wottrich.github.io.smartchecklist.baseui.StyledText
14+
import wottrich.github.io.smartchecklist.baseui.TopBarContent
15+
import wottrich.github.io.smartchecklist.baseui.components.SmartChecklistButton
16+
import wottrich.github.io.smartchecklist.baseui.icons.ArrowBackIcon
17+
import wottrich.github.io.smartchecklist.baseui.ui.ApplicationTheme
18+
import wottrich.github.io.smartchecklist.baseui.ui.Dimens
19+
import wottrich.github.io.smartchecklist.uiprivacypolicy.R
20+
21+
@Composable
22+
fun PrivacyPolicyScreen(onOpenPrivacyPolicy: () -> Unit, onBackButton: () -> Unit) {
23+
ApplicationTheme {
24+
PrivacyPolicyComponent(onOpenPrivacyPolicy, onBackButton)
25+
}
26+
}
27+
28+
@Composable
29+
private fun PrivacyPolicyComponent(onOpenPrivacyPolicy: () -> Unit, onBackButton: () -> Unit) {
30+
Scaffold(
31+
topBar = {
32+
TopBarContent(
33+
title = {},
34+
navigationIcon = {
35+
ArrowBackIcon()
36+
},
37+
navigationIconAction = onBackButton
38+
)
39+
}
40+
) {
41+
Column(
42+
modifier = Modifier
43+
.padding(it)
44+
.padding(Dimens.BaseFour.SizeFour),
45+
) {
46+
Column(modifier = Modifier.weight(1f)) {
47+
StyledText(textStyle = MaterialTheme.typography.h4) {
48+
Text(text = stringResource(id = R.string.privacy_policy_title))
49+
}
50+
StyledText(textStyle = MaterialTheme.typography.body1) {
51+
Text(text = stringResource(id = R.string.privacy_policy_description))
52+
}
53+
}
54+
SmartChecklistButton(
55+
onClick = onOpenPrivacyPolicy,
56+
modifier = Modifier.fillMaxWidth()
57+
) {
58+
Text(text = stringResource(id = R.string.privacy_policy_button))
59+
}
60+
}
61+
}
62+
}
63+
64+
@Preview(showBackground = true)
65+
@Composable
66+
private fun PrivacyPolicyComponentPreview() {
67+
ApplicationTheme {
68+
PrivacyPolicyComponent(
69+
onOpenPrivacyPolicy = {},
70+
onBackButton = {}
71+
)
72+
}
73+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="privacy_policy_title">Política de privacidade</string>
4+
<string name="privacy_policy_description">Atualmente não coletamos nenhuma informação do usuário.\n\nCaso tenha dúvidas sobre esta Política de Privacidade ou sobre os dados pessoais que tratamos, você pode entrar em contato com o nosso Encarregado de Proteção de Dados Pessoais, através dos seguintes canais:\n\nWottrich78@gmail.com\n\nAtt.: Lucas Cruz Wottrich</string>
5+
<string name="privacy_policy_button">Visite o site</string>
6+
</resources>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="privacy_policy_title">Privacy Policy</string>
4+
<string name="privacy_policy_description">We currently do not collect any user information.\n\nIf you have questions about this Privacy Policy or the personal data we process, you can contact our Personal Data Protection Officer through the following channels:\n\nWottrich78@gmail.com\n\nAssigned: Lucas Cruz Wottrich</string>
5+
<string name="privacy_policy_button">Visit the website</string>
6+
</resources>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package wottrich.github.io.smartchecklist.uiprivacypolicy
2+
3+
class EmptyClass

0 commit comments

Comments
 (0)