saveNoteToPod function
Implementation
Future<SolidFunctionCallStatus> saveNoteToPod(
BuildContext context, Map noteNewData, Widget returnPage,
[bool shared = false, Map prevSharedNoteInfo = const {}]) async {
// Encrypt note text using created time as the key
// av: 20250519 - We need to encrypt the note text because
// at the moment rdflib cannot parse multiline text with
// # (hash) values in them.
String encNoteText = encryptVal(
noteNewData[noteContentPred], noteNewData[createdDateTimePred]);
// Create note file name
// String noteFileName =
// '$noteFileNamePrefix$noteTitle-$dateTimeStr.ttl';
String noteFileName =
'$noteFileNamePrefix${noteNewData[createdDateTimePred]}.ttl';
// Create TTL body for note
final noteTTLStr = genNoteTTLStr(
noteNewData[createdDateTimePred],
noteNewData[modifiedDateTimePred],
noteNewData[noteTitlePred],
encNoteText);
if (shared) {
// Get note url
String noteFileUrl = prevSharedNoteInfo[noteUrl];
// Get note owner webId
String noteOwnerWebId = prevSharedNoteInfo[noteOwner];
return await writeExternalPod(
noteFileUrl,
noteTTLStr,
noteOwnerWebId,
context,
returnPage,
);
} else {
// Write note to POD
return await writePod(
noteFileName,
noteTTLStr,
context,
returnPage,
//encrypted: false, // save in plain text for now
);
}
}