Note: minor cleanup

This commit is contained in:
Vishesh Handa
2021-03-18 14:29:29 +01:00
parent 2487a3327a
commit eb6aff7b76

View File

@ -53,9 +53,7 @@ enum NoteType {
} }
class NoteFileFormatInfo { class NoteFileFormatInfo {
static List<String> allowedExtensions() { static List<String> allowedExtensions = ['.md', '.org', '.txt'];
return ['.md', '.org', '.txt'];
}
static String defaultExtension(NoteFileFormat format) { static String defaultExtension(NoteFileFormat format) {
switch (format) { switch (format) {
@ -72,11 +70,13 @@ class NoteFileFormatInfo {
static bool isAllowedFileName(String filePath) { static bool isAllowedFileName(String filePath) {
var noteFilePath = filePath.toLowerCase(); var noteFilePath = filePath.toLowerCase();
var isMarkdownFile = noteFilePath.endsWith('.md'); for (var ext in allowedExtensions) {
var isTxtFile = noteFilePath.endsWith('.txt'); if (noteFilePath.endsWith(ext)) {
var isOrgFile = noteFilePath.endsWith('.org'); return true;
}
}
return isMarkdownFile || isTxtFile || isOrgFile; return false;
} }
} }