Skip to content

Commit

Permalink
starts moving Debugger UI into a separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbrooks12 committed Aug 22, 2023
1 parent 63c3c61 commit 1c44b3a
Show file tree
Hide file tree
Showing 46 changed files with 520 additions and 392 deletions.
41 changes: 41 additions & 0 deletions ballast-debugger-ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
plugins {
id("copper-leaf-base")
id("copper-leaf-targets")
id("copper-leaf-kotest")
id("copper-leaf-serialization")
id("copper-leaf-compose")
id("copper-leaf-lint")
id("copper-leaf-publish")
}

kotlin {
sourceSets {
all {
languageSettings.apply {
optIn("androidx.compose.material.ExperimentalMaterialApi")
optIn("androidx.compose.foundation.ExperimentalFoundationApi")
optIn("com.copperleaf.ballast.ExperimentalBallastApi")
}
}

val commonMain by getting {
dependencies {
// Ktor websocket server
implementation(libs.kotlinx.datetime)
implementation(libs.bundles.ktorEmbeddedServer)

implementation(libs.kotlinx.coroutines.swing)
implementation(libs.multiplatformSettings.core)
implementation(libs.multiplatformSettings.test)

// Ballast, to manage its own UI state (with debugger artifact to share serialization models between the client and server)
implementation(project(":ballast-core"))
implementation(project(":ballast-repository"))
implementation(project(":ballast-saved-state"))
implementation(project(":ballast-navigation"))
implementation(project(":ballast-debugger-models"))
implementation(project(":ballast-debugger-server"))
}
}
}
}
7 changes: 7 additions & 0 deletions ballast-debugger-ui/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
copperleaf.description=Compose UI for Ballast Debugger
copperleaf.targets.android=false
copperleaf.targets.jvm=true
copperleaf.targets.ios=false
copperleaf.targets.js=false

copperleaf.compose.splitPane=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.copperleaf.ballast.debugger.idea.features.debugger.injector

import com.copperleaf.ballast.debugger.idea.features.debugger.router.DebuggerRouter
import com.copperleaf.ballast.debugger.idea.features.debugger.vm.DebuggerUiViewModel
import com.copperleaf.ballast.debugger.server.vm.DebuggerServerViewModel

public interface DebuggerToolWindowInjector {

public val debuggerRouter: DebuggerRouter
public val debuggerServerViewModel: DebuggerServerViewModel
public val debuggerUiViewModel: DebuggerUiViewModel

public companion object
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.copperleaf.ballast.debugger.idea.features.debugger.repository

import com.copperleaf.ballast.debugger.idea.settings.DebuggerUiSettings
import com.copperleaf.ballast.debugger.idea.settings.GeneralSettings
import com.copperleaf.ballast.debugger.server.BallastDebuggerServerSettings
import com.copperleaf.ballast.repository.cache.Cached
import kotlinx.coroutines.flow.Flow

public interface DebuggerUseCase {
public fun observeGeneralSettings(): Flow<Cached<GeneralSettings>>
public fun observeBallastDebuggerServerSettings(): Flow<Cached<BallastDebuggerServerSettings>>
public fun observeDebuggerUiSettings(): Flow<Cached<DebuggerUiSettings>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.copperleaf.ballast.navigation.routing.Route
import com.copperleaf.ballast.navigation.routing.RouteAnnotation
import com.copperleaf.ballast.navigation.routing.RouteMatcher

enum class DebuggerRoute(
public enum class DebuggerRoute(
routeFormat: String,
override val annotations: Set<RouteAnnotation> = emptySet(),
) : Route {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.copperleaf.ballast.debugger.idea.features.debugger.router

import com.copperleaf.ballast.navigation.vm.BasicRouter

typealias DebuggerRouter = BasicRouter<DebuggerRoute>
public typealias DebuggerRouter = BasicRouter<DebuggerRoute>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.copperleaf.ballast.EventHandler
import com.copperleaf.ballast.EventHandlerScope
import com.copperleaf.ballast.navigation.routing.RouterContract

class RouterEventHandler : EventHandler<
public class RouterEventHandler : EventHandler<
RouterContract.Inputs<DebuggerRoute>,
RouterContract.Events<DebuggerRoute>,
RouterContract.State<DebuggerRoute>> {
Expand All @@ -13,7 +13,7 @@ class RouterEventHandler : EventHandler<
RouterContract.Events<DebuggerRoute>,
RouterContract.State<DebuggerRoute>>.handleEvent(
event: RouterContract.Events<DebuggerRoute>
) = when (event) {
): Unit = when (event) {
is RouterContract.Events.BackstackChanged -> {}
is RouterContract.Events.BackstackEmptied -> {}
is RouterContract.Events.NoChange -> {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.copperleaf.ballast.debugger.idea.features.debugger.vm.DebuggerUiContr
import com.copperleaf.ballast.debugger.idea.features.debugger.vm.DebuggerUiViewModel
import com.copperleaf.ballast.debugger.server.vm.DebuggerServerContract

class DebuggerServerEventHandler(
private val getDebuggerUiViewModelLazy: ()->DebuggerUiViewModel
public class DebuggerServerEventHandler(
private val getDebuggerUiViewModelLazy: () -> DebuggerUiViewModel
) : EventHandler<
DebuggerServerContract.Inputs,
DebuggerServerContract.Events,
Expand All @@ -17,7 +17,7 @@ class DebuggerServerEventHandler(
DebuggerServerContract.Events,
DebuggerServerContract.State>.handleEvent(
event: DebuggerServerContract.Events
) = when (event) {
): Unit = when (event) {
is DebuggerServerContract.Events.ConnectionEstablished -> {
getDebuggerUiViewModelLazy()
.send(DebuggerUiContract.Inputs.OnConnectionEstablished(event.connectionId))
Expand Down
Loading

0 comments on commit 1c44b3a

Please sign in to comment.