chore: Make retrofitClient var lateinit
This commit is contained in:
parent
28211abe93
commit
16c7640fcd
|
@ -25,29 +25,28 @@ object RetrofitClient {
|
||||||
private var baseUrl: String = DEFAULT_BASE_URL
|
private var baseUrl: String = DEFAULT_BASE_URL
|
||||||
private lateinit var appContext: Context
|
private lateinit var appContext: Context
|
||||||
|
|
||||||
// TODO: Make this lateinit
|
private lateinit var retrofitClient: Retrofit
|
||||||
private var retrofitClient: Retrofit? = null
|
|
||||||
|
|
||||||
val authService: AuthService
|
val authService: AuthService
|
||||||
get() = retrofitClient!!.create(AuthService::class.java)
|
get() = retrofitClient.create(AuthService::class.java)
|
||||||
|
|
||||||
val generalService: GeneralService
|
val generalService: GeneralService
|
||||||
get() = retrofitClient!!.create(GeneralService::class.java)
|
get() = retrofitClient.create(GeneralService::class.java)
|
||||||
|
|
||||||
val eventsService: EventsService
|
val eventsService: EventsService
|
||||||
get() = retrofitClient!!.create(EventsService::class.java)
|
get() = retrofitClient.create(EventsService::class.java)
|
||||||
|
|
||||||
val categoryService: CategoryService
|
val categoryService: CategoryService
|
||||||
get() = retrofitClient!!.create(CategoryService::class.java)
|
get() = retrofitClient.create(CategoryService::class.java)
|
||||||
|
|
||||||
val invitationService: InvitationsService
|
val invitationService: InvitationsService
|
||||||
get() = retrofitClient!!.create(InvitationsService::class.java)
|
get() = retrofitClient.create(InvitationsService::class.java)
|
||||||
|
|
||||||
val usersService: UsersService
|
val usersService: UsersService
|
||||||
get() = retrofitClient!!.create(UsersService::class.java)
|
get() = retrofitClient.create(UsersService::class.java)
|
||||||
|
|
||||||
val notificationsService: NotificationService
|
val notificationsService: NotificationService
|
||||||
get() = retrofitClient!!.create(NotificationService::class.java)
|
get() = retrofitClient.create(NotificationService::class.java)
|
||||||
|
|
||||||
fun initialize(context: Context) {
|
fun initialize(context: Context) {
|
||||||
appContext = context
|
appContext = context
|
||||||
|
@ -117,7 +116,7 @@ object RetrofitClient {
|
||||||
*/
|
*/
|
||||||
suspend fun ping() {
|
suspend fun ping() {
|
||||||
// This will potentially raise 503 HttpException
|
// This will potentially raise 503 HttpException
|
||||||
val responseBody = retrofitClient!!.create(GeneralService::class.java).ping()
|
val responseBody = retrofitClient.create(GeneralService::class.java).ping()
|
||||||
|
|
||||||
val responseText = responseBody.string()
|
val responseText = responseBody.string()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue