-
Notifications
You must be signed in to change notification settings - Fork 0
[poc] kotzilla plugin #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
santimattius
wants to merge
11
commits into
master
Choose a base branch
from
kotzilla-plugin
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0d082af
[poc] kotzilla plugin
santimattius bd8e8ae
[improvement] kotzilla plugin init
santimattius db687be
[improvement] update poc
santimattius 299cf53
[improvement] update branch
santimattius 355c588
Merge remote-tracking branch 'origin/master' into kotzilla-plugin
santimattius bff8ab3
[improvement] update branch
santimattius a6282c1
[improvement] fixed version
santimattius bad703a
[improvement] fixed version (#11)
santimattius 7b38ea6
[improvement] test prompt
santimattius fb67988
[improvement] test prompt
santimattius 58d541c
[annotations] update annotations (#12)
santimattius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,3 +15,5 @@ | |
| local.properties | ||
| /.kotlin/ | ||
| /.idea/ | ||
| /app/kotzilla.json | ||
| /app/src/main/assets/kotzilla.key | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 26 additions & 12 deletions
38
app/src/main/java/com/santimattius/template/MainApplication.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,40 @@ | ||
| package com.santimattius.template | ||
|
|
||
| import android.app.Application | ||
| import android.util.Log | ||
| import com.santimattius.core.CoreModule | ||
| import com.santimattius.template.di.AppModule | ||
| import com.santimattius.template.di.DataModule | ||
| import io.kotzilla.sdk.analytics.koin.analytics | ||
| import org.koin.android.ext.koin.androidContext | ||
| import org.koin.android.logger.AndroidLogger | ||
| import org.koin.androix.startup.KoinStartup | ||
| import org.koin.core.annotation.KoinApplication | ||
| import org.koin.core.annotation.KoinExperimentalAPI | ||
| import org.koin.dsl.KoinConfiguration | ||
| import org.koin.ksp.generated.com_santimattius_template_di_AppModule | ||
| import org.koin.ksp.generated.com_santimattius_template_di_DataModule | ||
| import org.koin.ksp.generated.defaultModule | ||
| import org.koin.dsl.module | ||
| import org.koin.ksp.generated.defineComSantimattiusTemplateUiComposeHomeComposeViewModel | ||
| import org.koin.ksp.generated.defineComSantimattiusTemplateUiXmlHomeHomeViewModel | ||
| import org.koin.ksp.generated.koinConfiguration | ||
|
|
||
| @KoinApplication( | ||
| configurations = ["default"], | ||
| modules = [CoreModule::class, DataModule::class, AppModule::class] | ||
| ) | ||
| object MainKoinApplication | ||
|
|
||
| @OptIn(KoinExperimentalAPI::class) | ||
| class MainApplication : Application(), KoinStartup { | ||
|
|
||
| override fun onKoinStartup(): KoinConfiguration { | ||
| return KoinConfiguration { | ||
| Log.d(this::class.simpleName, "onKoinStartup: ${Thread.currentThread().name}") | ||
| val configuration = MainKoinApplication.koinConfiguration { | ||
| androidContext(this@MainApplication) | ||
| logger(AndroidLogger()) | ||
| modules( | ||
| com_santimattius_template_di_DataModule, | ||
| com_santimattius_template_di_AppModule, | ||
| defaultModule | ||
| ) | ||
| analytics() | ||
| modules(modules = module { | ||
| defineComSantimattiusTemplateUiComposeHomeComposeViewModel() | ||
| defineComSantimattiusTemplateUiXmlHomeHomeViewModel() | ||
| }) | ||
| } | ||
| return KoinConfiguration(configuration) | ||
| } | ||
| } | ||
| } |
34 changes: 9 additions & 25 deletions
34
app/src/main/java/com/santimattius/template/di/AppModule.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,21 @@ | ||
| package com.santimattius.template.di | ||
|
|
||
| import android.content.Context | ||
| import com.santimattius.core.data.client.database.TheMovieDataBase | ||
| import com.santimattius.core.data.client.network.RetrofitServiceCreator | ||
| import com.santimattius.core.data.client.network.TheMovieDBService | ||
| import com.santimattius.template.BuildConfig | ||
| import org.koin.core.annotation.Configuration | ||
| import org.koin.core.annotation.Module | ||
| import org.koin.core.annotation.Named | ||
| import org.koin.core.annotation.Singleton | ||
| import org.koin.core.annotation.Single | ||
|
|
||
|
|
||
| @Module | ||
| @Configuration | ||
| class AppModule { | ||
|
|
||
| @Singleton | ||
| fun provideAppDatabase(context: Context): TheMovieDataBase = | ||
| TheMovieDataBase.get(context) | ||
|
|
||
| @Singleton | ||
| fun provideMovieDBService(serviceCreator: RetrofitServiceCreator): TheMovieDBService = | ||
| serviceCreator.createService(TheMovieDBService::class.java) | ||
|
|
||
|
|
||
| @Singleton | ||
| fun provideRetrofit(@Named("base_url") baseUrl: String): RetrofitServiceCreator { | ||
| return RetrofitServiceCreator( | ||
| baseUrl = baseUrl, | ||
| apiKey = BuildConfig.apiKey | ||
| ) | ||
| } | ||
|
|
||
| @Named("base_url") | ||
| @Singleton | ||
| @Suppress("FunctionOnlyReturningConstant") | ||
| @Single(createdAtStart = true) | ||
| @Named("baseUrl") | ||
| fun provideBaseUrl() = "https://api.themoviedb.org" | ||
|
|
||
| @Single(createdAtStart = true) | ||
| @Named("apiKey") | ||
| fun provideApiKey() = BuildConfig.apiKey | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package com.santimattius.core | ||
|
|
||
| import android.content.Context | ||
| import com.santimattius.core.data.client.database.TheMovieDataBase | ||
| import com.santimattius.core.data.client.network.RequestInterceptor | ||
| import com.santimattius.core.data.client.network.TheMovieDBService | ||
| import okhttp3.OkHttpClient | ||
| import org.koin.core.annotation.Configuration | ||
| import org.koin.core.annotation.Module | ||
| import org.koin.core.annotation.Named | ||
| import org.koin.core.annotation.Single | ||
| import retrofit2.Retrofit | ||
| import retrofit2.converter.gson.GsonConverterFactory | ||
|
|
||
| @Module | ||
| @Configuration | ||
| class CoreModule { | ||
|
|
||
| @Single(createdAtStart = true) | ||
| fun provideOkHttpClient(@Named("apiKey") apiKey: String): OkHttpClient { | ||
| return OkHttpClient().newBuilder() | ||
| .addInterceptor(RequestInterceptor(apiKey)) | ||
| .build() | ||
| } | ||
|
|
||
| @Single(createdAtStart = true) | ||
| fun provideRetrofit( | ||
| @Named("baseUrl") baseUrl: String, | ||
| client: OkHttpClient | ||
| ): Retrofit { | ||
| return Retrofit.Builder() | ||
| .baseUrl(baseUrl) | ||
| .client(client) | ||
| .addConverterFactory(GsonConverterFactory.create()) | ||
| .build() | ||
| } | ||
|
|
||
| @Single(createdAtStart = true) | ||
| fun provideService(retrofit: Retrofit): TheMovieDBService { | ||
| return retrofit.create(TheMovieDBService::class.java) | ||
| } | ||
|
|
||
| @Single(createdAtStart = true) | ||
| fun provideAppDatabase(context: Context): TheMovieDataBase = | ||
| TheMovieDataBase.get(context) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be kept in project, even empty