feat(ios): hashcash in swift (#8602)

This commit is contained in:
Brooooooklyn
2024-10-29 08:40:15 +00:00
parent efee4dfd66
commit 5709ebbb11
10 changed files with 152 additions and 9 deletions
@@ -11,10 +11,8 @@ export const Captcha = () => {
const isLoading = useLiveData(captchaService.isLoading$);
const verifyToken = useLiveData(captchaService.verifyToken$);
useEffect(() => {
if (hasCaptchaFeature) {
captchaService.revalidate();
}
}, [captchaService, hasCaptchaFeature]);
captchaService.revalidate();
}, [captchaService]);
const handleTurnstileSuccess = useCallback(
(token: string) => {
@@ -7,7 +7,7 @@ import {
onStart,
Service,
} from '@toeverything/infra';
import { EMPTY, mergeMap, switchMap } from 'rxjs';
import { EMPTY, exhaustMap, mergeMap } from 'rxjs';
import type { ValidatorProvider } from '../provider/validator';
import type { FetchService } from './fetch';
@@ -31,7 +31,7 @@ export class CaptchaService extends Service {
}
revalidate = effect(
switchMap(() => {
exhaustMap(() => {
return fromPromise(async signal => {
if (!this.needCaptcha$.value) {
return {};