Tangyuan/.idea/deploymentTargetSelector.xml
grtsinry43 46588259dd
feat: Implement user profile screen and enhance authentication
This commit introduces a dedicated user profile screen (`UserScreen`) and significantly enhances the authentication system by adding registration, auto-login, and robust form validation.

**Key Changes:**

*   **feat(UserScreen):**
    *   Added a new `UserScreen` to display the logged-in user's profile.
    *   Displays user details including avatar, nickname, ID, bio, location, and email in a styled card.
    *   Includes a menu section for actions like "Post Management," "Settings," and "About."
    *   Shows a "not logged in" state to prompt users to log in.

*   **feat(Auth):**
    *   **Registration:** Implemented a registration flow alongside the login flow on the `LoginScreen`. Users can now switch between Login and Register modes.
    *   **Auto-Login:** The app now automatically logs in the user on startup if a valid token or saved credentials exist, improving user experience.
    *   **Token Management:** Enhanced `TokenManager` to handle JWT parsing to extract `userId`, check token validity (expiration), and securely store credentials. Added `java-jwt` dependency for this.
    *   **Logout:** Improved the logout function to clear all stored tokens and user credentials from `SharedPreferences`.

*   **feat(Validation):**
    *   Introduced `ValidationUtils` to provide real-time validation for phone number, password, and nickname fields on the `LoginScreen`.
    *   Input fields now display specific error messages to guide the user (e.g., "Password must contain a letter," "Invalid phone number format").

*   **refactor(LoginScreen):**
    *   Redesigned the `LoginScreen` to support both login and registration (`AuthMode`) with animated transitions between modes and form fields.
    *   Form submission buttons are dynamically enabled based on validation results.
    *   After successful registration, the user is now automatically logged in.

*   **refactor(UserViewModel):**
    *   Integrated auto-login logic (`checkAutoLogin`) that runs on initialization.
    *   Refactored `login` and `register` flows to handle token storage and fetch user profile data immediately after authentication.
    *   Added `isLoggedIn()` to provide a reliable check of the current authentication state.

*   **refactor(TopBar):**
    *   The top bar avatar now correctly reflects the user's login state. It displays the user's avatar when logged in and a generic app icon when logged out.
    *   Clicking the avatar/icon now navigates to the `UserScreen` if logged in, or the `LoginScreen` if not.
2025-10-07 00:06:37 +08:00

18 lines
609 B
XML

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-10-06T14:55:34.827294Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=6fbe7ac" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>
</project>