mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 14:29:35 +00:00
更改appName等常量为全局变量
This commit is contained in:
parent
896f8837bd
commit
e2aa73c01c
35 changed files with 167 additions and 216 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:vaani/settings/constants.dart';
|
||||
import 'package:vaani/globals.dart';
|
||||
|
||||
final imageCacheManager = CacheManager(
|
||||
Config(
|
||||
'${AppMetadata.appNameLowerCase}_image_cache',
|
||||
'${appName}_image_cache',
|
||||
stalePeriod: const Duration(days: 365 * 10),
|
||||
repo: JsonCacheInfoRepository(),
|
||||
maxNrOfCacheObjects: 1000,
|
||||
|
|
@ -12,7 +12,7 @@ final imageCacheManager = CacheManager(
|
|||
|
||||
final apiResponseCacheManager = CacheManager(
|
||||
Config(
|
||||
'${AppMetadata.appNameLowerCase}_api_response_cache',
|
||||
'${appName}_api_response_cache',
|
||||
stalePeriod: const Duration(days: 7),
|
||||
repo: JsonCacheInfoRepository(),
|
||||
maxNrOfCacheObjects: 1000,
|
||||
|
|
|
|||
|
|
@ -1,27 +1,19 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:vaani/main.dart';
|
||||
import 'package:vaani/settings/constants.dart';
|
||||
import 'package:vaani/globals.dart';
|
||||
|
||||
import 'register_models.dart';
|
||||
|
||||
// does the initial setup of the storage
|
||||
Future initStorage() async {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
// final dir = await getApplicationDocumentsDirectory();
|
||||
|
||||
// use vaani as the directory for hive
|
||||
final storageDir = Directory(
|
||||
p.join(
|
||||
dir.path,
|
||||
AppMetadata.appNameLowerCase,
|
||||
),
|
||||
);
|
||||
await storageDir.create(recursive: true);
|
||||
// // use vaani as the directory for hive
|
||||
// final storageDir = Directory(
|
||||
// p.join(dir.path, appName),
|
||||
// );
|
||||
// await storageDir.create(recursive: true);
|
||||
|
||||
Hive.defaultDirectory = storageDir.path;
|
||||
Hive.defaultDirectory = appStorageDir.path;
|
||||
appLogger.config('Hive storage directory init: ${Hive.defaultDirectory}');
|
||||
|
||||
await registerModels();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue