feat(appcheck): implement RecaptchaEnterpriseProvider and tests#16150
Conversation
Using Gemini Code AssistThe 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 by creating a comment using either
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 Limitations & Feedback Gemini Code Assist 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
Generated by 🚫 Danger |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds the reCAPTCHA Enterprise provider to Firebase App Check, including the FIRRecaptchaEnterpriseProvider class, its factory, and unit tests. Feedback identifies a potential runtime crash in the provider's initialization, recommends removing unused code in the test suite, and suggests using standard XCTest macros for consistency.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check, including the provider and factory implementations, new logging constants, and unit tests. Additionally, the Package.swift file was updated with a helper function to support local or branch-based dependencies for the App Check core. The review feedback suggests refining the API by removing unnecessary nullability from the factory initializer and improving test reliability by using a single NSDate instance for consistent timestamps in unit tests.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check, including the provider implementation, a factory for instantiation, and associated unit tests. It also updates the project's dependency management in Package.swift to support the new provider and allow for more flexible dependency resolution. Feedback was provided regarding code duplication in the completion handlers of the new provider class to improve maintainability.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the reCAPTCHA Enterprise provider to Firebase App Check, adding the provider and factory implementations, error logging for incomplete configurations, and unit tests. The feedback recommends implementing runtime validation to ensure the siteKey is not empty during initialization and suggests removing an unnecessary empty line in the Package.swift file.
| return self; | ||
| } | ||
|
|
||
| - (nullable instancetype)initWithApp:(FIRApp *)app siteKey:(NSString *)siteKey { |
There was a problem hiding this comment.
It is recommended to validate that siteKey is not an empty string before proceeding with initialization. While NS_ASSUME_NONNULL handles nullability at compile-time, a runtime check or assertion for an empty string can prevent issues with the underlying GACRecaptchaEnterpriseProvider.
- (nullable instancetype)initWithApp:(FIRApp *)app siteKey:(NSString *)siteKey {
if (siteKey.length == 0) {
return nil;
}|
|
||
| @implementation FIRAppCheckRecaptchaEnterpriseProviderFactory | ||
|
|
||
| - (instancetype)initWithSiteKey:(NSString *)siteKey { |
There was a problem hiding this comment.
Similar to the provider initialization, it is good practice to ensure the siteKey provided to the factory is not empty.
| - (instancetype)initWithSiteKey:(NSString *)siteKey { | |
| - (instancetype)initWithSiteKey:(NSString *)siteKey { | |
| NSParameterAssert(siteKey.length > 0); | |
| self = [super init]; |
| .product(name: "RecaptchaEnterpriseProvider", package: "app-check"), | ||
| .product(name: "GULEnvironment", package: "GoogleUtilities"), | ||
|
|
||
| .product(name: "GULUserDefaults", package: "GoogleUtilities"), |
There was a problem hiding this comment.
There is an unnecessary empty line introduced here. It's better to keep the dependency list compact.
| .product(name: "RecaptchaEnterpriseProvider", package: "app-check"), | |
| .product(name: "GULEnvironment", package: "GoogleUtilities"), | |
| .product(name: "GULUserDefaults", package: "GoogleUtilities"), | |
| .product(name: "RecaptchaEnterpriseProvider", package: "app-check"), | |
| .product(name: "GULEnvironment", package: "GoogleUtilities"), | |
| .product(name: "GULUserDefaults", package: "GoogleUtilities"), |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds the reCAPTCHA Enterprise provider to Firebase App Check, including provider and factory implementations, logging, and unit tests. The Package.swift file was also updated to support dynamic dependency resolution. Feedback identifies minor style issues, specifically unnecessary blank lines and inconsistent indentation.
| NSArray<NSString *> *missingOptionsFields = | ||
|
|
||
| [FIRAppCheckValidator tokenExchangeMissingFieldsInOptions:app.options]; |
There was a problem hiding this comment.
There is an unnecessary blank line and inconsistent indentation here. It's better to keep the assignment clean and follow standard continuation indentation.
| NSArray<NSString *> *missingOptionsFields = | |
| [FIRAppCheckValidator tokenExchangeMissingFieldsInOptions:app.options]; | |
| NSArray<NSString *> *missingOptionsFields = | |
| [FIRAppCheckValidator tokenExchangeMissingFieldsInOptions:app.options]; |
| .product(name: "GULUserDefaults", package: "GoogleUtilities"), | ||
|
|
||
| ], |
Depends on google/app-check#94