Skip to content

Commit

Permalink
Fix namespace to id
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Oct 11, 2024
1 parent 0563fe0 commit 5ab0806
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions api/lib/src/models/meta.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum FileType {
@MappableClass()
final class FileMetadata with FileMetadataMappable {
final FileType type;
final String namespace;
final String id;
final String name;
final String description;
final String author;
Expand All @@ -24,7 +24,7 @@ final class FileMetadata with FileMetadataMappable {

const FileMetadata({
this.type = FileType.pack,
this.namespace = '',
this.id = '',
this.name = '',
this.description = '',
this.author = '',
Expand Down
18 changes: 9 additions & 9 deletions api/lib/src/models/meta.mapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class FileMetadataMapper extends ClassMapperBase<FileMetadata> {
static FileType _$type(FileMetadata v) => v.type;
static const Field<FileMetadata, FileType> _f$type =
Field('type', _$type, opt: true, def: FileType.pack);
static String _$namespace(FileMetadata v) => v.namespace;
static const Field<FileMetadata, String> _f$namespace =
Field('namespace', _$namespace, opt: true, def: '');
static String _$id(FileMetadata v) => v.id;
static const Field<FileMetadata, String> _f$id =
Field('id', _$id, opt: true, def: '');
static String _$name(FileMetadata v) => v.name;
static const Field<FileMetadata, String> _f$name =
Field('name', _$name, opt: true, def: '');
Expand All @@ -99,7 +99,7 @@ class FileMetadataMapper extends ClassMapperBase<FileMetadata> {
@override
final MappableFields<FileMetadata> fields = const {
#type: _f$type,
#namespace: _f$namespace,
#id: _f$id,
#name: _f$name,
#description: _f$description,
#author: _f$author,
Expand All @@ -111,7 +111,7 @@ class FileMetadataMapper extends ClassMapperBase<FileMetadata> {
static FileMetadata _instantiate(DecodingData data) {
return FileMetadata(
type: data.dec(_f$type),
namespace: data.dec(_f$namespace),
id: data.dec(_f$id),
name: data.dec(_f$name),
description: data.dec(_f$description),
author: data.dec(_f$author),
Expand Down Expand Up @@ -174,7 +174,7 @@ abstract class FileMetadataCopyWith<$R, $In extends FileMetadata, $Out>
implements ClassCopyWith<$R, $In, $Out> {
$R call(
{FileType? type,
String? namespace,
String? id,
String? name,
String? description,
String? author,
Expand All @@ -195,7 +195,7 @@ class _FileMetadataCopyWithImpl<$R, $Out>
@override
$R call(
{FileType? type,
String? namespace,
String? id,
String? name,
String? description,
String? author,
Expand All @@ -204,7 +204,7 @@ class _FileMetadataCopyWithImpl<$R, $Out>
int? fileVersion}) =>
$apply(FieldCopyWithData({
if (type != null) #type: type,
if (namespace != null) #namespace: namespace,
if (id != null) #id: id,
if (name != null) #name: name,
if (description != null) #description: description,
if (author != null) #author: author,
Expand All @@ -215,7 +215,7 @@ class _FileMetadataCopyWithImpl<$R, $Out>
@override
FileMetadata $make(CopyWithData data) => FileMetadata(
type: data.get(#type, or: $value.type),
namespace: data.get(#namespace, or: $value.namespace),
id: data.get(#id, or: $value.id),
name: data.get(#name, or: $value.name),
description: data.get(#description, or: $value.description),
author: data.get(#author, or: $value.author),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/api/open.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Future<void> importFileData(BuildContext context, SetonixFileSystem fileSystem,
),
);
if (!(result ?? false)) return;
final namespace = metadata.namespace;
final namespace = metadata.id;
switch (type) {
case FileType.pack:
await fileSystem.packSystem.updateFile(namespace, data);
Expand Down
5 changes: 3 additions & 2 deletions app/lib/pages/game/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ class GameDrawer extends StatelessWidget {
));
if (newInfo == null) return;
bloc.process(MetadataChanged(newInfo.copyWith(
type: metadata.type,
namespace: metadata.namespace)));
type: metadata.type,
id: metadata.id,
)));
},
),
],
Expand Down

0 comments on commit 5ab0806

Please sign in to comment.