Skip to content

Refactor authentication and task management for improved UX#78

Merged
ohmzi merged 24 commits into
masterfrom
develop
May 25, 2026
Merged

Refactor authentication and task management for improved UX#78
ohmzi merged 24 commits into
masterfrom
develop

Conversation

@ohmzi
Copy link
Copy Markdown
Owner

@ohmzi ohmzi commented May 25, 2026

No description provided.

ohmzi and others added 24 commits May 24, 2026 00:44
…ove reliability and user experience during network instability.

This update introduces a formal `AuthSessionState` machine, improves data persistence logic during logout, and enhances the landing page behavior for returning users.

- **Authentication & Session Management**:
    - **`AuthProvider`**: Replaced simple `isLoading` boolean with a multi-state `authState` (`loading`, `authenticated`, `unauthenticated`, `unavailable`).
    - **Session Recovery**: Added a retry mechanism that attempts to fetch the session every 15 seconds when the service is `unavailable`.
    - **Session Invalidation**: Updated `logout` and unauthorized session refreshes to clear user data while explicitly preserving a new "returning browser" marker.
    - **Error Handling**: Added toast notifications for failed logout attempts and ensured local state remains intact if the server-side logout fails.

- **Routing & UX**:
    - **Returning User Flow**: Introduced `tday.returning-browser` in `localStorage`. Users who have previously interacted with the app are now redirected directly to `/login` instead of the landing page.
    - **`AuthBootstrapScreen`**: Standardized the loading/reconnecting UI into a reusable component used across `AuthLayout`, `LandingPage`, and `ProtectedRoute`.
    - **Security**: Refactored `clearClientUserData` to support excluding specific keys from deletion during cleanup.

- **Backend (Kotlin)**:
    - Updated `SessionAuthFlowTest` to verify secure cookie attributes (`HttpOnly`, `Secure`, `SameSite=Lax`, `Path=/`) in production environments.

- **Testing**:
    - Expanded `AuthProvider.test.tsx` with comprehensive test cases for 401/500 responses, session refreshes, and data persistence during logout.
    - Updated `publicRouteAuthGuard.test.tsx` to validate the new redirect logic for returning browsers and "unavailable" auth states.
- Replace `Box` with `BoxWithConstraints` to implement responsive width logic
- Introduce layout constants for card width, padding, and breakpoints
- Adjust card width dynamically based on screen size (wide vs. narrow layouts)
- Apply `WIZARD_CARD_CONTENT_PADDING` and `WIZARD_WATERMARK_SIZE` constants
- Ensure the onboarding card maintains consistent edge padding on smaller screens
- Add `isSessionAuthenticationIssue` to `ApiResponseUtils` to detect 401 errors
- Implement `recoverSessionAndRetrySyncIfNeeded` in `AppViewModel` to automatically attempt session restoration when a sync fails due to authentication issues
- Enhance `syncAndUpdateOfflineState` to handle suppressed authentication errors and prevent flickering offline notices
- Update `AppViewModel` to treat specific authentication failures as offline states when configured, avoiding intrusive error snackbars during background syncs
- Ensure `RealtimeClient` reconnects after successful session recovery if the user is authenticated
- Add unit tests for `isSessionAuthenticationIssue` and session recovery logic in `AppViewModelTest`
Display today's todos directly on the Home screen for both iOS and Android,
enabling quick management without navigating to a sub-screen.

- Add `todayTodos` state and fetch logic to `HomeViewModel` on both platforms
- Implement `HomeTodayCard` to display the current date and today's task count
- Add `HomeTodayTaskRow` with support for completion, deletion, and editing
- Implement horizontal swipe gestures for task actions (Edit/Delete) in the
  today's task list
- Reorganize the Home category grid to accommodate the new today's card layout
- Integrate task editing flows via `CreateTaskSheet` (iOS) and
  `CreateTaskBottomSheet` (Android) directly from the Home screen
- Update UI metrics, including tile heights, corner radii, and padding for
  a more compact dashboard view
…s platforms

Standardize the custom trailing swipe action behavior across iOS screens and implement a more robust task completion animation for the home screen on both Android and iOS.

- **iOS Refinement**:
    - Introduce `todoTrailingSwipeActions` view modifier in `SwipeActions.swift` to replace native `swipeActions`, providing consistent custom pill-style buttons (Edit/Delete) with reveal animations.
    - Adopt the new swipe modifier in `TodoListScreen`, `CalendarScreen`, and `CompletedScreen`.
    - Enhance `HomeTodayTaskRow` with a multi-phase completion state (`active`, `checked`, `fading`), adding a strikethrough animation and a delayed fade-out.
    - Consolidate common swipe button UI into `HomeTodaySwipeActionButton`.

- **Android/Compose Enhancement**:
    - Update `HomeTodayTaskRow` to include a canvas-drawn strikethrough animation on the task title when completed.
    - Implement a phased completion flow with alpha fading and a 500ms delay before triggering the `onComplete` callback.
    - Improve swipe action button visuals with localized strings and standardized colors.
    - Wrap the "Today" task list in a single `item` block containing a `Column` to optimize rendering within the `HomeScreen` LazyColumn.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Implement logic to display date dividers only when consecutive items fall on different local days. This replaces static dividers and improves visual grouping across Android (Compose) and iOS (SwiftUI) platforms.

- **Intelligent Divider Logic**: Introduce `shouldShowDateDivider` to check if the subsequent visible item (even across collapsed sections) belongs to a different calendar day.
- **Android (Compose)**:
    - Update `CompletedScreen`, `TodoListScreen`, `HomeScreen`, and `CalendarScreen` to pass `showDateDivider` to row components.
    - Refactor `SwipeTaskRow` and `CalendarTodoRow` to conditionally render the bottom `Spacer` divider.
- **iOS (SwiftUI)**:
    - Update `TodoListScreen`, `CompletedScreen`, `CalendarScreen`, and `HomeScreen` (search results) to wrap `TimelineRowDivider` in conditional checks.
    - Adjust `resultsHeight` calculation in Home search to account for the dynamic number of dividers.
- **Cross-Platform Consistency**: Ensure date comparisons use the appropriate system time zone or `Calendar` instance to determine day boundaries.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Refactor the swipe-to-reveal action logic in `HomeScreen` and `SwipeActions` to improve interaction reliability. These changes ensure that action buttons are layered correctly and do not intercept touches prematurely.

- **Reorder ZStack Layers**: Move the action button `HStack` after the row content in the `ZStack`. This ensures the buttons are rendered on top of the content when revealed, preventing the base row from blocking button interactions.
- **Enhanced Hit Testing**: Add `.allowsHitTesting(easedReveal > 0.8)` to `HomeTodaySwipeActionButton` and `TodoSwipePillActionButton`. This prevents accidental triggers by only enabling button interactions when they are nearly fully revealed.
- **Consistent Implementation**: Applied these layering and hit-test improvements across both the home screen today tasks and the generic `SwipeActions` component.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Update text components in `HomeScreen.kt` to use the custom `TdayFontFamily` and adjust font weights and sizes for improved visual hierarchy.

- **Date Label**: Update to `ExtraBold` weight at `22.sp` with defined line height.
- **Task Count**: Upgrade style to `headlineLarge` with `34.sp` font size and `40.sp` line height.
- **Task Title**: Change style to `titleMedium` using `ExtraBold` weight at `18.sp`.
- **Subtitle**: Adjust weight to `Bold` and set font size to `13.sp`.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Consolidate and rename list-related utility functions across Android and iOS home screens to improve consistency and reduce code duplication.

- **Android (Compose)**:
    - Remove local `homeTodayListAccentColor` and `homeTodayListIcon` helper functions from `HomeScreen.kt`.
    - Replace them with centralized calls to `listColorAccent` and `listIconForKey`.
- **iOS (SwiftUI)**:
    - Rename `homeTodayListSymbolName` to `homeListSymbolName`.
    - Rename `todoListAccentColor` to `homeListAccentColor`.
    - Remove the redundant local implementation of `homeTodayListSymbolName` in `HomeScreen.swift`.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Introduce cross-platform support for rescheduling tasks via drag-and-drop in both the todo list and calendar views, including specialized handling for recurring task series.

- **Rescheduling Logic**:
    - Add `TaskRescheduleScope` to distinguish between updating a single `OCCURRENCE` or the entire `SERIES`.
    - Implement `movedDuePreservingTime` to ensure tasks maintain their original local time when moved to a new date.
    - Introduce `timelineRescheduleTargetDate` to resolve drop target dates from various UI section keys (day, month, etc.).
- **Android (Compose)**:
    - Enable `dragAndDropSource` and `dragAndDropTarget` on task rows and list sections.
    - Add an `AlertDialog` to prompt users when moving recurring tasks.
    - Integrate haptic feedback during drag-and-drop interactions.
- **iOS (SwiftUI)**:
    - Implement `DropDelegate` and `onDrag` modifiers for `TodoListScreen` and `CalendarScreen`.
    - Add `confirmationDialog` for recurring task rescheduling choices.
    - Update `CalendarMonthGrid` and `CalendarWeekCard` to support visual drop targets and task relocation.
- **Core Improvements**:
    - Refactor `TodoListViewModel` and `CalendarViewModel` to support scoped task updates.
    - Add unit tests for date parsing and rescheduling target resolution in `CacheMappersDateParsingTests.swift`.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Improved the cross-platform task rescheduling experience by enabling drop support for external content (via task IDs) and refining the visual feedback for drop targets.

- **Cross-Platform Drag-and-Drop Improvements**:
    - Implemented `resolveTodoForDrop` to lookup tasks by ID or canonical ID when dropped from external sources or providers.
    - Updated drop delegates and targets to handle `itemProviders` (iOS) and `ClipData` (Android) for task ID extraction.
    - Expanded supported drag content types to include `plainText` and `text`.
- **UI & Feedback**:
    - Standardized drop target highlighting to use `error` (accent) colors for better visibility during drag operations.
    - Applied drop target coloring to section headers, calendar dates, and month/week navigation labels.
    - Added state-driven text coloring and background tints to calendar cells when acting as active drop targets.
- **Android Specifics**:
    - Refactored drag source detection to use `detectDragGesturesAfterLongPress` for more reliable gesture handling.
    - Added unit tests for `TaskReschedule` logic, covering date movement and timeline target resolution.
- **iOS Specifics**:
    - Refined `ScheduledTodoDropDelegate` to validate drops based on both the dragged item presence and content type conformity.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
…heduling

Implement a dedicated drop target for the "Earlier" section and introduce visual placeholders during drag-and-drop operations to improve the task rescheduling experience on both Android and iOS.

- **Rescheduling Logic**:
    - Update `timelineRescheduleTargetDate` to resolve the "Earlier" section key to "yesterday" relative to the current date.
    - Enable the "Earlier" section to appear as an empty drop target when a task is being dragged, even if it contains no items.
    - Add logic to prevent redundant reschedule requests using a drop signature check.

- **UI & Animation (Android/Compose)**:
    - Introduce `TimelineDropPlaceholder` with animated height and border styles to indicate active drop zones.
    - Refactor `buildTimelineSections` to support optional empty sections during drag operations.
    - Ensure smooth transitions for placeholders using `animateItem` and `animateDpAsState`.

- **UI & Drag-and-Drop (iOS/SwiftUI)**:
    - Introduce `TodoDropPlaceholder` and `calendarTaskDropTarget` modifier to standardize drop behavior across List and Calendar screens.
    - Implement `TodoTaskDragSession` and `CalendarTaskDragSession` singletons to track dragged items across view updates reliably.
    - Enhance `TodoListScreen` to show a dashed placeholder in sections when a task is dragged over them.

- **Testing**:
    - Add unit tests for "Earlier" section date resolution in `TaskRescheduleTest.kt` (Android) and `CacheMappersDateParsingTests.swift` (iOS).

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Replace native platform drag-and-drop with a custom implementation for both iOS (SwiftUI) and Android (Compose) to improve control and responsiveness during task rescheduling.

- **Cross-Platform Changes**:
    - Introduce manual drag gesture handling using `LongPressGesture` (iOS) and `detectDragGesturesAfterLongPress` (Android).
    - Implement a custom drag preview overlay that follows the user's touch.
    - Track drop target boundaries globally using coordinate space names (iOS) and a shared state map of `Rect` bounds (Android).
- **iOS Implementation**:
    - Add `TodoInAppDrag` and `TodoDropTargetFrame` models for state tracking.
    - Use `PreferencePicker` to bubble up component frames to the `TodoListScreen` for hit testing.
    - Update `TodoRow` and section headers to register their frames as potential drop targets.
- **Android Implementation**:
    - Replace `dragAndDropSource`/`dragAndDropTarget` with a manual pointer input and `onGloballyPositioned` logic.
    - Add `TimelineInAppDrag` state to track the active todo and its position relative to the root container.
    - Refactor `SwipeTaskRow` to support custom drag lifecycle callbacks (`onDragStart`, `onDragMove`, `onDragEnd`, `onDragCancel`).

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Refine the drag-and-drop implementation in `TodoListScreen` to use global coordinates, ensuring more reliable hit testing and preview positioning across both iOS and Android platforms.

- **iOS: Global Coordinate Transition**:
    - Switch from named coordinate spaces to `.global` for drag gestures and drop target frame calculations.
    - Introduce `TodoDragRootFramePreferenceKey` to track the screen's root global frame.
    - Calculate `TodoDragPreview` position relative to the root frame to maintain alignment during global drags.
- **Android: UI Cleanup**:
    - Remove the conditional background color highlight on drop targets in `TodoListScreen.kt` to align with the intended visual design.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
…d-drop gestures

Streamline the coordinate calculation for in-app drag previews and improve the reliability of the long-press-to-drag gesture sequence.

- **Simplified Coordinate Tracking**: Remove `TodoDragRootFramePreferenceKey` and the manual global frame state. Instead, use a `GeometryReader` within the overlay to dynamically calculate the local preview position relative to the global drag location.
- **Gesture Refinement**: Update `TodoInAppDragModifier` to use a `simultaneousGesture` for location tracking and a `highPriorityGesture` for the long-press trigger. This ensures the drag location is captured immediately when the long press activates, preventing "jumping" previews.
- **UI Enhancements**:
    - Adjust `TodoDragPreview` vertical offset for better finger alignment.
    - Refine `placeholderStroke` logic in `TodoDropTargetPlaceholder` to switch between a solid border when active and a dashed border when inactive.
    - Set `allowsHitTesting(false)` on the drag preview overlay to prevent it from interfering with underlying touch events.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
…bridge

Replace the pure SwiftUI `DragGesture` and `LongPressGesture` implementation with a `UIViewRepresentable` bridge using `UILongPressGestureRecognizer`. This change improves the reliability and responsiveness of long-press-to-drag interactions within scrollable views.

- **Improved Gesture Handling**: Transition from SwiftUI gestures to `UILongPressGestureRecognizer` to better manage gesture transitions and simultaneous recognition.
- **Enhanced Precision**: Implement hit-testing logic in `gestureRecognizerShouldBegin` to ensure the gesture only triggers when interacting with the specific todo item's bounds.
- **Scroll View Integration**: Automatically attach the gesture recognizer to the nearest enclosing scroll view or superview to ensure consistent coordinate mapping and behavior.
- **State Management**: Encapsulate gesture logic within a `Coordinator` class that manages start, move, end, and cancel states, providing more robust feedback to the `TodoListScreen`.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
… Calendar

Introduces a robust in-app drag-and-drop system for rescheduling tasks within the calendar and todo views across both iOS and Android. This replaces generic task updates with a specialized `moveTodo` operation that preserves time and optimizes sync payloads.

- **In-App Drag-and-Drop (iOS/SwiftUI)**:
    - Replaces system `onDrag` with a custom `CalendarInAppDragModifier` using `UILongPressGestureRecognizer` for a more responsive dragging experience.
    - Implements a global overlay for drag previews and uses `PreferenceKeys` to track date drop targets.
    - Adds `CalendarTaskDragPreview` to provide visual feedback during the drag operation.

- **In-App Drag-and-Drop (Android/Compose)**:
    - Implements a pointer-input-based drag system in `CalendarScreen` that calculates drop targets via global coordinates.
    - Adds `CalendarTaskDragPreview` to show task details (title, time, list icon, priority) while dragging.
    - Expands the list of supported icons for list summaries in the calendar view.

- **Data & Sync Optimization**:
    - **`TodoRepository`**: Adds `moveTodo` to both platforms to handle date-specific updates with optimized mutation tracking (coalescing multiple moves on the same task).
    - **`SyncManager`**: Refines patching logic to recognize "due-only moves," preventing unnecessary resetting of fields like `rrule`, `description`, or `listID` on the server when only the date changes.
    - **Optimistic Updates**: Task dates are updated in the UI state immediately before the repository call to ensure a lag-free experience.

- **UI Refinements**:
    - Updates `CalendarPendingTaskRow` to display list and priority indicators.
    - Improves drag preview styling with rounded corners, shadows, and adjusted opacities.
    - Ensures dragging is disabled in "Day" view to avoid layout conflicts.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
…bridge

Replace the pure SwiftUI `DragGesture` and `LongPressGesture` implementation with a `UIViewRepresentable` bridge using `UILongPressGestureRecognizer`. This change improves the reliability and responsiveness of long-press-to-drag interactions within scrollable views.

- **Improved Gesture Handling**: Transition from SwiftUI gestures to `UILongPressGestureRecognizer` to better manage gesture transitions and simultaneous recognition.
- **Enhanced Precision**: Implement hit-testing logic in `gestureRecognizerShouldBegin` to ensure the gesture only triggers when interacting with the specific todo item's bounds.
- **Scroll View Integration**: Automatically attach the gesture recognizer to the nearest enclosing scroll view or superview to ensure consistent coordinate mapping and behavior.
- **State Management**: Encapsulate gesture logic within a `Coordinator` class that manages start, move, end, and cancel states, providing more robust feedback to the `TodoListScreen`.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
### iOS (SwiftUI)
- **UI Adjustments**: Added `CalendarTaskListMetrics` to standardize row padding and updated `CalendarScreen` to use `listRowSpacing(0)` and `listSectionSpacing(0)` for a tighter layout.
- **Cleanup**: Removed unused `isMonthDropTarget` and `isWeekDropTarget` logic that was incorrectly styling headers with an error color during drag-and-drop.

### Android (Compose)
- **Paging Architecture**: Replaced the 3-slot "infinite" pager (Previous/Current/Next) with a fixed-count `HorizontalPager` using `ChronoUnit` to calculate page indices for Month (240 pages), Week (1040 pages), and Day (3650 pages) views.
- **Navigation**:
    - Introduced `CalendarPagerScrollRequest` to handle programmatic jumps (e.g., "Today").
    - Updated `CalendarMonthCard`, `CalendarWeekCard`, and `CalendarDayCard` to manage state based on page indices rather than relative slots.
    - Simplified `CalendarPagingContent` to use standard `PagerState` with `snapshotFlow` for settling logic.
- **UI**: Removed `AnimatedContent` wrapping the calendar cards to improve transition performance and simplified header text coloring.
- **Cleanup**: Removed unused imports and the legacy `CalendarPagerSlot` / `CalendarPagerPage` models.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Refine UI transitions and layout stability for the calendar and todo list screens across iOS and Android.

- **iOS Calendar**:
    - Introduce `CalendarModeCardMetrics` to define explicit heights for month and period views, preventing layout jumps during mode switching.
    - Implement a spring-based `calendarModeTransitionAnimation` for smoother display mode toggling.
    - Apply opacity and scale transitions to the calendar card during mode changes.
- **iOS Todo List**:
    - Introduce `todoDropPlaceholderAnimation` to standardize spring-based animations for drag-and-drop interactions.
    - Encapsulate `activeDropSectionId` updates within `setActiveDropSection` to ensure all drag-related state changes are animated consistently.
    - Update `timelineRowTransition` to use spring animations for row insertions and removals.
- **Android Calendar**:
    - Add `animateContentSize` with a custom spring spec to the calendar card container to smoothly handle height transitions between different views.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
Optimize the calendar view logic across platforms by refining pager state management in Android and removing redundant state resets in iOS.

- **Android (Compose)**:
    - Update `HorizontalPager` key logic to use a combination of slot and value for better identity tracking during page transitions.
    - Refine `handledSettledPage` logic in `CalendarPager` to prevent redundant settling calls while ensuring correct resets when returning to the center page.
- **iOS (SwiftUI)**:
    - Remove redundant manual resets of `dateDropTargetFrames` in `CalendarScreen` drag-and-drop handlers, streamlining the session cleanup.

Signed-off-by: ohmzi <6551272+ohmzi@users.noreply.github.com>
@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented May 25, 2026

DeepSource Code Review

We reviewed changes in 95017cc...ece9c1d on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript May 25, 2026 8:50a.m. Review ↗
Kotlin May 25, 2026 8:50a.m. Review ↗
Secrets May 25, 2026 8:50a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

}
}

suspend fun moveTodo(todo: TodoItem, due: Instant) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`moveTodo` has a cyclomatic complexity of 20 with "High" risk


Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A function with high cyclomatic
complexity can be hard to understand and maintain. A higher cyclomatic
complexity indicates that the function has more decision points and is more complex.

private val CalendarPeriodPageHorizontalGutter = 2.dp
private val CalendarPeriodCardBottomPadding = 18.dp
private val CalendarTaskDragDueTimeFormatter: DateTimeFormatter =
DateTimeFormatter.ofPattern("h:mm a").withZone(ZoneId.systemDefault())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple occurrences of the same string literal within a single file detected. Prefer extracting the string literal into a property or constant.


Avoiding repeated string literals in the same scope is considered good practice in Kotlin. By using shared constants/variables, one improves code maintainability, readability, consistency, and support for localization efforts. Repeated string literals can make code harder to understand, update, and translate. Using shared constants or variables promotes code consistency and potential performance optimizations.

return
}
fun dateForPage(page: Int): LocalDate {
return minWeekStart.plusWeeks(page.toLong()).plusDays(selectedDayOffset)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions with exact one statement, the return statement, can be rewritten with ExpressionBodySyntax.


Functions which only contain a return statement can be collapsed to an expression body. This shortens the code and makes it more readable.

today: LocalDate,
tasksByDate: Map<LocalDate, List<TodoItem>>,
canGoPrevDay: Boolean,
canSelectDate: (LocalDate) -> Boolean,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function parameter `canSelectDate` is unused.


When defining a function, it is common to encounter scenarios where a parameter is declared but not actually used within the function body. In such cases, it is considered good practice to remove the unused parameter to simplify the function signature. By removing the unused parameter, you make the function declaration cleaner and easier to read, and it also

return
}
fun dateForPage(page: Int): LocalDate {
return minDate.plusDays(page.toLong())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions with exact one statement, the return statement, can be rewritten with ExpressionBodySyntax.


Functions which only contain a return statement can be collapsed to an expression body. This shortens the code and makes it more readable.

return
}
fun monthForPage(page: Int): YearMonth {
return minNavigableMonth.plusMonths(page.toLong())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions with exact one statement, the return statement, can be rewritten with ExpressionBodySyntax.


Functions which only contain a return statement can be collapsed to an expression body. This shortens the code and makes it more readable.


@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun CalendarTodoRow(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`CalendarTodoRow` has a cyclomatic complexity of 22 with "High" risk


Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A function with high cyclomatic
complexity can be hard to understand and maintain. A higher cyclomatic
complexity indicates that the function has more decision points and is more complex.

@@ -2147,22 +2595,74 @@ private fun listAccentColor(colorKey: String?): Color {
private fun listIconForKey(iconKey: String?): ImageVector {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`listIconForKey` has a cyclomatic complexity of 70 with "Critical" risk


Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A function with high cyclomatic
complexity can be hard to understand and maintain. A higher cyclomatic
complexity indicates that the function has more decision points and is more complex.


@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun HomeTodayTaskRow(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`HomeTodayTaskRow` has a cyclomatic complexity of 22 with "High" risk


Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A function with high cyclomatic
complexity can be hard to understand and maintain. A higher cyclomatic
complexity indicates that the function has more decision points and is more complex.


@Test
fun `timelineRescheduleTargetDate resolves exact day sections`() {
val today = LocalDate.parse("2026-05-24")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple occurrences of the same string literal within a single file detected. Prefer extracting the string literal into a property or constant.


Avoiding repeated string literals in the same scope is considered good practice in Kotlin. By using shared constants/variables, one improves code maintainability, readability, consistency, and support for localization efforts. Repeated string literals can make code harder to understand, update, and translate. Using shared constants or variables promotes code consistency and potential performance optimizations.

@ohmzi ohmzi merged commit cd5a026 into master May 25, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant