diff --git a/app/src/main/java/com/vanced/manager/di/APIModule.kt b/app/src/main/java/com/vanced/manager/di/APIModule.kt index bddadd89..0ac77bcc 100644 --- a/app/src/main/java/com/vanced/manager/di/APIModule.kt +++ b/app/src/main/java/com/vanced/manager/di/APIModule.kt @@ -7,33 +7,40 @@ import com.vanced.manager.network.util.BASE import okhttp3.OkHttpClient import org.koin.dsl.module import retrofit2.Retrofit +import retrofit2.create //TODO Add mirror support val apiModule = module { fun provideVancedAPI( okHttpClient: OkHttpClient - ) = Retrofit.Builder() - .baseUrl(BASE) - .client(okHttpClient) - .build() - .create(VancedAPI::class.java) + ): VancedAPI { + return Retrofit.Builder() + .baseUrl(BASE) + .client(okHttpClient) + .build() + .create() + } fun provideMusicAPI( okHttpClient: OkHttpClient - ) = Retrofit.Builder() - .baseUrl(BASE) - .client(okHttpClient) - .build() - .create(MusicAPI::class.java) + ): MusicAPI { + return Retrofit.Builder() + .baseUrl(BASE) + .client(okHttpClient) + .build() + .create() + } fun provideMicrogAPI( okHttpClient: OkHttpClient - ) = Retrofit.Builder() - .baseUrl("https://github.com/YTVanced/VancedMicroG/") - .client(okHttpClient) - .build() - .create(MicrogAPI::class.java) + ): MicrogAPI { + return Retrofit.Builder() + .baseUrl("https://github.com/YTVanced/VancedMicroG/") + .client(okHttpClient) + .build() + .create(MicrogAPI::class.java) + } single { provideVancedAPI(get()) } single { provideMusicAPI(get()) } diff --git a/app/src/main/java/com/vanced/manager/di/CustomTabsModule.kt b/app/src/main/java/com/vanced/manager/di/CustomTabsModule.kt index ea29dcad..ac552d20 100644 --- a/app/src/main/java/com/vanced/manager/di/CustomTabsModule.kt +++ b/app/src/main/java/com/vanced/manager/di/CustomTabsModule.kt @@ -4,6 +4,7 @@ import androidx.browser.customtabs.CustomTabsIntent import org.koin.dsl.module val customTabsModule = module { + fun provideChromeCustomTabs(): CustomTabsIntent { return CustomTabsIntent.Builder() .build() diff --git a/app/src/main/java/com/vanced/manager/di/DownloaderModule.kt b/app/src/main/java/com/vanced/manager/di/DownloaderModule.kt index c9f093b6..642e9bcc 100644 --- a/app/src/main/java/com/vanced/manager/di/DownloaderModule.kt +++ b/app/src/main/java/com/vanced/manager/di/DownloaderModule.kt @@ -7,6 +7,7 @@ import com.vanced.manager.core.downloader.api.VancedAPI import com.vanced.manager.core.downloader.impl.MicrogDownloader import com.vanced.manager.core.downloader.impl.MusicDownloader import com.vanced.manager.core.downloader.impl.VancedDownloader +import org.koin.android.ext.koin.androidContext import org.koin.dsl.module val downloaderModule = module { @@ -14,19 +15,34 @@ val downloaderModule = module { fun provideVancedDownloader( vancedAPI: VancedAPI, context: Context, - ) = VancedDownloader(vancedAPI, context) + ): VancedDownloader { + return VancedDownloader( + vancedAPI = vancedAPI, + context = context + ) + } fun provideMusicDownloader( musicAPI: MusicAPI, context: Context, - ) = MusicDownloader(musicAPI, context) + ): MusicDownloader { + return MusicDownloader( + musicAPI = musicAPI, + context = context + ) + } fun provideMicrogDownloader( microgAPI: MicrogAPI, context: Context, - ) = MicrogDownloader(microgAPI, context) + ): MicrogDownloader { + return MicrogDownloader( + microgAPI = microgAPI, + context = context + ) + } - single { provideVancedDownloader(get(), get()) } - single { provideMusicDownloader(get(), get()) } - single { provideMicrogDownloader(get(), get()) } + single { provideVancedDownloader(get(), androidContext()) } + single { provideMusicDownloader(get(), androidContext()) } + single { provideMicrogDownloader(get(), androidContext()) } } \ No newline at end of file diff --git a/app/src/main/java/com/vanced/manager/di/InstallerModuke.kt b/app/src/main/java/com/vanced/manager/di/InstallerModuke.kt index 7c90797c..31f6f43a 100644 --- a/app/src/main/java/com/vanced/manager/di/InstallerModuke.kt +++ b/app/src/main/java/com/vanced/manager/di/InstallerModuke.kt @@ -4,23 +4,36 @@ import android.content.Context import com.vanced.manager.core.installer.impl.MicrogInstaller import com.vanced.manager.core.installer.impl.MusicInstaller import com.vanced.manager.core.installer.impl.VancedInstaller +import org.koin.android.ext.koin.androidContext import org.koin.dsl.module val installerModule = module { fun provideVancedInstaller( context: Context - ) = VancedInstaller(context) + ): VancedInstaller { + return VancedInstaller( + context = context + ) + } fun provideMusicInstaller( context: Context - ) = MusicInstaller(context) + ): MusicInstaller { + return MusicInstaller( + context = context + ) + } fun provideMicrogInstaller( context: Context - ) = MicrogInstaller(context) + ): MicrogInstaller { + return MicrogInstaller( + context = context + ) + } - single { provideVancedInstaller(get()) } - single { provideMusicInstaller(get()) } - single { provideMicrogInstaller(get()) } + single { provideVancedInstaller(androidContext()) } + single { provideMusicInstaller(androidContext()) } + single { provideMicrogInstaller(androidContext()) } } \ No newline at end of file diff --git a/app/src/main/java/com/vanced/manager/di/NetworkModule.kt b/app/src/main/java/com/vanced/manager/di/NetworkModule.kt index 94a90107..bf3545b9 100644 --- a/app/src/main/java/com/vanced/manager/di/NetworkModule.kt +++ b/app/src/main/java/com/vanced/manager/di/NetworkModule.kt @@ -5,8 +5,10 @@ import org.koin.dsl.module val networkModule = module { - fun provideOkHttpClient() = - OkHttpClient() + fun provideOkHttpClient(): OkHttpClient { + return OkHttpClient.Builder() + .build() + } single { provideOkHttpClient() } } \ No newline at end of file diff --git a/app/src/main/java/com/vanced/manager/di/ViewModelModule.kt b/app/src/main/java/com/vanced/manager/di/ViewModelModule.kt index 8c411310..2119b9ec 100644 --- a/app/src/main/java/com/vanced/manager/di/ViewModelModule.kt +++ b/app/src/main/java/com/vanced/manager/di/ViewModelModule.kt @@ -39,7 +39,17 @@ val viewModelModule = module { vancedInstaller: VancedInstaller, musicInstaller: MusicInstaller, microgInstaller: MicrogInstaller, - ) = InstallViewModel(vancedDownloader, musicDownloader, microgDownloader, vancedInstaller, musicInstaller, microgInstaller) + ): InstallViewModel { + return InstallViewModel( + vancedDownloader = vancedDownloader, + musicDownloader = musicDownloader, + microgDownloader = microgDownloader, + + vancedInstaller = vancedInstaller, + musicInstaller = musicInstaller, + microgInstaller = microgInstaller + ) + } fun provideConfigurationViewModel(): ConfigurationViewModel { return ConfigurationViewModel()