This commit introduces a new "Create Post" screen, enabling users to compose and publish posts with text and up to three images. The implementation includes a dedicated ViewModel, robust state management, and an asynchronous image upload flow.
**Key Changes:**
* **feat(Create Post Screen):**
* Added `CreatePostScreen.kt`, a new Composable screen for creating posts.
* The UI includes a text input field, selectors for "Section" and "Category," and an image picker/preview area.
* Implemented `SelectionBottomSheet` as a reusable component for picking sections and categories from a modal bottom sheet.
* The "Publish" button is dynamically enabled based on content validation and image upload status.
* Error messages are displayed to the user via a snackbar-like component.
* **feat(CreatePostViewModel):**
* Created a new `CreatePostViewModel` to manage the logic and state (`CreatePostState`) of the creation process.
* Fetches post categories on initialization.
* Handles image selection and manages an asynchronous upload queue. Each selected image is immediately uploaded to the backend via `MediaRepository`.
* The ViewModel tracks the upload progress for each image and updates the UI accordingly.
* The `createPost` function validates all inputs, compiles the post data (including uploaded image UUIDs), and sends it to the repository.
* **feat(Navigation):**
* Added a `CreatePost` route to the navigation graph (`Screen.kt`).
* Integrated the new screen into `App.kt` with custom horizontal slide transitions.
* The publish button on the main screen's top bar now navigates to the `CreatePostScreen`.
* Upon successful post creation, the user is navigated back to the main screen.
* **refactor(PostDetailViewModel):**
* Adjusted the `createComment` logic to correctly handle `parentCommentId`, sending `0L` instead of `null` when there is no parent comment.
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.
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.
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.