Skip to content
Snippets Groups Projects
Commit 30816b9c authored by Taras's avatar Taras
Browse files

Remove hardcoded string res from constants

parent 4fc62fb4
No related branches found
No related tags found
No related merge requests found
......@@ -3,11 +3,8 @@ package com.futo.circles.core
const val GROUP_TAG = "social.kombucha.group"
const val DEFAULT_USER_PREFIX = "@notices:"
const val DEFAULT_ERROR_MESSAGE = "Something went wrong"
const val AUTH_EXCEPTION_REASON_KEY = "reason"
const val DEFAULT_TERMS_NAME = "Terms and Conditions"
const val TERMS_URL_EXTENSION = "_matrix/consent"
const val REGISTRATION_TOKEN_KEY = "org.matrix.msc3231.login.registration_token"
......
......@@ -8,7 +8,7 @@ object ErrorParser {
fun getErrorMessage(t: Throwable): String =
handleErrorBodyException(t) ?: handleServerException(t) ?: DEFAULT_ERROR_MESSAGE
handleErrorBodyException(t) ?: handleServerException(t) ?: "Unexpected error"
private fun handleErrorBodyException(t: Throwable): String? =
......
......@@ -25,6 +25,6 @@ val dataSourceModule = module {
single { SignUpDataSource(get()) }
factory { ValidateTokenDataSource(get()) }
factory { SelectSignUpTypeDataSource(get()) }
factory { AcceptTermsDataSource(get()) }
factory { AcceptTermsDataSource(get(), get()) }
factory { ValidateEmailDataSource(get()) }
}
\ No newline at end of file
package com.futo.circles.extensions
import com.futo.circles.core.DEFAULT_TERMS_NAME
import com.futo.circles.model.TermsListItem
import org.matrix.android.sdk.api.auth.registration.TermPolicies
import org.matrix.android.sdk.api.auth.toLocalizedLoginTerms
......@@ -10,7 +9,7 @@ fun TermPolicies.toTermsListItems() =
toLocalizedLoginTerms("en").mapIndexed { i, item ->
TermsListItem(
i,
item.localizedName ?: item.policyName ?: DEFAULT_TERMS_NAME,
item.localizedName ?: item.policyName ?: "",
item.localizedUrl ?: ""
)
}
......
package com.futo.circles.feature.terms.data_source
import android.content.Context
import androidx.lifecycle.MutableLiveData
import com.futo.circles.BuildConfig
import com.futo.circles.core.DEFAULT_TERMS_NAME
import com.futo.circles.R
import com.futo.circles.core.TERMS_URL_EXTENSION
import com.futo.circles.extensions.Response
import com.futo.circles.extensions.createResult
......@@ -15,6 +16,7 @@ import org.matrix.android.sdk.api.auth.registration.RegistrationResult
import org.matrix.android.sdk.api.auth.registration.Stage
class AcceptTermsDataSource(
private val context: Context,
private val signUpDataSource: SignUpDataSource
) {
......@@ -42,7 +44,7 @@ class AcceptTermsDataSource(
?.takeIf { it.isNotEmpty() }
?: listOf(
TermsListItem(
1, DEFAULT_TERMS_NAME,
1, context.getString(R.string.terms_and_conditions),
BuildConfig.MATRIX_HOME_SERVER_URL + TERMS_URL_EXTENSION
)
)
......
......@@ -65,6 +65,7 @@
<string name="sign_up_token_explanation">In order to sign up for a service, every new user must present a valid registration token.\n\nIf you found out about the app from a friend or from the posting online, you should be able to get a signup token from the same source.</string>
<string name="sign_up_stage_subtitle_format">Stage %1$d of %2$d</string>
<string name="accept">Accept</string>
<string name="terms_and_conditions">Terms and Conditions</string>
<string name="accept_terms_to_continue">Accept terms to continue</string>
<string name="discard_current_registration_progress">Discard current registration progress?</string>
<string name="validate_your_email">Validate your email</string>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment