forked from openedx/openedx-app-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: eula on registration and sign in (openedx#236)
- Loading branch information
Showing
22 changed files
with
427 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
auth/src/main/java/org/openedx/auth/presentation/AgreementProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.openedx.auth.presentation | ||
|
||
import androidx.compose.ui.text.intl.Locale | ||
import org.openedx.auth.R | ||
import org.openedx.core.config.Config | ||
import org.openedx.core.system.ResourceManager | ||
|
||
class AgreementProvider( | ||
private val config: Config, | ||
private val resourceManager: ResourceManager, | ||
) { | ||
internal fun getAgreement(isSignIn: Boolean): String? { | ||
val agreementConfig = config.getAgreement(Locale.current.language) | ||
if (agreementConfig.eulaUrl.isBlank()) return null | ||
val platformName = config.getPlatformName() | ||
val agreementRes = if (isSignIn) { | ||
R.string.auth_agreement_signin_in | ||
} else { | ||
R.string.auth_agreement_creating_account | ||
} | ||
val eula = resourceManager.getString( | ||
R.string.auth_cdata_template, | ||
agreementConfig.eulaUrl, | ||
"$platformName ${resourceManager.getString(R.string.auth_agreement_eula)}" | ||
) | ||
val tos = resourceManager.getString( | ||
R.string.auth_cdata_template, | ||
agreementConfig.tosUrl, | ||
"$platformName ${resourceManager.getString(R.string.auth_agreement_tos)}" | ||
) | ||
val privacy = resourceManager.getString( | ||
R.string.auth_cdata_template, | ||
agreementConfig.privacyPolicyUrl, | ||
"$platformName ${resourceManager.getString(R.string.auth_agreement_privacy)}" | ||
) | ||
return resourceManager.getString( | ||
agreementRes, | ||
eula, | ||
tos, | ||
config.getPlatformName(), | ||
privacy, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.