kasy-cli 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/bin/kasy.js +529 -0
- package/docs/cli-reference.md +251 -0
- package/lib/commands/add.js +777 -0
- package/lib/commands/check.js +240 -0
- package/lib/commands/codemagic.js +161 -0
- package/lib/commands/deploy.js +257 -0
- package/lib/commands/docs.js +47 -0
- package/lib/commands/doctor.js +227 -0
- package/lib/commands/features.js +36 -0
- package/lib/commands/ios.js +206 -0
- package/lib/commands/new.js +1870 -0
- package/lib/commands/notifications.js +207 -0
- package/lib/commands/remove.js +466 -0
- package/lib/commands/run.js +75 -0
- package/lib/commands/update.js +382 -0
- package/lib/commands/validate.js +131 -0
- package/lib/scaffold/CHANGELOG.json +6 -0
- package/lib/scaffold/backends/api/.flutter-plugins-dependencies +1 -0
- package/lib/scaffold/backends/api/analysis_options.yaml +5 -0
- package/lib/scaffold/backends/api/generator.js +76 -0
- package/lib/scaffold/backends/api/patch/README.md +85 -0
- package/lib/scaffold/backends/api/patch/android/app/src/main/AndroidManifest.xml +87 -0
- package/lib/scaffold/backends/api/patch/ios/Runner/AppDelegate.swift +61 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/api/meta_ads_api.dart +80 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/api/storage_api.dart +117 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/api/user_api.dart +148 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/entities/json_converters.dart +35 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/entities/user_entity.dart +48 -0
- package/lib/scaffold/backends/api/patch/lib/core/rating/widgets/review_popup.dart +211 -0
- package/lib/scaffold/backends/api/patch/lib/environnements.dart +151 -0
- package/lib/scaffold/backends/api/patch/lib/features/authentication/api/authentication_api.dart +303 -0
- package/lib/scaffold/backends/api/patch/lib/features/authentication/api/authentication_api_interface.dart +80 -0
- package/lib/scaffold/backends/api/patch/lib/features/authentication/repositories/authentication_repository.dart +406 -0
- package/lib/scaffold/backends/api/patch/lib/features/camera/xfile_extension.dart +6 -0
- package/lib/scaffold/backends/api/patch/lib/features/feedbacks/api/entities/feature_request_entity.dart +24 -0
- package/lib/scaffold/backends/api/patch/lib/features/feedbacks/api/entities/feature_vote_entity.dart +21 -0
- package/lib/scaffold/backends/api/patch/lib/features/feedbacks/api/feature_request_api.dart +52 -0
- package/lib/scaffold/backends/api/patch/lib/features/feedbacks/api/feature_vote_api.dart +60 -0
- package/lib/scaffold/backends/api/patch/lib/features/llm_chat/api/llm_chat_api.dart +58 -0
- package/lib/scaffold/backends/api/patch/lib/features/llm_chat/api/llm_chat_message_entity.dart +29 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/api/device_api.dart +398 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/api/entities/device_entity.dart +39 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/api/entities/notifications_entity.dart +23 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/api/notifications_api.dart +333 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/providers/models/notification.dart +185 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/api/entities/user_info_entity.dart +26 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/api/user_infos_api.dart +107 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/models/user_info.dart +94 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/repositories/user_infos_repository.dart +29 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/animations/movefade_anim.dart +34 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/components/onboarding_att_setup.dart +66 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/components/onboarding_notifications_setup.dart +73 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +173 -0
- package/lib/scaffold/backends/api/patch/lib/features/settings/ui/widgets/avatar_utils.dart +33 -0
- package/lib/scaffold/backends/api/patch/lib/features/subscription/api/entities/subscription_entity.dart +34 -0
- package/lib/scaffold/backends/api/patch/lib/features/subscription/api/subscription_api.dart +49 -0
- package/lib/scaffold/backends/api/patch/lib/features/subscription/shared/maybeshow_premium.dart +88 -0
- package/lib/scaffold/backends/api/patch/lib/main.dart +256 -0
- package/lib/scaffold/backends/api/patch/lib/router.dart +133 -0
- package/lib/scaffold/backends/api/pubspec.yaml.tpl +108 -0
- package/lib/scaffold/backends/firebase/deploy.js +1006 -0
- package/lib/scaffold/backends/firebase/generator.js +24 -0
- package/lib/scaffold/backends/firebase/setup-from-scratch.js +1008 -0
- package/lib/scaffold/backends/firebase/tokens.js +113 -0
- package/lib/scaffold/backends/supabase/.flutter-plugins-dependencies +1 -0
- package/lib/scaffold/backends/supabase/analysis_options.yaml +5 -0
- package/lib/scaffold/backends/supabase/config.toml +34 -0
- package/lib/scaffold/backends/supabase/deploy.js +485 -0
- package/lib/scaffold/backends/supabase/edge-functions/delete-user-account/README.md +15 -0
- package/lib/scaffold/backends/supabase/edge-functions/delete-user-account/index.ts +97 -0
- package/lib/scaffold/backends/supabase/edge-functions/llm-chat/index.ts +156 -0
- package/lib/scaffold/backends/supabase/edge-functions/meta-track-event/index.ts +292 -0
- package/lib/scaffold/backends/supabase/edge-functions/revenuecat-webhook/README.md +30 -0
- package/lib/scaffold/backends/supabase/edge-functions/revenuecat-webhook/index.ts +488 -0
- package/lib/scaffold/backends/supabase/edge-functions/send-push-notification/README.md +35 -0
- package/lib/scaffold/backends/supabase/edge-functions/send-push-notification/index.ts +314 -0
- package/lib/scaffold/backends/supabase/generator.js +108 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000001_initial_schema.sql +149 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000002_storage_bucket.sql +40 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000005_vote_triggers.sql +34 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000006_notification_webhook.sql +36 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000007_welcome_notification.sql +64 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000008_user_feature_requests.sql +2 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000009_llm_messages.sql +22 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000010_notification_image.sql +2 -0
- package/lib/scaffold/backends/supabase/patch/README.md +121 -0
- package/lib/scaffold/backends/supabase/patch/android/app/src/main/AndroidManifest.xml +87 -0
- package/lib/scaffold/backends/supabase/patch/ios/Runner/AppDelegate.swift +61 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/api/meta_ads_api.dart +75 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/api/storage_api.dart +83 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/api/user_api.dart +143 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/entities/json_converters.dart +35 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/entities/user_entity.dart +48 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/rating/widgets/review_popup.dart +211 -0
- package/lib/scaffold/backends/supabase/patch/lib/environnements.dart +149 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/authentication/api/authentication_api.dart +546 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/authentication/repositories/authentication_repository.dart +410 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/camera/xfile_extension.dart +6 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/api/entities/feature_request_entity.dart +25 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/api/entities/feature_vote_entity.dart +21 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/api/feature_request_api.dart +59 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/api/feature_vote_api.dart +85 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/ui/component/add_feature_form.dart +199 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/llm_chat/api/llm_chat_api.dart +47 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/llm_chat/api/llm_chat_message_entity.dart +30 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/llm_chat/providers/llm_chat_notifier.dart +266 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/api/device_api.dart +410 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/api/entities/device_entity.dart +51 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/api/entities/notifications_entity.dart +26 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/api/notifications_api.dart +317 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/providers/models/notification.dart +174 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/api/entities/user_info_entity.dart +26 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/api/user_infos_api.dart +90 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/models/user_info.dart +94 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/repositories/user_infos_repository.dart +29 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/animations/movefade_anim.dart +34 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/components/onboarding_att_setup.dart +66 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/components/onboarding_notifications_setup.dart +73 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +173 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/settings/ui/widgets/avatar_utils.dart +35 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/subscription/api/entities/subscription_entity.dart +35 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/subscription/api/subscription_api.dart +44 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/subscription/shared/maybeshow_premium.dart +85 -0
- package/lib/scaffold/backends/supabase/patch/lib/google_auth_options.dart +23 -0
- package/lib/scaffold/backends/supabase/patch/lib/main.dart +288 -0
- package/lib/scaffold/backends/supabase/patch/lib/router.dart +133 -0
- package/lib/scaffold/backends/supabase/pubspec.yaml.tpl +110 -0
- package/lib/scaffold/backends/supabase/tokens.js +9 -0
- package/lib/scaffold/catalog.js +177 -0
- package/lib/scaffold/engine.js +230 -0
- package/lib/scaffold/features/README.md +152 -0
- package/lib/scaffold/features/analytics/lib/core/data/api/analytics_api.dart +124 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/BUG.es.md +35 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/BUG.md +35 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/BUG.pt.md +35 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/feature_request.es.md +12 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/feature_request.md +12 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/feature_request.pt.md +12 -0
- package/lib/scaffold/features/ci/.github/PULL_REQUEST_TEMPLATE.es.md +17 -0
- package/lib/scaffold/features/ci/.github/PULL_REQUEST_TEMPLATE.md +17 -0
- package/lib/scaffold/features/ci/.github/PULL_REQUEST_TEMPLATE.pt.md +17 -0
- package/lib/scaffold/features/ci/.github/dependabot.yml +16 -0
- package/lib/scaffold/features/ci/.github/workflows/app.yml +20 -0
- package/lib/scaffold/features/ci/.gitlab/templates/deploy.yaml +14 -0
- package/lib/scaffold/features/ci/.gitlab/templates/dropbox.yaml +19 -0
- package/lib/scaffold/features/ci/.gitlab/templates/flutter.yaml +163 -0
- package/lib/scaffold/features/ci/.gitlab/templates/mailgun.yaml +28 -0
- package/lib/scaffold/features/ci/.gitlab-ci.yml +37 -0
- package/lib/scaffold/features/ci/codemagic.yaml +157 -0
- package/lib/scaffold/features/facebook/lib/core/data/api/tracking_api.dart +111 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/entities/feature_request_entity.dart +27 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/entities/feature_vote_entity.dart +27 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/feature_request_api.dart +50 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/feature_vote_api.dart +79 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/models/feature_requests.dart +48 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/models/feedback_state.dart +42 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/providers/feedback_page_notifier.dart +147 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/repositories/feature_request_repository.dart +95 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/component/add_feature_form.dart +199 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/feedback_page.dart +175 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/widgets/add_feature_button.dart +76 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/widgets/feature_card.dart +279 -0
- package/lib/scaffold/features/ios-release/.kasy/apple.env.example +8 -0
- package/lib/scaffold/features/ios-release/.kasy/codemagic.env.example +7 -0
- package/lib/scaffold/features/ios-release/docs/codemagic-release.en.md +50 -0
- package/lib/scaffold/features/ios-release/docs/codemagic-release.es.md +50 -0
- package/lib/scaffold/features/ios-release/docs/codemagic-release.pt.md +50 -0
- package/lib/scaffold/features/ios-release/docs/ios-release.en.md +41 -0
- package/lib/scaffold/features/ios-release/docs/ios-release.es.md +41 -0
- package/lib/scaffold/features/ios-release/docs/ios-release.pt.md +41 -0
- package/lib/scaffold/features/ios-release/scripts/bump-ios-version.js +38 -0
- package/lib/scaffold/features/ios-release/scripts/release-ios.sh +137 -0
- package/lib/scaffold/features/llm_chat/lib/features/llm_chat/llm_chat_page.dart +301 -0
- package/lib/scaffold/features/local_notifications/lib/features/local_reminder/providers/reminder_notifier.dart +81 -0
- package/lib/scaffold/features/local_notifications/lib/features/local_reminder/repositories/reminder_preferences.dart +76 -0
- package/lib/scaffold/features/local_notifications/lib/features/local_reminder/ui/reminder_page.dart +282 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/api/entities/user_info_entity.dart +24 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/api/user_infos_api.dart +71 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/models/user_info.dart +92 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/providers/onboarding_model.dart +15 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/providers/onboarding_provider.dart +78 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/repositories/user_infos_repository.dart +29 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/animations/page_transitions.dart +30 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_att_setup.dart +66 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_features.dart +72 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_loader.dart +92 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_notifications_setup.dart +73 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_questions.dart +89 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/onboarding_page.dart +94 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_background.dart +80 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_feature.dart +139 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_illustration_scaffold.dart +110 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_progress.dart +84 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +173 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_reassurance.dart +45 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_sticky_footer.dart +77 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/selectable_row_tile.dart +392 -0
- package/lib/scaffold/features/revenuecat/lib/core/data/api/tracking_api.dart +116 -0
- package/lib/scaffold/features/revenuecat/lib/core/data/models/subscription.dart +322 -0
- package/lib/scaffold/features/revenuecat/lib/core/home_widgets/home_widget_background_task.dart +41 -0
- package/lib/scaffold/features/revenuecat/lib/core/states/user_state_notifier.dart +305 -0
- package/lib/scaffold/features/widget/lib/core/home_widgets/home_widget_background_task.dart +41 -0
- package/lib/scaffold/features/widget/lib/core/home_widgets/home_widget_mywidget_service.dart +57 -0
- package/lib/scaffold/features/widget/lib/core/home_widgets/home_widget_service.dart +54 -0
- package/lib/scaffold/features/widget/lib/features/settings/ui/components/admin/admin_home_widgets.dart +32 -0
- package/lib/scaffold/generate.js +370 -0
- package/lib/scaffold/patch.js +395 -0
- package/lib/scaffold/shared/backend-config.js +74 -0
- package/lib/scaffold/shared/fcm-service-account.js +126 -0
- package/lib/scaffold/shared/generator-utils.js +1664 -0
- package/lib/scaffold/shared/post-build.js +809 -0
- package/lib/scaffold/shared/template-strings.js +112 -0
- package/lib/utils/apple-release.js +273 -0
- package/lib/utils/checks.js +319 -0
- package/lib/utils/codemagic-release.js +127 -0
- package/lib/utils/fs.js +122 -0
- package/lib/utils/i18n.js +2123 -0
- package/lib/utils/license-gate.js +72 -0
- package/lib/utils/license.js +64 -0
- package/lib/utils/prompts.js +213 -0
- package/lib/utils/updates.js +97 -0
- package/package.json +55 -0
- package/templates/firebase/.env.example +24 -0
- package/templates/firebase/.firebaserc +5 -0
- package/templates/firebase/.kasy/apple.env.example +8 -0
- package/templates/firebase/.kasy/codemagic.env.example +7 -0
- package/templates/firebase/.metadata +30 -0
- package/templates/firebase/.windsurfrules +95 -0
- package/templates/firebase/Makefile +30 -0
- package/templates/firebase/README.en.md +180 -0
- package/templates/firebase/README.es.md +180 -0
- package/templates/firebase/README.md +180 -0
- package/templates/firebase/analysis_options.yaml +37 -0
- package/templates/firebase/android/app/build.gradle.kts +80 -0
- package/templates/firebase/android/app/src/debug/AndroidManifest.xml +7 -0
- package/templates/firebase/android/app/src/main/AndroidManifest.xml +93 -0
- package/templates/firebase/android/app/src/main/kotlin/com/aicrus/firebase/kit/MainActivity.kt +36 -0
- package/templates/firebase/android/app/src/main/kotlin/com/aicrus/firebase/kit/MyWidget.kt +50 -0
- package/templates/firebase/android/app/src/main/kotlin/com/aicrus/firebase/kit/MyWidgetReceiver.kt +7 -0
- package/templates/firebase/android/app/src/main/res/drawable/background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable/launch_background.xml +9 -0
- package/templates/firebase/android/app/src/main/res/drawable-hdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-mdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-v21/background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-v21/launch_background.xml +9 -0
- package/templates/firebase/android/app/src/main/res/drawable-xhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxxhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/values/strings.xml +6 -0
- package/templates/firebase/android/app/src/main/res/values/styles.xml +22 -0
- package/templates/firebase/android/app/src/main/res/values-night/styles.xml +22 -0
- package/templates/firebase/android/app/src/main/res/values-night-v31/styles.xml +20 -0
- package/templates/firebase/android/app/src/main/res/values-v31/styles.xml +20 -0
- package/templates/firebase/android/app/src/main/res/xml/locales_config.xml +7 -0
- package/templates/firebase/android/app/src/main/res/xml/mywidget_info.xml +11 -0
- package/templates/firebase/android/app/src/profile/AndroidManifest.xml +7 -0
- package/templates/firebase/android/build.gradle.kts +28 -0
- package/templates/firebase/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/templates/firebase/android/gradle.properties +2 -0
- package/templates/firebase/android/settings.gradle.kts +29 -0
- package/templates/firebase/assets/icons/apple.png +0 -0
- package/templates/firebase/assets/icons/facebook.png +0 -0
- package/templates/firebase/assets/icons/google.png +0 -0
- package/templates/firebase/assets/icons/google_play_games.png +0 -0
- package/templates/firebase/assets/images/app_icon.png +0 -0
- package/templates/firebase/assets/images/empty_notifications.jpg +0 -0
- package/templates/firebase/assets/images/icon.png +0 -0
- package/templates/firebase/assets/images/onboarding/authentication-login-template.jpg +0 -0
- package/templates/firebase/assets/images/onboarding/img1.jpg +0 -0
- package/templates/firebase/assets/images/onboarding/img2.jpg +0 -0
- package/templates/firebase/assets/images/onboarding/img3.jpg +0 -0
- package/templates/firebase/assets/images/onboarding/notifications.png +0 -0
- package/templates/firebase/assets/images/onboarding/onboarding.png +0 -0
- package/templates/firebase/assets/images/onboarding/purchase.png +0 -0
- package/templates/firebase/assets/images/premium-bg.jpg +0 -0
- package/templates/firebase/assets/images/premium-switch-header.png +0 -0
- package/templates/firebase/assets/images/review.png +0 -0
- package/templates/firebase/assets/images/splashscreen.png +0 -0
- package/templates/firebase/assets/images/update.png +0 -0
- package/templates/firebase/build.yaml +13 -0
- package/templates/firebase/devtools_options.yaml +3 -0
- package/templates/firebase/docs/auth-setup.en.md +145 -0
- package/templates/firebase/docs/auth-setup.es.md +145 -0
- package/templates/firebase/docs/auth-setup.pt.md +145 -0
- package/templates/firebase/docs/codemagic-release.en.md +50 -0
- package/templates/firebase/docs/codemagic-release.es.md +50 -0
- package/templates/firebase/docs/codemagic-release.pt.md +50 -0
- package/templates/firebase/docs/ios-release.en.md +41 -0
- package/templates/firebase/docs/ios-release.es.md +41 -0
- package/templates/firebase/docs/ios-release.pt.md +54 -0
- package/templates/firebase/docs/navigation-transitions.md +80 -0
- package/templates/firebase/docs/revenuecat-setup.es.md +341 -0
- package/templates/firebase/docs/revenuecat-setup.pt.md +341 -0
- package/templates/firebase/firebase.json +1 -0
- package/templates/firebase/firestore.indexes.json +25 -0
- package/templates/firebase/firestore.rules +51 -0
- package/templates/firebase/functions/.eslintrc.js +45 -0
- package/templates/firebase/functions/jest.config.js +16 -0
- package/templates/firebase/functions/package-lock.json +6876 -0
- package/templates/firebase/functions/package.json +33 -0
- package/templates/firebase/functions/src/authentication/functions.ts +30 -0
- package/templates/firebase/functions/src/authentication/triggers.ts +103 -0
- package/templates/firebase/functions/src/core/api/meta_ads_api.ts +390 -0
- package/templates/firebase/functions/src/core/data/entities/entity_utils.ts +87 -0
- package/templates/firebase/functions/src/core/data/entities/notification_entity.ts +74 -0
- package/templates/firebase/functions/src/core/data/entities/page.ts +4 -0
- package/templates/firebase/functions/src/core/data/entities/subscription_entity.ts +76 -0
- package/templates/firebase/functions/src/core/data/entities/user_device_entity.ts +64 -0
- package/templates/firebase/functions/src/core/data/entities/user_entity.ts +43 -0
- package/templates/firebase/functions/src/core/data/repositories/repositories.ts +16 -0
- package/templates/firebase/functions/src/core/data/repositories/subscription_repository.ts +42 -0
- package/templates/firebase/functions/src/core/data/repositories/user_device_repository.ts +31 -0
- package/templates/firebase/functions/src/core/data/repositories/user_notifications_repository.ts +58 -0
- package/templates/firebase/functions/src/core/data/repositories/user_repository.ts +84 -0
- package/templates/firebase/functions/src/core/logger/logger.ts +13 -0
- package/templates/firebase/functions/src/core/storage/storage_manager.ts +52 -0
- package/templates/firebase/functions/src/core/utils/async_utils.ts +5 -0
- package/templates/firebase/functions/src/feature_requests/triggers.ts +3 -0
- package/templates/firebase/functions/src/index.ts +24 -0
- package/templates/firebase/functions/src/llm_chat/index.ts +181 -0
- package/templates/firebase/functions/src/notifications/admin_functions.ts +91 -0
- package/templates/firebase/functions/src/notifications/models/notification.ts +61 -0
- package/templates/firebase/functions/src/notifications/notifications_api.ts +147 -0
- package/templates/firebase/functions/src/notifications/triggers.ts +102 -0
- package/templates/firebase/functions/src/subscriptions/models/revenuecat_events.ts +162 -0
- package/templates/firebase/functions/src/subscriptions/models/subscription_status.ts +18 -0
- package/templates/firebase/functions/src/subscriptions/models/subscriptions.ts +173 -0
- package/templates/firebase/functions/src/subscriptions/subscriptions_functions.ts +135 -0
- package/templates/firebase/functions/src/subscriptions/triggers.ts +35 -0
- package/templates/firebase/functions/src/test/core/data/entities/entity_utils.spec.ts +44 -0
- package/templates/firebase/functions/tsconfig.dev.json +5 -0
- package/templates/firebase/functions/tsconfig.json +18 -0
- package/templates/firebase/home_widget_config.json +30 -0
- package/templates/firebase/ios/Flutter/AppFrameworkInfo.plist +24 -0
- package/templates/firebase/ios/Flutter/Debug.xcconfig +2 -0
- package/templates/firebase/ios/Flutter/Profile.xcconfig +2 -0
- package/templates/firebase/ios/Flutter/Release.xcconfig +2 -0
- package/templates/firebase/ios/HomeWidgetExtension/HomeWidgetBundle.swift +13 -0
- package/templates/firebase/ios/HomeWidgetExtension/Info.plist +29 -0
- package/templates/firebase/ios/HomeWidgetExtension/MyWidget.swift +86 -0
- package/templates/firebase/ios/HomeWidgetExtension.entitlements +10 -0
- package/templates/firebase/ios/NotificationService/Info.plist +31 -0
- package/templates/firebase/ios/NotificationService/NotificationService.swift +76 -0
- package/templates/firebase/ios/Podfile +111 -0
- package/templates/firebase/ios/Runner/AppDelegate.swift +75 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +1 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json +21 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
- package/templates/firebase/ios/Runner/Base.lproj/LaunchScreen.storyboard +44 -0
- package/templates/firebase/ios/Runner/Base.lproj/Main.storyboard +26 -0
- package/templates/firebase/ios/Runner/Info.plist +132 -0
- package/templates/firebase/ios/Runner/Runner-Bridging-Header.h +1 -0
- package/templates/firebase/ios/Runner/Runner.entitlements +14 -0
- package/templates/firebase/ios/Runner/es.lproj/InfoPlist.strings +10 -0
- package/templates/firebase/ios/Runner/pt-BR.lproj/InfoPlist.strings +10 -0
- package/templates/firebase/ios/Runner/pt.lproj/InfoPlist.strings +10 -0
- package/templates/firebase/ios/Runner.xcodeproj/project.pbxproj +1108 -0
- package/templates/firebase/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/templates/firebase/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/templates/firebase/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/templates/firebase/ios/Runner.xcodeproj/xcshareddata/xcschemes/NotificationService.xcscheme +58 -0
- package/templates/firebase/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +101 -0
- package/templates/firebase/ios/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/templates/firebase/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/templates/firebase/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/templates/firebase/ios/RunnerTests/RunnerTests.swift +12 -0
- package/templates/firebase/lib/components/components.dart +27 -0
- package/templates/firebase/lib/components/kasy_accordion.dart +384 -0
- package/templates/firebase/lib/components/kasy_alert.dart +266 -0
- package/templates/firebase/lib/components/kasy_app_bar.dart +536 -0
- package/templates/firebase/lib/components/kasy_avatar.dart +549 -0
- package/templates/firebase/lib/components/kasy_avatar_presets.dart +104 -0
- package/templates/firebase/lib/components/kasy_badge.dart +278 -0
- package/templates/firebase/lib/components/kasy_bottom_sheet.dart +338 -0
- package/templates/firebase/lib/components/kasy_button.dart +926 -0
- package/templates/firebase/lib/components/kasy_card.dart +128 -0
- package/templates/firebase/lib/components/kasy_checkbox.dart +429 -0
- package/templates/firebase/lib/components/kasy_chip.dart +83 -0
- package/templates/firebase/lib/components/kasy_dialog.dart +789 -0
- package/templates/firebase/lib/components/kasy_otp_verification_bottom_sheet.dart +233 -0
- package/templates/firebase/lib/components/kasy_skeleton.dart +225 -0
- package/templates/firebase/lib/components/kasy_text_area.dart +392 -0
- package/templates/firebase/lib/components/kasy_text_field.dart +591 -0
- package/templates/firebase/lib/components/kasy_text_field_otp.dart +532 -0
- package/templates/firebase/lib/components/kasy_toast.dart +803 -0
- package/templates/firebase/lib/core/ads/ads_provider.dart +136 -0
- package/templates/firebase/lib/core/ads/ads_state.dart +15 -0
- package/templates/firebase/lib/core/animations/bottomfade_anim.dart +37 -0
- package/templates/firebase/lib/core/animations/movefade_anim.dart +34 -0
- package/templates/firebase/lib/core/animations/slideright_anim.dart +38 -0
- package/templates/firebase/lib/core/bottom_menu/bart_inner_paths.dart +5 -0
- package/templates/firebase/lib/core/bottom_menu/bottom_menu.dart +127 -0
- package/templates/firebase/lib/core/bottom_menu/bottom_router.dart +281 -0
- package/templates/firebase/lib/core/bottom_menu/kasy_bart_navigation.dart +22 -0
- package/templates/firebase/lib/core/bottom_menu/kasy_bottom_bar_factory.dart +127 -0
- package/templates/firebase/lib/core/bottom_menu/notification_bottom_item.dart +48 -0
- package/templates/firebase/lib/core/config/app_env.dart +100 -0
- package/templates/firebase/lib/core/config/features.dart +15 -0
- package/templates/firebase/lib/core/data/api/analytics_api.dart +124 -0
- package/templates/firebase/lib/core/data/api/base_api_exceptions.dart +28 -0
- package/templates/firebase/lib/core/data/api/firestore_retry.dart +29 -0
- package/templates/firebase/lib/core/data/api/http_client.dart +38 -0
- package/templates/firebase/lib/core/data/api/image.dart +52 -0
- package/templates/firebase/lib/core/data/api/remote_config_api.dart +170 -0
- package/templates/firebase/lib/core/data/api/storage_api.dart +115 -0
- package/templates/firebase/lib/core/data/api/tracking_api.dart +119 -0
- package/templates/firebase/lib/core/data/api/user_api.dart +115 -0
- package/templates/firebase/lib/core/data/entities/json_converters.dart +39 -0
- package/templates/firebase/lib/core/data/entities/upload_result.dart +48 -0
- package/templates/firebase/lib/core/data/entities/user_entity.dart +54 -0
- package/templates/firebase/lib/core/data/models/pageable.dart +12 -0
- package/templates/firebase/lib/core/data/models/subscription.dart +322 -0
- package/templates/firebase/lib/core/data/models/user.dart +107 -0
- package/templates/firebase/lib/core/data/repositories/user_repository.dart +130 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector.dart +464 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector_highlight.dart +88 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector_info.dart +70 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector_panel.dart +204 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector_service.dart +321 -0
- package/templates/firebase/lib/core/extensions/date.ext.dart +32 -0
- package/templates/firebase/lib/core/guards/authenticated_guard.dart +37 -0
- package/templates/firebase/lib/core/guards/guard.dart +68 -0
- package/templates/firebase/lib/core/guards/user_info_guard.dart +55 -0
- package/templates/firebase/lib/core/haptics/haptic_feedback_notifier.dart +19 -0
- package/templates/firebase/lib/core/haptics/kasy_haptics.dart +27 -0
- package/templates/firebase/lib/core/home_widgets/home_widget_background_task.dart +41 -0
- package/templates/firebase/lib/core/home_widgets/home_widget_mywidget_service.dart +57 -0
- package/templates/firebase/lib/core/home_widgets/home_widget_service.dart +54 -0
- package/templates/firebase/lib/core/icons/kasy_icons.dart +86 -0
- package/templates/firebase/lib/core/initializer/models/run_state.dart +14 -0
- package/templates/firebase/lib/core/initializer/onstart_service.dart +38 -0
- package/templates/firebase/lib/core/initializer/onstart_widget.dart +83 -0
- package/templates/firebase/lib/core/initializer/pending_notification_handler.dart +48 -0
- package/templates/firebase/lib/core/keyboard_fix/keyboard_flicker_fix.dart +164 -0
- package/templates/firebase/lib/core/navigation/kasy_fade_page_transitions_builder.dart +34 -0
- package/templates/firebase/lib/core/navigation/kasy_material_page_route.dart +41 -0
- package/templates/firebase/lib/core/navigation/kasy_navigation_config.dart +29 -0
- package/templates/firebase/lib/core/navigation/kasy_page_transition.dart +40 -0
- package/templates/firebase/lib/core/navigation/kasy_route_transition.dart +68 -0
- package/templates/firebase/lib/core/navigation/kasy_transition_kind.dart +17 -0
- package/templates/firebase/lib/core/navigation/navigation.dart +6 -0
- package/templates/firebase/lib/core/rating/api/rating_api.dart +99 -0
- package/templates/firebase/lib/core/rating/models/rating.dart +52 -0
- package/templates/firebase/lib/core/rating/models/review.dart +70 -0
- package/templates/firebase/lib/core/rating/providers/rating_repository.dart +75 -0
- package/templates/firebase/lib/core/rating/widgets/rate_banner.dart +190 -0
- package/templates/firebase/lib/core/rating/widgets/rate_popup.dart +54 -0
- package/templates/firebase/lib/core/rating/widgets/review_popup.dart +175 -0
- package/templates/firebase/lib/core/security/biometric_copy_slot.dart +20 -0
- package/templates/firebase/lib/core/security/biometric_guard.dart +114 -0
- package/templates/firebase/lib/core/security/biometric_preference_notifier.dart +17 -0
- package/templates/firebase/lib/core/security/biometric_service.dart +79 -0
- package/templates/firebase/lib/core/security/biometric_ui_bundle.dart +136 -0
- package/templates/firebase/lib/core/security/secured_storage.dart +46 -0
- package/templates/firebase/lib/core/shared_preferences/shared_preferences.dart +70 -0
- package/templates/firebase/lib/core/sidebar/kasy_sidebar.dart +2021 -0
- package/templates/firebase/lib/core/states/components/maybe_ask_biometric_setup.dart +88 -0
- package/templates/firebase/lib/core/states/components/maybe_ask_rating.dart +49 -0
- package/templates/firebase/lib/core/states/components/maybe_show_update_bottom_sheet.dart +86 -0
- package/templates/firebase/lib/core/states/components/maybeshow_component.dart +110 -0
- package/templates/firebase/lib/core/states/events_dispatcher.dart +103 -0
- package/templates/firebase/lib/core/states/models/event_model.dart +118 -0
- package/templates/firebase/lib/core/states/models/user_state.dart +22 -0
- package/templates/firebase/lib/core/states/notifications_dispatcher.dart +81 -0
- package/templates/firebase/lib/core/states/translations.dart +11 -0
- package/templates/firebase/lib/core/states/user_state_notifier.dart +321 -0
- package/templates/firebase/lib/core/theme/colors.dart +262 -0
- package/templates/firebase/lib/core/theme/extensions/theme_extension.dart +48 -0
- package/templates/firebase/lib/core/theme/providers/kasy_theme.dart +76 -0
- package/templates/firebase/lib/core/theme/providers/theme_provider.dart +212 -0
- package/templates/firebase/lib/core/theme/radius.dart +33 -0
- package/templates/firebase/lib/core/theme/shadows.dart +64 -0
- package/templates/firebase/lib/core/theme/spacing.dart +44 -0
- package/templates/firebase/lib/core/theme/texts.dart +176 -0
- package/templates/firebase/lib/core/theme/theme.dart +24 -0
- package/templates/firebase/lib/core/theme/theme_data/theme_data.dart +32 -0
- package/templates/firebase/lib/core/theme/theme_data/theme_data_factory.dart +15 -0
- package/templates/firebase/lib/core/theme/universal_theme.dart +210 -0
- package/templates/firebase/lib/core/toast/toast_service.dart +55 -0
- package/templates/firebase/lib/core/ui/app_dialog.dart +26 -0
- package/templates/firebase/lib/core/web_device_preview/web_device_preview.dart +1126 -0
- package/templates/firebase/lib/core/widgets/debouncer.dart +31 -0
- package/templates/firebase/lib/core/widgets/kasy_hover.dart +166 -0
- package/templates/firebase/lib/core/widgets/kasy_pressable.dart +2 -0
- package/templates/firebase/lib/core/widgets/kasy_pressable_depth.dart +161 -0
- package/templates/firebase/lib/core/widgets/kasy_scroll_behavior.dart +17 -0
- package/templates/firebase/lib/core/widgets/keyboard_visibility.dart +75 -0
- package/templates/firebase/lib/core/widgets/page_background.dart +71 -0
- package/templates/firebase/lib/core/widgets/page_not_found.dart +15 -0
- package/templates/firebase/lib/core/widgets/responsive_layout.dart +215 -0
- package/templates/firebase/lib/core/widgets/update_bottom_sheet.dart +192 -0
- package/templates/firebase/lib/environnements.dart +160 -0
- package/templates/firebase/lib/features/authentication/api/authentication_api.dart +528 -0
- package/templates/firebase/lib/features/authentication/api/authentication_api_interface.dart +84 -0
- package/templates/firebase/lib/features/authentication/providers/models/email.dart +36 -0
- package/templates/firebase/lib/features/authentication/providers/models/password.dart +37 -0
- package/templates/firebase/lib/features/authentication/providers/models/phone_signin_state.dart +21 -0
- package/templates/firebase/lib/features/authentication/providers/models/recover_state.dart +21 -0
- package/templates/firebase/lib/features/authentication/providers/models/signin_state.dart +20 -0
- package/templates/firebase/lib/features/authentication/providers/models/signup_state.dart +20 -0
- package/templates/firebase/lib/features/authentication/providers/phone_auth_notifier.dart +132 -0
- package/templates/firebase/lib/features/authentication/providers/recover_provider.dart +51 -0
- package/templates/firebase/lib/features/authentication/providers/signin_state_provider.dart +166 -0
- package/templates/firebase/lib/features/authentication/providers/signup_state_provider.dart +67 -0
- package/templates/firebase/lib/features/authentication/repositories/authentication_repository.dart +399 -0
- package/templates/firebase/lib/features/authentication/repositories/exceptions/authentication_exceptions.dart +85 -0
- package/templates/firebase/lib/features/authentication/ui/components/apple_signin.dart +19 -0
- package/templates/firebase/lib/features/authentication/ui/components/facebook_signin.dart +19 -0
- package/templates/firebase/lib/features/authentication/ui/components/google_signin.dart +32 -0
- package/templates/firebase/lib/features/authentication/ui/components/otp_verification.dart +100 -0
- package/templates/firebase/lib/features/authentication/ui/components/phone_input.dart +109 -0
- package/templates/firebase/lib/features/authentication/ui/phone_auth_page.dart +60 -0
- package/templates/firebase/lib/features/authentication/ui/recover_password_page.dart +101 -0
- package/templates/firebase/lib/features/authentication/ui/signin_page.dart +321 -0
- package/templates/firebase/lib/features/authentication/ui/signup_page.dart +310 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/auth_brand.dart +35 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/auth_page_back_button.dart +149 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/otp_input.dart +194 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/recover_password_result.dart +62 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/round_signin.dart +73 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/social_separator.dart +26 -0
- package/templates/firebase/lib/features/dev/keyboard_test_page.dart +93 -0
- package/templates/firebase/lib/features/feedbacks/api/entities/feature_request_entity.dart +27 -0
- package/templates/firebase/lib/features/feedbacks/api/entities/feature_vote_entity.dart +27 -0
- package/templates/firebase/lib/features/feedbacks/api/feature_request_api.dart +51 -0
- package/templates/firebase/lib/features/feedbacks/api/feature_vote_api.dart +79 -0
- package/templates/firebase/lib/features/feedbacks/models/feature_requests.dart +48 -0
- package/templates/firebase/lib/features/feedbacks/models/feedback_state.dart +43 -0
- package/templates/firebase/lib/features/feedbacks/providers/feedback_page_notifier.dart +147 -0
- package/templates/firebase/lib/features/feedbacks/repositories/feature_request_repository.dart +92 -0
- package/templates/firebase/lib/features/feedbacks/ui/component/add_feature_form.dart +112 -0
- package/templates/firebase/lib/features/feedbacks/ui/feedback_page.dart +184 -0
- package/templates/firebase/lib/features/feedbacks/ui/widgets/add_feature_button.dart +66 -0
- package/templates/firebase/lib/features/feedbacks/ui/widgets/feature_card.dart +266 -0
- package/templates/firebase/lib/features/home/design_system_page.dart +552 -0
- package/templates/firebase/lib/features/home/home_components_page.dart +314 -0
- package/templates/firebase/lib/features/home/home_components_preview_page.dart +791 -0
- package/templates/firebase/lib/features/home/home_components_preview_registry.dart +7712 -0
- package/templates/firebase/lib/features/home/home_features_page.dart +207 -0
- package/templates/firebase/lib/features/home/home_page.dart +348 -0
- package/templates/firebase/lib/features/llm_chat/api/llm_chat_api.dart +50 -0
- package/templates/firebase/lib/features/llm_chat/api/llm_chat_message_entity.dart +35 -0
- package/templates/firebase/lib/features/llm_chat/llm_chat_page.dart +352 -0
- package/templates/firebase/lib/features/llm_chat/providers/llm_chat_notifier.dart +315 -0
- package/templates/firebase/lib/features/llm_chat/ui/widgets/llm_chat_avatars.dart +148 -0
- package/templates/firebase/lib/features/llm_chat/ui/widgets/llm_chat_composer.dart +124 -0
- package/templates/firebase/lib/features/local_reminder/providers/reminder_notifier.dart +81 -0
- package/templates/firebase/lib/features/local_reminder/repositories/reminder_preferences.dart +76 -0
- package/templates/firebase/lib/features/local_reminder/ui/reminder_page.dart +288 -0
- package/templates/firebase/lib/features/notifications/api/device_api.dart +433 -0
- package/templates/firebase/lib/features/notifications/api/entities/device_entity.dart +62 -0
- package/templates/firebase/lib/features/notifications/api/entities/notifications_entity.dart +35 -0
- package/templates/firebase/lib/features/notifications/api/local_notifier.dart +409 -0
- package/templates/firebase/lib/features/notifications/api/notifications_api.dart +319 -0
- package/templates/firebase/lib/features/notifications/providers/models/device.dart +27 -0
- package/templates/firebase/lib/features/notifications/providers/models/notification.dart +196 -0
- package/templates/firebase/lib/features/notifications/providers/models/notification_list.dart +38 -0
- package/templates/firebase/lib/features/notifications/providers/notifications_provider.dart +120 -0
- package/templates/firebase/lib/features/notifications/repositories/background_notification_handler.dart +13 -0
- package/templates/firebase/lib/features/notifications/repositories/device_repository.dart +137 -0
- package/templates/firebase/lib/features/notifications/repositories/notifications_repository.dart +214 -0
- package/templates/firebase/lib/features/notifications/shared/att_permission.dart +75 -0
- package/templates/firebase/lib/features/notifications/shared/notification_permission_bottom_sheet.dart +144 -0
- package/templates/firebase/lib/features/notifications/ui/components/notification_settings_sheet.dart +169 -0
- package/templates/firebase/lib/features/notifications/ui/components/notification_tile.dart +46 -0
- package/templates/firebase/lib/features/notifications/ui/components/notifications_header.dart +32 -0
- package/templates/firebase/lib/features/notifications/ui/components/push_notification_switcher.dart +106 -0
- package/templates/firebase/lib/features/notifications/ui/notifications_page.dart +202 -0
- package/templates/firebase/lib/features/notifications/ui/request_notification_permission.dart +84 -0
- package/templates/firebase/lib/features/notifications/ui/widgets/empty_notifications.dart +73 -0
- package/templates/firebase/lib/features/notifications/ui/widgets/notification_tile.dart +362 -0
- package/templates/firebase/lib/features/onboarding/api/entities/user_info_entity.dart +24 -0
- package/templates/firebase/lib/features/onboarding/api/user_infos_api.dart +71 -0
- package/templates/firebase/lib/features/onboarding/models/user_info.dart +92 -0
- package/templates/firebase/lib/features/onboarding/providers/onboarding_model.dart +15 -0
- package/templates/firebase/lib/features/onboarding/providers/onboarding_provider.dart +78 -0
- package/templates/firebase/lib/features/onboarding/repositories/user_infos_repository.dart +29 -0
- package/templates/firebase/lib/features/onboarding/ui/animations/page_transitions.dart +33 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_att_setup.dart +66 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_features.dart +76 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_loader.dart +92 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_notifications_setup.dart +76 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_questions.dart +89 -0
- package/templates/firebase/lib/features/onboarding/ui/onboarding_page.dart +108 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_background.dart +80 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_feature.dart +145 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_illustration_scaffold.dart +125 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_progress.dart +84 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +173 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_reassurance.dart +44 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_sticky_footer.dart +77 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/selectable_row_tile.dart +392 -0
- package/templates/firebase/lib/features/settings/settings_page.dart +460 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/admin_bottom_sheet.dart +301 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/admin_home_widgets.dart +38 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/admin_paywalls.dart +53 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/admin_routes.dart +22 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/send_push_notification_page.dart +366 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/send_push_notifier.dart +40 -0
- package/templates/firebase/lib/features/settings/ui/components/avatar_component.dart +430 -0
- package/templates/firebase/lib/features/settings/ui/components/delete_user_component.dart +28 -0
- package/templates/firebase/lib/features/settings/ui/components/language_switcher.dart +163 -0
- package/templates/firebase/lib/features/settings/ui/widgets/admin_card.dart +59 -0
- package/templates/firebase/lib/features/settings/ui/widgets/avatar_utils.dart +51 -0
- package/templates/firebase/lib/features/settings/ui/widgets/round_progress.dart +151 -0
- package/templates/firebase/lib/features/settings/ui/widgets/settings_bottom_sheet_option_tile.dart +52 -0
- package/templates/firebase/lib/features/settings/ui/widgets/settings_tile.dart +163 -0
- package/templates/firebase/lib/features/subscription/api/entities/subscription_entity.dart +40 -0
- package/templates/firebase/lib/features/subscription/api/inapp_subscription_api.dart +389 -0
- package/templates/firebase/lib/features/subscription/api/subscription_api.dart +39 -0
- package/templates/firebase/lib/features/subscription/providers/models/premium_state.dart +35 -0
- package/templates/firebase/lib/features/subscription/providers/premium_page_provider.dart +259 -0
- package/templates/firebase/lib/features/subscription/repositories/subscription_repository.dart +177 -0
- package/templates/firebase/lib/features/subscription/shared/maybeshow_premium.dart +85 -0
- package/templates/firebase/lib/features/subscription/ui/component/active_premium_content.dart +171 -0
- package/templates/firebase/lib/features/subscription/ui/component/paywall_minimal.dart +146 -0
- package/templates/firebase/lib/features/subscription/ui/component/paywall_row.dart +332 -0
- package/templates/firebase/lib/features/subscription/ui/component/paywall_with_switch.dart +207 -0
- package/templates/firebase/lib/features/subscription/ui/component/premium_content.dart +157 -0
- package/templates/firebase/lib/features/subscription/ui/component/premium_page_factory.dart +161 -0
- package/templates/firebase/lib/features/subscription/ui/premium_page.dart +139 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/comparison_table.dart +346 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/feature_line.dart +131 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/paywall_empty_state.dart +68 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_background.dart +63 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_background_gradient.dart +53 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_banner.dart +80 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_bottom_menu.dart +102 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_card.dart +26 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_close_button.dart +61 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_feature.dart +39 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/selectable_col.dart +377 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/selectable_row.dart +436 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/trial_switcher.dart +85 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/unsubscribe_feedback_popup.dart +123 -0
- package/templates/firebase/lib/firebase_options.dart +75 -0
- package/templates/firebase/lib/google_auth_options.dart +10 -0
- package/templates/firebase/lib/i18n/app_locale_display.dart +17 -0
- package/templates/firebase/lib/i18n/en.i18n.json +514 -0
- package/templates/firebase/lib/i18n/es.i18n.json +514 -0
- package/templates/firebase/lib/i18n/pt.i18n.json +514 -0
- package/templates/firebase/lib/i18n/widgets/locale_code_badge.dart +47 -0
- package/templates/firebase/lib/main.dart +263 -0
- package/templates/firebase/lib/router.dart +226 -0
- package/templates/firebase/login-redesign-preview.png +0 -0
- package/templates/firebase/pubspec.yaml +177 -0
- package/templates/firebase/scripts/bump-ios-version.js +38 -0
- package/templates/firebase/scripts/release-ios.sh +137 -0
- package/templates/firebase/slang.yaml +7 -0
- package/templates/firebase/storage.rules +12 -0
- package/templates/firebase/test/core/data/api/analytics_api_fake.dart +25 -0
- package/templates/firebase/test/core/data/api/fake_remote_config_api.dart +45 -0
- package/templates/firebase/test/core/data/api/storage_api_fake.dart +28 -0
- package/templates/firebase/test/core/data/models/subscription_test.dart +42 -0
- package/templates/firebase/test/core/data/repositories/user_repository_test.dart +56 -0
- package/templates/firebase/test/core/guards/guard_test.dart +78 -0
- package/templates/firebase/test/core/navigation/kasy_page_transition_test.dart +30 -0
- package/templates/firebase/test/core/onstart_service_test.dart +18 -0
- package/templates/firebase/test/core/rating/rating_api_fake.dart +58 -0
- package/templates/firebase/test/core/rating/rating_banner_test.dart +117 -0
- package/templates/firebase/test/core/rating/rating_test.dart +60 -0
- package/templates/firebase/test/core/security/secured_storage_fake.dart +33 -0
- package/templates/firebase/test/core/states/event_dispatcher_test.dart +269 -0
- package/templates/firebase/test/core/states/user_state_notifier_test.dart +244 -0
- package/templates/firebase/test/core/widgets/responsive_layout_test.dart +50 -0
- package/templates/firebase/test/device_test_utils.dart +98 -0
- package/templates/firebase/test/features/authentication/data/api/auth_api_fake.dart +169 -0
- package/templates/firebase/test/features/authentication/data/api/user_api_fake.dart +86 -0
- package/templates/firebase/test/features/authentication/lost_password_page_test.dart +59 -0
- package/templates/firebase/test/features/authentication/repositories/authentication_repository_test.dart +88 -0
- package/templates/firebase/test/features/authentication/signin_page_test.dart +133 -0
- package/templates/firebase/test/features/authentication/signup_page_test.dart +136 -0
- package/templates/firebase/test/features/notifications/data/device_api_fake.dart +66 -0
- package/templates/firebase/test/features/notifications/data/fake_facebook_api.dart +40 -0
- package/templates/firebase/test/features/notifications/data/local_notifier_fake.dart +59 -0
- package/templates/firebase/test/features/notifications/data/notifications_api_fake.dart +120 -0
- package/templates/firebase/test/features/notifications/data/notifications_settings_fake.dart +34 -0
- package/templates/firebase/test/features/notifications/providers/device_repository_test.dart +68 -0
- package/templates/firebase/test/features/notifications/providers/notifications_repository_test.dart +74 -0
- package/templates/firebase/test/features/notifications/ui/notifications_page_test.dart +69 -0
- package/templates/firebase/test/features/subscription/api/fake_inapp_subscription_api.dart +85 -0
- package/templates/firebase/test/features/subscription/api/fake_revenuecat_product.dart +186 -0
- package/templates/firebase/test/features/subscription/api/fake_subscription_api.dart +11 -0
- package/templates/firebase/test/features/subscription/subscription_page_test.dart +119 -0
- package/templates/firebase/test/firebase_test_utils.dart +25 -0
- package/templates/firebase/test/test_utils.dart +272 -0
- package/templates/firebase/web/favicon.png +0 -0
- package/templates/firebase/web/firebase-messaging-sw.js +27 -0
- package/templates/firebase/web/icons/Icon-192.png +0 -0
- package/templates/firebase/web/icons/Icon-512.png +0 -0
- package/templates/firebase/web/icons/Icon-maskable-192.png +0 -0
- package/templates/firebase/web/icons/Icon-maskable-512.png +0 -0
- package/templates/firebase/web/index.html +110 -0
- package/templates/firebase/web/local_notifications.js +31 -0
- package/templates/firebase/web/manifest.json +35 -0
- package/templates/firebase/web/splash/img/dark-1x.png +0 -0
- package/templates/firebase/web/splash/img/dark-2x.png +0 -0
- package/templates/firebase/web/splash/img/dark-3x.png +0 -0
- package/templates/firebase/web/splash/img/dark-4x.png +0 -0
- package/templates/firebase/web/splash/img/light-1x.png +0 -0
- package/templates/firebase/web/splash/img/light-2x.png +0 -0
- package/templates/firebase/web/splash/img/light-3x.png +0 -0
- package/templates/firebase/web/splash/img/light-4x.png +0 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import 'package:flutter/foundation.dart';
|
|
2
|
+
import 'package:flutter/services.dart' show PlatformException;
|
|
3
|
+
import 'package:kasy_kit/core/data/api/analytics_api.dart';
|
|
4
|
+
import 'package:kasy_kit/core/data/models/subscription.dart';
|
|
5
|
+
import 'package:kasy_kit/core/states/models/user_state.dart';
|
|
6
|
+
import 'package:kasy_kit/core/states/translations.dart';
|
|
7
|
+
import 'package:kasy_kit/core/states/user_state_notifier.dart';
|
|
8
|
+
import 'package:kasy_kit/core/toast/toast_service.dart';
|
|
9
|
+
import 'package:kasy_kit/features/feedbacks/repositories/feature_request_repository.dart';
|
|
10
|
+
import 'package:kasy_kit/features/subscription/api/inapp_subscription_api.dart'
|
|
11
|
+
show UserCancelledPurchaseException;
|
|
12
|
+
import 'package:kasy_kit/features/subscription/providers/models/premium_state.dart';
|
|
13
|
+
import 'package:kasy_kit/features/subscription/repositories/subscription_repository.dart';
|
|
14
|
+
import 'package:kasy_kit/router.dart';
|
|
15
|
+
import 'package:logger/logger.dart';
|
|
16
|
+
import 'package:purchases_flutter/purchases_flutter.dart';
|
|
17
|
+
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
18
|
+
import 'package:sentry_flutter/sentry_flutter.dart';
|
|
19
|
+
|
|
20
|
+
part 'premium_page_provider.g.dart';
|
|
21
|
+
|
|
22
|
+
@Riverpod()
|
|
23
|
+
class PremiumStateNotifier extends _$PremiumStateNotifier {
|
|
24
|
+
final Logger _logger = Logger();
|
|
25
|
+
|
|
26
|
+
UserState get _userState => ref.read(userStateNotifierProvider);
|
|
27
|
+
|
|
28
|
+
SubscriptionRepository get _subscriptionRepository =>
|
|
29
|
+
ref.read(subscriptionRepositoryProvider);
|
|
30
|
+
|
|
31
|
+
AnalyticsApi? get _analyticsApi => ref.read(analyticsApiProvider);
|
|
32
|
+
|
|
33
|
+
@override
|
|
34
|
+
Future<PremiumState> build() async {
|
|
35
|
+
try {
|
|
36
|
+
// If you have installed the remote config brick
|
|
37
|
+
// you can use it like this
|
|
38
|
+
// RemoteConfig is amazing to manage and test different settings for paywalls
|
|
39
|
+
// ex: you can test different title and texts
|
|
40
|
+
// final remoteConfigApi = ref.watch(remoteConfigApiProvider);
|
|
41
|
+
// print(remoteConfigApi.subscription.title.value);
|
|
42
|
+
final offers = await _subscriptionRepository.getOffers();
|
|
43
|
+
if (offers.isEmpty) {
|
|
44
|
+
_logger.w(
|
|
45
|
+
'RevenueCat returned no subscription offers. The paywall will show '
|
|
46
|
+
'an empty-products state instead of a blank screen.',
|
|
47
|
+
);
|
|
48
|
+
return const PremiumState(offers: []);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return switch (_userState.subscription) {
|
|
52
|
+
SubscriptionStateData(:final activeOffer) => PremiumState.active(
|
|
53
|
+
activeOffer: offers.firstWhere(
|
|
54
|
+
(element) => element.skuId == activeOffer?.skuId,
|
|
55
|
+
orElse: () => offers.first,
|
|
56
|
+
),
|
|
57
|
+
),
|
|
58
|
+
SubscriptionInactiveStateData() => PremiumState(
|
|
59
|
+
offers: offers,
|
|
60
|
+
selectedOffer: offers.first,
|
|
61
|
+
),
|
|
62
|
+
_ => PremiumState(offers: offers, selectedOffer: offers.first),
|
|
63
|
+
};
|
|
64
|
+
} catch (err, stack) {
|
|
65
|
+
// RevenueCat CONFIGURATION_ERROR (code 23) means the products exist in the
|
|
66
|
+
// dashboard but aren't live on the store yet (e.g. "Ready to Submit").
|
|
67
|
+
// This is expected before the first app submission — skip Sentry noise.
|
|
68
|
+
final isConfigError = err is PlatformException &&
|
|
69
|
+
(err.details as Map?)?['readableErrorCode'] == 'CONFIGURATION_ERROR';
|
|
70
|
+
if (isConfigError) {
|
|
71
|
+
_logger.w(
|
|
72
|
+
'RevenueCat CONFIGURATION_ERROR: products not yet live on App Store. '
|
|
73
|
+
'Showing empty paywall state.',
|
|
74
|
+
);
|
|
75
|
+
} else {
|
|
76
|
+
await Sentry.captureException(err, stackTrace: stack);
|
|
77
|
+
_logger.e(
|
|
78
|
+
'...PremiumStateNotifier: init failed, '
|
|
79
|
+
'👉 Make sure you have properly setup subscription '
|
|
80
|
+
'following our guide (https://kasy.dev/docs/monetize/subscription-template/) '
|
|
81
|
+
'$err --> $stack',
|
|
82
|
+
stackTrace: stack,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return const PremiumStateData(offers: []);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Future<void> startCoupon() async {
|
|
90
|
+
if (TargetPlatform.iOS != defaultTargetPlatform) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
await Purchases.presentCodeRedemptionSheet();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
void selectOffer(SubscriptionProduct offer) {
|
|
97
|
+
if (state.value == null) {
|
|
98
|
+
throw "cannot select offer";
|
|
99
|
+
}
|
|
100
|
+
final newState = switch (state.value!) {
|
|
101
|
+
final PremiumStateData el => el.copyWith(selectedOffer: offer),
|
|
102
|
+
final PremiumStateActive el => el.copyWith(activeOffer: offer),
|
|
103
|
+
_ => null,
|
|
104
|
+
};
|
|
105
|
+
if (newState == null) {
|
|
106
|
+
throw "cannot select offer";
|
|
107
|
+
}
|
|
108
|
+
state = AsyncValue.data(newState);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
Future<void> purchase({String? paywall, String? redirectRoute}) async {
|
|
112
|
+
if (state.value is! PremiumStateData) {
|
|
113
|
+
throw "cannot purchase without offers";
|
|
114
|
+
}
|
|
115
|
+
final offer = state.value?.selectedOffer;
|
|
116
|
+
if (offer == null) {
|
|
117
|
+
throw "cannot purchase without selected offer";
|
|
118
|
+
}
|
|
119
|
+
await purchaseOffer(offer, paywall: paywall, redirectRoute: redirectRoute);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
Future<void> purchaseOffer(
|
|
123
|
+
SubscriptionProduct offer, {
|
|
124
|
+
String? paywall,
|
|
125
|
+
String? redirectRoute,
|
|
126
|
+
}) async {
|
|
127
|
+
state = switch (state.value) {
|
|
128
|
+
PremiumStateData(:final offers) => AsyncData(
|
|
129
|
+
PremiumState.sending(
|
|
130
|
+
isPremium: false,
|
|
131
|
+
offers: offers,
|
|
132
|
+
selectedOffer: offer,
|
|
133
|
+
),
|
|
134
|
+
),
|
|
135
|
+
_ => throw "cannot purchase while active",
|
|
136
|
+
};
|
|
137
|
+
try {
|
|
138
|
+
final entitlements = await _subscriptionRepository.purchase(offer);
|
|
139
|
+
state = AsyncData(PremiumState.active(activeOffer: offer));
|
|
140
|
+
await _analyticsApi?.logEvent("purchase", {
|
|
141
|
+
"skuId": offer.skuId,
|
|
142
|
+
"price": offer.price,
|
|
143
|
+
// "promotion": offer.promotion,
|
|
144
|
+
"duration": offer.duration,
|
|
145
|
+
"paywall": paywall,
|
|
146
|
+
});
|
|
147
|
+
// let's refresh the user state
|
|
148
|
+
await ref
|
|
149
|
+
.read(userStateNotifierProvider.notifier)
|
|
150
|
+
.refreshSubscription(product: offer, entitlements: entitlements);
|
|
151
|
+
final t = ref.read(translationsProvider);
|
|
152
|
+
ref
|
|
153
|
+
.read(toastProvider)
|
|
154
|
+
.success(
|
|
155
|
+
title: t.premium.purchase_success_title,
|
|
156
|
+
text: t.premium.purchase_success_text,
|
|
157
|
+
);
|
|
158
|
+
await Future.delayed(const Duration(seconds: 2));
|
|
159
|
+
if (redirectRoute != null) ref.read(goRouterProvider).go(redirectRoute);
|
|
160
|
+
} catch (err, stackTrace) {
|
|
161
|
+
state = switch (state.value) {
|
|
162
|
+
PremiumStateData(:final offers) => AsyncData(
|
|
163
|
+
PremiumState(offers: offers, selectedOffer: offer),
|
|
164
|
+
),
|
|
165
|
+
PremiumStateSending(:final offers) => AsyncData(
|
|
166
|
+
PremiumState(offers: offers, selectedOffer: offer),
|
|
167
|
+
),
|
|
168
|
+
PremiumStateActive() => state,
|
|
169
|
+
_ => throw "cannot purchase while active",
|
|
170
|
+
};
|
|
171
|
+
if (err is UserCancelledPurchaseException) return;
|
|
172
|
+
await Sentry.captureException(err, stackTrace: stackTrace);
|
|
173
|
+
_logger.e("...PremiumStateNotifier: purchase failed $err : $stackTrace");
|
|
174
|
+
final t = ref.read(translationsProvider);
|
|
175
|
+
ref
|
|
176
|
+
.read(toastProvider)
|
|
177
|
+
.error(
|
|
178
|
+
title: t.premium.error_title,
|
|
179
|
+
text: t.premium.error_text,
|
|
180
|
+
reason: "We were unable to process your subscription",
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
Future<void> unsubscribe() async {
|
|
186
|
+
// _analytics.logPageOpened("launch_unsubscribe_page");
|
|
187
|
+
await _subscriptionRepository.unsubscribe();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
Future<void> saveUnsubscribeReason(String reason) async {
|
|
191
|
+
try {
|
|
192
|
+
final userId = _userState.user.idOrNull;
|
|
193
|
+
if (userId == null) return;
|
|
194
|
+
await ref
|
|
195
|
+
.read(featureRequestRepositoryProvider)
|
|
196
|
+
.createNewFeatureSuggestion(
|
|
197
|
+
userId: userId,
|
|
198
|
+
title: "unsubscribed",
|
|
199
|
+
description: reason,
|
|
200
|
+
);
|
|
201
|
+
_logger.i('👉 Unsubscribe reason saved successfully');
|
|
202
|
+
} catch (err, stackTrace) {
|
|
203
|
+
_logger.e('👉 Error saving unsubscribe reason: $err : $stackTrace');
|
|
204
|
+
await Sentry.captureException(err, stackTrace: stackTrace);
|
|
205
|
+
// Don't rethrow as we don't want to block the unsubscribe process
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
Future<void> restore({String? redirectRoute}) async {
|
|
210
|
+
if (state.value is! PremiumStateData) {
|
|
211
|
+
throw "cannot restore while active";
|
|
212
|
+
}
|
|
213
|
+
final data = state.value! as PremiumStateData;
|
|
214
|
+
|
|
215
|
+
// Only enter loading state when there are offers to display; with an empty
|
|
216
|
+
// offer list the paywall already shows the empty-state UI.
|
|
217
|
+
if (data.offers.isNotEmpty) {
|
|
218
|
+
state = AsyncData(
|
|
219
|
+
PremiumState.sending(
|
|
220
|
+
isPremium: false,
|
|
221
|
+
offers: data.offers,
|
|
222
|
+
selectedOffer: data.selectedOffer,
|
|
223
|
+
),
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
try {
|
|
228
|
+
await _subscriptionRepository.restorePurchase();
|
|
229
|
+
final t = ref.read(translationsProvider);
|
|
230
|
+
ref
|
|
231
|
+
.read(toastProvider)
|
|
232
|
+
.success(
|
|
233
|
+
title: t.premium.restore_success_title,
|
|
234
|
+
text: t.premium.restore_success_text,
|
|
235
|
+
);
|
|
236
|
+
await Future.delayed(const Duration(seconds: 2));
|
|
237
|
+
if (redirectRoute != null) ref.read(goRouterProvider).go(redirectRoute);
|
|
238
|
+
} catch (err, trace) {
|
|
239
|
+
_logger.e("Error while restoring purchase: $err : $trace");
|
|
240
|
+
state = AsyncData(
|
|
241
|
+
PremiumStateData(offers: data.offers, selectedOffer: data.selectedOffer),
|
|
242
|
+
);
|
|
243
|
+
final t = ref.read(translationsProvider);
|
|
244
|
+
ref
|
|
245
|
+
.read(toastProvider)
|
|
246
|
+
.error(
|
|
247
|
+
title: t.premium.error_title,
|
|
248
|
+
text: t.premium.error_text,
|
|
249
|
+
reason: "We were unable to restore your subscription",
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
class SubscriptionException implements Exception {
|
|
256
|
+
final String message;
|
|
257
|
+
|
|
258
|
+
SubscriptionException(this.message);
|
|
259
|
+
}
|
package/templates/firebase/lib/features/subscription/repositories/subscription_repository.dart
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import 'package:flutter/services.dart';
|
|
2
|
+
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
3
|
+
import 'package:kasy_kit/core/data/models/subscription.dart';
|
|
4
|
+
import 'package:kasy_kit/core/initializer/onstart_service.dart';
|
|
5
|
+
import 'package:kasy_kit/core/shared_preferences/shared_preferences.dart';
|
|
6
|
+
import 'package:kasy_kit/features/subscription/api/inapp_subscription_api.dart';
|
|
7
|
+
import 'package:kasy_kit/features/subscription/api/subscription_api.dart';
|
|
8
|
+
import 'package:logger/logger.dart';
|
|
9
|
+
import 'package:purchases_flutter/errors.dart';
|
|
10
|
+
import 'package:purchases_flutter/models/entitlement_info_wrapper.dart';
|
|
11
|
+
import 'package:shared_preferences/shared_preferences.dart';
|
|
12
|
+
|
|
13
|
+
final subscriptionRepositoryProvider = Provider(
|
|
14
|
+
(ref) => SubscriptionRepository(
|
|
15
|
+
subscriptionApi: ref.watch(subscriptionApiProvider),
|
|
16
|
+
inAppSubscriptionApi: ref.watch(inAppSubscriptionApiProvider),
|
|
17
|
+
prefs: ref.watch(sharedPreferencesProvider).prefs,
|
|
18
|
+
// remoteConfig: ref.watch(remoteConfigApiProvider),
|
|
19
|
+
),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const _lastAskKey = 'subscription_last_asking_date';
|
|
23
|
+
|
|
24
|
+
/// This class is responsible for managing the subscription of the user
|
|
25
|
+
/// It will be used to know if the user is subscribed or not and to get the subscription
|
|
26
|
+
/// A fake implementation of the revenue cat is used for units test see: [InAppSubscriptionApiFake]
|
|
27
|
+
class SubscriptionRepository implements OnStartService {
|
|
28
|
+
final SubscriptionApi _subscriptionApi;
|
|
29
|
+
|
|
30
|
+
final RevenueCatPaymentApi _inAppSubscriptionApi;
|
|
31
|
+
|
|
32
|
+
final SharedPreferences? _prefs;
|
|
33
|
+
|
|
34
|
+
final Logger _logger;
|
|
35
|
+
|
|
36
|
+
/// You can use the remote config to configure the subscription module
|
|
37
|
+
/// For example, you can set the number of hours between two requests to the API
|
|
38
|
+
// final RemoteConfigApi? _remoteConfig;
|
|
39
|
+
|
|
40
|
+
SubscriptionRepository({
|
|
41
|
+
required SubscriptionApi subscriptionApi,
|
|
42
|
+
required RevenueCatPaymentApi inAppSubscriptionApi,
|
|
43
|
+
required SharedPreferences? prefs,
|
|
44
|
+
// RemoteConfigApi? remoteConfig,
|
|
45
|
+
Logger? logger,
|
|
46
|
+
}) : _subscriptionApi = subscriptionApi,
|
|
47
|
+
_logger = logger ?? Logger(),
|
|
48
|
+
_prefs = prefs,
|
|
49
|
+
// _remoteConfig = remoteConfig,
|
|
50
|
+
_inAppSubscriptionApi = inAppSubscriptionApi;
|
|
51
|
+
|
|
52
|
+
@override
|
|
53
|
+
Future<void> init() async {
|
|
54
|
+
try {
|
|
55
|
+
// We must init the subscription API
|
|
56
|
+
await _inAppSubscriptionApi.init();
|
|
57
|
+
} catch (e) {
|
|
58
|
+
_logger.w('''
|
|
59
|
+
Revenuecat seems not to be initialized.
|
|
60
|
+
👉 Please check that you have setup your account on https://revenuecat.com
|
|
61
|
+
And that you have added your token in the environment file or variable (see lib/environnements.dart)
|
|
62
|
+
or
|
|
63
|
+
👉 Remove completely the subscription module if you don't need it
|
|
64
|
+
''');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// We use a custom subscriber id to be able to identify the user
|
|
69
|
+
Future<void> initUser(String userId) async {
|
|
70
|
+
await _inAppSubscriptionApi.initUser(userId);
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// We get the subscription of the user
|
|
75
|
+
/// We fetch the subscription from our own API and not directly from RevenueCat
|
|
76
|
+
/// So we can grant some free subscription to users easily
|
|
77
|
+
/// Either you can uncomment the code to directly check from RevenueCat
|
|
78
|
+
Future<Subscription> get(String userId) async {
|
|
79
|
+
final entity = await _subscriptionApi.get(userId);
|
|
80
|
+
final subscription = Subscription.fromEntity(
|
|
81
|
+
entity,
|
|
82
|
+
lastAskingDate,
|
|
83
|
+
);
|
|
84
|
+
if (subscription.isActive) {
|
|
85
|
+
final entitlements = await _inAppSubscriptionApi.getEntitlements();
|
|
86
|
+
final product = await _inAppSubscriptionApi.getFromProductId(
|
|
87
|
+
entity!.skuId,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
return switch(subscription) {
|
|
91
|
+
final SubscriptionStateData active => active.copyWith(
|
|
92
|
+
activeOffer: product,
|
|
93
|
+
entitlements: entitlements,
|
|
94
|
+
),
|
|
95
|
+
_ => subscription,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
// RC fallback: backend has no active record (webhook may not have arrived yet).
|
|
99
|
+
// RevenueCat is the source of truth for purchases — consult it before
|
|
100
|
+
// marking the user as inactive.
|
|
101
|
+
final rcEntitlements = await _inAppSubscriptionApi.getEntitlements();
|
|
102
|
+
if (rcEntitlements != null && rcEntitlements.isNotEmpty) {
|
|
103
|
+
_logger.i(
|
|
104
|
+
'No active backend subscription — RevenueCat reports active entitlements. '
|
|
105
|
+
'Treating as active (webhook likely delayed).',
|
|
106
|
+
);
|
|
107
|
+
return Subscription.active(entitlements: rcEntitlements);
|
|
108
|
+
}
|
|
109
|
+
return subscription;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// We can have multiple offers (BASIC MONTH, BASIC YEAR, GOLD MONTH, GOLD YEAR, ...)
|
|
113
|
+
Future<List<SubscriptionProduct>> getOffers({String? offerId}) {
|
|
114
|
+
return _inAppSubscriptionApi.getOffers(offerId);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// We check if the user has a permission
|
|
118
|
+
// This allows us to add multiple permissions within subscription
|
|
119
|
+
// If you want only have a single premium subscription, you can create a single permission 'premium'
|
|
120
|
+
Future<bool> checkPermission(String permissionToCheck) async {
|
|
121
|
+
final permissions = await _inAppSubscriptionApi.getPermissions();
|
|
122
|
+
final hasPermission = permissions.any(
|
|
123
|
+
(e) => e.identifier == permissionToCheck && e.isActive,
|
|
124
|
+
);
|
|
125
|
+
if (!hasPermission) throw Exception("Permission denied: $permissionToCheck");
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// The purchase method is used to buy a subscription or a product
|
|
130
|
+
Future<List<EntitlementInfo>?> purchase(SubscriptionProduct product) async {
|
|
131
|
+
if (product is RevenueCatProduct) {
|
|
132
|
+
try {
|
|
133
|
+
await _inAppSubscriptionApi.purchasePackage(product.revenueCatPackage);
|
|
134
|
+
return _inAppSubscriptionApi.getEntitlements();
|
|
135
|
+
} on PlatformException catch (e) {
|
|
136
|
+
final error = PurchasesErrorHelper.getErrorCode(e);
|
|
137
|
+
if (error == PurchasesErrorCode.purchaseCancelledError) {
|
|
138
|
+
_logger.i('User has cancelled the purchase');
|
|
139
|
+
throw UserCancelledPurchaseException();
|
|
140
|
+
}
|
|
141
|
+
_logger.e('Error while purchasing the product: $e');
|
|
142
|
+
rethrow;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
throw Exception('Invalid product');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/// Unsubscribe the user
|
|
149
|
+
/// This will route the user to the subscription management page
|
|
150
|
+
/// This is handled by the Play Store or the App Store
|
|
151
|
+
Future<void> unsubscribe() async {
|
|
152
|
+
await _inAppSubscriptionApi.unsubscribe();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/// Restore a previous purchase
|
|
156
|
+
/// For ex if the user has changed his phone
|
|
157
|
+
/// he can restore his previous purchase
|
|
158
|
+
Future<void> restorePurchase() async {
|
|
159
|
+
await _inAppSubscriptionApi.restorePurchase();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/// Save the last time we showed the subscription paywall
|
|
163
|
+
Future<void> saveLastAskingDate() async {
|
|
164
|
+
if (_prefs == null) return;
|
|
165
|
+
final now = DateTime.now();
|
|
166
|
+
await _prefs.setInt(_lastAskKey, now.millisecondsSinceEpoch);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/// Get the last time we showed the subscription paywall
|
|
170
|
+
DateTime? get lastAskingDate {
|
|
171
|
+
final lastAsk = _prefs?.getInt(_lastAskKey);
|
|
172
|
+
if (lastAsk == null) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
return DateTime.fromMillisecondsSinceEpoch(lastAsk);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// ignore_for_file: use_build_context_synchronously
|
|
2
|
+
|
|
3
|
+
import 'package:flutter/foundation.dart';
|
|
4
|
+
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
5
|
+
import 'package:kasy_kit/core/config/features.dart';
|
|
6
|
+
import 'package:kasy_kit/core/data/models/user.dart';
|
|
7
|
+
import 'package:kasy_kit/core/shared_preferences/shared_preferences.dart';
|
|
8
|
+
import 'package:kasy_kit/core/states/components/maybeshow_component.dart';
|
|
9
|
+
import 'package:kasy_kit/core/states/models/event_model.dart';
|
|
10
|
+
import 'package:kasy_kit/core/states/user_state_notifier.dart';
|
|
11
|
+
import 'package:kasy_kit/router.dart';
|
|
12
|
+
|
|
13
|
+
const _lastAskKey = 'subscription_last_asking_date';
|
|
14
|
+
|
|
15
|
+
const _kDaysToAsk = 2;
|
|
16
|
+
|
|
17
|
+
class MaybeShowPremiumPage implements MaybeShowWithRef {
|
|
18
|
+
@override
|
|
19
|
+
Future<bool> handle(WidgetRef ref, AppEvent event) async {
|
|
20
|
+
if (event is! OnAppStartEvent) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (kIsWeb && !revenuecatWeb) return false;
|
|
24
|
+
debugPrint("🧐 MaybeShowPremiumPage");
|
|
25
|
+
final userState = ref.watch(userStateNotifierProvider);
|
|
26
|
+
if (userState.subscription?.isActive == true) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
final userCreationDate = switch(userState.user) {
|
|
30
|
+
AuthenticatedUserData(:final creationDate) => creationDate,
|
|
31
|
+
AnonymousUserData(:final creationDate) => creationDate,
|
|
32
|
+
_ => null,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
if (userCreationDate == null) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
final now = DateTime.now();
|
|
40
|
+
final prefs = ref.watch(sharedPreferencesProvider).prefs;
|
|
41
|
+
|
|
42
|
+
// await prefs.remove(_lastAskKey);
|
|
43
|
+
// await prefs.remove(_lastShowPromoKey);
|
|
44
|
+
|
|
45
|
+
final lastAskingDate = prefs.getInt(_lastAskKey);
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/// 🧐 🧐 🧐 if we have a promo - we only show the promo once or customize it
|
|
49
|
+
/// ----
|
|
50
|
+
// final lastShowPromoInMS = prefs.getInt(_lastShowPromoKey);
|
|
51
|
+
// final lastShowPromoDate = lastShowPromoInMS == null ? null : DateTime.fromMillisecondsSinceEpoch(lastShowPromoInMS);
|
|
52
|
+
// if (now.isAfter(userCreationDate.add(const Duration(days: 3))) && lastShowPromoDate == null && ref.context.mounted) {
|
|
53
|
+
// await prefs.setInt(_lastShowPromoKey, now.millisecondsSinceEpoch);
|
|
54
|
+
// await prefs.setInt(_lastAskKey, DateTime.now().millisecondsSinceEpoch);
|
|
55
|
+
// PromoBottomSheet.show(ref.context);
|
|
56
|
+
// return true;
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
if (now.isBefore(userCreationDate.add(const Duration(days: 1)))) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (lastAskingDate == null) {
|
|
64
|
+
await prefs.setInt(_lastAskKey, DateTime.now().millisecondsSinceEpoch);
|
|
65
|
+
showPremiumPage(ref);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
final lastDate = DateTime.fromMillisecondsSinceEpoch(lastAskingDate);
|
|
70
|
+
|
|
71
|
+
final difference = now.difference(lastDate);
|
|
72
|
+
|
|
73
|
+
if (difference.inDays >= _kDaysToAsk) {
|
|
74
|
+
await prefs.setInt(_lastAskKey, now.millisecondsSinceEpoch);
|
|
75
|
+
showPremiumPage(ref);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
void showPremiumPage(WidgetRef ref) {
|
|
83
|
+
ref.read(goRouterProvider).push("/premium");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
3
|
+
import 'package:google_fonts/google_fonts.dart';
|
|
4
|
+
import 'package:kasy_kit/components/components.dart';
|
|
5
|
+
import 'package:kasy_kit/core/states/user_state_notifier.dart';
|
|
6
|
+
import 'package:kasy_kit/core/theme/theme.dart';
|
|
7
|
+
import 'package:kasy_kit/features/subscription/ui/widgets/premium_background.dart';
|
|
8
|
+
import 'package:kasy_kit/features/subscription/ui/widgets/premium_card.dart';
|
|
9
|
+
import 'package:kasy_kit/features/subscription/ui/widgets/unsubscribe_feedback_popup.dart';
|
|
10
|
+
import 'package:kasy_kit/i18n/translations.g.dart';
|
|
11
|
+
|
|
12
|
+
typedef OnTapUnSubscribe = void Function(String reason);
|
|
13
|
+
typedef OnExit = void Function();
|
|
14
|
+
|
|
15
|
+
class ActivePremiumContent extends ConsumerStatefulWidget {
|
|
16
|
+
final OnTapUnSubscribe? onTap;
|
|
17
|
+
final OnExit? onExit;
|
|
18
|
+
|
|
19
|
+
const ActivePremiumContent({super.key, this.onExit, required this.onTap});
|
|
20
|
+
|
|
21
|
+
@override
|
|
22
|
+
ConsumerState<ActivePremiumContent> createState() =>
|
|
23
|
+
_ActivePremiumContentState();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class _ActivePremiumContentState extends ConsumerState<ActivePremiumContent> {
|
|
27
|
+
bool _isPopupShowing = false;
|
|
28
|
+
|
|
29
|
+
Future<void> _showUnsubscribePopup(BuildContext context) async {
|
|
30
|
+
if (_isPopupShowing) return;
|
|
31
|
+
setState(() => _isPopupShowing = true);
|
|
32
|
+
try {
|
|
33
|
+
await UnsubscribeFeedbackPopup.show(
|
|
34
|
+
context: context,
|
|
35
|
+
onConfirm: (String reason) {
|
|
36
|
+
Navigator.of(context).pop();
|
|
37
|
+
widget.onTap?.call(reason);
|
|
38
|
+
},
|
|
39
|
+
onCancel: () {},
|
|
40
|
+
);
|
|
41
|
+
} finally {
|
|
42
|
+
if (mounted) setState(() => _isPopupShowing = false);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@override
|
|
47
|
+
Widget build(BuildContext context) {
|
|
48
|
+
final userState = ref.watch(userStateNotifierProvider);
|
|
49
|
+
|
|
50
|
+
return PremiumBackground(
|
|
51
|
+
bgImagePath: "assets/images/premium-bg.jpg",
|
|
52
|
+
child: Scaffold(
|
|
53
|
+
backgroundColor: Colors.transparent,
|
|
54
|
+
appBar: AppBar(
|
|
55
|
+
backgroundColor: Colors.transparent,
|
|
56
|
+
elevation: 0,
|
|
57
|
+
foregroundColor: context.colors.onPrimary,
|
|
58
|
+
leading: widget.onExit != null
|
|
59
|
+
? KasyButton.iconOnly(
|
|
60
|
+
icon: KasyIcons.close,
|
|
61
|
+
variant: KasyButtonVariant.ghost,
|
|
62
|
+
foregroundColor: context.colors.onPrimary,
|
|
63
|
+
onPressed: widget.onExit,
|
|
64
|
+
semanticLabel:
|
|
65
|
+
MaterialLocalizations.of(context).closeButtonTooltip,
|
|
66
|
+
)
|
|
67
|
+
: null,
|
|
68
|
+
automaticallyImplyLeading: widget.onExit == null,
|
|
69
|
+
),
|
|
70
|
+
body: Column(
|
|
71
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
72
|
+
children: [
|
|
73
|
+
Padding(
|
|
74
|
+
padding: const EdgeInsets.symmetric(horizontal: KasySpacing.pageHorizontalGutter),
|
|
75
|
+
child: PremiumCard(
|
|
76
|
+
bgColor: context.colors.onBackground.withValues(alpha: .54),
|
|
77
|
+
child: Column(
|
|
78
|
+
mainAxisSize: MainAxisSize.min,
|
|
79
|
+
children: [
|
|
80
|
+
Padding(
|
|
81
|
+
padding: const EdgeInsets.only(bottom: KasySpacing.sm),
|
|
82
|
+
child: Chip(
|
|
83
|
+
backgroundColor: context.colors.primary,
|
|
84
|
+
label: Text(
|
|
85
|
+
"ACTIVE",
|
|
86
|
+
style: GoogleFonts.albertSans(
|
|
87
|
+
fontSize: 12,
|
|
88
|
+
fontWeight: FontWeight.w700,
|
|
89
|
+
color: context.colors.onPrimary,
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
),
|
|
94
|
+
Text(
|
|
95
|
+
"Premium",
|
|
96
|
+
textAlign: TextAlign.center,
|
|
97
|
+
style: GoogleFonts.albertSans(
|
|
98
|
+
fontSize: 32,
|
|
99
|
+
fontWeight: FontWeight.w700,
|
|
100
|
+
color: context.colors.onPrimary,
|
|
101
|
+
),
|
|
102
|
+
),
|
|
103
|
+
const SizedBox(height: KasySpacing.smd),
|
|
104
|
+
// for (var i = 0; i < features.length; i++)
|
|
105
|
+
// Padding(
|
|
106
|
+
// padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
107
|
+
// child: FeatureLine(
|
|
108
|
+
// title: translations.features[i],
|
|
109
|
+
// topPadding: i > 0 ? 4 : 0,
|
|
110
|
+
// icon: switch (i) {
|
|
111
|
+
// 0 => HugeIcons.strokeRoundedTaskDone02,
|
|
112
|
+
// 1 => HugeIcons.strokeRoundedCheckmarkSquare01,
|
|
113
|
+
// 2 => HugeIcons.strokeRoundedGame,
|
|
114
|
+
// _ => Icons.check,
|
|
115
|
+
// },
|
|
116
|
+
// ),
|
|
117
|
+
// ),
|
|
118
|
+
const SizedBox(height: KasySpacing.xl),
|
|
119
|
+
if (userState.subscription?.isLifetime == true)
|
|
120
|
+
Padding(
|
|
121
|
+
padding: const EdgeInsets.all(KasySpacing.lg),
|
|
122
|
+
child: Text(
|
|
123
|
+
Translations.of(
|
|
124
|
+
context,
|
|
125
|
+
).activePremium.lifetime_user_description,
|
|
126
|
+
style: context.textTheme.bodyMedium?.copyWith(
|
|
127
|
+
fontWeight: FontWeight.w700,
|
|
128
|
+
),
|
|
129
|
+
textAlign: TextAlign.center,
|
|
130
|
+
),
|
|
131
|
+
),
|
|
132
|
+
// SliverToBoxAdapter(
|
|
133
|
+
// child: Padding(
|
|
134
|
+
// padding: hPadding,
|
|
135
|
+
// child: ComparisonTable(
|
|
136
|
+
// rows: ComparisonTableRow.getComparisonRows(
|
|
137
|
+
// context,
|
|
138
|
+
// ref.read(environmentProvider),
|
|
139
|
+
// ),
|
|
140
|
+
// freeColumnTitle:
|
|
141
|
+
// ComparisonTableRow.getFreeColumnTitle(context),
|
|
142
|
+
// premiumColumnTitle:
|
|
143
|
+
// ComparisonTableRow.getPremiumColumnTitle(context),
|
|
144
|
+
// ),
|
|
145
|
+
// ),
|
|
146
|
+
// ),
|
|
147
|
+
if (userState.subscription?.isLifetime == false)
|
|
148
|
+
Padding(
|
|
149
|
+
padding: const EdgeInsets.fromLTRB(
|
|
150
|
+
KasySpacing.pageHorizontalGutter,
|
|
151
|
+
72,
|
|
152
|
+
KasySpacing.pageHorizontalGutter,
|
|
153
|
+
KasySpacing.lg,
|
|
154
|
+
),
|
|
155
|
+
child: KasyButton(
|
|
156
|
+
label: Translations.of(context).activePremium.unsubscribe_button,
|
|
157
|
+
variant: KasyButtonVariant.soft,
|
|
158
|
+
expand: true,
|
|
159
|
+
onPressed: () => _showUnsubscribePopup(context),
|
|
160
|
+
),
|
|
161
|
+
),
|
|
162
|
+
],
|
|
163
|
+
),
|
|
164
|
+
),
|
|
165
|
+
),
|
|
166
|
+
],
|
|
167
|
+
),
|
|
168
|
+
),
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|