[APIv2/Template] Add first login template.

This commit is contained in:
Kuba Szczodrzyński 2019-10-27 15:38:43 +01:00
parent 46dd543b48
commit 10c439afad
2 changed files with 35 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.api.v2.interfaces.EdziennikInterface
import pl.szczodrzynski.edziennik.api.v2.models.ApiError
import pl.szczodrzynski.edziennik.api.v2.prepare
import pl.szczodrzynski.edziennik.api.v2.template.data.TemplateData
import pl.szczodrzynski.edziennik.api.v2.template.firstlogin.TemplateFirstLogin
import pl.szczodrzynski.edziennik.api.v2.template.login.TemplateLogin
import pl.szczodrzynski.edziennik.api.v2.templateLoginMethods
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
@ -68,7 +69,9 @@ class Template(val app: App, val profile: Profile?, val loginStore: LoginStore,
}
override fun firstLogin() {
// TODO
TemplateFirstLogin(data) {
completed()
}
}
override fun cancel() {

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) Kuba Szczodrzyński 2019-10-27.
*/
package pl.szczodrzynski.edziennik.api.v2.template.firstlogin
import pl.szczodrzynski.edziennik.api.v2.template.DataTemplate
import pl.szczodrzynski.edziennik.api.v2.template.data.TemplateApi
import pl.szczodrzynski.edziennik.api.v2.template.data.TemplateWeb
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
class TemplateFirstLogin(val data: DataTemplate, val onSuccess: () -> Unit) {
companion object {
private const val TAG = "TemplateFirstLogin"
}
private val web = TemplateWeb(data)
private val api = TemplateApi(data)
private val profileList = mutableListOf<Profile>()
init {
/*TemplateLoginWeb(data) {
web.webGet(TAG, "get all accounts") { text ->
//val accounts = json.getJsonArray("accounts")
EventBus.getDefault().post(FirstLoginFinishedEvent(profileList, data.loginStore))
onSuccess()
}
}*/
}
}