add login and board_list #26

Manually merged
norangebit merged 38 commits from feature_integrate_login into develop 2020-01-14 19:53:09 +00:00
Showing only changes of commit 8c1b0cb6a0 - Show all commits

View File

@ -5,9 +5,10 @@ import okhttp3.OkHttpClient
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory import retrofit2.converter.gson.GsonConverterFactory
object ServicesFactory { class ServicesFactory private constructor(
reader: PreferenceReader
) {
private val retrofit: Retrofit private val retrofit: Retrofit
private lateinit var reader: PreferenceReader //TODO
init { init {
val httpClient = OkHttpClient.Builder() val httpClient = OkHttpClient.Builder()
@ -55,5 +56,23 @@ object ServicesFactory {
val userService by lazy { val userService by lazy {
retrofit.create(UserService::class.java) retrofit.create(UserService::class.java)
} }
companion object {
@Volatile
private var INSTANCE: ServicesFactory? = null
fun getInstance(reader: PreferenceReader): ServicesFactory {
val tempInstance = INSTANCE
if (tempInstance != null)
return tempInstance
synchronized(this) {
val instance = ServicesFactory(reader)
INSTANCE = instance
return instance
}
}
}
} }