mangayomi/lib/services/http_service/cloudflare/cookie.dart
kodjomoustapha a7d801e210 +
2023-09-14 19:54:15 +01:00

21 lines
862 B
Dart

import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:mangayomi/services/http_service/cloudflare/providers/cookie_providers.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'cookie.g.dart';
@riverpod
Future setCookie(SetCookieRef ref, String sourceId, String url) async {
CookieManager cookie = CookieManager.instance();
final cookies = await cookie.getCookies(url: Uri.parse(url.toString()));
final newCookie = cookies.map((e) => "${e.name}=${e.value}").join("; ");
setCookieBA(newCookie, sourceId);
}
Future setCookieB(String sourceId, String url) async {
CookieManager cookie = CookieManager.instance();
final cookies = await cookie.getCookies(url: Uri.parse(url.toString()));
final newCookie = cookies.map((e) => "${e.name}=${e.value}").join("; ");
setCookieBA(newCookie, sourceId);
}