diff --git a/app/lib/pages/settings/data.dart b/app/lib/pages/settings/data.dart index 52a93629..f01ad3c5 100644 --- a/app/lib/pages/settings/data.dart +++ b/app/lib/pages/settings/data.dart @@ -1,8 +1,11 @@ +import 'package:archive/archive.dart'; import 'package:file_selector/file_selector.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:lw_file_system/lw_file_system.dart'; +import 'package:lw_sysapi/lw_sysapi.dart'; import 'package:material_leap/material_leap.dart'; import 'package:phosphor_flutter/phosphor_flutter.dart'; import 'package:setonix/services/file_system.dart'; @@ -83,6 +86,38 @@ class DataSettingsPage extends StatelessWidget { } }, ), + ListTile( + title: Text(AppLocalizations.of(context).export), + leading: + const PhosphorIcon(PhosphorIconsLight.export), + onTap: () async { + final worldSystem = + context.read().worldSystem; + final archive = Archive(); + final keys = await worldSystem.getKeys(); + for (final key in keys) { + final entity = + await worldSystem.fileSystem.getFile(key); + if (entity == null) continue; + archive.addFile( + ArchiveFile( + '$key.stnx', entity.length, entity), + ); + } + final bytes = ZipEncoder().encode(archive); + if (context.mounted && bytes != null) { + exportFile( + context: context, + bytes: bytes, + fileExtension: 'zip', + mimeType: 'application/zip', + uniformTypeIdentifier: 'public.zip-archive', + fileName: 'output', + label: AppLocalizations.of(context).export, + ); + } + }, + ) ]), ), ), diff --git a/app/pack/textures/figures/chess.png b/app/pack/textures/figures/chess.png index c46d4266..52afebaa 100644 Binary files a/app/pack/textures/figures/chess.png and b/app/pack/textures/figures/chess.png differ diff --git a/app/pubspec.lock b/app/pubspec.lock index 1632fce4..bdd197e2 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -1354,10 +1354,10 @@ packages: dependency: transitive description: name: win32 - sha256: "4d45dc9069dba4619dc0ebd93c7cec5e66d8482cb625a370ac806dcc8165f2ec" + sha256: e5c39a90447e7c81cfec14b041cdbd0d0916bd9ebbc7fe02ab69568be703b9bd url: "https://pub.dev" source: hosted - version: "5.5.5" + version: "5.6.0" win32_registry: dependency: transitive description: diff --git a/docs/package.json b/docs/package.json index 667b0843..6a57575e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -16,7 +16,7 @@ "@phosphor-icons/react": "^2.1.7", "@types/react": "^18.3.11", "@types/react-dom": "^18.3.1", - "astro": "^4.16.1", + "astro": "^4.16.2", "react": "^18.3.1", "react-dom": "^18.3.1", "remark-gemoji": "^8.0.0", diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml index 81fdf53e..09bdf568 100644 --- a/docs/pnpm-lock.yaml +++ b/docs/pnpm-lock.yaml @@ -16,7 +16,7 @@ importers: version: 3.6.2(@types/react-dom@18.3.1)(@types/react@18.3.11)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(vite@5.4.8(sass@1.79.5)) '@astrojs/starlight': specifier: ^0.28.3 - version: 0.28.3(astro@4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3)) + version: 0.28.3(astro@4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3)) '@phosphor-icons/react': specifier: ^2.1.7 version: 2.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -27,8 +27,8 @@ importers: specifier: ^18.3.1 version: 18.3.1 astro: - specifier: ^4.16.1 - version: 4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3) + specifier: ^4.16.2 + version: 4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3) react: specifier: ^18.3.1 version: 18.3.1 @@ -919,8 +919,8 @@ packages: peerDependencies: astro: ^4.0.0-beta || ^3.3.0 - astro@4.16.1: - resolution: {integrity: sha512-ZeZd+L147HHgHmvoSkve7KM3EutV+hY0mOCa4PwARHEFAAh+omo4MUNoTWsFkfq7ozTgR0PCXQwslrZduoWHNg==} + astro@4.16.2: + resolution: {integrity: sha512-Dfkpyt6sA+nv6LnOJr+7bt+gQF5Qh02yqVgyes4c4SvcPScteq1bLX22/z/XW+VU0vlciJOMiM8GWtcDiF6gUQ==} engines: {node: ^18.17.1 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'} hasBin: true @@ -2428,12 +2428,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@astrojs/mdx@3.1.8(astro@4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3))': + '@astrojs/mdx@3.1.8(astro@4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3))': dependencies: '@astrojs/markdown-remark': 5.3.0 '@mdx-js/mdx': 3.0.1 acorn: 8.12.1 - astro: 4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3) + astro: 4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3) es-module-lexer: 1.5.4 estree-util-visit: 2.0.0 gray-matter: 4.0.3 @@ -2470,15 +2470,15 @@ snapshots: stream-replace-string: 2.0.0 zod: 3.23.8 - '@astrojs/starlight@0.28.3(astro@4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3))': + '@astrojs/starlight@0.28.3(astro@4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3))': dependencies: - '@astrojs/mdx': 3.1.8(astro@4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3)) + '@astrojs/mdx': 3.1.8(astro@4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3)) '@astrojs/sitemap': 3.2.0 '@pagefind/default-ui': 1.1.1 '@types/hast': 3.0.4 '@types/mdast': 4.0.4 - astro: 4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3) - astro-expressive-code: 0.35.6(astro@4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3)) + astro: 4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3) + astro-expressive-code: 0.35.6(astro@4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3)) bcp-47: 2.1.0 hast-util-from-html: 2.0.3 hast-util-select: 6.0.3 @@ -3263,12 +3263,12 @@ snapshots: astring@1.9.0: {} - astro-expressive-code@0.35.6(astro@4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3)): + astro-expressive-code@0.35.6(astro@4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3)): dependencies: - astro: 4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3) + astro: 4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3) rehype-expressive-code: 0.35.6 - astro@4.16.1(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3): + astro@4.16.2(rollup@4.24.0)(sass@1.79.5)(typescript@5.6.3): dependencies: '@astrojs/compiler': 2.10.3 '@astrojs/internal-helpers': 0.4.1