-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: create WebView before xml inflation * feat: compose-sdk wrap HCaptchaWebView into remember * chore: upgrade com.android.tools.build:gradle:8.7.3 * chore: bump version 4.1.0 * chore: make log statements follow format "identifier: message" Co-authored-by: Sergiu D. <danalachi.sergiu@gmail.com> --------- Co-authored-by: Sergiu D. <danalachi.sergiu@gmail.com>
- Loading branch information
Showing
22 changed files
with
223 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Changelog | ||
|
||
# 4.1.0 | ||
|
||
- Feat: preload WebView on `setup` call | ||
|
||
# 4.0.5 | ||
|
||
- compose-sdk: set minSdk to 21 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
compose-sdk/src/main/java/com/hcaptcha/sdk/HCaptchaComposeVerifier.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.hcaptcha.sdk | ||
|
||
import android.app.Activity | ||
import androidx.compose.runtime.State | ||
|
||
internal class HCaptchaComposeVerifier( | ||
private val config: HCaptchaConfig, | ||
private val onResult: (HCaptchaResponse) -> Unit, | ||
private val helperState: State<HCaptchaWebViewHelper?> | ||
) : IHCaptchaVerifier { | ||
|
||
override fun onLoaded() { | ||
onResult(HCaptchaResponse.Event(HCaptchaEvent.Loaded)) | ||
if (config.hideDialog) { | ||
helperState.value?.resetAndExecute() ?: run { | ||
HCaptchaLog.w("HCaptchaWebViewHelper wasn't created, report but to developer") | ||
onResult(HCaptchaResponse.Failure(HCaptchaError.INTERNAL_ERROR)) | ||
} | ||
} | ||
} | ||
|
||
override fun onOpen() { | ||
onResult(HCaptchaResponse.Event(HCaptchaEvent.Opened)) | ||
} | ||
|
||
override fun onSuccess(result: String) { | ||
onResult(HCaptchaResponse.Success(result)) | ||
} | ||
|
||
override fun onFailure(exception: HCaptchaException) { | ||
onResult(HCaptchaResponse.Failure(exception.hCaptchaError)) | ||
} | ||
|
||
override fun startVerification(activity: Activity) { | ||
error("startVerification should never be reached") | ||
} | ||
|
||
override fun reset() { | ||
error("reset should never be reached") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.