Skip to content

Commit

Permalink
Remove Screen API.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg-Melnik committed Dec 27, 2024
1 parent e71e2c2 commit 7eee2f0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 59 deletions.
31 changes: 1 addition & 30 deletions core/src/main/kotlin/io/spine/chords/core/appshell/AppWindow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class AppWindow(
*/
private val signInScreen: SignInScreen = SignInScreen(signInScreenContent) {
screenNavigator.pop()
show(mainScreen)
screenNavigator.push(mainScreen)
}

/**
Expand Down Expand Up @@ -128,35 +128,6 @@ public class AppWindow(
}
}

/**
* Makes the given screen the current visible app screen.
*
* This screen will be rendered using the entire area
* of the application window. No other components
* from other screens will be visible or interactable.
*
* @param screen The screen to be shown.
*/
internal fun show(screen: Screen) {
check(bottomDialog == null) {
"Cannot display the screen when a dialog is displayed."
}
screenNavigator.push(screen)
}

/**
* Closes the currently visible screen.
*
* The currently visible screen won't be saved to the navigation history and
* the bottom-most screen in the history will be displayed.
*/
internal fun closeCurrentScreen() {
check(screenNavigator.size > 1) {
"Cannot close the bottom-most screen `${screenNavigator.lastItem}`."
}
screenNavigator.pop()
}

/**
* Selects the given [appView].
*/
Expand Down
23 changes: 0 additions & 23 deletions core/src/main/kotlin/io/spine/chords/core/appshell/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.window.application
import cafe.adriel.voyager.core.screen.Screen
import io.spine.chords.core.layout.ConfirmationDialog
import io.spine.chords.core.layout.Dialog
import io.spine.chords.core.layout.DialogDisplayMode
Expand Down Expand Up @@ -274,28 +273,6 @@ public open class Application(
public class ApplicationUI
internal constructor(private val appWindow: AppWindow) {

/**
* Displays the given [screen].
*
* This screen will be rendered using the entire area
* of the application window. No other components
* from other screens will be visible or interactable.
*
* @param screen The screen to be shown.
*/
public fun show(screen: Screen) {
appWindow.show(screen)
}

/**
* Closes the currently visible screen.
*
* The bottom-most screen in the history will be displayed.
*/
public fun closeCurrentScreen() {
appWindow.closeCurrentScreen()
}

/**
* Selects the given [appView].
*
Expand Down
7 changes: 1 addition & 6 deletions core/src/main/kotlin/io/spine/chords/core/layout/Wizard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import androidx.compose.ui.input.key.Key.Companion.DirectionLeft
import androidx.compose.ui.input.key.Key.Companion.DirectionRight
import androidx.compose.ui.input.key.Key.Companion.Enter
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.core.screen.Screen
import io.spine.chords.core.Component
import io.spine.chords.core.keyboard.KeyModifiers.Companion.Alt
import io.spine.chords.core.keyboard.KeyModifiers.Companion.Ctrl
Expand Down Expand Up @@ -95,13 +94,9 @@ private object WizardContentSize {
* finished using the wizard, and it needs to be closed. The container where
* the wizard is placed is responsible for hiding the wizard (excluding it from
* the composition) upon this event.
*
* It implements Voyager's [Screen] since any wizard currently displays
* as an application screen. This will likely be removed once wizards
* are displayed as dialogs.
*/
@Stable
public abstract class Wizard : Component(), Screen {
public abstract class Wizard : Component() {

/**
* The text to be the title of the wizard.
Expand Down

0 comments on commit 7eee2f0

Please sign in to comment.