diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index ddc227b1b..2d6ad8ebc 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,6 +1,6 @@ version: 2 updates: - package-ecosystem: "pub" - directory: "/" + directory: "/packages/app_center" schedule: interval: "daily" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ac3f39a20..5f95a2bc8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,9 +13,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: asdf-vm/actions/install@v2 - - run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH - - run: flutter pub global activate melos - - run: melos pub get + - uses: bluefireteam/melos-action@v2 - run: melos analyze format: @@ -23,9 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: asdf-vm/actions/install@v2 - - run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH - - run: flutter pub global activate melos - - run: melos pub get + - uses: bluefireteam/melos-action@v2 - run: melos format mocks: @@ -33,9 +29,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: asdf-vm/actions/install@v2 - - run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH - - run: flutter pub global activate melos - - run: melos pub get + - uses: bluefireteam/melos-action@v2 - run: melos generate - name: Check for outdated mocks if: github.event_name != 'push' @@ -55,9 +49,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: asdf-vm/actions/install@v2 - - run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH - - run: flutter pub global activate melos - - run: melos pub get + - uses: bluefireteam/melos-action@v2 - run: melos gen-l10n - name: Check for outdated l10n if: github.event_name == 'pull_request' @@ -77,10 +69,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: asdf-vm/actions/install@v2 - - run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH + - uses: bluefireteam/melos-action@v2 - run: sudo apt update && sudo apt install -y lcov - - run: flutter pub global activate melos - - run: melos pub get - run: melos coverage - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index 38fd0c349..7287628bb 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -15,5 +15,8 @@ jobs: - uses: asdf-vm/actions/install@v2 - run: sudo apt update - run: sudo apt install -y clang cmake libblkid-dev libglib2.0-dev libgtk-3-dev liblzma-dev network-manager ninja-build packagekit pkg-config polkitd xvfb - - run: sudo cp integration_test/assets/snapd-ci.pkla /var/lib/polkit-1/localauthority/50-local.d/ - - run: LANG=en_US.UTF-8 xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' flutter test integration_test + - run: | + cd packages/app_center && \ + sudo cp integration_test/assets/snapd-ci.pkla /var/lib/polkit-1/localauthority/50-local.d/ + LANG=en_US.UTF-8 xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' \ + flutter test integration_test diff --git a/.gitignore b/.gitignore index bd082c9e2..851e7d7a2 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ pubspec.lock /coverage/ /doc/ .fvm +**/build/ # Symbolication related app.*.symbols diff --git a/analysis_options.yaml b/analysis_options.yaml deleted file mode 100644 index 62c58f003..000000000 --- a/analysis_options.yaml +++ /dev/null @@ -1,9 +0,0 @@ -include: package:flutter_lints/flutter.yaml - -linter: - rules: - - directives_ordering - - prefer_relative_imports - - prefer_single_quotes - - type_annotate_public_apis - - unawaited_futures diff --git a/melos.yaml b/melos.yaml index 1f544758c..e903fac98 100644 --- a/melos.yaml +++ b/melos.yaml @@ -1,12 +1,8 @@ name: app_center packages: - - . - packages/** -ignore: - - synthetic_package - scripts: # analyze all packages analyze: > diff --git a/packages/app_center/analysis_options.yaml b/packages/app_center/analysis_options.yaml new file mode 100644 index 000000000..cf89ba946 --- /dev/null +++ b/packages/app_center/analysis_options.yaml @@ -0,0 +1 @@ +include: package:ubuntu_lints/analysis_options.yaml diff --git a/assets/2.0x/app-center.png b/packages/app_center/assets/2.0x/app-center.png similarity index 100% rename from assets/2.0x/app-center.png rename to packages/app_center/assets/2.0x/app-center.png diff --git a/assets/app-center.desktop b/packages/app_center/assets/app-center.desktop similarity index 100% rename from assets/app-center.desktop rename to packages/app_center/assets/app-center.desktop diff --git a/assets/app-center.png b/packages/app_center/assets/app-center.png similarity index 100% rename from assets/app-center.png rename to packages/app_center/assets/app-center.png diff --git a/assets/app-center.svg b/packages/app_center/assets/app-center.svg similarity index 100% rename from assets/app-center.svg rename to packages/app_center/assets/app-center.svg diff --git a/integration_test/app_center_test.dart b/packages/app_center/integration_test/app_center_test.dart similarity index 100% rename from integration_test/app_center_test.dart rename to packages/app_center/integration_test/app_center_test.dart diff --git a/integration_test/assets/snapd-ci.pkla b/packages/app_center/integration_test/assets/snapd-ci.pkla similarity index 100% rename from integration_test/assets/snapd-ci.pkla rename to packages/app_center/integration_test/assets/snapd-ci.pkla diff --git a/l10n.yaml b/packages/app_center/l10n.yaml similarity index 100% rename from l10n.yaml rename to packages/app_center/l10n.yaml diff --git a/lib/about.dart b/packages/app_center/lib/about.dart similarity index 100% rename from lib/about.dart rename to packages/app_center/lib/about.dart diff --git a/lib/appstream.dart b/packages/app_center/lib/appstream.dart similarity index 100% rename from lib/appstream.dart rename to packages/app_center/lib/appstream.dart diff --git a/lib/config.dart b/packages/app_center/lib/config.dart similarity index 100% rename from lib/config.dart rename to packages/app_center/lib/config.dart diff --git a/lib/constants.dart b/packages/app_center/lib/constants.dart similarity index 100% rename from lib/constants.dart rename to packages/app_center/lib/constants.dart diff --git a/lib/deb.dart b/packages/app_center/lib/deb.dart similarity index 100% rename from lib/deb.dart rename to packages/app_center/lib/deb.dart diff --git a/lib/explore.dart b/packages/app_center/lib/explore.dart similarity index 100% rename from lib/explore.dart rename to packages/app_center/lib/explore.dart diff --git a/lib/l10n.dart b/packages/app_center/lib/l10n.dart similarity index 100% rename from lib/l10n.dart rename to packages/app_center/lib/l10n.dart diff --git a/lib/layout.dart b/packages/app_center/lib/layout.dart similarity index 100% rename from lib/layout.dart rename to packages/app_center/lib/layout.dart diff --git a/lib/main.dart b/packages/app_center/lib/main.dart similarity index 100% rename from lib/main.dart rename to packages/app_center/lib/main.dart diff --git a/lib/manage.dart b/packages/app_center/lib/manage.dart similarity index 100% rename from lib/manage.dart rename to packages/app_center/lib/manage.dart diff --git a/lib/packagekit.dart b/packages/app_center/lib/packagekit.dart similarity index 100% rename from lib/packagekit.dart rename to packages/app_center/lib/packagekit.dart diff --git a/lib/ratings.dart b/packages/app_center/lib/ratings.dart similarity index 100% rename from lib/ratings.dart rename to packages/app_center/lib/ratings.dart diff --git a/lib/search.dart b/packages/app_center/lib/search.dart similarity index 100% rename from lib/search.dart rename to packages/app_center/lib/search.dart diff --git a/lib/snapd.dart b/packages/app_center/lib/snapd.dart similarity index 100% rename from lib/snapd.dart rename to packages/app_center/lib/snapd.dart diff --git a/lib/src/about/about_page.dart b/packages/app_center/lib/src/about/about_page.dart similarity index 100% rename from lib/src/about/about_page.dart rename to packages/app_center/lib/src/about/about_page.dart diff --git a/lib/src/about/about_providers.dart b/packages/app_center/lib/src/about/about_providers.dart similarity index 100% rename from lib/src/about/about_providers.dart rename to packages/app_center/lib/src/about/about_providers.dart diff --git a/lib/src/appstream/appstream_search.dart b/packages/app_center/lib/src/appstream/appstream_search.dart similarity index 100% rename from lib/src/appstream/appstream_search.dart rename to packages/app_center/lib/src/appstream/appstream_search.dart diff --git a/lib/src/appstream/appstream_service.dart b/packages/app_center/lib/src/appstream/appstream_service.dart similarity index 100% rename from lib/src/appstream/appstream_service.dart rename to packages/app_center/lib/src/appstream/appstream_service.dart diff --git a/lib/src/appstream/appstream_utils.dart b/packages/app_center/lib/src/appstream/appstream_utils.dart similarity index 100% rename from lib/src/appstream/appstream_utils.dart rename to packages/app_center/lib/src/appstream/appstream_utils.dart diff --git a/lib/src/appstream/logger.dart b/packages/app_center/lib/src/appstream/logger.dart similarity index 100% rename from lib/src/appstream/logger.dart rename to packages/app_center/lib/src/appstream/logger.dart diff --git a/lib/src/deb/deb_model.dart b/packages/app_center/lib/src/deb/deb_model.dart similarity index 100% rename from lib/src/deb/deb_model.dart rename to packages/app_center/lib/src/deb/deb_model.dart diff --git a/lib/src/deb/deb_page.dart b/packages/app_center/lib/src/deb/deb_page.dart similarity index 98% rename from lib/src/deb/deb_page.dart rename to packages/app_center/lib/src/deb/deb_page.dart index 143ce3687..eeb48006a 100644 --- a/lib/src/deb/deb_page.dart +++ b/packages/app_center/lib/src/deb/deb_page.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:packagekit/packagekit.dart'; import 'package:ubuntu_widgets/ubuntu_widgets.dart'; import 'package:url_launcher/url_launcher_string.dart'; import 'package:yaru_icons/yaru_icons.dart'; @@ -29,7 +30,7 @@ class DebPage extends ConsumerStatefulWidget { } class _DebPageState extends ConsumerState { - StreamSubscription? _errorSubscription; + StreamSubscription? _errorSubscription; @override void initState() { diff --git a/lib/src/explore/explore_page.dart b/packages/app_center/lib/src/explore/explore_page.dart similarity index 100% rename from lib/src/explore/explore_page.dart rename to packages/app_center/lib/src/explore/explore_page.dart diff --git a/lib/src/l10n/app_cs.arb b/packages/app_center/lib/src/l10n/app_cs.arb similarity index 100% rename from lib/src/l10n/app_cs.arb rename to packages/app_center/lib/src/l10n/app_cs.arb diff --git a/lib/src/l10n/app_da.arb b/packages/app_center/lib/src/l10n/app_da.arb similarity index 100% rename from lib/src/l10n/app_da.arb rename to packages/app_center/lib/src/l10n/app_da.arb diff --git a/lib/src/l10n/app_de.arb b/packages/app_center/lib/src/l10n/app_de.arb similarity index 100% rename from lib/src/l10n/app_de.arb rename to packages/app_center/lib/src/l10n/app_de.arb diff --git a/lib/src/l10n/app_en.arb b/packages/app_center/lib/src/l10n/app_en.arb similarity index 100% rename from lib/src/l10n/app_en.arb rename to packages/app_center/lib/src/l10n/app_en.arb diff --git a/lib/src/l10n/app_eo.arb b/packages/app_center/lib/src/l10n/app_eo.arb similarity index 100% rename from lib/src/l10n/app_eo.arb rename to packages/app_center/lib/src/l10n/app_eo.arb diff --git a/lib/src/l10n/app_es.arb b/packages/app_center/lib/src/l10n/app_es.arb similarity index 100% rename from lib/src/l10n/app_es.arb rename to packages/app_center/lib/src/l10n/app_es.arb diff --git a/lib/src/l10n/app_fa.arb b/packages/app_center/lib/src/l10n/app_fa.arb similarity index 100% rename from lib/src/l10n/app_fa.arb rename to packages/app_center/lib/src/l10n/app_fa.arb diff --git a/lib/src/l10n/app_fi.arb b/packages/app_center/lib/src/l10n/app_fi.arb similarity index 100% rename from lib/src/l10n/app_fi.arb rename to packages/app_center/lib/src/l10n/app_fi.arb diff --git a/lib/src/l10n/app_fr.arb b/packages/app_center/lib/src/l10n/app_fr.arb similarity index 100% rename from lib/src/l10n/app_fr.arb rename to packages/app_center/lib/src/l10n/app_fr.arb diff --git a/lib/src/l10n/app_hu.arb b/packages/app_center/lib/src/l10n/app_hu.arb similarity index 100% rename from lib/src/l10n/app_hu.arb rename to packages/app_center/lib/src/l10n/app_hu.arb diff --git a/lib/src/l10n/app_id.arb b/packages/app_center/lib/src/l10n/app_id.arb similarity index 100% rename from lib/src/l10n/app_id.arb rename to packages/app_center/lib/src/l10n/app_id.arb diff --git a/lib/src/l10n/app_it.arb b/packages/app_center/lib/src/l10n/app_it.arb similarity index 100% rename from lib/src/l10n/app_it.arb rename to packages/app_center/lib/src/l10n/app_it.arb diff --git a/lib/src/l10n/app_ja.arb b/packages/app_center/lib/src/l10n/app_ja.arb similarity index 100% rename from lib/src/l10n/app_ja.arb rename to packages/app_center/lib/src/l10n/app_ja.arb diff --git a/lib/src/l10n/app_ko.arb b/packages/app_center/lib/src/l10n/app_ko.arb similarity index 100% rename from lib/src/l10n/app_ko.arb rename to packages/app_center/lib/src/l10n/app_ko.arb diff --git a/lib/src/l10n/app_oc.arb b/packages/app_center/lib/src/l10n/app_oc.arb similarity index 100% rename from lib/src/l10n/app_oc.arb rename to packages/app_center/lib/src/l10n/app_oc.arb diff --git a/lib/src/l10n/app_pl.arb b/packages/app_center/lib/src/l10n/app_pl.arb similarity index 100% rename from lib/src/l10n/app_pl.arb rename to packages/app_center/lib/src/l10n/app_pl.arb diff --git a/lib/src/l10n/app_pt.arb b/packages/app_center/lib/src/l10n/app_pt.arb similarity index 100% rename from lib/src/l10n/app_pt.arb rename to packages/app_center/lib/src/l10n/app_pt.arb diff --git a/lib/src/l10n/app_pt_BR.arb b/packages/app_center/lib/src/l10n/app_pt_BR.arb similarity index 100% rename from lib/src/l10n/app_pt_BR.arb rename to packages/app_center/lib/src/l10n/app_pt_BR.arb diff --git a/lib/src/l10n/app_ru.arb b/packages/app_center/lib/src/l10n/app_ru.arb similarity index 100% rename from lib/src/l10n/app_ru.arb rename to packages/app_center/lib/src/l10n/app_ru.arb diff --git a/lib/src/l10n/app_sk.arb b/packages/app_center/lib/src/l10n/app_sk.arb similarity index 100% rename from lib/src/l10n/app_sk.arb rename to packages/app_center/lib/src/l10n/app_sk.arb diff --git a/lib/src/l10n/app_sv.arb b/packages/app_center/lib/src/l10n/app_sv.arb similarity index 100% rename from lib/src/l10n/app_sv.arb rename to packages/app_center/lib/src/l10n/app_sv.arb diff --git a/lib/src/l10n/app_tr.arb b/packages/app_center/lib/src/l10n/app_tr.arb similarity index 100% rename from lib/src/l10n/app_tr.arb rename to packages/app_center/lib/src/l10n/app_tr.arb diff --git a/lib/src/l10n/app_uk.arb b/packages/app_center/lib/src/l10n/app_uk.arb similarity index 100% rename from lib/src/l10n/app_uk.arb rename to packages/app_center/lib/src/l10n/app_uk.arb diff --git a/lib/src/l10n/app_zh.arb b/packages/app_center/lib/src/l10n/app_zh.arb similarity index 100% rename from lib/src/l10n/app_zh.arb rename to packages/app_center/lib/src/l10n/app_zh.arb diff --git a/lib/src/l10n/app_zh_Hant.arb b/packages/app_center/lib/src/l10n/app_zh_Hant.arb similarity index 100% rename from lib/src/l10n/app_zh_Hant.arb rename to packages/app_center/lib/src/l10n/app_zh_Hant.arb diff --git a/lib/src/manage/local_snap_providers.dart b/packages/app_center/lib/src/manage/local_snap_providers.dart similarity index 100% rename from lib/src/manage/local_snap_providers.dart rename to packages/app_center/lib/src/manage/local_snap_providers.dart diff --git a/lib/src/manage/manage_model.dart b/packages/app_center/lib/src/manage/manage_model.dart similarity index 100% rename from lib/src/manage/manage_model.dart rename to packages/app_center/lib/src/manage/manage_model.dart diff --git a/lib/src/manage/manage_page.dart b/packages/app_center/lib/src/manage/manage_page.dart similarity index 99% rename from lib/src/manage/manage_page.dart rename to packages/app_center/lib/src/manage/manage_page.dart index 4075ab1bd..b1734873c 100644 --- a/lib/src/manage/manage_page.dart +++ b/packages/app_center/lib/src/manage/manage_page.dart @@ -27,7 +27,7 @@ class ManagePage extends ConsumerStatefulWidget { } class _ManagePageState extends ConsumerState { - StreamSubscription? _errorSubscription; + StreamSubscription? _errorSubscription; @override void initState() { diff --git a/lib/src/packagekit/logger.dart b/packages/app_center/lib/src/packagekit/logger.dart similarity index 100% rename from lib/src/packagekit/logger.dart rename to packages/app_center/lib/src/packagekit/logger.dart diff --git a/lib/src/packagekit/packagekit_service.dart b/packages/app_center/lib/src/packagekit/packagekit_service.dart similarity index 98% rename from lib/src/packagekit/packagekit_service.dart rename to packages/app_center/lib/src/packagekit/packagekit_service.dart index ab2f83b68..d84cb423b 100644 --- a/lib/src/packagekit/packagekit_service.dart +++ b/packages/app_center/lib/src/packagekit/packagekit_service.dart @@ -78,7 +78,7 @@ class PackageKitService { final id = _nextId++; _transactions[id] = transaction; - late final StreamSubscription subscription; + late final StreamSubscription subscription; subscription = transaction.events.listen((event) { listener?.call(event); if (event is PackageKitFinishedEvent || event is PackageKitDestroyEvent) { diff --git a/lib/src/ratings/exports.dart b/packages/app_center/lib/src/ratings/exports.dart similarity index 100% rename from lib/src/ratings/exports.dart rename to packages/app_center/lib/src/ratings/exports.dart diff --git a/lib/src/ratings/ratings_l10n.dart b/packages/app_center/lib/src/ratings/ratings_l10n.dart similarity index 100% rename from lib/src/ratings/ratings_l10n.dart rename to packages/app_center/lib/src/ratings/ratings_l10n.dart diff --git a/lib/src/ratings/ratings_model.dart b/packages/app_center/lib/src/ratings/ratings_model.dart similarity index 100% rename from lib/src/ratings/ratings_model.dart rename to packages/app_center/lib/src/ratings/ratings_model.dart diff --git a/lib/src/ratings/ratings_service.dart b/packages/app_center/lib/src/ratings/ratings_service.dart similarity index 100% rename from lib/src/ratings/ratings_service.dart rename to packages/app_center/lib/src/ratings/ratings_service.dart diff --git a/lib/src/search/search_field.dart b/packages/app_center/lib/src/search/search_field.dart similarity index 100% rename from lib/src/search/search_field.dart rename to packages/app_center/lib/src/search/search_field.dart diff --git a/lib/src/search/search_page.dart b/packages/app_center/lib/src/search/search_page.dart similarity index 100% rename from lib/src/search/search_page.dart rename to packages/app_center/lib/src/search/search_page.dart diff --git a/lib/src/search/search_provider.dart b/packages/app_center/lib/src/search/search_provider.dart similarity index 100% rename from lib/src/search/search_provider.dart rename to packages/app_center/lib/src/search/search_provider.dart diff --git a/lib/src/snapd/logger.dart b/packages/app_center/lib/src/snapd/logger.dart similarity index 100% rename from lib/src/snapd/logger.dart rename to packages/app_center/lib/src/snapd/logger.dart diff --git a/lib/src/snapd/snap_category_enum.dart b/packages/app_center/lib/src/snapd/snap_category_enum.dart similarity index 100% rename from lib/src/snapd/snap_category_enum.dart rename to packages/app_center/lib/src/snapd/snap_category_enum.dart diff --git a/lib/src/snapd/snap_l10n.dart b/packages/app_center/lib/src/snapd/snap_l10n.dart similarity index 100% rename from lib/src/snapd/snap_l10n.dart rename to packages/app_center/lib/src/snapd/snap_l10n.dart diff --git a/lib/src/snapd/snap_launcher.dart b/packages/app_center/lib/src/snapd/snap_launcher.dart similarity index 100% rename from lib/src/snapd/snap_launcher.dart rename to packages/app_center/lib/src/snapd/snap_launcher.dart diff --git a/lib/src/snapd/snap_model.dart b/packages/app_center/lib/src/snapd/snap_model.dart similarity index 97% rename from lib/src/snapd/snap_model.dart rename to packages/app_center/lib/src/snapd/snap_model.dart index 93284130a..70ac70f0e 100644 --- a/lib/src/snapd/snap_model.dart +++ b/packages/app_center/lib/src/snapd/snap_model.dart @@ -23,7 +23,7 @@ final progressProvider = final streamController = StreamController.broadcast(); final subProgresses = {for (final id in ids) id: 0.0}; - final subscriptions = { + final subscriptions = >{ for (final id in ids) id: snapd.watchChange(id).listen((change) { subProgresses[id] = change.progress; @@ -79,8 +79,8 @@ class SnapModel extends ChangeNotifier { Map? get availableChannels => storeSnap?.channels; - StreamSubscription? _storeSnapSubscription; - StreamSubscription? _activeChangeSubscription; + StreamSubscription? _storeSnapSubscription; + StreamSubscription? _activeChangeSubscription; Stream get errorStream => _errorStreamController.stream; final StreamController _errorStreamController = diff --git a/lib/src/snapd/snap_page.dart b/packages/app_center/lib/src/snapd/snap_page.dart similarity index 99% rename from lib/src/snapd/snap_page.dart rename to packages/app_center/lib/src/snapd/snap_page.dart index 0374cf202..1ec9883c5 100644 --- a/lib/src/snapd/snap_page.dart +++ b/packages/app_center/lib/src/snapd/snap_page.dart @@ -34,7 +34,7 @@ class SnapPage extends ConsumerStatefulWidget { } class _SnapPageState extends ConsumerState { - StreamSubscription? _errorSubscription; + StreamSubscription? _errorSubscription; @override void initState() { diff --git a/lib/src/snapd/snap_search.dart b/packages/app_center/lib/src/snapd/snap_search.dart similarity index 100% rename from lib/src/snapd/snap_search.dart rename to packages/app_center/lib/src/snapd/snap_search.dart diff --git a/lib/src/snapd/snap_sort.dart b/packages/app_center/lib/src/snapd/snap_sort.dart similarity index 100% rename from lib/src/snapd/snap_sort.dart rename to packages/app_center/lib/src/snapd/snap_sort.dart diff --git a/lib/src/snapd/snapd_cache.dart b/packages/app_center/lib/src/snapd/snapd_cache.dart similarity index 95% rename from lib/src/snapd/snapd_cache.dart rename to packages/app_center/lib/src/snapd/snapd_cache.dart index 25e851ac6..dab3f0438 100644 --- a/lib/src/snapd/snapd_cache.dart +++ b/packages/app_center/lib/src/snapd/snapd_cache.dart @@ -147,7 +147,10 @@ extension SnapCacheFile on CacheFile { Future?> readSnapList() async { final data = await read() as List?; - return data?.cast().map((s) => Snap.fromJson(s.cast())).toList(); + return data + ?.cast>() + .map((s) => Snap.fromJson(s.cast())) + .toList(); } Future writeSnap(Snap snap) => write(snap.toJson()); @@ -165,14 +168,14 @@ class CacheFile { String path, { Duration? expiry, FileSystem? fs, - MessageCodec codec = const StandardMessageCodec(), + MessageCodec codec = const StandardMessageCodec(), }) : _file = (fs ?? const LocalFileSystem()).file(path), _expiry = expiry ?? Duration.zero, _codec = codec; final File _file; final Duration _expiry; - final MessageCodec _codec; + final MessageCodec _codec; String get path => _file.path; @@ -218,7 +221,7 @@ class CacheFile { } extension CacheObject on Object { - Uint8List encodeCache(MessageCodec codec) { + Uint8List encodeCache(MessageCodec codec) { final data = codec.encodeMessage(_toMessage())!; return data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); } @@ -233,7 +236,7 @@ extension CacheObject on Object { } extension CacheUint8List on Uint8List { - Object? decodeCache(MessageCodec codec) { + Object? decodeCache(MessageCodec codec) { return codec.decodeMessage(ByteData.sublistView(this)); } } diff --git a/lib/src/snapd/snapd_service.dart b/packages/app_center/lib/src/snapd/snapd_service.dart similarity index 100% rename from lib/src/snapd/snapd_service.dart rename to packages/app_center/lib/src/snapd/snapd_service.dart diff --git a/lib/src/snapd/snapd_watcher.dart b/packages/app_center/lib/src/snapd/snapd_watcher.dart similarity index 100% rename from lib/src/snapd/snapd_watcher.dart rename to packages/app_center/lib/src/snapd/snapd_watcher.dart diff --git a/lib/src/snapd/snapx.dart b/packages/app_center/lib/src/snapd/snapx.dart similarity index 100% rename from lib/src/snapd/snapx.dart rename to packages/app_center/lib/src/snapd/snapx.dart diff --git a/lib/src/snapd/updates_model.dart b/packages/app_center/lib/src/snapd/updates_model.dart similarity index 100% rename from lib/src/snapd/updates_model.dart rename to packages/app_center/lib/src/snapd/updates_model.dart diff --git a/lib/src/store/store_app.dart b/packages/app_center/lib/src/store/store_app.dart similarity index 100% rename from lib/src/store/store_app.dart rename to packages/app_center/lib/src/store/store_app.dart diff --git a/lib/src/store/store_navigator.dart b/packages/app_center/lib/src/store/store_navigator.dart similarity index 100% rename from lib/src/store/store_navigator.dart rename to packages/app_center/lib/src/store/store_navigator.dart diff --git a/lib/src/store/store_observer.dart b/packages/app_center/lib/src/store/store_observer.dart similarity index 87% rename from lib/src/store/store_observer.dart rename to packages/app_center/lib/src/store/store_observer.dart index d5e4c4e84..577ca41c0 100644 --- a/lib/src/store/store_observer.dart +++ b/packages/app_center/lib/src/store/store_observer.dart @@ -10,7 +10,7 @@ class StoreObserver extends NavigatorObserver { final WidgetRef ref; @override - void didPop(Route route, Route? previousRoute) { + void didPop(Route route, Route? previousRoute) { final query = previousRoute != null ? StoreRoutes.queryOf(previousRoute.settings) : null; diff --git a/lib/src/store/store_pages.dart b/packages/app_center/lib/src/store/store_pages.dart similarity index 100% rename from lib/src/store/store_pages.dart rename to packages/app_center/lib/src/store/store_pages.dart diff --git a/lib/src/store/store_providers.dart b/packages/app_center/lib/src/store/store_providers.dart similarity index 100% rename from lib/src/store/store_providers.dart rename to packages/app_center/lib/src/store/store_providers.dart diff --git a/lib/src/store/store_routes.dart b/packages/app_center/lib/src/store/store_routes.dart similarity index 100% rename from lib/src/store/store_routes.dart rename to packages/app_center/lib/src/store/store_routes.dart diff --git a/lib/src/widgets/app_card.dart b/packages/app_center/lib/src/widgets/app_card.dart similarity index 100% rename from lib/src/widgets/app_card.dart rename to packages/app_center/lib/src/widgets/app_card.dart diff --git a/lib/src/widgets/app_icon.dart b/packages/app_center/lib/src/widgets/app_icon.dart similarity index 100% rename from lib/src/widgets/app_icon.dart rename to packages/app_center/lib/src/widgets/app_icon.dart diff --git a/lib/src/widgets/app_info_bar.dart b/packages/app_center/lib/src/widgets/app_info_bar.dart similarity index 100% rename from lib/src/widgets/app_info_bar.dart rename to packages/app_center/lib/src/widgets/app_info_bar.dart diff --git a/lib/src/widgets/app_title.dart b/packages/app_center/lib/src/widgets/app_title.dart similarity index 95% rename from lib/src/widgets/app_title.dart rename to packages/app_center/lib/src/widgets/app_title.dart index ec85fac46..dd5454273 100644 --- a/lib/src/widgets/app_title.dart +++ b/packages/app_center/lib/src/widgets/app_title.dart @@ -19,7 +19,7 @@ class AppTitle extends StatelessWidget { this.large = false, }); - factory AppTitle.fromSnap(Snap snap, {large = false}) => AppTitle( + factory AppTitle.fromSnap(Snap snap, {bool large = false}) => AppTitle( title: snap.titleOrName, publisher: snap.publisher?.displayName, verifiedPublisher: snap.verifiedPublisher, @@ -28,7 +28,10 @@ class AppTitle extends StatelessWidget { large: large, ); - factory AppTitle.fromDeb(AppstreamComponent component, {large = false}) => + factory AppTitle.fromDeb( + AppstreamComponent component, { + bool large = false, + }) => AppTitle( title: component.getLocalizedName(), publisher: component.getLocalizedDeveloperName(), diff --git a/lib/src/widgets/clickable.dart b/packages/app_center/lib/src/widgets/clickable.dart similarity index 100% rename from lib/src/widgets/clickable.dart rename to packages/app_center/lib/src/widgets/clickable.dart diff --git a/lib/src/widgets/dialogs.dart b/packages/app_center/lib/src/widgets/dialogs.dart similarity index 100% rename from lib/src/widgets/dialogs.dart rename to packages/app_center/lib/src/widgets/dialogs.dart diff --git a/lib/src/widgets/screenshot_gallery.dart b/packages/app_center/lib/src/widgets/screenshot_gallery.dart similarity index 100% rename from lib/src/widgets/screenshot_gallery.dart rename to packages/app_center/lib/src/widgets/screenshot_gallery.dart diff --git a/lib/src/widgets/snap_grid.dart b/packages/app_center/lib/src/widgets/snap_grid.dart similarity index 100% rename from lib/src/widgets/snap_grid.dart rename to packages/app_center/lib/src/widgets/snap_grid.dart diff --git a/lib/store.dart b/packages/app_center/lib/store.dart similarity index 100% rename from lib/store.dart rename to packages/app_center/lib/store.dart diff --git a/lib/widgets.dart b/packages/app_center/lib/widgets.dart similarity index 100% rename from lib/widgets.dart rename to packages/app_center/lib/widgets.dart diff --git a/lib/xdg_cache_manager.dart b/packages/app_center/lib/xdg_cache_manager.dart similarity index 100% rename from lib/xdg_cache_manager.dart rename to packages/app_center/lib/xdg_cache_manager.dart diff --git a/linux/.gitignore b/packages/app_center/linux/.gitignore similarity index 100% rename from linux/.gitignore rename to packages/app_center/linux/.gitignore diff --git a/linux/CMakeLists.txt b/packages/app_center/linux/CMakeLists.txt similarity index 100% rename from linux/CMakeLists.txt rename to packages/app_center/linux/CMakeLists.txt diff --git a/linux/flutter/CMakeLists.txt b/packages/app_center/linux/flutter/CMakeLists.txt similarity index 100% rename from linux/flutter/CMakeLists.txt rename to packages/app_center/linux/flutter/CMakeLists.txt diff --git a/linux/main.cc b/packages/app_center/linux/main.cc similarity index 100% rename from linux/main.cc rename to packages/app_center/linux/main.cc diff --git a/linux/my_application.cc b/packages/app_center/linux/my_application.cc similarity index 100% rename from linux/my_application.cc rename to packages/app_center/linux/my_application.cc diff --git a/linux/my_application.h b/packages/app_center/linux/my_application.h similarity index 100% rename from linux/my_application.h rename to packages/app_center/linux/my_application.h diff --git a/packages/app_center/pubspec.yaml b/packages/app_center/pubspec.yaml new file mode 100644 index 000000000..3bcd9374c --- /dev/null +++ b/packages/app_center/pubspec.yaml @@ -0,0 +1,71 @@ +name: app_center +description: App Center +version: 1.0.0 +publish_to: 'none' + +environment: + sdk: '>=3.1.0 <4.0.0' + flutter: 3.13.9 + +dependencies: + appstream: ^0.2.8 + args: ^2.4.2 + cached_network_image: ^3.3.0 + collection: ^1.17.2 + dbus: ^0.7.10 + app_center_ratings_client: + git: + url: https://github.com/matthew-hagemann/app_center_ratings_client.dart.git + ref: main + crypto: ^3.0.3 + file: ^6.1.4 + flutter: + sdk: flutter + flutter_cache_manager: ^3.3.1 + flutter_html: ^3.0.0-beta.2 + flutter_localizations: + sdk: flutter + flutter_markdown: ^0.6.18 + flutter_riverpod: ^2.4.6 + github: ^9.20.0 + glib: ^0.0.1 + gtk: ^2.1.0 + handy_window: ^0.3.1 + intl: ^0.18.1 + jwt_decode: ^0.3.1 + meta: ^1.9.1 + package_info_plus: ^4.2.0 + packagekit: ^0.2.6 + path: ^1.8.3 + shimmer: ^3.0.0 + snapcraft_launcher: ^0.1.0 + snapd: ^0.4.11 + snowball_stemmer: ^0.1.0 + ubuntu_localizations: ^0.3.4 + ubuntu_logger: ^0.1.0 + ubuntu_service: ^0.3.0 + ubuntu_test: ^0.1.0-0 + ubuntu_widgets: ^0.3.0 + url_launcher: ^6.2.1 + xdg_directories: ^1.0.3 + yaru: ^1.2.0 + yaru_icons: ^2.2.2 + yaru_widgets: ^3.3.0 + yaru_test: ^0.1.5 + clock: ^1.1.1 + +dev_dependencies: + build_runner: ^2.4.6 + fake_async: ^1.3.1 + flutter_test: + sdk: flutter + integration_test: + sdk: flutter + mockito: 5.4.3 + ubuntu_lints: ^0.1.0 + +flutter: + uses-material-design: true + generate: true + assets: + - assets/ diff --git a/test/app_card_test.dart b/packages/app_center/test/app_card_test.dart similarity index 100% rename from test/app_card_test.dart rename to packages/app_center/test/app_card_test.dart diff --git a/test/appstream_service_test.dart b/packages/app_center/test/appstream_service_test.dart similarity index 100% rename from test/appstream_service_test.dart rename to packages/app_center/test/appstream_service_test.dart diff --git a/test/appstream_service_test.mocks.dart b/packages/app_center/test/appstream_service_test.mocks.dart similarity index 100% rename from test/appstream_service_test.mocks.dart rename to packages/app_center/test/appstream_service_test.mocks.dart diff --git a/test/config_service_test.dart b/packages/app_center/test/config_service_test.dart similarity index 100% rename from test/config_service_test.dart rename to packages/app_center/test/config_service_test.dart diff --git a/test/deb_model_test.dart b/packages/app_center/test/deb_model_test.dart similarity index 100% rename from test/deb_model_test.dart rename to packages/app_center/test/deb_model_test.dart diff --git a/test/deb_page_test.dart b/packages/app_center/test/deb_page_test.dart similarity index 100% rename from test/deb_page_test.dart rename to packages/app_center/test/deb_page_test.dart diff --git a/test/initial_route_test.dart b/packages/app_center/test/initial_route_test.dart similarity index 100% rename from test/initial_route_test.dart rename to packages/app_center/test/initial_route_test.dart diff --git a/test/manage_model_test.dart b/packages/app_center/test/manage_model_test.dart similarity index 100% rename from test/manage_model_test.dart rename to packages/app_center/test/manage_model_test.dart diff --git a/test/manage_page_test.dart b/packages/app_center/test/manage_page_test.dart similarity index 100% rename from test/manage_page_test.dart rename to packages/app_center/test/manage_page_test.dart diff --git a/test/packagekit_service_test.dart b/packages/app_center/test/packagekit_service_test.dart similarity index 100% rename from test/packagekit_service_test.dart rename to packages/app_center/test/packagekit_service_test.dart diff --git a/test/packagekit_service_test.mocks.dart b/packages/app_center/test/packagekit_service_test.mocks.dart similarity index 100% rename from test/packagekit_service_test.mocks.dart rename to packages/app_center/test/packagekit_service_test.mocks.dart diff --git a/test/ratings_model_test.dart b/packages/app_center/test/ratings_model_test.dart similarity index 100% rename from test/ratings_model_test.dart rename to packages/app_center/test/ratings_model_test.dart diff --git a/test/ratings_service_test.dart b/packages/app_center/test/ratings_service_test.dart similarity index 100% rename from test/ratings_service_test.dart rename to packages/app_center/test/ratings_service_test.dart diff --git a/test/search_field_test.dart b/packages/app_center/test/search_field_test.dart similarity index 100% rename from test/search_field_test.dart rename to packages/app_center/test/search_field_test.dart diff --git a/test/search_page_test.dart b/packages/app_center/test/search_page_test.dart similarity index 100% rename from test/search_page_test.dart rename to packages/app_center/test/search_page_test.dart diff --git a/test/snap_launcher_test.dart b/packages/app_center/test/snap_launcher_test.dart similarity index 100% rename from test/snap_launcher_test.dart rename to packages/app_center/test/snap_launcher_test.dart diff --git a/test/snap_launcher_test.mocks.dart b/packages/app_center/test/snap_launcher_test.mocks.dart similarity index 100% rename from test/snap_launcher_test.mocks.dart rename to packages/app_center/test/snap_launcher_test.mocks.dart diff --git a/test/snap_model_test.dart b/packages/app_center/test/snap_model_test.dart similarity index 100% rename from test/snap_model_test.dart rename to packages/app_center/test/snap_model_test.dart diff --git a/test/snap_page_test.dart b/packages/app_center/test/snap_page_test.dart similarity index 100% rename from test/snap_page_test.dart rename to packages/app_center/test/snap_page_test.dart diff --git a/test/snap_search_test.dart b/packages/app_center/test/snap_search_test.dart similarity index 100% rename from test/snap_search_test.dart rename to packages/app_center/test/snap_search_test.dart diff --git a/test/snapd_cache_test.dart b/packages/app_center/test/snapd_cache_test.dart similarity index 100% rename from test/snapd_cache_test.dart rename to packages/app_center/test/snapd_cache_test.dart diff --git a/test/snapd_cache_test.mocks.dart b/packages/app_center/test/snapd_cache_test.mocks.dart similarity index 100% rename from test/snapd_cache_test.mocks.dart rename to packages/app_center/test/snapd_cache_test.mocks.dart diff --git a/test/snapd_watcher_test.dart b/packages/app_center/test/snapd_watcher_test.dart similarity index 100% rename from test/snapd_watcher_test.dart rename to packages/app_center/test/snapd_watcher_test.dart diff --git a/test/snapd_watcher_test.mocks.dart b/packages/app_center/test/snapd_watcher_test.mocks.dart similarity index 100% rename from test/snapd_watcher_test.mocks.dart rename to packages/app_center/test/snapd_watcher_test.mocks.dart diff --git a/test/store_app_test.dart b/packages/app_center/test/store_app_test.dart similarity index 100% rename from test/store_app_test.dart rename to packages/app_center/test/store_app_test.dart diff --git a/test/store_navigator_test.dart b/packages/app_center/test/store_navigator_test.dart similarity index 100% rename from test/store_navigator_test.dart rename to packages/app_center/test/store_navigator_test.dart diff --git a/test/store_routes_test.dart b/packages/app_center/test/store_routes_test.dart similarity index 100% rename from test/store_routes_test.dart rename to packages/app_center/test/store_routes_test.dart diff --git a/test/test_utils.dart b/packages/app_center/test/test_utils.dart similarity index 99% rename from test/test_utils.dart rename to packages/app_center/test/test_utils.dart index b68c3f3d4..ede772a0e 100644 --- a/test/test_utils.dart +++ b/packages/app_center/test/test_utils.dart @@ -248,8 +248,8 @@ MockPackageKitTransaction createMockPackageKitTransaction({ Iterable? events, PackageKitExit? exit, int? runtime, - Future? start, - Future? end, + Future? start, + Future? end, }) { final transaction = MockPackageKitTransaction(); final controller = StreamController.broadcast(); diff --git a/test/test_utils.mocks.dart b/packages/app_center/test/test_utils.mocks.dart similarity index 100% rename from test/test_utils.mocks.dart rename to packages/app_center/test/test_utils.mocks.dart diff --git a/test/updates_model_test.dart b/packages/app_center/test/updates_model_test.dart similarity index 100% rename from test/updates_model_test.dart rename to packages/app_center/test/updates_model_test.dart diff --git a/pubspec.yaml b/pubspec.yaml index a6335edd2..718ff011c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,72 +1,7 @@ -name: app_center -description: App Center -version: 1.0.0 -publish_to: 'none' +name: app_center_workspace environment: sdk: '>=3.1.0 <4.0.0' - flutter: 3.13.9 - -dependencies: - appstream: ^0.2.8 - args: ^2.4.2 - cached_network_image: ^3.3.0 - collection: ^1.17.2 - dbus: ^0.7.10 - app_center_ratings_client: - git: - url: https://github.com/matthew-hagemann/app_center_ratings_client.dart.git - ref: main - crypto: ^3.0.3 - file: ^6.1.4 - flutter: - sdk: flutter - flutter_cache_manager: ^3.3.1 - flutter_html: ^3.0.0-beta.2 - flutter_localizations: - sdk: flutter - flutter_markdown: ^0.6.18 - flutter_riverpod: ^2.4.6 - github: ^9.20.0 - glib: ^0.0.1 - gtk: ^2.1.0 - handy_window: ^0.3.1 - intl: ^0.18.1 - jwt_decode: ^0.3.1 - meta: ^1.9.1 - package_info_plus: ^4.2.0 - packagekit: ^0.2.6 - path: ^1.8.3 - shimmer: ^3.0.0 - snapcraft_launcher: ^0.1.0 - snapd: ^0.4.11 - snowball_stemmer: ^0.1.0 - ubuntu_localizations: ^0.3.4 - ubuntu_logger: ^0.1.0 - ubuntu_service: ^0.3.0 - ubuntu_test: ^0.1.0-0 - ubuntu_widgets: ^0.3.0 - url_launcher: ^6.2.1 - xdg_directories: ^1.0.3 - yaru: ^1.2.0 - yaru_icons: ^2.2.2 - yaru_widgets: ^3.3.0 - yaru_test: ^0.1.5 - clock: ^1.1.1 dev_dependencies: - build_runner: ^2.4.6 - fake_async: ^1.3.1 - flutter_lints: ^3.0.1 - flutter_test: - sdk: flutter - integration_test: - sdk: flutter melos: ^3.2.0 - mockito: 5.4.3 - -flutter: - uses-material-design: true - generate: true - assets: - - assets/ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index b623acae7..6f275876d 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -35,6 +35,7 @@ parts: source: . plugin: nil override-build: | + cd packages/app_center # when building locally artifacts can pollute the container and cause builds to fail # this helps increase reliability for local builds flutter clean