-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
120 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
28 changes: 28 additions & 0 deletions
28
app/android/src/androidMain/kotlin/dev/datlag/burningseries/App.kt
This file contains 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,28 @@ | ||
package dev.datlag.burningseries | ||
|
||
import androidx.multidex.MultiDexApplication | ||
import dev.datlag.burningseries.module.NetworkModule | ||
import io.github.aakira.napier.DebugAntilog | ||
import io.github.aakira.napier.Napier | ||
import org.kodein.di.DI | ||
import org.kodein.di.DIAware | ||
import org.kodein.di.bindSingleton | ||
|
||
class App : MultiDexApplication(), DIAware { | ||
|
||
override val di: DI = DI { | ||
bindSingleton { | ||
applicationContext | ||
} | ||
|
||
import(NetworkModule.di) | ||
} | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
|
||
if (BuildConfig.DEBUG) { | ||
Napier.base(DebugAntilog()) | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
app/android/src/androidMain/kotlin/dev/datlag/burningseries/MainActivity.kt
This file contains 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,59 @@ | ||
package dev.datlag.burningseries | ||
|
||
import android.os.Bundle | ||
import androidx.activity.compose.setContent | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.core.view.WindowCompat | ||
import com.arkivanov.decompose.DefaultComponentContext | ||
import com.arkivanov.essenty.lifecycle.Lifecycle | ||
import com.arkivanov.essenty.lifecycle.LifecycleOwner | ||
import com.arkivanov.essenty.lifecycle.essentyLifecycle | ||
import dev.datlag.burningseries.common.lifecycle.LocalLifecycleOwner | ||
import dev.datlag.burningseries.ui.navigation.NavHostComponent | ||
import io.kamel.core.config.KamelConfig | ||
import io.kamel.core.config.takeFrom | ||
import io.kamel.image.config.Default | ||
import io.kamel.image.config.LocalKamelConfig | ||
import io.kamel.image.config.resourcesFetcher | ||
import io.kamel.image.config.resourcesIdMapper | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
WindowCompat.setDecorFitsSystemWindows(window, false) | ||
enableEdgeToEdge() | ||
|
||
val di = ((applicationContext as? App) ?: (application as App)).di | ||
val imageConfig = KamelConfig { | ||
takeFrom(KamelConfig.Default) | ||
resourcesFetcher(this@MainActivity) | ||
resourcesIdMapper(this@MainActivity) | ||
} | ||
|
||
val lifecycleOwner = object : LifecycleOwner { | ||
override val lifecycle: Lifecycle = essentyLifecycle() | ||
} | ||
|
||
val root = NavHostComponent( | ||
componentContext = DefaultComponentContext( | ||
lifecycle = lifecycleOwner.lifecycle | ||
), | ||
di = di | ||
) | ||
|
||
setContent { | ||
CompositionLocalProvider( | ||
LocalKamelConfig provides imageConfig, | ||
LocalLifecycleOwner provides lifecycleOwner | ||
) { | ||
App(di) { | ||
root.render() | ||
} | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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 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
19 changes: 17 additions & 2 deletions
19
app/shared/src/androidMain/kotlin/dev/datlag/burningseries/module/PlatformModule.android.kt
This file contains 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,9 +1,24 @@ | ||
package dev.datlag.burningseries.module | ||
|
||
import io.ktor.client.* | ||
import io.ktor.client.engine.okhttp.* | ||
import org.kodein.di.DI | ||
import org.kodein.di.bindSingleton | ||
|
||
actual object PlatformModule { | ||
actual val di: DI.Module | ||
get() = TODO("Not yet implemented") | ||
|
||
private const val NAME = "PlatformModuleAndroid" | ||
|
||
actual val di: DI.Module = DI.Module(NAME) { | ||
bindSingleton { | ||
HttpClient(OkHttp) { | ||
engine { | ||
config { | ||
followRedirects(true) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains 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 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,5 @@ | ||
import androidx.compose.ui.window.ComposeUIViewController | ||
|
||
fun MainViewController() = ComposeUIViewController { | ||
|
||
} |
This file contains 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 |
---|---|---|
|
@@ -33,10 +33,6 @@ kotlin { | |
api(libs.ktsoup.ktor) | ||
} | ||
} | ||
|
||
val androidMain by getting { | ||
dependsOn(jvmMain.get()) | ||
} | ||
} | ||
} | ||
|
||
|