Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import io.writeopia.notemenu.navigation.navigateToNotes
import io.writeopia.notemenu.ui.screen.menu.EditFileDialog
import io.writeopia.notemenu.ui.screen.menu.RoundedVerticalDivider
import io.writeopia.sdk.persistence.core.di.RepositoryInjector
import io.writeopia.theme.WrieopiaTheme
import io.writeopia.theme.WriteopiaTheme
import io.writeopia.ui.components.multiselection.DragSelectionBox
import io.writeopia.ui.draganddrop.target.DraggableScreen
Expand Down Expand Up @@ -122,7 +121,7 @@ fun DesktopApp(
}
}

WrieopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
WriteopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
val density = LocalDensity.current
val globalBackground = WriteopiaTheme.colorScheme.globalBackground
DragSelectionBox(modifier = modifier) {
Expand Down
4 changes: 2 additions & 2 deletions application/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ android {
applicationId = "io.writeopia"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = 49
versionName = "0.36.0"
versionCode = 51
versionName = "0.38.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import io.writeopia.navigation.notes.navigateToNoteMenu
import io.writeopia.navigation.notifications.navigateToNotifications
import io.writeopia.navigation.search.navigateToSearch
import io.writeopia.notemenu.di.NotesMenuInjection
import io.writeopia.theme.WrieopiaTheme
import io.writeopia.theme.WriteopiaTheme
import io.writeopia.viewmodel.UiConfigurationViewModel

@Composable
Expand All @@ -46,7 +46,7 @@ fun PortraitMobile(
) {
val colorTheme by uiConfigViewModel.listenForColorTheme { "disconnected_user" }.collectAsState()

WrieopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
WriteopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
Box(modifier = modifier) {
Navigation(
isDarkTheme = colorTheme.isDarkTheme(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import io.writeopia.auth.menu.AuthMenuViewModel
import io.writeopia.common.utils.Destinations
import io.writeopia.model.ColorThemeOption
import io.writeopia.model.isDarkTheme
import io.writeopia.theme.WrieopiaTheme
import io.writeopia.theme.WriteopiaTheme
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.StateFlow
Expand Down Expand Up @@ -63,7 +62,7 @@ fun ScreenLoading() {

@Composable
fun IntroScreen(colorThemeOption: ColorThemeOption?) {
WrieopiaTheme(darkTheme = colorThemeOption.isDarkTheme()) {
WriteopiaTheme(darkTheme = colorThemeOption.isDarkTheme()) {
Box(
modifier = Modifier
.fillMaxSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import io.writeopia.sqldelight.database.DatabaseCreation
import io.writeopia.sqldelight.database.DatabaseFactory
import io.writeopia.sqldelight.database.driver.DriverFactory
import io.writeopia.sqldelight.di.WriteopiaDbInjector
import io.writeopia.theme.WrieopiaTheme
import io.writeopia.theme.WriteopiaTheme
import io.writeopia.ui.image.ImageLoadConfig
import io.writeopia.ui.keyboard.KeyboardEvent
Expand Down Expand Up @@ -228,7 +227,7 @@ private fun ApplicationScope.App(onCloseRequest: () -> Unit = ::exitApplication)

val navigationController = rememberNavController()

WrieopiaTheme(darkTheme = colorTheme.value.isDarkTheme()) {
WriteopiaTheme(darkTheme = colorTheme.value.isDarkTheme()) {
GlobalToastBox(
modifier = Modifier
.background(WriteopiaTheme.colorScheme.globalBackground)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ val LocalWriteopiaColors = staticCompositionLocalOf {
}

@Composable
fun WrieopiaTheme(
fun WriteopiaTheme(
darkTheme: Boolean = isSystemInDarkMode(),
content: @Composable () -> Unit
) {
Expand Down
4 changes: 4 additions & 0 deletions application/core/utils/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2016,6 +2016,10 @@
<error line="56" column="13" source="standard:backing-property-naming" />
<error line="56" column="13" source="standard:backing-property-naming" />
</file>
<file name="src/commonMain/kotlin/io/writeopia/common/utils/icons/all/highlighter.kt">
<error line="52" column="13" source="standard:backing-property-naming" />
<error line="54" column="1" source="standard:no-consecutive-blank-lines" />
</file>
<file name="src/commonMain/kotlin/io/writeopia/common/utils/icons/all/link.kt">
<error line="51" column="13" source="standard:backing-property-naming" />
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.writeopia.common.utils.colors

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import io.writeopia.sdk.models.span.Span

val colors = listOf(
Color.Blue.toArgb(),
Expand All @@ -15,3 +16,18 @@ val colors = listOf(
Color.Black.toArgb(),
Color.White.toArgb(),
)

fun highlightColors(isDarkTheme: Boolean) =
if (isDarkTheme) {
listOf(
Span.HIGHLIGHT_RED to Color(0xFFD32F2F),
Span.HIGHLIGHT_GREEN to Color(0xFF2E7D32),
Span.HIGHLIGHT_YELLOW to Color(0xFFF9A825)
)
} else {
listOf(
Span.HIGHLIGHT_RED to Color(0xFFE57373),
Span.HIGHLIGHT_GREEN to Color.Green,
Span.HIGHLIGHT_YELLOW to Color.Yellow
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import io.writeopia.common.utils.icons.all.Undo2
import io.writeopia.common.utils.icons.all.WandSparkles
import io.writeopia.common.utils.icons.all.X
import io.writeopia.common.utils.icons.all.Zap
import io.writeopia.common.utils.icons.all.highlighter

object WrIcons {
val settings: ImageVector = Bolt
Expand Down Expand Up @@ -177,6 +178,8 @@ object WrIcons {

val link = Link

val highlight = highlighter

val allIcons: Map<String, ImageVector> =
mapOf(
"settings" to settings,
Expand Down Expand Up @@ -234,6 +237,7 @@ object WrIcons {
"command" to command,
"chart" to chart,
"link" to link,
"highlight" to highlighter,
)

fun fromName(name: String): ImageVector? = allIcons[name]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package io.writeopia.common.utils.icons.all

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp

internal val highlighter: ImageVector
get() {
if (_highlighter != null) return _highlighter!!

_highlighter = ImageVector.Builder(
name = "highlighter",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
).apply {
path(
stroke = SolidColor(Color.Black),
strokeLineWidth = 2f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round
) {
moveToRelative(9f, 11f)
lineToRelative(-6f, 6f)
verticalLineToRelative(3f)
horizontalLineToRelative(9f)
lineToRelative(3f, -3f)
}
path(
stroke = SolidColor(Color.Black),
strokeLineWidth = 2f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round
) {
moveToRelative(22f, 12f)
lineToRelative(-4.6f, 4.6f)
arcToRelative(2f, 2f, 0f, false, true, -2.8f, 0f)
lineToRelative(-5.2f, -5.2f)
arcToRelative(2f, 2f, 0f, false, true, 0f, -2.8f)
lineTo(14f, 4f)
}
}.build()

return _highlighter!!
}

private var _highlighter: ImageVector? = null

3 changes: 0 additions & 3 deletions application/features/auth/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<file name="build.gradle.kts">
<error line="78" column="1" source="standard:no-blank-line-before-rbrace" />
</file>
<file name="src/commonMain/kotlin/io/writeopia/auth/navigation/AuthNavigation.kt">
<error line="148" column="1" source="standard:no-consecutive-blank-lines" />
</file>
<file name="src/commonMain/kotlin/io/writeopia/auth/register/RegisterViewModel.kt">
<error line="24" column="17" source="standard:backing-property-naming" />
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import io.writeopia.auth.workspace.ChooseWorkspace
import io.writeopia.common.utils.Destinations
import io.writeopia.model.ColorThemeOption
import io.writeopia.model.isDarkTheme
import io.writeopia.theme.WrieopiaTheme
import io.writeopia.theme.WriteopiaTheme
import kotlinx.coroutines.flow.StateFlow
import kotlin.time.ExperimentalTime
Expand All @@ -37,7 +36,7 @@ fun NavGraphBuilder.authNavigation(
val viewModel = authInjection.provideResetPasswordViewModel()
val colorTheme by colorThemeOption.collectAsState()

WrieopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
WriteopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
RegisterPasswordScreen(
modifier = Modifier.background(WriteopiaTheme.colorScheme.globalBackground),
passwordState = viewModel.password,
Expand All @@ -64,7 +63,7 @@ fun NavGraphBuilder.authNavigation(
val authMenuViewModel: AuthMenuViewModel = authInjection.provideAuthMenuViewModel()
val colorTheme by colorThemeOption.collectAsState()

WrieopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
WriteopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
AuthMenuScreen(
modifier = Modifier.background(WriteopiaTheme.colorScheme.globalBackground),
emailState = authMenuViewModel.email,
Expand Down Expand Up @@ -112,7 +111,7 @@ fun NavGraphBuilder.authNavigation(
val registerViewModel = authInjection.provideRegisterViewModel()
val colorTheme by colorThemeOption.collectAsState()

WrieopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
WriteopiaTheme(darkTheme = colorTheme.isDarkTheme()) {
RegisterScreen(
modifier = Modifier.background(WriteopiaTheme.colorScheme.globalBackground),
nameState = registerViewModel.name,
Expand Down Expand Up @@ -144,5 +143,3 @@ fun NavController.navigateToApp() {
fun NavController.navigateToWorkspaceChoice() {
navigate(Destinations.CHOOSE_WORKSPACE.id)
}


3 changes: 3 additions & 0 deletions application/features/editor/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
<error line="4" column="1" source="standard:no-unused-imports" />
<error line="11" column="1" source="standard:no-unused-imports" />
</file>
<file name="src/commonMain/kotlin/io/writeopia/editor/ui/MobileInputScreen.kt">
<error line="245" column="1" source="standard:no-consecutive-blank-lines" />
</file>
</baseline>
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ internal fun NoteEditorScreen(
BottomScreen(
noteEditorViewModel.isEditState,
metadataState = noteEditorViewModel.writeopiaManager.selectionMetadataState,
isDarkTheme = isDarkTheme,
noteEditorViewModel::undo,
noteEditorViewModel::redo,
noteEditorViewModel.canUndo,
Expand All @@ -160,6 +161,7 @@ internal fun NoteEditorScreen(
noteEditorViewModel::onAddCheckListClick,
noteEditorViewModel::onAddListItemClick,
noteEditorViewModel::addPage,
noteEditorViewModel::toggleHighLightBlock
)
}

Expand Down Expand Up @@ -307,6 +309,7 @@ private fun shareDocument(context: Context, shareDocument: ShareDocument) {
private fun BottomScreen(
editState: StateFlow<EditState>,
metadataState: Flow<Set<SelectionMetadata>>,
isDarkTheme: Boolean,
unDo: () -> Unit = {},
reDo: () -> Unit = {},
canUndo: StateFlow<Boolean>,
Expand All @@ -319,6 +322,7 @@ private fun BottomScreen(
onCheckItem: () -> Unit = {},
onListItem: () -> Unit = {},
onAddPage: () -> Unit = {},
onHighlight: () -> Unit,
) {
val edit by editState.collectAsState()

Expand All @@ -345,6 +349,7 @@ private fun BottomScreen(
EditState.TEXT -> {
InputScreen(
modifier = containerModifier,
isDarkTheme = isDarkTheme,
metadataState = metadataState,
onAddSpan = onSpanSelected,
onBackPress = unDo,
Expand All @@ -364,6 +369,7 @@ private fun BottomScreen(
onClose = onClose,
checkboxClick = onCheckItem,
listItemClick = onListItem,
onHighlight = onHighlight,
onAddPage = onAddPage
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import kotlinx.coroutines.flow.StateFlow
@Composable
internal fun InputScreen(
modifier: Modifier = Modifier,
isDarkTheme: Boolean,
metadataState: Flow<Set<SelectionMetadata>>,
onAddSpan: (Span) -> Unit,
onBackPress: () -> Unit = {},
Expand All @@ -21,6 +22,7 @@ internal fun InputScreen(
) {
MobileInputScreen(
modifier,
isDarkTheme,
metadataState,
onAddSpan,
onBackPress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Popup
import androidx.compose.ui.window.PopupProperties
import io.writeopia.common.utils.collections.inBatches
import io.writeopia.common.utils.colors.highlightColors
import io.writeopia.common.utils.file.fileChooserLoad
import io.writeopia.common.utils.file.fileChooserSave
import io.writeopia.common.utils.icons.WrIcons
Expand Down Expand Up @@ -508,19 +509,7 @@ private fun HighlightText(isDarkTheme: Boolean, spanClick: (Span) -> Unit) {
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceEvenly
) {
val colors = if (isDarkTheme) {
listOf(
Span.HIGHLIGHT_RED to Color(0xFFD32F2F),
Span.HIGHLIGHT_GREEN to Color(0xFF2E7D32),
Span.HIGHLIGHT_YELLOW to Color(0xFFF9A825)
)
} else {
listOf(
Span.HIGHLIGHT_RED to Color(0xFFE57373),
Span.HIGHLIGHT_GREEN to Color.Green,
Span.HIGHLIGHT_YELLOW to Color.Yellow
)
}
val colors = highlightColors(isDarkTheme)

colors.forEach { (span, color) ->
Box(
Expand Down
Loading