-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- implemented view models - now it uses CompositionLocalProvider to use app state - navigation is now a modal which is bound to the left side of the screen
- Loading branch information
Showing
35 changed files
with
720 additions
and
435 deletions.
There are no files selected for viewing
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
31 changes: 12 additions & 19 deletions
31
composeApp/src/commonMain/kotlin/com/github/aeoliux/violet/App.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,36 +1,29 @@ | ||
package com.github.aeoliux.violet | ||
|
||
import androidx.compose.material.AlertDialog | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.material.TextButton | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.runtime.LaunchedEffect | ||
import com.github.aeoliux.violet.app.login.LoginView | ||
import com.github.aeoliux.violet.app.MainView | ||
import com.github.aeoliux.violet.storage.Database | ||
import com.github.aeoliux.violet.storage.selectAboutMe | ||
import androidx.compose.runtime.remember | ||
import com.github.aeoliux.violet.app.appState.AppState | ||
import com.github.aeoliux.violet.app.appState.LocalAppState | ||
import com.github.aeoliux.violet.app.main.AppAlertDialog | ||
import com.github.aeoliux.violet.app.main.MainView | ||
import org.jetbrains.compose.ui.tooling.preview.Preview | ||
|
||
@Composable | ||
@Preview | ||
fun App(keychain: Keychain) { | ||
MaterialTheme { | ||
val appState = remember { AppState().setKeychain(keychain) } | ||
|
||
LaunchedEffect(Unit) { | ||
AppContext.isLoggedIn.value = Database.selectAboutMe() != null | ||
appState.appLaunchedEffect() | ||
} | ||
|
||
MainView(keychain) | ||
|
||
if (AppContext.showAlert.value) { | ||
AlertDialog( | ||
onDismissRequest = { AppContext.showAlert.value = false }, | ||
confirmButton = { TextButton(onClick = { | ||
AppContext.showAlert.value = false | ||
}) { Text("Ok") } }, | ||
title = { Text(AppContext.alertTitle.value) }, | ||
text = { Text(AppContext.alertMessage.value) } | ||
) | ||
CompositionLocalProvider(LocalAppState provides appState) { | ||
MainView() | ||
AppAlertDialog() | ||
} | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
composeApp/src/commonMain/kotlin/com/github/aeoliux/violet/AppContext.kt
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
composeApp/src/commonMain/kotlin/com/github/aeoliux/violet/Colors.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,5 @@ | ||
package com.github.aeoliux.violet | ||
|
||
import androidx.compose.ui.graphics.Color | ||
|
||
data class Colors(val primary: Color, val secondary: Color, val background: Color) |
7 changes: 0 additions & 7 deletions
7
composeApp/src/commonMain/kotlin/com/github/aeoliux/violet/ShowAlert.kt
This file was deleted.
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
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
61 changes: 0 additions & 61 deletions
61
composeApp/src/commonMain/kotlin/com/github/aeoliux/violet/app/FetchData.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.