Skip to content

Commit

Permalink
Fix publishToMavenLocal - need to create expect/actual for kotlin-inj…
Browse files Browse the repository at this point in the history
…ect component creation methods for every final platform. (See kotlin-inject KMP examples.)
  • Loading branch information
prashanDYDX committed May 23, 2024
1 parent f4faed4 commit e0e48bf
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/commonMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import kotlin.annotation.AnnotationTarget.CLASS
import kotlin.annotation.AnnotationTarget.FUNCTION
import kotlin.annotation.AnnotationTarget.PROPERTY_GETTER
import kotlin.js.JsExport
import kotlin.reflect.KClass

// kotlin-inject handles qualifiers via typealiases (though Dagger-style @Qualifier annotations are coming soon)
typealias DeploymentUri = String
Expand All @@ -34,7 +35,7 @@ object AbacusFactory {
stateNotification: StateNotificationProtocol? = null,
dataNotification: DataNotificationProtocol? = null,
presentationProtocol: PresentationProtocol? = null,
): AbacusComponent = AbacusComponent::class.create(
): AbacusComponent = createAbacusComponent(
deploymentUri,
deployment,
appConfigs,
Expand All @@ -61,3 +62,15 @@ abstract class AbacusComponent(
) {
abstract val stateManager: AsyncAbacusStateManagerV2
}


internal expect fun createAbacusComponent(
deploymentUri: DeploymentUri,
deployment: Deployment,
appConfigs: AppConfigsV2,
ioImplementations: IOImplementations,
uiImplementations: UIImplementations,
stateNotification: StateNotificationProtocol?,
dataNotification: DataNotificationProtocol?,
presentationProtocol: PresentationProtocol?,
): AbacusComponent
28 changes: 28 additions & 0 deletions src/iosArm64Main/kotlin/di/AbacusComponent.ios.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package exchange.dydx.abacus.di

import exchange.dydx.abacus.protocols.DataNotificationProtocol
import exchange.dydx.abacus.protocols.PresentationProtocol
import exchange.dydx.abacus.protocols.StateNotificationProtocol
import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2
import exchange.dydx.abacus.utils.IOImplementations
import exchange.dydx.abacus.utils.UIImplementations

internal actual fun createAbacusComponent(
deploymentUri: DeploymentUri,
deployment: Deployment,
appConfigs: AppConfigsV2,
ioImplementations: IOImplementations,
uiImplementations: UIImplementations,
stateNotification: StateNotificationProtocol?,
dataNotification: DataNotificationProtocol?,
presentationProtocol: PresentationProtocol?,
): AbacusComponent = AbacusComponent::class.create(
deploymentUri,
deployment,
appConfigs,
ioImplementations,
uiImplementations,
stateNotification,
dataNotification,
presentationProtocol,
)
28 changes: 28 additions & 0 deletions src/iosSimulatorArm64Main/kotlin/di/AbacusComponent.ios.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package exchange.dydx.abacus.di

import exchange.dydx.abacus.protocols.DataNotificationProtocol
import exchange.dydx.abacus.protocols.PresentationProtocol
import exchange.dydx.abacus.protocols.StateNotificationProtocol
import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2
import exchange.dydx.abacus.utils.IOImplementations
import exchange.dydx.abacus.utils.UIImplementations

internal actual fun createAbacusComponent(
deploymentUri: DeploymentUri,
deployment: Deployment,
appConfigs: AppConfigsV2,
ioImplementations: IOImplementations,
uiImplementations: UIImplementations,
stateNotification: StateNotificationProtocol?,
dataNotification: DataNotificationProtocol?,
presentationProtocol: PresentationProtocol?,
): AbacusComponent = AbacusComponent::class.create(
deploymentUri,
deployment,
appConfigs,
ioImplementations,
uiImplementations,
stateNotification,
dataNotification,
presentationProtocol,
)
28 changes: 28 additions & 0 deletions src/jsMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.js.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package exchange.dydx.abacus.di

import exchange.dydx.abacus.protocols.DataNotificationProtocol
import exchange.dydx.abacus.protocols.PresentationProtocol
import exchange.dydx.abacus.protocols.StateNotificationProtocol
import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2
import exchange.dydx.abacus.utils.IOImplementations
import exchange.dydx.abacus.utils.UIImplementations

internal actual fun createAbacusComponent(
deploymentUri: DeploymentUri,
deployment: Deployment,
appConfigs: AppConfigsV2,
ioImplementations: IOImplementations,
uiImplementations: UIImplementations,
stateNotification: StateNotificationProtocol?,
dataNotification: DataNotificationProtocol?,
presentationProtocol: PresentationProtocol?,
): AbacusComponent = AbacusComponent::class.create(
deploymentUri,
deployment,
appConfigs,
ioImplementations,
uiImplementations,
stateNotification,
dataNotification,
presentationProtocol,
)
28 changes: 28 additions & 0 deletions src/jvmMain/kotlin/di/AbacusComponent.jvm.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package exchange.dydx.abacus.di

import exchange.dydx.abacus.protocols.DataNotificationProtocol
import exchange.dydx.abacus.protocols.PresentationProtocol
import exchange.dydx.abacus.protocols.StateNotificationProtocol
import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2
import exchange.dydx.abacus.utils.IOImplementations
import exchange.dydx.abacus.utils.UIImplementations

internal actual fun createAbacusComponent(
deploymentUri: DeploymentUri,
deployment: Deployment,
appConfigs: AppConfigsV2,
ioImplementations: IOImplementations,
uiImplementations: UIImplementations,
stateNotification: StateNotificationProtocol?,
dataNotification: DataNotificationProtocol?,
presentationProtocol: PresentationProtocol?,
): AbacusComponent = AbacusComponent::class.create(
deploymentUri,
deployment,
appConfigs,
ioImplementations,
uiImplementations,
stateNotification,
dataNotification,
presentationProtocol,
)

0 comments on commit e0e48bf

Please sign in to comment.