新增登录

This commit is contained in:
2024-07-30 16:57:25 +08:00
parent f28236b365
commit 2c79195f44
8 changed files with 237 additions and 63 deletions

View File

@@ -2,8 +2,16 @@ package com.aiosman.riderpro.data
import com.aiosman.riderpro.test.TestDatabase
data class UserAuth(
val id: Int,
val token: String? = null
)
interface UserService {
suspend fun getUserProfile(id:String): AccountProfile
suspend fun getUserProfile(id: String): AccountProfile
suspend fun getMyAccount(): UserAuth
suspend fun loginUserWithPassword(loginName: String, password: String): UserAuth
suspend fun logout()
}
class TestUserServiceImpl : UserService {
@@ -15,4 +23,17 @@ class TestUserServiceImpl : UserService {
}
return AccountProfile(0, 0, 0, "", "", "", "")
}
override suspend fun getMyAccount(): UserAuth {
return UserAuth(1)
}
override suspend fun loginUserWithPassword(loginName: String, password: String): UserAuth {
return UserAuth(1, "token")
}
override suspend fun logout() {
// do nothing
}
}