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:
@@ -4,9 +4,11 @@ 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';
|
||||
import 'api/client.dart';
|
||||
|
||||
final dio = Dio();
|
||||
final dio = Dio()..options.validateStatus = (int? _) {return true;};
|
||||
SharedPreferences? _prefs;
|
||||
EHApi? _api;
|
||||
|
||||
Future<void> prepareJar() async {
|
||||
final Directory appDocDir = await getApplicationDocumentsDirectory();
|
||||
@@ -27,3 +29,18 @@ SharedPreferences get prefs {
|
||||
}
|
||||
return _prefs!;
|
||||
}
|
||||
|
||||
void initApi(String baseUrl) {
|
||||
_api = EHApi(dio, baseUrl: baseUrl);
|
||||
}
|
||||
|
||||
bool get apiInited {
|
||||
return _api != null;
|
||||
}
|
||||
|
||||
EHApi get api {
|
||||
if (_api == null) {
|
||||
throw Exception('EHApi not initialized');
|
||||
}
|
||||
return _api!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user