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:
Benoit Marty 2022-05-05 18:07:31 +02:00 committed by Benoit Marty
parent cfd6456614
commit e6c8ffd1b8
7 changed files with 24 additions and 27 deletions

View File

@ -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.

View File

@ -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
}

View File

@ -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

View File

@ -49,8 +49,7 @@ internal class DefaultRegistrationWizard(
private val validateCodeTask: ValidateCodeTask = DefaultValidateCodeTask(authAPI)
private val registerCustomTask: RegisterCustomTask = DefaultRegisterCustomTask(authAPI)
override val currentThreePid: String?
get() {
override fun currentThreePid(): String? {
return when (val threePid = pendingSessionData.currentThreePidData?.threePid) {
is RegisterThreePid.Email -> threePid.email
is RegisterThreePid.Msisdn -> {
@ -61,8 +60,7 @@ internal class DefaultRegistrationWizard(
}
}
override val isRegistrationStarted: Boolean
get() = pendingSessionData.isRegistrationStarted
override fun isRegistrationStarted() = pendingSessionData.isRegistrationStarted
override suspend fun getRegistrationFlow(): RegistrationResult {
val params = RegistrationParams()

View File

@ -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)))
}

View File

@ -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)))
}

View File

@ -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)))
}