Skip to content
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

Feat/keep browser open #21

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

trunges21
Copy link
Contributor

@trunges21 trunges21 commented Mar 7, 2024

Explain your changes

Suppose there is a related issue with enough detail for a reviewer to understand your changes fully. In that case, you can omit an explanation and instead include either “Fixes #XX” or “Updates #XX” where “XX” is the issue number.

Checklist

🛟 If you need help, consider asking for advice over in the Kinde community.

Summary by CodeRabbit

  • New Features
    • Introduced forceTokenRefresh option for refreshing access tokens.
    • Added forceCloseOnRedirection and showInRecents options in the SDK Utils module for enhanced web browser control.
  • Enhancements
    • Merged existing and new parameters in the authenticate method for improved flexibility.
    • Updated the SDK version to ReactNative/1.2.3.
  • Tests
    • Enhanced testing suite with functionalities including claims, permissions, organizations, user details, flags, and token refresh testing.
  • Refactor
    • Updated the projectName variable for consistency.
    • Removed unused ApiClient import and usage in tests.
    • Improved FormDataMock for better test reliability.

Copy link

coderabbitai bot commented Mar 7, 2024

Walkthrough

The update enhances the React Native SDK for Kinde, focusing on authentication improvements, token management, and user interface options. It introduces merging additional parameters in the authentication process, a method for forced token refresh, and updates the SDK version. Additionally, it adds options for web browser behavior in the SDK Utils module and revises testing strategies by removing outdated dependencies and incorporating new functionality tests.

Changes

File Path Changes
.../KindeReactNativeGenerator.java Updated projectName to "@kinde-oss/react-native-sdk-0-7x".
.../SDK/KindeSDK.mustache Added additionalParametersMerged and forceTokenRefresh. Updated SDK version to ReactNative/1.2.3.
.../SDK/Utils.mustache Added forceCloseOnRedirection and showInRecents options to openWebBrowser.
.../index.spec.mustache Removed ApiClient import, modified FormDataMock, and added new tests.

🐰🌟
In the realm of code, where changes abound,
A rabbit hopped in, improvements found.
With tokens refreshed and parameters merged,
The SDK's power, through versions, surged.
🚀📱 "Hop to success!" it cheerily said,
As into the future, the updates led.
🐾💻

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1cb22dc and 6f8f546.
Files ignored due to path filters (2)
  • bin/configs/kinde-react-native.yaml is excluded by: !**/*.yaml
  • kinde-mgmt-api-specs.yaml is excluded by: !**/*.yaml
Files selected for processing (4)
  • generators/react-native/src/main/java/com/kinde/codegen/KindeReactNativeGenerator.java (1 hunks)
  • generators/react-native/src/main/resources/react-native/SDK/KindeSDK.mustache (3 hunks)
  • generators/react-native/src/main/resources/react-native/SDK/Utils.mustache (1 hunks)
  • generators/react-native/src/main/resources/react-native/index.spec.mustache (5 hunks)
Additional comments: 8
generators/react-native/src/main/resources/react-native/SDK/Utils.mustache (1)
  • 194-195: The addition of forceCloseOnRedirection and showInRecents options to the openWebBrowser function enhances the control developers have over the browser's behavior. However, it's crucial to ensure that these options are documented clearly, including their default values and impact on the browser's behavior. This will help developers understand how to use these options effectively.

Consider adding detailed documentation for these new options in the SDK's official documentation or inline comments.

generators/react-native/src/main/resources/react-native/SDK/KindeSDK.mustache (3)
  • 136-139: The implementation of additionalParametersMerged in the register method correctly merges existing and new additional parameters. This approach ensures that any custom parameters provided during registration are combined with the default parameters set during the SDK initialization. This is a good practice as it allows for flexibility and customization in the authentication process.
  • 267-291: The forceTokenRefresh method is a valuable addition for managing token lifecycle. However, it's important to handle the case where the token refresh fails more gracefully. Currently, if the refresh fails, null is returned, which might not be informative enough for the developer to understand the cause of the failure.

Consider throwing a custom exception or returning a more descriptive error object in case of token refresh failure. This would help developers implement more robust error handling in their applications.

  • 306-306: Updating the Kinde-SDK version in the fetchToken method's headers to ReactNative/1.2.3 is a good practice as it helps with tracking the SDK version used in API requests. This can be beneficial for debugging and analytics purposes.
generators/react-native/src/main/resources/react-native/index.spec.mustache (3)
  • 23-26: The introduction of a symbol for state in FormDataMock is a good practice for encapsulating the internal state and preventing accidental access or modification from outside the class. This change enhances the maintainability and security of the mock implementation.
  • 29-31: Adding an append method to FormDataMock is a necessary enhancement for mimicking the behavior of the FormData API, allowing for a more accurate simulation of form data manipulation in tests. This addition improves the testability of components that interact with FormData.
  • 871-1177: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [758-1161]

The added tests cover a wide range of functionalities, including claims, permissions, organizations, user details, flags, and token refresh mechanisms. It's commendable that the tests are thorough and seem to cover both positive and negative scenarios. However, ensure that edge cases and error handling paths are also adequately tested to improve the robustness of the SDK.

generators/react-native/src/main/java/com/kinde/codegen/KindeReactNativeGenerator.java (1)
  • 47-47: The update of the projectName variable to "@kinde-oss/react-native-sdk-0-7x" correctly reflects the intended minor version or variant change in the SDK. This change is clear and aligns with the PR objectives.

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.

2 participants