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(sdk)!: allow passing Activity for passive sitekeys #146

Merged
merged 6 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# 4.0.0

- Feature: accept `HCaptcha.getClient(Activity)` for passive `siteKey`s (#112)
- Feat (breaking change): accept `HCaptcha.getClient(Activity)` for passive sitekeys. (#112)

# 3.11.0

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ To remove a specific listener you may use `HCaptcha.removeOn[Success|Failure|Ope

To remove all listeners you may use `HCaptcha.removeAllListener()`.

Note: For a regular use-case (Visual Challenge validation), `HCaptcha.getClient(Activity)` must be called with `FragmentActivity` instance
Note ⚠️: For the regular use-case (visual challenge validation), `HCaptcha.getClient(Activity)` must be called with `FragmentActivity` instance. `Activity` is allowed only when `hideDialog=true`.


```java
...
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/hcaptcha/sdk/HCaptcha.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void onFailure(final HCaptchaException exception) {
captchaVerifier = HCaptchaDialogFragment.newInstance(inputConfig, internalConfig, listener);
this.config = inputConfig;
} else {
throw new IllegalStateException("Visual Challenge verification require FragmentActivity");
throw new IllegalStateException("Visual hCaptcha challenge verification requires FragmentActivity.");
}
} catch (AndroidRuntimeException e) {
listener.onFailure(new HCaptchaException(HCaptchaError.ERROR));
Expand Down