Skip to content

Commit

Permalink
Add desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedRejeb committed Mar 12, 2023
1 parent c655f91 commit a2f95ab
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package com.mocoding.pokedex.ui.main.components

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.mocoding.pokedex

import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers

actual val pokedexDispatchers: PokedexDispatchers = object: PokedexDispatchers {
override val main: CoroutineDispatcher = Dispatchers.Main
override val io: CoroutineDispatcher = Dispatchers.Default
override val unconfined: CoroutineDispatcher = Dispatchers.Unconfined
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mocoding.pokedex.core.database

import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.jdbc.sqlite.JdbcSqliteDriver
import org.koin.core.scope.Scope
import java.io.File


actual fun Scope.sqlDriverFactory(): SqlDriver {
val databasePath = File(System.getProperty("java.io.tmpdir"), "${DatabaseConstants.name}.db")
val driver = JdbcSqliteDriver(url = "jdbc:sqlite:${databasePath.path}")
PokemonDatabase.Schema.create(driver)
return driver
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.mocoding.pokedex.core.network

import io.ktor.client.HttpClient
import io.ktor.client.engine.darwin.Darwin

actual fun createPlatformHttpClient(): HttpClient {
return HttpClient(Darwin)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mocoding.pokedex.ui

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.mocoding.pokedex.ui.root.RootComponent
import com.mocoding.pokedex.ui.root.RootContent
import com.mocoding.pokedex.ui.theme.PokedexTheme

@Composable
fun ContentView(component: RootComponent) {
PokedexTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
RootContent(component)
}
}
}

0 comments on commit a2f95ab

Please sign in to comment.