mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Update
This commit is contained in:
@@ -3,8 +3,10 @@ import 'package:cookie_jar/cookie_jar.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
final dio = Dio();
|
||||
SharedPreferences? _prefs;
|
||||
|
||||
Future<void> prepareJar() async {
|
||||
final Directory appDocDir = await getApplicationDocumentsDirectory();
|
||||
@@ -14,3 +16,14 @@ Future<void> prepareJar() async {
|
||||
);
|
||||
dio.interceptors.add(CookieManager(jar));
|
||||
}
|
||||
|
||||
Future<void> preparePrefs() async {
|
||||
_prefs = await SharedPreferences.getInstance();
|
||||
}
|
||||
|
||||
SharedPreferences get prefs {
|
||||
if (_prefs == null) {
|
||||
throw Exception('SharedPreferences not initialized');
|
||||
}
|
||||
return _prefs!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user