Skip to content

Commit

Permalink
fix major bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mshdabiola committed Jun 6, 2024
1 parent 6730ccd commit 3c90c76
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 142 deletions.
2 changes: 1 addition & 1 deletion composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ android {

compose.desktop {
application {
mainClass = "com.mshdabiola.desktop.MainAppKt"
mainClass = "com.mshdabiola.skeletonapp.MainAppKt"


buildTypes.release.proguard {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ class MainActivity : ComponentActivity() {
Color.TRANSPARENT,
) { darkTheme },
navigationBarStyle = SystemBarStyle.auto(
lightScrim,
darkScrim,
Color.TRANSPARENT,
Color.TRANSPARENT,
) { darkTheme },
)
onDispose {}
Expand Down
250 changes: 124 additions & 126 deletions composeApp/src/commonMain/kotlin/com/mshdabiola/skeletonapp/ui/SkApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,164 +112,162 @@ fun SkeletonApp() {
GradientColors()
},
) {
if (uiState == MainActivityUiState.Loading) {
SplashScreen()
} else {
val snackbarHostState = remember { SnackbarHostState() }

if (appState.shouldShowDrawer) {
PermanentNavigationDrawer(
drawerContent = {
CommonNavigation(
modifier = Modifier
.width(300.dp)
.fillMaxHeight(),
currentNavigation = appState.currentDestination?.route
?: "",
onNavigate = navigator,
)
},
) {
Scaffold(
modifier = Modifier.semanticsCommon {},
containerColor = Color.Transparent,
contentWindowInsets = WindowInsets(0, 0, 0, 0),
snackbarHost = { SnackbarHost(snackbarHostState) },
floatingActionButton = {
if (appState.currentDestination?.route == MAIN_ROUTE) {
ExtendedFloatingActionButton(
modifier = Modifier
.windowInsetsPadding(WindowInsets.safeDrawing)
.testTag("add"),
onClick = {
appState.navController.navigateToDetail(
0,
)
},
) {
Icon(
imageVector = Icons.Rounded.Add,
contentDescription = "add note",
val snackbarHostState = remember { SnackbarHostState() }

if (appState.shouldShowDrawer) {
PermanentNavigationDrawer(
drawerContent = {
CommonNavigation(
modifier = Modifier
.width(300.dp)
.fillMaxHeight(),
currentNavigation = appState.currentDestination?.route
?: "",
onNavigate = navigator,
)
},
) {
Scaffold(
modifier = Modifier.semanticsCommon {},
containerColor = Color.Transparent,
contentWindowInsets = WindowInsets(0, 0, 0, 0),
snackbarHost = { SnackbarHost(snackbarHostState) },
floatingActionButton = {
if (appState.currentDestination?.route == MAIN_ROUTE) {
ExtendedFloatingActionButton(
modifier = Modifier
.windowInsetsPadding(WindowInsets.safeDrawing)
.testTag("add"),
onClick = {
appState.navController.navigateToDetail(
0,
)
},
) {
Icon(
imageVector = Icons.Rounded.Add,
contentDescription = "add note",
)
// Spacer(modifier = )
Text(text = "Add note")
}
Text(text = "Add note")
}
},
}
},

) { padding ->

Column(
Modifier
.fillMaxSize()
.padding(padding)
.consumeWindowInsets(padding)
.windowInsetsPadding(
WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal),
),
) {
when (appState.windowSizeClass.widthSizeClass) {
WindowWidthSizeClass.Compact -> {}
else -> {
Column(
Modifier
.fillMaxSize()
.padding(padding)
.consumeWindowInsets(padding)
.windowInsetsPadding(
WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal),
),
) {
when (appState.windowSizeClass.widthSizeClass) {
WindowWidthSizeClass.Compact -> {}
else -> {
// Row {

// CommonNavigation (
// modifier = Modifier.weight(0.3f),
// currentNavigation = appState.currentDestination?.route ?:""
// )
SkNavHost(
SkNavHost(
// modifier = Modifier.weight(0.7f),
appState = appState,
onShowSnackbar = { message, action ->
snackbarHostState.showSnackbar(
message = message,
actionLabel = action,
duration = SnackbarDuration.Short,
) == SnackbarResult.ActionPerformed
},
)
appState = appState,
onShowSnackbar = { message, action ->
snackbarHostState.showSnackbar(
message = message,
actionLabel = action,
duration = SnackbarDuration.Short,
) == SnackbarResult.ActionPerformed
},
)
// }
}
}
}
}
}
} else {
Row {
if (appState.shouldShowNavRail) {
CommonRail(
modifier = Modifier
.width(100.dp)
.fillMaxHeight(),
currentNavigation = appState.currentDestination?.route
?: "",
onNavigate = navigator,
}
} else {
Row {
if (appState.shouldShowNavRail) {
CommonRail(
modifier = Modifier
.width(100.dp)
.fillMaxHeight(),
currentNavigation = appState.currentDestination?.route
?: "",
onNavigate = navigator,

)
}
Scaffold(
modifier = Modifier.semanticsCommon {},
containerColor = Color.Transparent,
contentColor = MaterialTheme.colorScheme.onBackground,
contentWindowInsets = WindowInsets(0, 0, 0, 0),
snackbarHost = { SnackbarHost(snackbarHostState) },
floatingActionButton = {
if (appState.currentDestination?.route == MAIN_ROUTE) {
ExtendedFloatingActionButton(
modifier = Modifier
.windowInsetsPadding(WindowInsets.safeDrawing)
.testTag("add"),
onClick = {
appState.navController.navigateToDetail(
0,
)
},
) {
Icon(
imageVector = Icons.Rounded.Add,
contentDescription = "add note",
}
Scaffold(
modifier = Modifier.semanticsCommon {},
containerColor = Color.Transparent,
contentColor = MaterialTheme.colorScheme.onBackground,
contentWindowInsets = WindowInsets(0, 0, 0, 0),
snackbarHost = { SnackbarHost(snackbarHostState) },
floatingActionButton = {
if (appState.currentDestination?.route == MAIN_ROUTE) {
ExtendedFloatingActionButton(
modifier = Modifier
.windowInsetsPadding(WindowInsets.safeDrawing)
.testTag("add"),
onClick = {
appState.navController.navigateToDetail(
0,
)
},
) {
Icon(
imageVector = Icons.Rounded.Add,
contentDescription = "add note",
)
// Spacer(modifier = )
Text(text = "Add note")
}
Text(text = "Add note")
}
},
bottomBar = {
if (appState.shouldShowBottomBar) {
CommonBar(
currentNavigation = appState.currentDestination?.route
?: "",
) { navigator(it) }
}
},
}
},
bottomBar = {
if (appState.shouldShowBottomBar) {
CommonBar(
currentNavigation = appState.currentDestination?.route
?: "",
) { navigator(it) }
}
},

) { padding ->

Column(
Modifier
.fillMaxSize()
.padding(padding)
.consumeWindowInsets(padding)
.windowInsetsPadding(
WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal),
),
) {
SkNavHost(
Column(
Modifier
.fillMaxSize()
.padding(padding)
.consumeWindowInsets(padding)
.windowInsetsPadding(
WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal),
),
) {
SkNavHost(
// modifier = Modifier.weight(0.7f),
appState = appState,
onShowSnackbar = { message, action ->
snackbarHostState.showSnackbar(
message = message,
actionLabel = action,
duration = SnackbarDuration.Short,
) == SnackbarResult.ActionPerformed
},
)
appState = appState,
onShowSnackbar = { message, action ->
snackbarHostState.showSnackbar(
message = message,
actionLabel = action,
duration = SnackbarDuration.Short,
) == SnackbarResult.ActionPerformed
},
)
// }
}
}
}
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package com.mshdabiola.desktop
package com.mshdabiola.skeletonapp

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Window
Expand All @@ -17,6 +23,8 @@ import com.mshdabiola.designsystem.string.appName
import com.mshdabiola.model.Writer
import com.mshdabiola.skeletonapp.di.appModule
import com.mshdabiola.skeletonapp.ui.SkeletonApp
import com.mshdabiola.ui.SplashScreen
import kotlinx.coroutines.delay
import org.koin.core.context.GlobalContext.startKoin
import org.koin.dsl.module
import java.io.File
Expand All @@ -36,7 +44,17 @@ fun mainApp() {
icon = defaultAppIcon,
state = windowState,
) {
SkeletonApp()
val show = remember { mutableStateOf(true) }
LaunchedEffect(Unit) {
delay(2000)
show.value = false
}
Box(Modifier.fillMaxSize()) {
SkeletonApp()
if (show.value) {
SplashScreen()
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ compose = "1.6.7"

ksp = "2.0.0-1.0.21"
androidx-paging = "3.3.0"
androidx-room = "2.7.0-alpha02"
androidx-room = "2.7.0-alpha03"
pagingComposeAndroid = "3.3.0"
roomKtx = "2.6.1"
sqlite = "2.5.0-alpha02"
sqlite = "2.5.0-alpha03"

kermit = "2.0.3"
slf4jSimple = "2.0.12"
Expand Down
Loading

0 comments on commit 3c90c76

Please sign in to comment.