Skip to content

Fix Login/Signup Service Redirection Issue #465 #478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

prangowda
Copy link

This PR addresses issue #465 where the login/signup service was not properly redirecting users after authentication actions.

Changes Made:

  • Modified navigation in LoginScreen from Get.offNamed() to Get.toNamed() to preserve navigation history
  • Added explicit redirection to home screen after successful login/signup using Get.offAllNamed()

Fixes #465

I've added a straightforward "Quick Setup Guide" to the README. It includes:

1) A list of things you need before getting started.

2) Simple step-by-step instructions with commands to set everything up.

3)  Key configuration details you should know.
4)  A direct link to the full onboarding guide for more details.
### Pull Request: Add Length Restrictions to Room Input Parameters

#### Description
This PR introduces length restrictions on the input parameters for the Room Title and Description fields in the `RoomInput` component. The goal is to prevent UI overflow and ensure that the application remains stable even when users attempt to input excessively long text.

#### Changes Made
- **Character Limits**: 
  - Set a maximum character limit of **50** for the Room Title.
  - Set a maximum character limit of **200** for the Room Description.
  
- **Input Validation**: 
  - Implemented validation logic in the `handleTitleChange` and `handleDescriptionChange` functions to restrict input length.
  - Added visual feedback to users by displaying the current character count alongside the input fields.

#### Motivation
This change is crucial to enhance the user experience and maintain the integrity of the application. By enforcing these limits, we can prevent potential UI issues that may arise from excessively long input, ensuring that the application remains user-friendly and visually appealing.

#### Linter Errors
Please note that there is a linter error indicating that the module 'react' cannot be found. This may require additional setup or installation of type declarations for React in the project.

#### Testing
- Manually tested the input fields to ensure that the character limits are enforced correctly.
- Verified that the character count updates in real-time as the user types.


#### Additional Notes
Please review the changes and let me know if there are any further modifications or improvements needed.
This implementation provides a basic structure for handling automatic reconnection in your LiveKit integration. You can expand upon this by adding more detailed user notifications and handling specific error cases during reconnection attempts.
1. Logout Method: Ensure the logout method clears the session and redirects the user.
2. Button Action: Verify that the button correctly calls the logout method
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @prangowda, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request addresses issue #465, which involves improper redirection after login/signup actions. The primary changes involve modifying the navigation logic in the LoginScreen and adding explicit redirection to the home screen after successful authentication. Additionally, there are updates to the PR template, README, and new files related to connection status and settings.

Highlights

  • Navigation Fix: Modified navigation in LoginScreen from Get.offNamed() to Get.toNamed() to preserve navigation history and added explicit redirection to the home screen after successful login/signup using Get.offAllNamed().
  • Form Field Clearing: Added a _clearFormFields() method in LoginScreen to clear email, password, and confirm password fields upon navigation away from the screen.
  • New Features: Added new files for connection management (connection_controller.dart, connection_status_widget.dart) and settings screen (settings_screen.dart) with logout functionality.
  • Documentation: Updated the README with a quick setup guide including prerequisites and basic setup steps.

Changelog

Click here to see the changelog
  • .github/PULL_REQUEST_TEMPLATE.md
    • Added a section for 'Additional Changes' to include cleanup logic for the leaveRoom method.
  • README.md
    • Added a 'Quick Setup Guide' section with prerequisites and basic setup steps for the project.
  • app/components/RoomInput.tsx
    • Created a new RoomInput component with title and description input fields, including character limits and display of current character count.
  • lib/controllers/connection_controller.dart
    • Created a ConnectionController using GetX to manage connection status and reconnection attempts.
  • lib/screens/settings_screen.dart
    • Created a SettingsScreen with a logout button that calls the authService.logout() method.
  • lib/services/auth_service.dart
    • Added a logout() method to clear the user session and redirect to the login screen using Get.offAllNamed('/login').
  • lib/services/livekit_service.dart
    • Created a LiveKitService to handle connection loss and reconnection attempts, including a reconnection loop and user notification.
  • lib/views/screens/login_screen.dart
    • Replaced individual clear() calls with _clearFormFields() for form fields in PopScope's onPopInvokedWithResult.
    • Modified login button's functionality to navigate to the home screen (AppRoutes.home) upon successful login using Get.offAllNamed().
    • Changed Get.offNamed() to Get.toNamed() for 'Forgot Password?' and 'Register' links, preserving navigation history, and added _clearFormFields() before navigation.
    • Added a _clearFormFields() method to clear form fields.
  • lib/widgets/connection_status_widget.dart
    • Created a ConnectionStatusWidget to display the connection status and reconnection attempts using Obx to react to changes in ConnectionController.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A screen's redirection,
A path now clearly defined,
Home is where we go.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR addresses a redirection issue in the login/signup service and introduces a quick setup guide in the README. The changes in LoginScreen improve navigation and form handling. The addition of ConnectionController and LiveKitService suggests enhanced connection management. Overall, the PR seems well-structured and addresses the stated issue.

Summary of Findings

  • Redirection Logic: The redirection logic in LoginScreen has been modified to use Get.offAllNamed() after successful login, ensuring a clean navigation stack. This addresses the original issue of improper redirection.
  • Form Field Clearing: The _clearFormFields() method in LoginScreen is now used consistently across different navigation actions, ensuring that form fields are cleared when navigating away from the login screen.
  • README Quick Setup Guide: A quick setup guide has been added to the README, providing users with a simplified set of instructions to get the project up and running quickly.

Merge Readiness

The pull request addresses the stated issue and includes improvements to the login/signup redirection logic. The addition of a quick setup guide in the README is also beneficial. I recommend merging this pull request after addressing the review comments. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging.

Comment on lines +27 to +29
// Implement your reconnection logic here
// Return true if successful, false otherwise
}

Choose a reason for hiding this comment

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

high

The reconnect() method is currently empty. It should contain the actual reconnection logic. Without this, the reconnection attempts will always fail.

    Future<bool> reconnect() async {
        // Implement your reconnection logic here
        // For example:
        // try {
        //   await LiveKit.connect(url, token);
        //   return true;
        // } catch (e) {
        //   print('Reconnection failed: $e');
        //   return false;
        // }
        return false; // Replace with actual logic
    }

Comment on lines +117 to +121
final success = await controller.login();
if (success) {
// Navigate to home or dashboard after successful login
Get.offAllNamed(AppRoutes.home);
}

Choose a reason for hiding this comment

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

medium

It would be beneficial to handle the case where success is false. Currently, if controller.login() fails (returns false), there is no feedback to the user. Consider adding an error message or logging the failure.

                                final success = await controller.login();
                                if (success) {
                                  // Navigate to home or dashboard after successful login
                                  Get.offAllNamed(AppRoutes.home);
                                } else {
                                  // Handle login failure, show error message
                                  print('Login failed'); // Replace with user-friendly message
                                }

Comment on lines +31 to +33
void notifyUser(String message) {
// Implement user notification logic here
}

Choose a reason for hiding this comment

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

medium

The notifyUser() method is also empty. It should contain the logic to notify the user about the reconnection status (success or failure).

    void notifyUser(String message) {
        // Implement user notification logic here
        // For example:
        // Get.snackbar('Connection Status', message);
    }

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.

The Login/Signup service has no redirection
1 participant