diff --git a/.github/workflows/leancode_app_rating-publish.yml b/.github/workflows/leancode_app_rating-publish.yml index 5df365f..6585019 100644 --- a/.github/workflows/leancode_app_rating-publish.yml +++ b/.github/workflows/leancode_app_rating-publish.yml @@ -12,6 +12,7 @@ jobs: permissions: id-token: write + contents: write defaults: run: diff --git a/README.md b/README.md index 539c3f7..b3a99a5 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If the user provides a positive review, they will be kindly asked to rate the ap #### Setup -Add `AppRatingLocalizations` to your localizations delegates in `MaterialApp`" +Add `AppRatingLocalizations` to your localizations delegates in `MaterialApp`: ```dart localizationsDelegates: const [ (...) diff --git a/mobile/.gitignore b/mobile/.gitignore index ab91066..69b89b8 100644 --- a/mobile/.gitignore +++ b/mobile/.gitignore @@ -34,6 +34,7 @@ .pub-cache/ .pub/ /build/ +pubspec.lock # Web related lib/generated_plugin_registrant.dart diff --git a/mobile/README.md b/mobile/README.md index b0344e0..d245cd8 100644 --- a/mobile/README.md +++ b/mobile/README.md @@ -1,10 +1,11 @@ # leancode_app_rating [![pub.dev badge][pub-badge]][pub-badge-link] +[![][leancode_app_rating-build-badge]][leancode_app_rating-build-badge-link] #### Setup -Add `AppRatingLocalizations` to your localizations delegates in `MaterialApp`" +Add `AppRatingLocalizations` to your localizations delegates in `MaterialApp`: ```dart localizationsDelegates: const [ (...) @@ -75,3 +76,7 @@ In the current version of this package, you're not able to have a strong impact [pub-badge]: https://img.shields.io/pub/v/leancode_app_rating.svg?logo=dart [pub-badge-link]: https://pub.dev/packages/leancode_app_rating + +[leancode_app_rating-build-badge]: https://img.shields.io/github/actions/workflow/status/leancodepl/app-rating/leancode_app_rating-test.yml?branch=main + +[leancode_app_rating-build-badge-link]: https://github.com/leancodepl/app-rating/actions/workflows/leancode_app_rating-test.yml diff --git a/mobile/lib/assets/star-selected.png b/mobile/assets/star-selected.png similarity index 100% rename from mobile/lib/assets/star-selected.png rename to mobile/assets/star-selected.png diff --git a/mobile/lib/assets/star-unselected.png b/mobile/assets/star-unselected.png similarity index 100% rename from mobile/lib/assets/star-unselected.png rename to mobile/assets/star-unselected.png diff --git a/mobile/l10n.yaml b/mobile/l10n.yaml index 875fd9d..66360fc 100644 --- a/mobile/l10n.yaml +++ b/mobile/l10n.yaml @@ -1,4 +1,5 @@ -arb-dir: lib/l10n +arb-dir: lib/src/l10n +output-dir: lib/src/l10n template-arb-file: app_en.arb output-localization-file: app_localizations.dart output-class: AppRatingLocalizations diff --git a/mobile/lib/leancode_app_rating.dart b/mobile/lib/leancode_app_rating.dart new file mode 100644 index 0000000..0775e05 --- /dev/null +++ b/mobile/lib/leancode_app_rating.dart @@ -0,0 +1,2 @@ +export 'src/app_rating.dart'; +export 'src/l10n/app_localizations.dart' show AppRatingLocalizations; \ No newline at end of file diff --git a/mobile/lib/rating.dart b/mobile/lib/rating.dart deleted file mode 100644 index 82239f7..0000000 --- a/mobile/lib/rating.dart +++ /dev/null @@ -1,2 +0,0 @@ -export 'app_rating.dart'; -export 'l10n/app_localizations.dart' show AppRatingLocalizations; \ No newline at end of file diff --git a/mobile/lib/app_rating.dart b/mobile/lib/src/app_rating.dart similarity index 93% rename from mobile/lib/app_rating.dart rename to mobile/lib/src/app_rating.dart index da3137f..81ac55e 100644 --- a/mobile/lib/app_rating.dart +++ b/mobile/lib/src/app_rating.dart @@ -1,5 +1,5 @@ -import 'package:leancode_app_rating/widgets/single_answer_dialog/single_answer_dialog.dart'; -import 'package:leancode_app_rating/widgets/star_dialog/rate_star_dialog.dart'; +import 'package:leancode_app_rating/src/widgets/single_answer_dialog/single_answer_dialog.dart'; +import 'package:leancode_app_rating/src/widgets/star_dialog/rate_star_dialog.dart'; import 'package:flutter/material.dart'; import 'package:in_app_review/in_app_review.dart'; import 'package:leancode_contracts/leancode_contracts.dart'; diff --git a/mobile/lib/data/contracts/contracts.dart b/mobile/lib/src/data/contracts/contracts.dart similarity index 100% rename from mobile/lib/data/contracts/contracts.dart rename to mobile/lib/src/data/contracts/contracts.dart diff --git a/mobile/lib/data/contracts/contracts.g.dart b/mobile/lib/src/data/contracts/contracts.g.dart similarity index 100% rename from mobile/lib/data/contracts/contracts.g.dart rename to mobile/lib/src/data/contracts/contracts.g.dart diff --git a/mobile/lib/l10n/app_en.arb b/mobile/lib/src/l10n/app_en.arb similarity index 100% rename from mobile/lib/l10n/app_en.arb rename to mobile/lib/src/l10n/app_en.arb diff --git a/mobile/lib/l10n/app_localizations.dart b/mobile/lib/src/l10n/app_localizations.dart similarity index 99% rename from mobile/lib/l10n/app_localizations.dart rename to mobile/lib/src/l10n/app_localizations.dart index db58710..2818b1b 100644 --- a/mobile/lib/l10n/app_localizations.dart +++ b/mobile/lib/src/l10n/app_localizations.dart @@ -8,6 +8,8 @@ import 'package:intl/intl.dart' as intl; import 'app_localizations_en.dart'; import 'app_localizations_pl.dart'; +// ignore_for_file: type=lint + /// Callers can lookup localized strings with an instance of AppRatingLocalizations /// returned by `AppRatingLocalizations.of(context)`. /// diff --git a/mobile/lib/l10n/app_localizations_en.dart b/mobile/lib/src/l10n/app_localizations_en.dart similarity index 97% rename from mobile/lib/l10n/app_localizations_en.dart rename to mobile/lib/src/l10n/app_localizations_en.dart index 98efea6..7f46b83 100644 --- a/mobile/lib/l10n/app_localizations_en.dart +++ b/mobile/lib/src/l10n/app_localizations_en.dart @@ -1,5 +1,7 @@ import 'app_localizations.dart'; +// ignore_for_file: type=lint + /// The translations for English (`en`). class AppRatingLocalizationsEn extends AppRatingLocalizations { AppRatingLocalizationsEn([String locale = 'en']) : super(locale); diff --git a/mobile/lib/l10n/app_localizations_pl.dart b/mobile/lib/src/l10n/app_localizations_pl.dart similarity index 98% rename from mobile/lib/l10n/app_localizations_pl.dart rename to mobile/lib/src/l10n/app_localizations_pl.dart index 1a35d9f..350c9dc 100644 --- a/mobile/lib/l10n/app_localizations_pl.dart +++ b/mobile/lib/src/l10n/app_localizations_pl.dart @@ -1,5 +1,7 @@ import 'app_localizations.dart'; +// ignore_for_file: type=lint + /// The translations for Polish (`pl`). class AppRatingLocalizationsPl extends AppRatingLocalizations { AppRatingLocalizationsPl([String locale = 'pl']) : super(locale); diff --git a/mobile/lib/l10n/app_pl.arb b/mobile/lib/src/l10n/app_pl.arb similarity index 100% rename from mobile/lib/l10n/app_pl.arb rename to mobile/lib/src/l10n/app_pl.arb diff --git a/mobile/lib/src/package_name.dart b/mobile/lib/src/package_name.dart new file mode 100644 index 0000000..85903a4 --- /dev/null +++ b/mobile/lib/src/package_name.dart @@ -0,0 +1 @@ +const packageName = 'leancode_app_rating'; \ No newline at end of file diff --git a/mobile/lib/utils/platform_info.dart b/mobile/lib/src/utils/platform_info.dart similarity index 84% rename from mobile/lib/utils/platform_info.dart rename to mobile/lib/src/utils/platform_info.dart index 50992df..512b13a 100644 --- a/mobile/lib/utils/platform_info.dart +++ b/mobile/lib/src/utils/platform_info.dart @@ -1,6 +1,6 @@ import 'dart:io' show Platform; -import 'package:leancode_app_rating/data/contracts/contracts.dart'; +import 'package:leancode_app_rating/src/data/contracts/contracts.dart'; String get systemVersion => Platform.operatingSystemVersion; diff --git a/mobile/lib/utils/strings.dart b/mobile/lib/src/utils/strings.dart similarity index 65% rename from mobile/lib/utils/strings.dart rename to mobile/lib/src/utils/strings.dart index adc9f36..37eb5e6 100644 --- a/mobile/lib/utils/strings.dart +++ b/mobile/lib/src/utils/strings.dart @@ -1,4 +1,4 @@ -import 'package:leancode_app_rating/l10n/app_localizations.dart'; +import 'package:leancode_app_rating/src/l10n/app_localizations.dart'; import 'package:flutter/material.dart'; AppRatingLocalizations l10n(BuildContext context) => AppRatingLocalizations.of(context); diff --git a/mobile/lib/widgets/buttons/button.dart b/mobile/lib/src/widgets/buttons/button.dart similarity index 95% rename from mobile/lib/widgets/buttons/button.dart rename to mobile/lib/src/widgets/buttons/button.dart index 67b74e5..26d3615 100644 --- a/mobile/lib/widgets/buttons/button.dart +++ b/mobile/lib/src/widgets/buttons/button.dart @@ -1,4 +1,4 @@ -import 'package:leancode_app_rating/widgets/common/text_styles.dart'; +import 'package:leancode_app_rating/src/widgets/common/text_styles.dart'; import 'package:flutter/material.dart'; class AppButton extends StatelessWidget { diff --git a/mobile/lib/widgets/buttons/primary_button.dart b/mobile/lib/src/widgets/buttons/primary_button.dart similarity index 85% rename from mobile/lib/widgets/buttons/primary_button.dart rename to mobile/lib/src/widgets/buttons/primary_button.dart index ea0eea8..dd9c60f 100644 --- a/mobile/lib/widgets/buttons/primary_button.dart +++ b/mobile/lib/src/widgets/buttons/primary_button.dart @@ -1,4 +1,4 @@ -import 'package:leancode_app_rating/widgets/buttons/button.dart'; +import 'package:leancode_app_rating/src/widgets/buttons/button.dart'; import 'package:flutter/material.dart'; class PrimaryButton extends StatelessWidget { diff --git a/mobile/lib/widgets/buttons/secondary_button.dart b/mobile/lib/src/widgets/buttons/secondary_button.dart similarity index 86% rename from mobile/lib/widgets/buttons/secondary_button.dart rename to mobile/lib/src/widgets/buttons/secondary_button.dart index ac6fc4b..ab2bbde 100644 --- a/mobile/lib/widgets/buttons/secondary_button.dart +++ b/mobile/lib/src/widgets/buttons/secondary_button.dart @@ -1,4 +1,4 @@ -import 'package:leancode_app_rating/widgets/buttons/button.dart'; +import 'package:leancode_app_rating/src/widgets/buttons/button.dart'; import 'package:flutter/material.dart'; class SecondaryButton extends StatelessWidget { diff --git a/mobile/lib/widgets/common/base_dialog.dart b/mobile/lib/src/widgets/common/base_dialog.dart similarity index 100% rename from mobile/lib/widgets/common/base_dialog.dart rename to mobile/lib/src/widgets/common/base_dialog.dart diff --git a/mobile/lib/widgets/common/feedback_text_field.dart b/mobile/lib/src/widgets/common/feedback_text_field.dart similarity index 92% rename from mobile/lib/widgets/common/feedback_text_field.dart rename to mobile/lib/src/widgets/common/feedback_text_field.dart index ab1e1c4..fd9eede 100644 --- a/mobile/lib/widgets/common/feedback_text_field.dart +++ b/mobile/lib/src/widgets/common/feedback_text_field.dart @@ -1,5 +1,5 @@ -import 'package:leancode_app_rating/utils/strings.dart'; -import 'package:leancode_app_rating/widgets/common/text_styles.dart'; +import 'package:leancode_app_rating/src/utils/strings.dart'; +import 'package:leancode_app_rating/src/widgets/common/text_styles.dart'; import 'package:flutter/material.dart'; import 'package:leancode_hooks/leancode_hooks.dart'; diff --git a/mobile/lib/widgets/common/loading_overlay.dart b/mobile/lib/src/widgets/common/loading_overlay.dart similarity index 100% rename from mobile/lib/widgets/common/loading_overlay.dart rename to mobile/lib/src/widgets/common/loading_overlay.dart diff --git a/mobile/lib/widgets/common/text_styles.dart b/mobile/lib/src/widgets/common/text_styles.dart similarity index 100% rename from mobile/lib/widgets/common/text_styles.dart rename to mobile/lib/src/widgets/common/text_styles.dart diff --git a/mobile/lib/widgets/single_answer_dialog/options_enum.dart b/mobile/lib/src/widgets/single_answer_dialog/options_enum.dart similarity index 100% rename from mobile/lib/widgets/single_answer_dialog/options_enum.dart rename to mobile/lib/src/widgets/single_answer_dialog/options_enum.dart diff --git a/mobile/lib/widgets/single_answer_dialog/single_answer_cubit.dart b/mobile/lib/src/widgets/single_answer_dialog/single_answer_cubit.dart similarity index 90% rename from mobile/lib/widgets/single_answer_dialog/single_answer_cubit.dart rename to mobile/lib/src/widgets/single_answer_dialog/single_answer_cubit.dart index 3d488cb..f61a5a3 100644 --- a/mobile/lib/widgets/single_answer_dialog/single_answer_cubit.dart +++ b/mobile/lib/src/widgets/single_answer_dialog/single_answer_cubit.dart @@ -1,6 +1,6 @@ -import 'package:leancode_app_rating/data/contracts/contracts.dart'; -import 'package:leancode_app_rating/utils/platform_info.dart'; -import 'package:leancode_app_rating/widgets/single_answer_dialog/options_enum.dart'; +import 'package:leancode_app_rating/src/data/contracts/contracts.dart'; +import 'package:leancode_app_rating/src/utils/platform_info.dart'; +import 'package:leancode_app_rating/src/widgets/single_answer_dialog/options_enum.dart'; import 'package:bloc_presentation/bloc_presentation.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/mobile/lib/widgets/single_answer_dialog/single_answer_cubit.freezed.dart b/mobile/lib/src/widgets/single_answer_dialog/single_answer_cubit.freezed.dart similarity index 100% rename from mobile/lib/widgets/single_answer_dialog/single_answer_cubit.freezed.dart rename to mobile/lib/src/widgets/single_answer_dialog/single_answer_cubit.freezed.dart diff --git a/mobile/lib/widgets/single_answer_dialog/single_answer_dialog.dart b/mobile/lib/src/widgets/single_answer_dialog/single_answer_dialog.dart similarity index 88% rename from mobile/lib/widgets/single_answer_dialog/single_answer_dialog.dart rename to mobile/lib/src/widgets/single_answer_dialog/single_answer_dialog.dart index da39bf4..6899b68 100644 --- a/mobile/lib/widgets/single_answer_dialog/single_answer_dialog.dart +++ b/mobile/lib/src/widgets/single_answer_dialog/single_answer_dialog.dart @@ -1,12 +1,12 @@ -import 'package:leancode_app_rating/utils/strings.dart'; -import 'package:leancode_app_rating/widgets/common/base_dialog.dart'; -import 'package:leancode_app_rating/widgets/buttons/primary_button.dart'; -import 'package:leancode_app_rating/widgets/buttons/secondary_button.dart'; -import 'package:leancode_app_rating/widgets/common/feedback_text_field.dart'; -import 'package:leancode_app_rating/widgets/common/loading_overlay.dart'; -import 'package:leancode_app_rating/widgets/common/text_styles.dart'; -import 'package:leancode_app_rating/widgets/single_answer_dialog/options_enum.dart'; -import 'package:leancode_app_rating/widgets/single_answer_dialog/single_answer_cubit.dart'; +import 'package:leancode_app_rating/src/utils/strings.dart'; +import 'package:leancode_app_rating/src/widgets/common/base_dialog.dart'; +import 'package:leancode_app_rating/src/widgets/buttons/primary_button.dart'; +import 'package:leancode_app_rating/src/widgets/buttons/secondary_button.dart'; +import 'package:leancode_app_rating/src/widgets/common/feedback_text_field.dart'; +import 'package:leancode_app_rating/src/widgets/common/loading_overlay.dart'; +import 'package:leancode_app_rating/src/widgets/common/text_styles.dart'; +import 'package:leancode_app_rating/src/widgets/single_answer_dialog/options_enum.dart'; +import 'package:leancode_app_rating/src/widgets/single_answer_dialog/single_answer_cubit.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:in_app_review/in_app_review.dart'; diff --git a/mobile/lib/widgets/star_dialog/rate_star_cubit.dart b/mobile/lib/src/widgets/star_dialog/rate_star_cubit.dart similarity index 92% rename from mobile/lib/widgets/star_dialog/rate_star_cubit.dart rename to mobile/lib/src/widgets/star_dialog/rate_star_cubit.dart index ba21623..d6bc75a 100644 --- a/mobile/lib/widgets/star_dialog/rate_star_cubit.dart +++ b/mobile/lib/src/widgets/star_dialog/rate_star_cubit.dart @@ -1,5 +1,5 @@ -import 'package:leancode_app_rating/data/contracts/contracts.dart'; -import 'package:leancode_app_rating/utils/platform_info.dart'; +import 'package:leancode_app_rating/src/data/contracts/contracts.dart'; +import 'package:leancode_app_rating/src/utils/platform_info.dart'; import 'package:bloc_presentation/bloc_presentation.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/mobile/lib/widgets/star_dialog/rate_star_cubit.freezed.dart b/mobile/lib/src/widgets/star_dialog/rate_star_cubit.freezed.dart similarity index 100% rename from mobile/lib/widgets/star_dialog/rate_star_cubit.freezed.dart rename to mobile/lib/src/widgets/star_dialog/rate_star_cubit.freezed.dart diff --git a/mobile/lib/widgets/star_dialog/rate_star_dialog.dart b/mobile/lib/src/widgets/star_dialog/rate_star_dialog.dart similarity index 88% rename from mobile/lib/widgets/star_dialog/rate_star_dialog.dart rename to mobile/lib/src/widgets/star_dialog/rate_star_dialog.dart index cf78591..8ecc776 100644 --- a/mobile/lib/widgets/star_dialog/rate_star_dialog.dart +++ b/mobile/lib/src/widgets/star_dialog/rate_star_dialog.dart @@ -1,12 +1,13 @@ -import 'package:leancode_app_rating/utils/platform_info.dart'; -import 'package:leancode_app_rating/utils/strings.dart'; -import 'package:leancode_app_rating/widgets/common/base_dialog.dart'; -import 'package:leancode_app_rating/widgets/buttons/primary_button.dart'; -import 'package:leancode_app_rating/widgets/buttons/secondary_button.dart'; -import 'package:leancode_app_rating/widgets/common/feedback_text_field.dart'; -import 'package:leancode_app_rating/widgets/common/loading_overlay.dart'; -import 'package:leancode_app_rating/widgets/common/text_styles.dart'; -import 'package:leancode_app_rating/widgets/star_dialog/rate_star_cubit.dart'; +import 'package:leancode_app_rating/src/package_name.dart'; +import 'package:leancode_app_rating/src/utils/platform_info.dart'; +import 'package:leancode_app_rating/src/utils/strings.dart'; +import 'package:leancode_app_rating/src/widgets/common/base_dialog.dart'; +import 'package:leancode_app_rating/src/widgets/buttons/primary_button.dart'; +import 'package:leancode_app_rating/src/widgets/buttons/secondary_button.dart'; +import 'package:leancode_app_rating/src/widgets/common/feedback_text_field.dart'; +import 'package:leancode_app_rating/src/widgets/common/loading_overlay.dart'; +import 'package:leancode_app_rating/src/widgets/common/text_styles.dart'; +import 'package:leancode_app_rating/src/widgets/star_dialog/rate_star_cubit.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:in_app_review/in_app_review.dart'; @@ -195,13 +196,15 @@ class RatingStars extends StatelessWidget { Widget build(BuildContext context) { const selectedStar = Image( image: AssetImage( - 'packages/app_rating/assets/star-selected.png', + 'assets/star-selected.png', + package: packageName, ), ); const unSelectedStar = Image( image: AssetImage( - 'packages/app_rating/assets/star-unselected.png', + 'assets/star-unselected.png', + package: packageName, ), ); diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index 4f65cc0..8a9ff9b 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -4,10 +4,7 @@ description: > app store rating prompts for positive reviews. repository: https://github.com/leancodepl/app-rating homepage: https://github.com/leancodepl/app-rating/tree/main/mobile -version: 0.0.1 - -library: - - lib/rating.dart +version: 0.0.2 environment: sdk: ">=3.4.0 <4.0.0" @@ -38,6 +35,5 @@ dev_dependencies: flutter: assets: - - packages/app_rating/assets/star-selected.png - - packages/app_rating/assets/star-unselected.png - generate: true + - assets/star-selected.png + - assets/star-unselected.png