Skip to content

fix(sdk): alt dimming#249

Merged
e271828- merged 3 commits into
fix/alt_dimmingfrom
fix/alt_dimming_regular_sdk
Mar 23, 2026
Merged

fix(sdk): alt dimming#249
e271828- merged 3 commits into
fix/alt_dimmingfrom
fix/alt_dimming_regular_sdk

Conversation

@CAMOBAP

@CAMOBAP CAMOBAP commented Mar 22, 2026

Copy link
Copy Markdown
Collaborator
  • fix(sdk): prevent stale readyForInteraction after dialog dismiss
  • chore: remove no-op Setup button and setupArmed state
  • chore: allow change siteKey in runtime

Issue demo (missing dimming where it should be for Normal and Compact):

Screenshot_1774218678 Screenshot_1774218694

@CAMOBAP CAMOBAP requested review from DSergiu and e271828- March 22, 2026 22:40
@CAMOBAP CAMOBAP self-assigned this Mar 22, 2026
@github-actions

Copy link
Copy Markdown

Diffuse report:

OLD: sdk-main.aar
NEW: sdk-pr.aar

 AAR      │ old       │ new       │ diff      
──────────┼───────────┼───────────┼───────────
      jar │  94.7 KiB │  65.5 KiB │ -29.1 KiB 
 manifest │     411 B │     411 B │       0 B 
      res │  78.2 KiB │  78.2 KiB │       0 B 
    other │     1 KiB │     1 KiB │       0 B 
──────────┼───────────┼───────────┼───────────
    total │ 174.3 KiB │ 145.2 KiB │ -29.1 KiB 

 JAR     │ old │ new │ diff           
─────────┼─────┼─────┼────────────────
 classes │  61 │  40 │  -21 (+0 -21)  
 methods │ 800 │ 603 │ -197 (+6 -203) 
  fields │ 270 │ 188 │  -82 (+0 -82)
AAR
 size     │ diff      │ path          
──────────┼───────────┼───────────────
 65.5 KiB │ -29.1 KiB │ ∆ classes.jar 
──────────┼───────────┼───────────────
 65.5 KiB │ -29.1 KiB │ (total)
JAR
CLASSES:

   old │ new │ diff         
  ─────┼─────┼──────────────
   61  │ 40  │ -21 (+0 -21) 
  
  - com.hcaptcha.sdk.journeylitics.EventKind
  - com.hcaptcha.sdk.journeylitics.FieldKey
  - com.hcaptcha.sdk.journeylitics.InMemorySink
  - com.hcaptcha.sdk.journeylitics.JLConfig
  - com.hcaptcha.sdk.journeylitics.JLEvent
  - com.hcaptcha.sdk.journeylitics.JLSink
  - com.hcaptcha.sdk.journeylitics.Journeylitics_1_1
  - com.hcaptcha.sdk.journeylitics.Journeylitics_1
  - com.hcaptcha.sdk.journeylitics.Journeylitics_10
  - com.hcaptcha.sdk.journeylitics.Journeylitics_2
  - com.hcaptcha.sdk.journeylitics.Journeylitics_3_1
  - com.hcaptcha.sdk.journeylitics.Journeylitics_3
  - com.hcaptcha.sdk.journeylitics.Journeylitics_4
  - com.hcaptcha.sdk.journeylitics.Journeylitics_5
  - com.hcaptcha.sdk.journeylitics.Journeylitics_6
  - com.hcaptcha.sdk.journeylitics.Journeylitics_7
  - com.hcaptcha.sdk.journeylitics.Journeylitics_8
  - com.hcaptcha.sdk.journeylitics.Journeylitics_9
  - com.hcaptcha.sdk.journeylitics.Journeylitics_ListenerLookup
  - com.hcaptcha.sdk.journeylitics.Journeylitics
  - com.hcaptcha.sdk.journeylitics.MetaMapHelper
  

METHODS:

   old │ new │ diff           
  ─────┼─────┼────────────────
   800 │ 603 │ -197 (+6 -203) 
  
  + com.hcaptcha.sdk.HCaptcha access_200(HCaptcha, long)
  + com.hcaptcha.sdk.HCaptcha access_300(HCaptcha) → Handler
  + com.hcaptcha.sdk.HCaptcha access_400(HCaptcha, Object)
  + com.hcaptcha.sdk.HCaptcha access_500(HCaptcha, HCaptchaException)
  + com.hcaptcha.sdk.HCaptchaConfig <init>(String, Boolean, Boolean, Boolean, String, String, String, String, String, String, String, String, HCaptchaSize, HCaptchaOrientation, HCaptchaTheme, HCaptchaRenderMode, String, String, Boolean, IHCaptchaRetryPredicate, long, Boolean, Boolean)
  + com.hcaptcha.sdk.HCaptchaVerifyParams <init>(String, String, String)
  
  - com.hcaptcha.sdk.HCaptcha access_200(HCaptcha) → InMemorySink
  - com.hcaptcha.sdk.HCaptcha access_300(HCaptcha, long)
  - com.hcaptcha.sdk.HCaptcha access_400(HCaptcha) → Handler
  - com.hcaptcha.sdk.HCaptcha access_500(HCaptcha, Object)
  - com.hcaptcha.sdk.HCaptcha access_600(HCaptcha, HCaptchaException)
  - com.hcaptcha.sdk.HCaptcha stopEvents()
  - com.hcaptcha.sdk.HCaptchaConfig _default_userJourney() → Boolean
  - com.hcaptcha.sdk.HCaptchaConfig <init>(String, Boolean, Boolean, Boolean, String, String, String, String, String, String, String, String, HCaptchaSize, HCaptchaOrientation, HCaptchaTheme, HCaptchaRenderMode, String, String, Boolean, IHCaptchaRetryPredicate, long, Boolean, Boolean, Boolean)
  - com.hcaptcha.sdk.HCaptchaConfig access_1700() → Boolean
  - com.hcaptcha.sdk.HCaptchaConfig getUserJourney() → Boolean
  - com.hcaptcha.sdk.HCaptchaConfig setUserJourney(Boolean)
  - com.hcaptcha.sdk.HCaptchaConfig_HCaptchaConfigBuilder userJourney(Boolean) → HCaptchaConfig_HCaptchaConfigBuilder
  - com.hcaptcha.sdk.HCaptchaVerifyParams <init>(String, String, String, Object)
  - com.hcaptcha.sdk.HCaptchaVerifyParams getUserJourney() → Object
  - com.hcaptcha.sdk.HCaptchaVerifyParams setUserJourney(Object)
  - com.hcaptcha.sdk.HCaptchaVerifyParams_HCaptchaVerifyParamsBuilder userJourney(Object) → HCaptchaVerifyParams_HCaptchaVerifyParamsBuilder
  - com.hcaptcha.sdk.IHCaptcha stopEvents()
  - com.hcaptcha.sdk.journeylitics.EventKind _values() → EventKind[]
  - com.hcaptcha.sdk.journeylitics.EventKind <clinit>()
  - com.hcaptcha.sdk.journeylitics.EventKind <init>(String, int, String)
  - com.hcaptcha.sdk.journeylitics.EventKind getValue() → String
  - com.hcaptcha.sdk.journeylitics.EventKind valueOf(String) → EventKind
  - com.hcaptcha.sdk.journeylitics.EventKind values() → EventKind[]
  - com.hcaptcha.sdk.journeylitics.FieldKey _values() → FieldKey[]
  - com.hcaptcha.sdk.journeylitics.FieldKey <clinit>()
  - com.hcaptcha.sdk.journeylitics.FieldKey <init>(String, int, String)
  - com.hcaptcha.sdk.journeylitics.FieldKey getJsonKey() → String
  - com.hcaptcha.sdk.journeylitics.FieldKey valueOf(String) → FieldKey
  - com.hcaptcha.sdk.journeylitics.FieldKey values() → FieldKey[]
  - com.hcaptcha.sdk.journeylitics.InMemorySink <init>()
  - com.hcaptcha.sdk.journeylitics.InMemorySink clearEvents()
  - com.hcaptcha.sdk.journeylitics.InMemorySink emit(JLEvent)
  - com.hcaptcha.sdk.journeylitics.InMemorySink getAndClearEvents() → List
  - com.hcaptcha.sdk.journeylitics.InMemorySink getEvents() → List
  - com.hcaptcha.sdk.journeylitics.JLConfig <clinit>()
  - com.hcaptcha.sdk.journeylitics.JL
...✂

@DSergiu DSergiu changed the title Fix/alt dimming regular sdk fix(sdk): alt dimming Mar 23, 2026
@github-actions

Copy link
Copy Markdown

Benchmark report:

Test name Time ms. (median) Allocations (median)
com.hcaptcha.sdk.HCaptchaBenchmarkTest.EMULATOR_UNLOCKED_benchmarkInvisibleVerification +518.03 +770
com.hcaptcha.sdk.HCaptchaBenchmarkTest.EMULATOR_UNLOCKED_benchmarkInvisibleVerificationColdRun +511.07 +1204
com.hcaptcha.sdk.HCaptchaBenchmarkTest.EMULATOR_UNLOCKED_benchmarkInvisibleSetup +8.48 +423
com.hcaptcha.sdk.HCaptchaDebugInfoTest.EMULATOR_UNLOCKED_benchmarkDebugInfo +21.31 -5592
com.hcaptcha.sdk.HCaptchaDebugInfoTest.EMULATOR_UNLOCKED_benchmarkDebugSys +93.92 +76

@e271828- e271828- merged commit c6e192f into fix/alt_dimming Mar 23, 2026
23 of 24 checks passed
@e271828- e271828- deleted the fix/alt_dimming_regular_sdk branch March 23, 2026 12:17
e271828- added a commit that referenced this pull request Mar 23, 2026
* fix(compose-sdk): restore dialog dim after hidden loading

Keep Compose dialog dimming aligned with the View SDK when loading is disabled.

Intended behavior:
- If loading=false, the dialog should start without the dim-behind backdrop while the captcha is still hidden/loading.
- If a visible checkbox is rendered, the dialog should regain its normal dimmed backdrop as soon as the checkbox is shown.
- If an invisible flow escalates into a visible challenge, the dialog should regain its normal dimmed backdrop when that visible state is entered.
- Unchanged flows such as embedded rendering, dialog cancellation, and preloaded WebView reuse should keep their prior behavior.

Implementation:
- Track dialog dimming as Compose state instead of repeatedly mutating the window from a global layout listener.
- Restore dim on the same semantic transitions used by the View SDK: Loaded for checkbox sizes, Opened for invisible flows.
- Centralize window flag updates in a dialog setup helper that preserves and restores the window's original dim configuration.

Tests:
- Add emulator-backed coverage for the loading=false hidden state.
- Add emulator-backed coverage for dim restoration when a checkbox becomes visible.
- Add emulator-backed coverage for the invisible-flow dim restoration state transition.
- Preserve existing Compose behavior checks for embedded mode, dialog cancellation, and WebView reuse.

* fix(sdk): alt dimming (#249)

* chore: allow change siteKey in runtime

* chore: remove no-op Setup button and setupArmed state

* fix(sdk): prevent stale readyForInteraction after dialog dismiss

---------

Co-authored-by: Aliaksandr Babrykovich <aliaksandr.babrykovich@callstack.com>

---------

Co-authored-by: Alex Babrykovich <abobrikovich@gmail.com>
Co-authored-by: Aliaksandr Babrykovich <aliaksandr.babrykovich@callstack.com>
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.

3 participants