42 lines
1.2 KiB
Kotlin
42 lines
1.2 KiB
Kotlin
package com.yuanxuan.rokid.dependencies
|
|
|
|
import android.app.Application
|
|
import com.yuanxuan.rokid.device.DeviceServiceManager
|
|
import com.yuanxuan.rokid.network.http.ApiRepository
|
|
import com.yuanxuan.rokid.network.http.ApiService
|
|
import com.yuanxuan.rokid.network.http.RetrofitClient
|
|
import com.yuanxuan.rokid.network.websocket.WebSocketManager
|
|
import com.yuanxuan.rokid.toast.ToastManager
|
|
import kotlinx.coroutines.CoroutineScope
|
|
|
|
class ApplicationDependencyProvider(val context: Application, val scope: CoroutineScope) :
|
|
AppDependencies.Provider {
|
|
override fun provideDeviceServiceManager(): DeviceServiceManager {
|
|
return DeviceServiceManager(context)
|
|
}
|
|
|
|
override fun provideWebSocketManager(): WebSocketManager {
|
|
return WebSocketManager(
|
|
context = context,
|
|
scope = scope
|
|
)
|
|
}
|
|
|
|
override fun provideRetrofitClient(): RetrofitClient {
|
|
return RetrofitClient()
|
|
}
|
|
|
|
override fun provideApiRepository(apiService: ApiService): ApiRepository {
|
|
return ApiRepository(
|
|
apiService = apiService
|
|
)
|
|
}
|
|
|
|
override fun provideToastManager(): ToastManager {
|
|
return ToastManager(
|
|
context = context,
|
|
scope = scope
|
|
)
|
|
}
|
|
|
|
} |