mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 09:47:35 +08:00
Save Notes Cache in the cache directory
It shouldn't be saved in the Documents folder. Now that this folder is exposed on ios, I should remove all non-user related files from here.
This commit is contained in:
@ -83,6 +83,7 @@ class JournalApp extends StatefulWidget {
|
||||
settings.localGitRepoConfigured = true;
|
||||
settings.save();
|
||||
}
|
||||
final cacheDir = await getApplicationSupportDirectory();
|
||||
|
||||
Widget app = ChangeNotifierProvider.value(
|
||||
value: settings,
|
||||
@ -92,6 +93,7 @@ class JournalApp extends StatefulWidget {
|
||||
appState: appState,
|
||||
settings: settings,
|
||||
gitBaseDirectory: appState.gitBaseDirectory,
|
||||
cacheDirectory: cacheDir.path,
|
||||
);
|
||||
},
|
||||
child: ChangeNotifierProvider(
|
||||
|
@ -320,6 +320,9 @@ class Settings extends ChangeNotifier {
|
||||
|
||||
Future<void> migrate(SharedPreferences pref, String gitBaseDir) async {
|
||||
if (version == 0) {
|
||||
var cache = p.join(gitBaseDir, "cache.json");
|
||||
await File(cache).delete(recursive: true);
|
||||
|
||||
if (localGitRepoConfigured && !remoteGitRepoConfigured) {
|
||||
Log.i("Migrating from local and remote repos to a single one");
|
||||
var oldName = p.join(gitBaseDir, "journal_local");
|
||||
|
@ -24,6 +24,7 @@ class StateContainer with ChangeNotifier {
|
||||
final AppState appState;
|
||||
final Settings settings;
|
||||
final String gitBaseDirectory;
|
||||
final String cacheDirectory;
|
||||
|
||||
final _opLock = Lock();
|
||||
final _loadLock = Lock();
|
||||
@ -38,6 +39,7 @@ class StateContainer with ChangeNotifier {
|
||||
@required this.appState,
|
||||
@required this.settings,
|
||||
@required this.gitBaseDirectory,
|
||||
@required this.cacheDirectory,
|
||||
}) {
|
||||
assert(settings.localGitRepoConfigured);
|
||||
var repoPath = p.join(gitBaseDirectory, settings.internalRepoFolderName);
|
||||
@ -51,7 +53,7 @@ class StateContainer with ChangeNotifier {
|
||||
value: settings.remoteGitRepoConfigured.toString(),
|
||||
);
|
||||
|
||||
var cachePath = p.join(gitBaseDirectory, "cache.json");
|
||||
var cachePath = p.join(cacheDirectory, "cache.json");
|
||||
_notesCache = NotesCache(
|
||||
filePath: cachePath,
|
||||
notesBasePath: _gitRepo.gitDirPath,
|
||||
|
Reference in New Issue
Block a user