From 38218fd9a360b03b56a4627b144cff81e6cb5b05 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Tue, 15 Jan 2019 21:23:26 +0100 Subject: [PATCH] Only save and load .md files For now I only want to deal with markdown. In the future, we can move towards maybe accepting all .txt files as well? Not sure. --- lib/state_container.dart | 2 +- lib/storage/file_storage.dart | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/state_container.dart b/lib/state_container.dart index d76e9f78..707150f1 100644 --- a/lib/state_container.dart +++ b/lib/state_container.dart @@ -50,7 +50,7 @@ class StateContainerState extends State { getDirectory: getNotesDir, dirName: "journal", gitCloneUrl: "root@bcn.vhanda.in:git/test", - fileNameGenerator: (Note n) => toIso8601WithTimezone(n.created), + fileNameGenerator: (Note n) => toIso8601WithTimezone(n.created) + '.md', ); StateContainerState(bool onBoardingCompleted) { diff --git a/lib/storage/file_storage.dart b/lib/storage/file_storage.dart index bb3230bf..ccd62c5c 100644 --- a/lib/storage/file_storage.dart +++ b/lib/storage/file_storage.dart @@ -32,6 +32,10 @@ class FileStorage implements NoteRepository { if (note == null) { continue; } + if (!fileEntity.path.endsWith('.md') && + !fileEntity.path.endsWith('.MD')) { + continue; + } if (note.id == null) { String filename = p.basename(fileEntity.path); note.id = filename;