Skip to content

Commit

Permalink
Update translations and related links
Browse files Browse the repository at this point in the history
  • Loading branch information
hueachilles committed Feb 26, 2024
1 parent bb70187 commit c011cb8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class MainActivityViewModel @Inject constructor(
private set

val termsOfServiceUrl = "${appSettingsProvider.baseUrl}/terms?view=plain"
val privacyPolicyUrl = "${appSettingsProvider.baseUrl}/privacy?view=plain"
var hasAcceptedTerms by mutableStateOf(false)
private set
var isAcceptingTerms by mutableStateOf(false)
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/com/crisiscleanup/ui/AcceptTermsView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.crisiscleanup.core.designsystem.LocalAppTranslator
import com.crisiscleanup.core.designsystem.component.BusyButton
import com.crisiscleanup.core.designsystem.component.CrisisCleanupAlertDialog
import com.crisiscleanup.core.designsystem.component.CrisisCleanupTextButton
import com.crisiscleanup.core.designsystem.component.LinkifyUrlText
import com.crisiscleanup.core.designsystem.component.LinkifyHtmlText
import com.crisiscleanup.core.designsystem.component.cancelButtonColors
import com.crisiscleanup.core.designsystem.theme.LocalFontStyles
import com.crisiscleanup.core.designsystem.theme.listItemModifier
Expand All @@ -34,6 +34,7 @@ import com.crisiscleanup.core.designsystem.theme.primaryRedColor
@Composable
internal fun AcceptTermsView(
termsOfServiceUrl: String,
privacyPolicyUrl: String,
isLoading: Boolean,
isAcceptingTerms: Boolean,
setAcceptingTerms: (Boolean) -> Unit,
Expand Down Expand Up @@ -90,10 +91,10 @@ internal fun AcceptTermsView(
modifier = Modifier.testTag("acceptTermsAcceptToggle"),
enabled = enable,
)
val acceptText = t("termsConditionsModal.accept_toc_privacy") //TODO: replace string {terms_url} and {privacy_url}, and render HTML. I embedded links in this localization.
val acceptText = t("termsConditionsModal.accept_toc_privacy")
.replace("{terms_url}", termsOfServiceUrl)
}
LinkifyUrlText(
.replace("{privacy_url}", privacyPolicyUrl)
LinkifyHtmlText(
acceptText,
Modifier.testTag("acceptTermsAcceptText"),
)
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/crisiscleanup/ui/CrisisCleanupApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ private fun BoxScope.LoadedContent(
AcceptTermsContent(
snackbarHostState,
viewModel.termsOfServiceUrl,
viewModel.privacyPolicyUrl,
isLoading,
viewModel.isAcceptingTerms,
setAcceptingTerms,
Expand Down Expand Up @@ -261,6 +262,7 @@ private fun AuthenticateContent(
private fun AcceptTermsContent(
snackbarHostState: SnackbarHostState,
termsOfServiceUrl: String,
privacyPolicyUrl: String,
isLoading: Boolean,
isAcceptingTerms: Boolean,
setAcceptingTerms: (Boolean) -> Unit,
Expand All @@ -279,6 +281,7 @@ private fun AcceptTermsContent(
) { padding ->
AcceptTermsView(
termsOfServiceUrl,
privacyPolicyUrl,
isLoading,
isAcceptingTerms = isAcceptingTerms,
setAcceptingTerms = setAcceptingTerms,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ class LoginWithPhoneViewModel @Inject constructor(

InitiatePhoneLoginResult.PhoneNotRegistered -> {
errorMessage =
translator("loginWithPhone.phone_number_not_registered") //TODO: Replace {phoneNumber} with $phoneNumber
translator("loginWithPhone.phone_number_not_registered")
.replace("phoneNumber", phoneNumber)
}

else -> {
Expand Down

0 comments on commit c011cb8

Please sign in to comment.