-
-
Notifications
You must be signed in to change notification settings - Fork 256
[License Accepting Required] Custom filenames #885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -1,9 +1,3 @@ | ||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was deleted automatically. not sure if this is correct
lib/core/note_storage.dart
Outdated
@@ -51,6 +52,13 @@ class NoteStorage { | ||
return catchAll<Note>(() async { | ||
assert(note.fullFilePath.startsWith(p.separator)); | ||
|
||
final directory = dirname(note.fullFilePath); | ||
final directoryExists = io.Directory(directory).existsSync(); | ||
if (!directoryExists) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary to allow new folders to be created for filename templates like this:
folder_name/{{date}} {{title}}
lib/editors/scaffold.dart
Outdated
@@ -73,7 +73,8 @@ class _EditorScaffoldState extends State<EditorScaffold> { | ||
|
||
note = widget.startingNote; | ||
|
||
SchedulerBinding.instance.addPostFrameCallback((_) => _initStateWithContext()); | ||
SchedulerBinding.instance | ||
.addPostFrameCallback((_) => _initStateWithContext()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the formatter caught this.
NoteFileNameFormat.fromPublicString(context, publicStr); | ||
child: NoteFileNameFormatPreference( | ||
getFileNameFormatFromConfig: () => folderConfig.journalFileNameFormat, | ||
setFileNameFormatInConfig: (format) { | ||
folderConfig.journalFileNameFormat = format; | ||
folderConfig.save(); | ||
setState(() {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this is for, but it was present in the previous onChange
handler, so included it here and below.
@@ -75,14 +74,16 @@ DateTime? parseDateTime(String str) { | ||
return null; | ||
} | ||
|
||
DateTime parseUnixTimeStamp(int val, NoteSerializationUnixTimestampMagnitude magnitude) { | ||
DateTime parseUnixTimeStamp( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the formatter did this automatically.
@@ -177,6 +177,8 @@ class Settings extends ChangeNotifier with SettingsSharedPref { | ||
} | ||
|
||
class NoteFileNameFormat extends GjSetting { | ||
final bool usesTitle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
introducing this here to prevent e.g. this bug #654 from happening again.
@@ -359,7 +370,7 @@ class Note implements File { | ||
bool get shouldRebuildPath { | ||
if (fileFormat != NoteFileFormat.Markdown) return false; | ||
|
||
return parent.config.fileNameFormat == NoteFileNameFormat.FromTitle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the source of #654.
The filename needs to be rebuilt whenever the file name format includes the title, which includes other cases than the plain "title" option.
This is wonderful. Thank you for this, and my apologies for not getting to it for over a month. Could you please rebase your changes? I've added a clause in the README specifying that all contributions will be in Apache2 license. Would that work for you? I want GitJournal to be released under GPL, but that would remove it from the iOS store, and I don't want to deal with CLAs. |
Hey @vHanda, finally found the time for that rebase 😃 Apache2 license is fine by me. |
daeb486
to
3fd8e96
Compare
Connection with issue(s)
Resolve issue #56
This + related issues were closed and converted to "discussions", although there was no resolution. Since I don't know the reason @vHanda closed them, I won't open a new issue.
EDIT: This incidentally solves issue #885. See comments in changed files.
Testing and Review Notes
So far, this PR only contains the template engine code + unit tests.Hopefully someone who can successfully get a build running locally will be able to handle the UI/Flutter parts.Well, I figured it out :P
Now, note creation with filename templates needs to be tested for normal + journal note types.
To Do