Skip to content

Commit

Permalink
Do not use attribute utils for file reference creation (#423)
Browse files Browse the repository at this point in the history
* do not use attribute utils for file reference creation

* chore: todo format
  • Loading branch information
jkoenig134 authored Feb 3, 2025
1 parent e15abba commit bfd370a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions apps/enmeshed/lib/core/widgets/upload_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,15 @@ class _UploadFileState extends State<UploadFile> {
bool validateEverything() => _selectedFile != null && isTitleValid && !_isFileTooLarge;

Future<RepositoryAttributeDVO> _createFileReferenceAttribute(FileDVO file) async {
final createEnabledNotifier = ValueNotifier<bool>(false);

final fileReferenceResult = await createRepositoryAttribute(
accountId: widget.accountId,
context: context,
createEnabledNotifier: createEnabledNotifier,
final session = GetIt.I.get<EnmeshedRuntime>().getSession(widget.accountId);
final createAttributeResult = await session.consumptionServices.attributes.createRepositoryAttribute(
value: IdentityFileReferenceAttributeValue(value: file.truncatedReference),
onAttributeCreated: () => createEnabledNotifier.value = true,
tags: _tagController.text.isNotEmpty ? [_tagController.text] : null,
);

final session = GetIt.I.get<EnmeshedRuntime>().getSession(widget.accountId);
return (await session.expander.expandLocalAttributeDTO(fileReferenceResult!)) as RepositoryAttributeDVO;
// TODO(jkoenig134): error handling

return (await session.expander.expandLocalAttributeDTO(createAttributeResult.value)) as RepositoryAttributeDVO;
}
}

Expand Down

0 comments on commit bfd370a

Please sign in to comment.