Change `val` to `fun` on the SDK interfaces.
Dokka will generate a better documentation (`Functions` and `Properties` are 2 distinct tab), and for Service it's better to have only `fun`
This commit is contained in:
parent
cfd6456614
commit
e6c8ffd1b8
|
@ -66,7 +66,7 @@ interface AuthenticationService {
|
|||
/**
|
||||
* True when login and password has been sent with success to the homeserver.
|
||||
*/
|
||||
val isRegistrationStarted: Boolean
|
||||
fun isRegistrationStarted(): Boolean
|
||||
|
||||
/**
|
||||
* Cancel pending login or pending registration.
|
||||
|
|
|
@ -109,14 +109,14 @@ interface RegistrationWizard {
|
|||
suspend fun checkIfEmailHasBeenValidated(delayMillis: Long): RegistrationResult
|
||||
|
||||
/**
|
||||
* This is the current ThreePid, waiting for validation. The SDK will store it in database, so it can be
|
||||
* Returns the current ThreePid, waiting for validation. The SDK will store it in database, so it can be
|
||||
* restored even if the app has been killed during the registration
|
||||
*/
|
||||
val currentThreePid: String?
|
||||
fun currentThreePid(): String?
|
||||
|
||||
/**
|
||||
* True when login and password have been sent with success to the homeserver, i.e. [createAccount] has been
|
||||
* Return true when login and password have been sent with success to the homeserver, i.e. [createAccount] has been
|
||||
* called successfully.
|
||||
*/
|
||||
val isRegistrationStarted: Boolean
|
||||
fun isRegistrationStarted(): Boolean
|
||||
}
|
||||
|
|
|
@ -323,8 +323,7 @@ internal class DefaultAuthenticationService @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override val isRegistrationStarted: Boolean
|
||||
get() = currentRegistrationWizard?.isRegistrationStarted == true
|
||||
override fun isRegistrationStarted() = currentRegistrationWizard?.isRegistrationStarted() == true
|
||||
|
||||
override fun getLoginWizard(): LoginWizard {
|
||||
return currentLoginWizard
|
||||
|
|
|
@ -49,20 +49,18 @@ internal class DefaultRegistrationWizard(
|
|||
private val validateCodeTask: ValidateCodeTask = DefaultValidateCodeTask(authAPI)
|
||||
private val registerCustomTask: RegisterCustomTask = DefaultRegisterCustomTask(authAPI)
|
||||
|
||||
override val currentThreePid: String?
|
||||
get() {
|
||||
return when (val threePid = pendingSessionData.currentThreePidData?.threePid) {
|
||||
is RegisterThreePid.Email -> threePid.email
|
||||
is RegisterThreePid.Msisdn -> {
|
||||
// Take formatted msisdn if provided by the server
|
||||
pendingSessionData.currentThreePidData?.addThreePidRegistrationResponse?.formattedMsisdn?.takeIf { it.isNotBlank() } ?: threePid.msisdn
|
||||
}
|
||||
null -> null
|
||||
override fun currentThreePid(): String? {
|
||||
return when (val threePid = pendingSessionData.currentThreePidData?.threePid) {
|
||||
is RegisterThreePid.Email -> threePid.email
|
||||
is RegisterThreePid.Msisdn -> {
|
||||
// Take formatted msisdn if provided by the server
|
||||
pendingSessionData.currentThreePidData?.addThreePidRegistrationResponse?.formattedMsisdn?.takeIf { it.isNotBlank() } ?: threePid.msisdn
|
||||
}
|
||||
null -> null
|
||||
}
|
||||
}
|
||||
|
||||
override val isRegistrationStarted: Boolean
|
||||
get() = pendingSessionData.isRegistrationStarted
|
||||
override fun isRegistrationStarted() = pendingSessionData.isRegistrationStarted
|
||||
|
||||
override suspend fun getRegistrationFlow(): RegistrationResult {
|
||||
val params = RegistrationParams()
|
||||
|
|
|
@ -91,11 +91,11 @@ class LoginViewModel @AssistedInject constructor(
|
|||
private val matrixOrgUrl = stringProvider.getString(R.string.matrix_org_server_url).ensureTrailingSlash()
|
||||
|
||||
val currentThreePid: String?
|
||||
get() = registrationWizard?.currentThreePid
|
||||
get() = registrationWizard?.currentThreePid()
|
||||
|
||||
// True when login and password has been sent with success to the homeserver
|
||||
val isRegistrationStarted: Boolean
|
||||
get() = authenticationService.isRegistrationStarted
|
||||
get() = authenticationService.isRegistrationStarted()
|
||||
|
||||
private val registrationWizard: RegistrationWizard?
|
||||
get() = authenticationService.getRegistrationWizard()
|
||||
|
@ -455,7 +455,7 @@ class LoginViewModel @AssistedInject constructor(
|
|||
|
||||
// If there is a pending email validation continue on this step
|
||||
try {
|
||||
if (registrationWizard?.isRegistrationStarted == true) {
|
||||
if (registrationWizard?.isRegistrationStarted() == true) {
|
||||
currentThreePid?.let {
|
||||
handle(LoginAction.PostViewEvent(LoginViewEvents.OnSendEmailSuccess(it)))
|
||||
}
|
||||
|
|
|
@ -92,11 +92,11 @@ class LoginViewModel2 @AssistedInject constructor(
|
|||
private val matrixOrgUrl = stringProvider.getString(R.string.matrix_org_server_url).ensureTrailingSlash()
|
||||
|
||||
val currentThreePid: String?
|
||||
get() = registrationWizard?.currentThreePid
|
||||
get() = registrationWizard?.currentThreePid()
|
||||
|
||||
// True when login and password has been sent with success to the homeserver
|
||||
val isRegistrationStarted: Boolean
|
||||
get() = authenticationService.isRegistrationStarted
|
||||
get() = authenticationService.isRegistrationStarted()
|
||||
|
||||
private val registrationWizard: RegistrationWizard?
|
||||
get() = authenticationService.getRegistrationWizard()
|
||||
|
@ -420,7 +420,7 @@ class LoginViewModel2 @AssistedInject constructor(
|
|||
|
||||
// If there is a pending email validation continue on this step
|
||||
try {
|
||||
if (registrationWizard?.isRegistrationStarted == true) {
|
||||
if (registrationWizard?.isRegistrationStarted() == true) {
|
||||
currentThreePid?.let {
|
||||
handle(LoginAction2.PostViewEvent(LoginViewEvents2.OnSendEmailSuccess(it)))
|
||||
}
|
||||
|
|
|
@ -114,11 +114,11 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
get() = authenticationService.getRegistrationWizard()
|
||||
|
||||
val currentThreePid: String?
|
||||
get() = registrationWizard.currentThreePid
|
||||
get() = registrationWizard.currentThreePid()
|
||||
|
||||
// True when login and password has been sent with success to the homeserver
|
||||
val isRegistrationStarted: Boolean
|
||||
get() = authenticationService.isRegistrationStarted
|
||||
get() = authenticationService.isRegistrationStarted()
|
||||
|
||||
private val loginWizard: LoginWizard?
|
||||
get() = authenticationService.getLoginWizard()
|
||||
|
@ -396,7 +396,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
|
||||
// If there is a pending email validation continue on this step
|
||||
try {
|
||||
if (registrationWizard.isRegistrationStarted) {
|
||||
if (registrationWizard.isRegistrationStarted()) {
|
||||
currentThreePid?.let {
|
||||
handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnSendEmailSuccess(it)))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue