3 Commits

Author SHA1 Message Date
c5ec5b1a0b
refactor: Integrate user auth for post interactions and enable post creation
This commit enhances the post detail and creation flows by integrating user authentication and activating the post creation functionality.

**Key Changes:**

*   **refactor(PostDetailViewModel):**
    *   The `loadPostDetail` function no longer requires `userId` as a parameter. It now retrieves the current user's ID directly from the JWT using `TokenManager`.
    *   When creating a new comment (`CreateCommentDto`), the current `commentDateTime` (using `java.util.Date`) is now included.

*   **feat(PostViewModel):**
    *   The previously stubbed `createPost` function has been fully implemented.
    *   It now makes sequential repository calls: first to `createPostMetadata` to get a new `postId`, and then to `createPostBody` with that ID.
    *   The UI state is updated to reflect success or failure throughout the creation process.
2025-10-08 00:33:29 +08:00
4325757404
feat: Implement "Save to Gallery" and enhance image/comment interactions
This commit introduces the ability for users to save images to their device's gallery and includes several enhancements to the image detail screen and comment section.

**Key Changes:**

*   **feat(Image Saving):**
    *   **ImageSaveUtils:** Added a new `ImageSaveUtils.kt` utility to handle saving images to the device gallery. It supports both modern (Android Q+) and legacy storage APIs.
    *   **Save Button:** Implemented a "Save" icon button in the `ImageDetailScreen` top bar, allowing users to download the currently viewed image.
    *   **Feedback:** The app now displays a `Snackbar` message (e.g., "Image saved to gallery") upon successful or failed save operations.

*   **feat(Image Detail Screen):**
    *   **Improved Zoom/Pan:** Reworked the zoom and pan logic in `ZoomableImage` for a smoother experience. The `HorizontalPager` is now disabled when an image is zoomed in to prevent accidental swiping.
    *   **Double-Tap to Zoom:** Added double-tap-to-zoom functionality on the `ImageDetailScreen`.

*   **refactor(Comments):**
    *   **Improved Reply UI:** The comment input bar now shows a preview of the comment being replied to (e.g., "Replying to User: This is the comment...").
    *   **Deprecated DTO Fields:** Marked `commentDateTime` and `imageGuid` in `CreateCommentDto` as deprecated, as they are now handled by the backend.

*   **refactor(Permissions):**
    *   Added `WRITE_EXTERNAL_STORAGE`, `READ_EXTERNAL_STORAGE`, and `READ_MEDIA_IMAGES` permissions to `AndroidManifest.xml` to support the new image saving feature across different Android versions.

*   **fix(Login):**
    *   Ensured that the user's profile information is fetched immediately after the login token is successfully saved, fixing a potential race condition.
2025-10-08 00:13:38 +08:00
6a1bc7ad97
feat: Implement core features with MVVM and Hilt
This commit introduces a comprehensive set of features, establishing the core functionality of the application using an MVVM architecture with Hilt for dependency injection.

**Key Changes:**

*   **UI & Navigation:**
    *   Implemented navigation between the main feed, post details, and login screens using Jetpack Navigation Compose.
    *   Added `TalkScreen` for displaying a feed of posts and `PostDetailScreen` for viewing individual posts and their comments.
    *   Created a `LoginScreen` with input fields and authentication logic.
    *   Introduced `PostCardItem` and `CommentItem` Composables for a consistent and reusable UI.
    *   Added shared element transitions for a smoother user experience when navigating to post details.

*   **Architecture & State Management:**
    *   Integrated Hilt for dependency injection across ViewModels and Repositories.
    *   Created ViewModels (`TalkViewModel`, `PostDetailViewModel`, `UserViewModel`, `CommentViewModel`, etc.) to manage UI state and business logic.
    *   Implemented Repository pattern for abstracting data sources from the backend API.
    *   Defined UI state data classes to ensure a predictable and observable state flow.

*   **Data & Models:**
    *   Introduced data models for `PostCard` and `CommentCard` to aggregate and display complex data structures.
    *   Added `PostDetailRepository` to orchestrate fetching of post and comment data concurrently.
    *   Refined DTOs, such as `CreateCommentDto`, for API interactions.

*   **Dependencies & Tooling:**
    *   Added Hilt, Navigation Compose, and Lifecycle ViewModel dependencies.
    *   Included the `pangu-jvm` library for improved text formatting with spacing between Chinese and English characters.
2025-10-06 00:29:51 +08:00