mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
Convert IgnoreReason to an enum
This commit is contained in:
@ -12,9 +12,14 @@ import 'note.dart';
|
|||||||
import 'notes_folder.dart';
|
import 'notes_folder.dart';
|
||||||
import 'notes_folder_notifier.dart';
|
import 'notes_folder_notifier.dart';
|
||||||
|
|
||||||
|
enum IgnoreReason {
|
||||||
|
HiddenFile,
|
||||||
|
InvalidExtension,
|
||||||
|
}
|
||||||
|
|
||||||
class IgnoredFile {
|
class IgnoredFile {
|
||||||
String filePath;
|
String filePath;
|
||||||
String reason;
|
IgnoreReason reason;
|
||||||
|
|
||||||
IgnoredFile({@required this.filePath, @required this.reason});
|
IgnoredFile({@required this.filePath, @required this.reason});
|
||||||
|
|
||||||
@ -242,27 +247,26 @@ class NotesFolderFS with NotesFolderNotifier implements NotesFolder {
|
|||||||
// FIXME: Why does 'tr' not work over here
|
// FIXME: Why does 'tr' not work over here
|
||||||
var ignoredFile = IgnoredFile(
|
var ignoredFile = IgnoredFile(
|
||||||
filePath: fsEntity.path,
|
filePath: fsEntity.path,
|
||||||
reason: "Starts with a .",
|
reason: IgnoreReason.HiddenFile,
|
||||||
);
|
);
|
||||||
_ignoredFiles.add(ignoredFile);
|
_ignoredFiles.add(ignoredFile);
|
||||||
|
|
||||||
Log.v("Ignoring file", props: {
|
Log.v("Ignoring file", props: {
|
||||||
"path": ignoredFile.filePath,
|
"path": ignoredFile.filePath,
|
||||||
"reason": ignoredFile.reason,
|
"reason": ignoredFile.reason.toString(),
|
||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!NoteFileFormatInfo.isAllowedFileName(note.filePath)) {
|
if (!NoteFileFormatInfo.isAllowedFileName(note.filePath)) {
|
||||||
var ignoredFile = IgnoredFile(
|
var ignoredFile = IgnoredFile(
|
||||||
filePath: fsEntity.path,
|
filePath: fsEntity.path,
|
||||||
reason: "Doesn't end with one of the following - " +
|
reason: IgnoreReason.InvalidExtension,
|
||||||
NoteFileFormatInfo.allowedExtensions().join(' '),
|
|
||||||
);
|
);
|
||||||
_ignoredFiles.add(ignoredFile);
|
_ignoredFiles.add(ignoredFile);
|
||||||
|
|
||||||
// Log.v("Ignoring file", props: {
|
// Log.v("Ignoring file", props: {
|
||||||
// "path": ignoredFile.filePath,
|
// "path": ignoredFile.filePath,
|
||||||
// "reason": ignoredFile.reason,
|
// "reason": ignoredFile.reason.toString(),
|
||||||
// });
|
// });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class _FileSystemScreenState extends State<FileSystemScreen> {
|
|||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(tr("screens.filesystem.ignoredFile.title")),
|
title: Text(tr("screens.filesystem.ignoredFile.title")),
|
||||||
content: Text(ignoredFile.reason),
|
content: Text(ignoredFile.reason.toString()),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
FlatButton(
|
FlatButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
Reference in New Issue
Block a user