mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +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.localGitRepoConfigured = true;
|
||||||
settings.save();
|
settings.save();
|
||||||
}
|
}
|
||||||
|
final cacheDir = await getApplicationSupportDirectory();
|
||||||
|
|
||||||
Widget app = ChangeNotifierProvider.value(
|
Widget app = ChangeNotifierProvider.value(
|
||||||
value: settings,
|
value: settings,
|
||||||
@ -92,6 +93,7 @@ class JournalApp extends StatefulWidget {
|
|||||||
appState: appState,
|
appState: appState,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
gitBaseDirectory: appState.gitBaseDirectory,
|
gitBaseDirectory: appState.gitBaseDirectory,
|
||||||
|
cacheDirectory: cacheDir.path,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: ChangeNotifierProvider(
|
child: ChangeNotifierProvider(
|
||||||
|
@ -320,6 +320,9 @@ class Settings extends ChangeNotifier {
|
|||||||
|
|
||||||
Future<void> migrate(SharedPreferences pref, String gitBaseDir) async {
|
Future<void> migrate(SharedPreferences pref, String gitBaseDir) async {
|
||||||
if (version == 0) {
|
if (version == 0) {
|
||||||
|
var cache = p.join(gitBaseDir, "cache.json");
|
||||||
|
await File(cache).delete(recursive: true);
|
||||||
|
|
||||||
if (localGitRepoConfigured && !remoteGitRepoConfigured) {
|
if (localGitRepoConfigured && !remoteGitRepoConfigured) {
|
||||||
Log.i("Migrating from local and remote repos to a single one");
|
Log.i("Migrating from local and remote repos to a single one");
|
||||||
var oldName = p.join(gitBaseDir, "journal_local");
|
var oldName = p.join(gitBaseDir, "journal_local");
|
||||||
|
@ -24,6 +24,7 @@ class StateContainer with ChangeNotifier {
|
|||||||
final AppState appState;
|
final AppState appState;
|
||||||
final Settings settings;
|
final Settings settings;
|
||||||
final String gitBaseDirectory;
|
final String gitBaseDirectory;
|
||||||
|
final String cacheDirectory;
|
||||||
|
|
||||||
final _opLock = Lock();
|
final _opLock = Lock();
|
||||||
final _loadLock = Lock();
|
final _loadLock = Lock();
|
||||||
@ -38,6 +39,7 @@ class StateContainer with ChangeNotifier {
|
|||||||
@required this.appState,
|
@required this.appState,
|
||||||
@required this.settings,
|
@required this.settings,
|
||||||
@required this.gitBaseDirectory,
|
@required this.gitBaseDirectory,
|
||||||
|
@required this.cacheDirectory,
|
||||||
}) {
|
}) {
|
||||||
assert(settings.localGitRepoConfigured);
|
assert(settings.localGitRepoConfigured);
|
||||||
var repoPath = p.join(gitBaseDirectory, settings.internalRepoFolderName);
|
var repoPath = p.join(gitBaseDirectory, settings.internalRepoFolderName);
|
||||||
@ -51,7 +53,7 @@ class StateContainer with ChangeNotifier {
|
|||||||
value: settings.remoteGitRepoConfigured.toString(),
|
value: settings.remoteGitRepoConfigured.toString(),
|
||||||
);
|
);
|
||||||
|
|
||||||
var cachePath = p.join(gitBaseDirectory, "cache.json");
|
var cachePath = p.join(cacheDirectory, "cache.json");
|
||||||
_notesCache = NotesCache(
|
_notesCache = NotesCache(
|
||||||
filePath: cachePath,
|
filePath: cachePath,
|
||||||
notesBasePath: _gitRepo.gitDirPath,
|
notesBasePath: _gitRepo.gitDirPath,
|
||||||
|
Reference in New Issue
Block a user