File tree Expand file tree Collapse file tree
common/navigation/enums/notes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ enum SelectionAvailableMenuOption {
1717 toggleLock (Icons .lock),
1818
1919 /// Add labels to the notes.
20- addLabels (Icons .label ),
20+ addLabels (Icons .new_label ),
2121
2222 /// Archive the notes.
2323 archive (Icons .archive),
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ sealed class Note implements Comparable<Note> {
117117
118118 /// The content as markdown.
119119 @ignore
120- String get markdown ;
120+ String get contentAsMarkdown ;
121121
122122 /// The content for the preview of the notes tiles.
123123 @ignore
@@ -155,7 +155,7 @@ sealed class Note implements Comparable<Note> {
155155 @ignore
156156 List <Label > get labelsVisibleSorted => labels.toList ().where ((label) => label.visible).sorted ();
157157
158- /// Returns the names of the visible [labels] of the note as a sorted list.
158+ /// The names of the visible [labels] of the note as a sorted list.
159159 @ignore
160160 List <String > get labelsNamesVisibleSorted => labelsVisibleSorted.map ((label) => label.name).toList ();
161161
@@ -167,6 +167,10 @@ sealed class Note implements Comparable<Note> {
167167 @ignore
168168 bool get hasLockedLabel => labels.any ((label) => label.locked);
169169
170+ /// The [labels] as markdown.
171+ @ignore
172+ String get labelsAsMarkdown => '> ${labelsNamesVisibleSorted .join (', ' )}' ;
173+
170174 /// Notes are sorted according to:
171175 /// 1. Their pin state.
172176 /// 2. The sort method chosen by the user.
Original file line number Diff line number Diff line change 1+ import '../../common/constants/constants.dart' ;
2+
13/// The status of a note.
24enum NoteStatus {
35 /// The note is available.
@@ -7,5 +9,14 @@ enum NoteStatus {
79 archived,
810
911 /// The note is deleted.
10- deleted,
12+ deleted;
13+
14+ /// Returns the title of this status.
15+ String get title {
16+ return switch (this ) {
17+ available => l.navigation_notes,
18+ archived => l.navigation_archives,
19+ deleted => l.navigation_bin,
20+ };
21+ }
1122}
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ class ChecklistNote extends Note {
9393
9494 @ignore
9595 @override
96- String get markdown {
96+ String get contentAsMarkdown {
9797 StringBuffer plainText = StringBuffer ();
9898
9999 for (int index = 0 ; index < checkboxes.length; index++ ) {
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ class MarkdownNote extends Note {
6767
6868 @ignore
6969 @override
70- String get markdown => content;
70+ String get contentAsMarkdown => content;
7171
7272 @ignore
7373 @override
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ class PlainTextNote extends Note {
6767
6868 @ignore
6969 @override
70- String get markdown => content;
70+ String get contentAsMarkdown => content;
7171
7272 @ignore
7373 @override
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ class RichTextNote extends Note {
7474
7575 @ignore
7676 @override
77- String get markdown => parchmentMarkdownCodec.encode (document);
77+ String get contentAsMarkdown => parchmentMarkdownCodec.encode (document);
7878
7979 @ignore
8080 @override
Original file line number Diff line number Diff line change @@ -291,11 +291,15 @@ class ManualBackupService {
291291 final archive = Archive ();
292292
293293 for (final note in notes) {
294- final bytes = utf8.encode (note.markdown);
294+ final markdown = '${note .labelsAsMarkdown }\n\n ${note .contentAsMarkdown }' ;
295+ final bytes = utf8.encode (markdown);
295296
296- final filenameWithoutExtension = '${note .title } (${note .createdTime .filename })' ;
297+ final filenameWithoutExtension = '${note .title } (${note .createdTime .filename })' . trim () ;
297298 final filenameWithoutExtensionSanitized = sanitizeFilename (filenameWithoutExtension);
298- final filename = 'test/$filenameWithoutExtensionSanitized .${MimeType .markdown .extension }' ;
299+
300+ final folder = note.status.title;
301+
302+ final filename = '$folder /$filenameWithoutExtensionSanitized .${MimeType .markdown .extension }' ;
299303
300304 archive.addFile (ArchiveFile (filename, bytes.length, bytes));
301305 }
You can’t perform that action at this time.
0 commit comments