-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kmp UI locker apps/watchfaces, images, http cache
- Loading branch information
Showing
21 changed files
with
389 additions
and
231 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
12 changes: 12 additions & 0 deletions
12
...id/shared/src/androidMain/kotlin/io/rebble/cobble/shared/di/DependenciesModule.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.rebble.cobble.shared.di | ||
|
||
import io.ktor.client.plugins.cache.storage.CacheStorage | ||
import io.ktor.client.plugins.cache.storage.FileStorage | ||
import io.rebble.cobble.shared.AndroidPlatformContext | ||
import io.rebble.cobble.shared.PlatformContext | ||
|
||
actual fun makePlatformCacheStorage(platformContext: PlatformContext): CacheStorage { | ||
val dir = (platformContext as AndroidPlatformContext).applicationContext.cacheDir.resolve("http_cache") | ||
dir.mkdir() | ||
return FileStorage(dir) | ||
} |
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
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
10 changes: 9 additions & 1 deletion
10
android/shared/src/commonMain/kotlin/io/rebble/cobble/shared/di/DependenciesModule.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,16 +1,24 @@ | ||
package io.rebble.cobble.shared.di | ||
|
||
import io.ktor.client.HttpClient | ||
import io.ktor.client.plugins.cache.HttpCache | ||
import io.ktor.client.plugins.cache.storage.CacheStorage | ||
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation | ||
import io.ktor.serialization.kotlinx.json.json | ||
import io.rebble.cobble.shared.PlatformContext | ||
import org.koin.dsl.module | ||
|
||
val dependenciesModule = module { | ||
factory { | ||
HttpClient { | ||
install(HttpCache) { | ||
publicStorage(makePlatformCacheStorage(get())) | ||
} | ||
install(ContentNegotiation) { | ||
json() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
expect fun makePlatformCacheStorage(platformContext: PlatformContext): CacheStorage |
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
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
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
Oops, something went wrong.