Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Jan 13, 2025
2 parents ec83135 + 0f47a33 commit c14fcac
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 24 deletions.
54 changes: 39 additions & 15 deletions api/lib/src/models/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,13 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return DocumentPage.fromJson(json);
try {
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return DocumentPage.fromJson(json);
} catch (e) {
return null;
}
}

@useResult
Expand Down Expand Up @@ -308,8 +312,12 @@ final class NoteData extends ArchiveData<NoteData> {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return DocumentInfo.fromJson(json);
try {
final json = jsonDecode(content) as Map<String, dynamic>;
return DocumentInfo.fromJson(json);
} catch (e) {
return null;
}
}

@useResult
Expand All @@ -331,7 +339,11 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
return NoteData.fromData(data);
try {
return NoteData.fromData(data);
} catch (e) {
return null;
}
}

@useResult
Expand Down Expand Up @@ -361,9 +373,13 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return ButterflyComponent.fromJson(json);
try {
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return ButterflyComponent.fromJson(json);
} catch (e) {
return null;
}
}

@useResult
Expand All @@ -384,9 +400,13 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return TextStyleSheet.fromJson(json);
try {
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return TextStyleSheet.fromJson(json);
} catch (e) {
return null;
}
}

@useResult
Expand Down Expand Up @@ -420,9 +440,13 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return ColorPalette.fromJson(json);
try {
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return ColorPalette.fromJson(json);
} catch (e) {
return null;
}
}

@useResult
Expand Down
4 changes: 2 additions & 2 deletions api/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
url: "https://pub.dev"
source: hosted
version: "6.0.2"
version: "6.1.0"
pool:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions app/lib/views/files/grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ class FileEntityGridItem extends StatelessWidget {
child: Image.memory(
thumbnail!,
fit: BoxFit.cover,
cacheHeight: kThumbnailWidth,
cacheWidth: kThumbnailHeight,
cacheHeight: kThumbnailHeight,
cacheWidth: kThumbnailWidth,
errorBuilder:
(context, error, stackTrace) =>
leading,
Expand Down
4 changes: 2 additions & 2 deletions app/lib/views/files/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class FileEntityListTile extends StatelessWidget {
child: Image.memory(
thumbnail!,
fit: BoxFit.cover,
cacheHeight: kThumbnailWidth,
cacheWidth: kThumbnailHeight,
cacheHeight: kThumbnailHeight,
cacheWidth: kThumbnailWidth,
)),
)
: leading,
Expand Down
4 changes: 2 additions & 2 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -816,10 +816,10 @@ packages:
dependency: "direct main"
description:
name: markdown
sha256: ef2a1298144e3f985cc736b22e0ccdaf188b5b3970648f2d9dc13efd1d9df051
sha256: "935e23e1ff3bc02d390bad4d4be001208ee92cc217cb5b5a6c19bc14aaa318c1"
url: "https://pub.dev"
source: hosted
version: "7.2.2"
version: "7.3.0"
matcher:
dependency: transitive
description:
Expand Down
8 changes: 7 additions & 1 deletion metadata/en-US/changelogs/128.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
This is a hotfix update, cherry picking some important fixes from the last 2.3.0-beta.0 nightly release.

* Add error boundaries for corrupted files
* Fix export button in data settings not working
* Fix utilties state resetted after undo
* Fix file view showing wrong aspect ratio for thumbnails

Cherry picks:
* Fix default stroke width ([#779](https://github.com/LinwoodDev/Butterfly/issues/779))
* Fix svg export shows wrong initial preset
* Fix capture thumbnail uses wrong position
* Fix zoom slider is not centered
* Fix shape detection list tile not clickable
* Fix corrupting files when saving ([#777](https://github.com/LinwoodDev/Butterfly/issues/777))
* Fix export button in data settings not working
* Fix action tools not updating

Read more here: https://linwood.dev/butterfly/2.2.4

0 comments on commit c14fcac

Please sign in to comment.