Skip to content

Commit

Permalink
1.3.0
Browse files Browse the repository at this point in the history
feat: app - TagDetail TagMemo Tab
feat: app - preferred width 500
fix: app - CalendarScreen request focus when resume(after close filter dialog can use keyboard shortcut)
fix: app - memo sort start, endInclusive, title
fix: app - screen navigate animation
feat: app - CalendarScreen F1~F2 shortcut(TopBar action)
refactor: kotlin 2.1.0
  • Loading branch information
taetae98coding committed Dec 3, 2024
1 parent 27eedf0 commit dc22081
Show file tree
Hide file tree
Showing 148 changed files with 3,653 additions and 496 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- main

jobs:
Linux-Build:
Linux-Test:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
14 changes: 7 additions & 7 deletions Diary/Diary.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
buildConfigurationList = 3DDC72042CCD5905001193A2 /* Build configuration list for PBXNativeTarget "Diary" */;
buildPhases = (
3DD9A7542CDFBD000023C4EE /* Run Script */,
3DDC72072CCD5943001193A2 /* Run Script */,
3DDC72072CCD5943001193A2 /* Compile Kotlin Framework */,
3DDC71F22CCD5903001193A2 /* Sources */,
3DDC71F32CCD5903001193A2 /* Frameworks */,
3DDC71F42CCD5903001193A2 /* Resources */,
Expand Down Expand Up @@ -170,7 +170,7 @@
shellPath = /bin/sh;
shellScript = "cd \"$SRCROOT/..\"\n\ncase \"${CONFIGURATION}\" in\n \"DevDebug\" )\ncp -r \"$SRCROOT/Secret/DevDebug/GoogleService-Info.plist\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist\" ;;\n \"DevRelease\" )\ncp -r \"$SRCROOT/Secret/DevRelease/GoogleService-Info.plist\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist\" ;;\n \"RealDebug\" )\ncp -r \"$SRCROOT/Secret/RealDebug/GoogleService-Info.plist\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist\" ;;\n \"RealRelease\" )\ncp -r \"$SRCROOT/Secret/RealRelease/GoogleService-Info.plist\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist\" ;;\n*)\n;;\nesac\n";
};
3DDC72072CCD5943001193A2 /* Run Script */ = {
3DDC72072CCD5943001193A2 /* Compile Kotlin Framework */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -179,7 +179,7 @@
);
inputPaths = (
);
name = "Run Script";
name = "Compile Kotlin Framework";
outputFileListPaths = (
);
outputPaths = (
Expand Down Expand Up @@ -292,7 +292,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = io.github.taetae98coding.diary.debug;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -388,7 +388,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = io.github.taetae98coding.diary;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -490,7 +490,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = io.github.taetae98coding.diary.dev.debug;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -584,7 +584,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = io.github.taetae98coding.diary.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ internal class MemoBackupRoomDao(
database.memo().delete(ids)
}

override fun findMemoIdByUid(uid: String): Flow<List<String>> = database.memo().findMemoIdByUid(uid)
override fun getMemoIdByUid(uid: String): Flow<List<String>> = database.memo().findMemoIdByUid(uid)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ internal class TagBackupRoomDao(
database.tag().delete(ids)
}

override fun findByUid(uid: String): Flow<List<String>> = database.tag().findByUid(uid)
override fun getByUid(uid: String): Flow<List<String>> = database.tag().findByUid(uid)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ public interface MemoBackupDao {

public suspend fun delete(ids: Set<String>)

public fun findMemoIdByUid(uid: String): Flow<List<String>>
public fun getMemoIdByUid(uid: String): Flow<List<String>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ public interface TagBackupDao {

public suspend fun delete(ids: Set<String>)

public fun findByUid(uid: String): Flow<List<String>>
public fun getByUid(uid: String): Flow<List<String>>
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
package io.github.taetae98coding.diary.core.calendar.compose

import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.unit.dp
import io.github.taetae98coding.diary.core.calendar.compose.color.CalendarColors
import io.github.taetae98coding.diary.core.calendar.compose.item.CalendarItemUiState
import io.github.taetae98coding.diary.core.calendar.compose.month.CalendarMonth
import io.github.taetae98coding.diary.core.calendar.compose.month.CalendarMonthState
import io.github.taetae98coding.diary.core.calendar.compose.state.CalendarState
import io.github.taetae98coding.diary.core.design.system.theme.DiaryTheme
import kotlinx.coroutines.launch
import kotlinx.datetime.DateTimeUnit
import kotlinx.datetime.LocalDate
import kotlinx.datetime.plus
Expand All @@ -36,26 +29,8 @@ public fun Calendar(
modifier: Modifier = Modifier,
colors: CalendarColors = CalendarDefaults.colors(),
) {
val coroutineScope = rememberCoroutineScope()

Surface(
modifier = modifier
.onPreviewKeyEvent {
when {
!state.pagerState.isScrollInProgress && it.key == Key.DirectionRight -> {
coroutineScope.launch { state.animateScrollToForward() }
true
}

!state.pagerState.isScrollInProgress && it.key == Key.DirectionLeft -> {
coroutineScope.launch { state.animateScrollToBackward() }
true
}

else -> false
}
}.focusRequester(state.focusRequester)
.focusable(),
modifier = modifier,
color = DiaryTheme.color.background,
) {
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Expand All @@ -70,10 +45,6 @@ public fun Calendar(
)
}
}

LaunchedEffect(state.focusRequester) {
state.focusRequester.requestFocus()
}
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.foundation.pager.PagerState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.focus.FocusRequester
import io.github.taetae98coding.diary.library.datetime.todayIn
import kotlinx.datetime.DateTimeUnit
import kotlinx.datetime.LocalDate
import kotlinx.datetime.Month
Expand All @@ -13,8 +13,6 @@ import kotlinx.datetime.plus
public class CalendarState internal constructor(
internal val pagerState: PagerState,
) {
internal val focusRequester = FocusRequester()

internal val localDate: LocalDate
get() = LocalDate(1, 1, 1).plus(pagerState.currentPage, DateTimeUnit.MONTH)

Expand All @@ -27,17 +25,24 @@ public class CalendarState internal constructor(
public val month: Month
get() = localDate.month

public val isScrollInProgress: Boolean
get() = pagerState.isScrollInProgress

public suspend fun animateScrollToToday() {
animateScrollTo(LocalDate.todayIn())
}

public suspend fun animateScrollTo(localDate: LocalDate) {
pagerState.animateScrollToPage(page(localDate))
}

internal suspend fun animateScrollToBackward() {
public suspend fun animateScrollToBackward() {
if (pagerState.canScrollBackward) {
pagerState.animateScrollToPage(pagerState.currentPage - 1)
}
}

internal suspend fun animateScrollToForward() {
public suspend fun animateScrollToForward() {
if (pagerState.canScrollForward) {
pagerState.animateScrollToPage(pagerState.currentPage + 1)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.github.taetae98coding.diary.core.design.system.icon

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Group
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier

@Composable
public fun BuddyIcon(
modifier: Modifier = Modifier,
) {
Icon(
imageVector = Icons.Rounded.Group,
contentDescription = null,
modifier = modifier,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.NonRestartableComposable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.input.VisualTransformation
import io.github.taetae98coding.diary.core.design.system.icon.ClearIcon
Expand All @@ -29,10 +32,12 @@ public fun ClearTextField(
keyboardActions: KeyboardActions = KeyboardActions.Default,
singleLine: Boolean = false,
) {
val focusRequester = remember { FocusRequester() }

TextField(
value = valueProvider(),
onValueChange = onValueChange,
modifier = modifier,
modifier = modifier.focusRequester(focusRequester),
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
Expand All @@ -43,7 +48,12 @@ public fun ClearTextField(
}

if (valueProvider().isNotEmpty()) {
IconButton(onClick = { onValueChange("") }) {
IconButton(
onClick = {
onValueChange("")
focusRequester.requestFocus()
},
) {
ClearIcon()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ internal abstract class MemoEntityDao : EntityDao<MemoEntity>() {
SELECT *
FROM MemoEntity
WHERE id = :memoId
AND (:filterNotDelete = 0 OR isDelete = 0)
""",
)
abstract fun find(memoId: String, filterNotDelete: Boolean): Flow<MemoEntity?>
abstract fun getById(memoId: String): Flow<MemoEntity?>

@Query(
"""
Expand All @@ -108,10 +107,9 @@ internal abstract class MemoEntityDao : EntityDao<MemoEntity>() {
LEFT OUTER JOIN MemoTagEntity
ON MemoEntity.id = MemoTagEntity.memoId
WHERE MemoEntity.id IN (:memoIds)
AND (:filterNotDelete = 0 OR isDelete = 0)
""",
)
abstract fun findMemoAndTagIdsByIds(memoIds: Set<String>, filterNotDelete: Boolean): Flow<Map<MemoEntity, List<MemoTagEntity>>>
abstract fun getMemoAndTagIdsByIds(memoIds: Set<String>): Flow<Map<MemoEntity, List<MemoTagEntity>>>

@Query(
"""
Expand All @@ -123,6 +121,7 @@ internal abstract class MemoEntityDao : EntityDao<MemoEntity>() {
AND endInclusive IS NOT NULL
AND endInclusive >= :start AND start <= :endInclusive
AND (:hasTagFilter = 0 OR id IN (SELECT memoId FROM MemoTagEntity WHERE tagId in (:tagFilter)))
ORDER BY start, endInclusive, title
""",
)
abstract fun findByDateRange(owner: String?, start: LocalDate, endInclusive: LocalDate, hasTagFilter: Boolean, tagFilter: Set<String>): Flow<List<MemoEntity>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ internal class MemoRoomDao(
database.memo().updateDelete(memoId, isDelete, clock.now())
}

override fun find(memoId: String, filterNotDelete: Boolean): Flow<MemoDto?> =
override fun getById(memoId: String): Flow<MemoDto?> =
database
.memo()
.find(memoId, filterNotDelete)
.getById(memoId)
.mapLatest { it?.toDto() }

override fun findMemoAndTagIdsByIds(memoIds: Set<String>, filterNotDelete: Boolean): Flow<List<MemoAndTagIds>> =
override fun getMemoAndTagIdsByIds(memoIds: Set<String>): Flow<List<MemoAndTagIds>> =
database
.memo()
.findMemoAndTagIdsByIds(memoIds, filterNotDelete)
.getMemoAndTagIdsByIds(memoIds)
.mapLatest { map ->
map.map { entry ->
MemoAndTagIds(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,40 @@ package io.github.taetae98coding.diary.core.diary.database.room.dao

import androidx.room.Dao
import androidx.room.Query
import io.github.taetae98coding.diary.core.diary.database.room.entity.MemoEntity
import io.github.taetae98coding.diary.core.diary.database.room.entity.MemoTagEntity
import io.github.taetae98coding.diary.core.diary.database.room.entity.TagEntity
import io.github.taetae98coding.diary.library.room.dao.EntityDao
import kotlinx.coroutines.flow.Flow

@Dao
internal abstract class MemoTagEntityDao : EntityDao<MemoTagEntity>() {
@Query(
"""
SELECT tagId
FROM MemoTagEntity
WHERE memoId = :memoId
SELECT *
FROM TagEntity
WHERE id IN (
SELECT tagId
FROM MemoTagEntity
WHERE memoId = :memoId
)
""",
)
abstract fun findTagIdsByMemoId(memoId: String): Flow<List<String>>
abstract fun findTagByMemoId(memoId: String): Flow<List<TagEntity>>

@Query(
"""
SELECT *
FROM MemoEntity
WHERE isDelete = 0
AND isFinish = 0
AND id IN (
SELECT memoId
FROM MemoTagEntity
WHERE tagId = :tagId
)
ORDER BY start, endInclusive, title
""",
)
abstract fun pageMemoByTagId(tagId: String): Flow<List<MemoEntity>>
}
Loading

0 comments on commit dc22081

Please sign in to comment.