-
Notifications
You must be signed in to change notification settings - Fork 21
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
1 parent
381c4d1
commit f8f76e7
Showing
23 changed files
with
241 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,21 @@ | ||
package com.spotify.app.kmp | ||
|
||
import android.app.Application | ||
import com.spotify.app.core_network.shared.impl.HttpEngineProviderAndroid | ||
import com.spotify.app.shared.di.getSharedModules | ||
import org.koin.android.ext.koin.androidContext | ||
import org.koin.android.ext.koin.androidLogger | ||
import org.koin.core.context.startKoin | ||
|
||
class SpotifyApp : Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
startKoin { | ||
androidContext(this@SpotifyApp) | ||
androidLogger() | ||
modules(getSharedModules(httpEngineProvider = HttpEngineProviderAndroid())) | ||
} | ||
} | ||
|
||
} |
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
12 changes: 12 additions & 0 deletions
12
...e-logger/src/commonMain/kotlin/com/spotify/app/core_logger/shared/impl/di/LoggerModule.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 com.spotify.app.core_logger.shared.impl.di | ||
|
||
import com.spotify.app.core_logger.shared.CoreLoggerBuildKonfig | ||
import com.spotify.app.core_logger.shared.api.LoggerApi | ||
import com.spotify.app.core_logger.shared.impl.LoggerApiImpl | ||
import org.koin.dsl.module | ||
|
||
val loggerModule = module { | ||
single<LoggerApi> { | ||
LoggerApiImpl(shouldEnableLogs = CoreLoggerBuildKonfig.DEBUG) | ||
} | ||
} |
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
.../androidMain/kotlin/com/spotify/app/core_network/shared/impl/HttpEngineProviderAndroid.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 com.spotify.app.core_network.shared.impl | ||
|
||
import io.ktor.client.engine.HttpClientEngine | ||
import io.ktor.client.engine.okhttp.OkHttp | ||
|
||
class HttpEngineProviderAndroid : HttpEngineProvider { | ||
|
||
override fun clientEngine(shouldEnableLogging: Boolean): HttpClientEngine { | ||
return OkHttp.create() | ||
} | ||
|
||
} |
3 changes: 1 addition & 2 deletions
3
...re-network/src/commonMain/kotlin/com/spotify/app/core_network/shared/api/HttpClientApi.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,10 +1,9 @@ | ||
package com.spotify.app.core_network.shared.api | ||
|
||
import com.spotify.app.core_network.shared.impl.HttpEngineProvider | ||
import io.ktor.client.HttpClient | ||
|
||
|
||
interface HttpClientApi { | ||
fun getHttpClient(httpEngineProvider: HttpEngineProvider): HttpClient | ||
fun getHttpClient(): HttpClient | ||
|
||
} |
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
17 changes: 17 additions & 0 deletions
17
...etwork/src/commonMain/kotlin/com/spotify/app/core_network/shared/impl/di/NetworkModule.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,17 @@ | ||
package com.spotify.app.core_network.shared.impl.di | ||
|
||
import com.spotify.app.core_network.shared.CoreNetworkBuildKonfig | ||
import com.spotify.app.core_network.shared.impl.HttpClientApiImpl | ||
import com.spotify.app.core_network.shared.impl.HttpEngineProvider | ||
import org.koin.dsl.module | ||
|
||
fun createNetworkModule(httpEngineProvider: HttpEngineProvider) = module { | ||
single { | ||
HttpClientApiImpl( | ||
shouldEnableLogging = CoreNetworkBuildKonfig.DEBUG, | ||
httpEngineProvider = httpEngineProvider, | ||
loggerApi = get(), | ||
preferenceUtilApi = get() | ||
) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...work/src/iosMain/kotlin/com/spotify/app/core_network/shared/impl/HttpEngineProviderIos.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,9 @@ | ||
package com.spotify.app.core_network.shared.impl | ||
|
||
import io.ktor.client.engine.HttpClientEngine | ||
import io.ktor.client.engine.darwin.Darwin | ||
|
||
class HttpEngineProviderIOS : HttpEngineProvider { | ||
override fun clientEngine(shouldEnableLogging: Boolean): HttpClientEngine = Darwin.create() | ||
|
||
} |
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: 10 additions & 0 deletions
10
...es/src/commonMain/kotlin/com/spotify/app/core_preferences/shared/api/PreferenceUtilApi.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,10 @@ | ||
package com.spotify.app.core_preferences.shared.api | ||
interface PreferenceUtilApi { | ||
suspend fun getAccessToken(): String? | ||
|
||
suspend fun setAccessToken(token: String) | ||
|
||
suspend fun getRefreshToken(): String? | ||
|
||
suspend fun setRefreshToken(token: String) | ||
} |
20 changes: 20 additions & 0 deletions
20
...rc/commonMain/kotlin/com/spotify/app/core_preferences/shared/impl/di/PreferencesModule.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,20 @@ | ||
package com.spotify.app.core_preferences.shared.impl.di | ||
|
||
import com.russhwolf.settings.ExperimentalSettingsApi | ||
import com.russhwolf.settings.Settings | ||
import com.russhwolf.settings.coroutines.toSuspendSettings | ||
import com.spotify.app.core_preferences.shared.api.PreferenceApi | ||
import com.spotify.app.core_preferences.shared.api.PreferenceUtilApi | ||
import com.spotify.app.core_preferences.shared.impl.PreferenceApiImpl | ||
import com.spotify.app.core_preferences.shared.impl.util.PreferenceUtilImpl | ||
import org.koin.dsl.module | ||
|
||
@OptIn(ExperimentalSettingsApi::class) | ||
val preferencesModule = module { | ||
single<PreferenceApi> { | ||
PreferenceApiImpl(suspendSettings = Settings().toSuspendSettings()) | ||
} | ||
single<PreferenceUtilApi> { | ||
PreferenceUtilImpl(get()) | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
...src/commonMain/kotlin/com/spotify/app/core_preferences/shared/impl/util/PreferenceUtil.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.