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,809 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-generation steps shared by all backends:
|
|
3
|
+
* 1. flutter pub get
|
|
4
|
+
* 2. dart run slang (translations)
|
|
5
|
+
* 3. dart run build_runner build
|
|
6
|
+
* 4. flutterfire configure (FCM + Remote Config)
|
|
7
|
+
* 5. write google_auth_options.dart (kGoogleWebClientId from google-services.json)
|
|
8
|
+
*
|
|
9
|
+
* @module scaffold/shared/post-build
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const { exec } = require('node:child_process');
|
|
13
|
+
const { promisify } = require('node:util');
|
|
14
|
+
const path = require('node:path');
|
|
15
|
+
const fs = require('fs-extra');
|
|
16
|
+
|
|
17
|
+
const execAsync = promisify(exec);
|
|
18
|
+
const MAX_BUFFER = 100 * 1024 * 1024; // 100 MB — build_runner can be verbose
|
|
19
|
+
|
|
20
|
+
async function run(cmd, cwd, timeout) {
|
|
21
|
+
try {
|
|
22
|
+
const opts = { cwd, maxBuffer: MAX_BUFFER };
|
|
23
|
+
if (timeout) opts.timeout = timeout;
|
|
24
|
+
const { stdout, stderr } = await execAsync(cmd, opts);
|
|
25
|
+
return { ok: true, stdout, stderr };
|
|
26
|
+
} catch (err) {
|
|
27
|
+
return {
|
|
28
|
+
ok: false,
|
|
29
|
+
error: err.message,
|
|
30
|
+
stdout: err.stdout || '',
|
|
31
|
+
stderr: err.stderr || '',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function pubGet(projectDir) {
|
|
37
|
+
return run('flutter pub get', projectDir, 300_000); // 5 min
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function slangGenerate(projectDir) {
|
|
41
|
+
return run('dart run slang', projectDir, 120_000); // 2 min
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function buildRunner(projectDir) {
|
|
45
|
+
return run('dart run build_runner build --delete-conflicting-outputs', projectDir, 600_000); // 10 min
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function flutterfireConfigure(projectDir, firebaseProjectId, options = {}) {
|
|
49
|
+
const { includeWeb = true } = options;
|
|
50
|
+
const platforms = includeWeb ? 'android,ios,web' : 'android,ios';
|
|
51
|
+
const args = [
|
|
52
|
+
`--project=${firebaseProjectId}`,
|
|
53
|
+
'--out lib/firebase_options_dev.dart',
|
|
54
|
+
`--platforms=${platforms}`,
|
|
55
|
+
'--yes',
|
|
56
|
+
].join(' ');
|
|
57
|
+
|
|
58
|
+
// Prefer the binary on PATH; fall back to the pub-cache absolute path for
|
|
59
|
+
// environments where ~/.pub-cache/bin isn't exported to child processes.
|
|
60
|
+
const result = await run(`flutterfire configure ${args}`, projectDir, 300_000);
|
|
61
|
+
if (!result.ok && (result.error?.includes('ENOENT') || result.error?.includes('not found'))) {
|
|
62
|
+
const pubCacheBin = `${process.env.HOME}/.pub-cache/bin/flutterfire`;
|
|
63
|
+
return run(`${pubCacheBin} configure ${args}`, projectDir, 300_000);
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Read the Web Client ID (client_type: 3) from google-services.json and write
|
|
70
|
+
* it into lib/google_auth_options.dart so google_sign_in v7 works without any
|
|
71
|
+
* manual step from the client.
|
|
72
|
+
*/
|
|
73
|
+
async function writeGoogleAuthOptions(projectDir) {
|
|
74
|
+
const googleServicesPath = path.join(
|
|
75
|
+
projectDir,
|
|
76
|
+
'android',
|
|
77
|
+
'app',
|
|
78
|
+
'google-services.json',
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (!(await fs.pathExists(googleServicesPath))) {
|
|
82
|
+
return { ok: false, error: 'google-services.json not found — skipping google_auth_options.dart' };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let googleServices;
|
|
86
|
+
try {
|
|
87
|
+
googleServices = await fs.readJson(googleServicesPath);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
return { ok: false, error: `Failed to parse google-services.json: ${err.message}` };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let webClientId = '';
|
|
93
|
+
for (const client of googleServices.client || []) {
|
|
94
|
+
for (const oauthClient of client.oauth_client || []) {
|
|
95
|
+
if (oauthClient.client_type === 3) {
|
|
96
|
+
webClientId = oauthClient.client_id;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (webClientId) break;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (!webClientId) {
|
|
104
|
+
return {
|
|
105
|
+
ok: false,
|
|
106
|
+
error:
|
|
107
|
+
'Web Client ID (client_type: 3) not found in google-services.json. ' +
|
|
108
|
+
'Enable Google Sign-In in Firebase Console → Authentication → Sign-in method → Google.',
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const content =
|
|
113
|
+
`// Google Sign-In Web Client ID (also called "Server Client ID")\n` +
|
|
114
|
+
`//\n` +
|
|
115
|
+
`// ⚠️ Auto-generated by the CLI from android/app/google-services.json.\n` +
|
|
116
|
+
`// Do NOT edit manually. Re-run \`kasy new\` or replace google-services.json to update.\n` +
|
|
117
|
+
`//\n` +
|
|
118
|
+
`// How to get it manually:\n` +
|
|
119
|
+
`// Firebase Console → Authentication → Sign-in method → Google\n` +
|
|
120
|
+
`// → Web SDK configuration → Web client ID\n` +
|
|
121
|
+
`// Or from google-services.json: look for "client_type": 3 → "client_id"\n` +
|
|
122
|
+
`const kGoogleWebClientId = '${webClientId}';\n`;
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
await fs.outputFile(
|
|
126
|
+
path.join(projectDir, 'lib', 'google_auth_options.dart'),
|
|
127
|
+
content,
|
|
128
|
+
'utf8',
|
|
129
|
+
);
|
|
130
|
+
return { ok: true };
|
|
131
|
+
} catch (err) {
|
|
132
|
+
return { ok: false, error: `Failed to write google_auth_options.dart: ${err.message}` };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Find the index of the closing </array> tag that matches the <array> at startPos,
|
|
138
|
+
* properly accounting for nested <array> tags.
|
|
139
|
+
*/
|
|
140
|
+
function findMatchingArrayEnd(content, startPos) {
|
|
141
|
+
let depth = 0;
|
|
142
|
+
let i = startPos;
|
|
143
|
+
while (i < content.length) {
|
|
144
|
+
if (content.startsWith('<array>', i)) {
|
|
145
|
+
depth++;
|
|
146
|
+
i += '<array>'.length;
|
|
147
|
+
} else if (content.startsWith('</array>', i)) {
|
|
148
|
+
depth--;
|
|
149
|
+
if (depth === 0) return i;
|
|
150
|
+
i += '</array>'.length;
|
|
151
|
+
} else {
|
|
152
|
+
i++;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return -1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function extractPlistString(content, key) {
|
|
159
|
+
const match = content.match(new RegExp(`<key>${key}<\\/key>\\s*<string>(.*?)<\\/string>`, 's'));
|
|
160
|
+
return match ? match[1].trim() : '';
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function extractBundleUrlSchemes(infoPlistContent) {
|
|
164
|
+
const schemes = [];
|
|
165
|
+
const schemesBlockRegex = /<key>CFBundleURLSchemes<\/key>\s*<array>([\s\S]*?)<\/array>/g;
|
|
166
|
+
let blockMatch;
|
|
167
|
+
while ((blockMatch = schemesBlockRegex.exec(infoPlistContent)) !== null) {
|
|
168
|
+
const stringRegex = /<string>([^<]+)<\/string>/g;
|
|
169
|
+
let stringMatch;
|
|
170
|
+
while ((stringMatch = stringRegex.exec(blockMatch[1])) !== null) {
|
|
171
|
+
schemes.push(stringMatch[1].trim());
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return schemes;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function deriveGoogleIosUrlSchemeFromClientId(iosClientId) {
|
|
178
|
+
const trimmed = (iosClientId || '').trim();
|
|
179
|
+
const prefix = trimmed.replace(/\.apps\.googleusercontent\.com$/, '');
|
|
180
|
+
if (!prefix || prefix === trimmed) return '';
|
|
181
|
+
return `com.googleusercontent.apps.${prefix}`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function googleIosUrlSchemeEntry(reversedClientId) {
|
|
185
|
+
return (
|
|
186
|
+
`\t\t<dict>\n` +
|
|
187
|
+
`\t\t\t<key>CFBundleTypeRole</key>\n` +
|
|
188
|
+
`\t\t\t<string>Editor</string>\n` +
|
|
189
|
+
`\t\t\t<key>CFBundleURLSchemes</key>\n` +
|
|
190
|
+
`\t\t\t<array>\n` +
|
|
191
|
+
`\t\t\t\t<string>${reversedClientId}</string>\n` +
|
|
192
|
+
`\t\t\t</array>\n` +
|
|
193
|
+
`\t\t</dict>\n`
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function replaceFirstStaleGoogleIosUrlScheme(infoPlistContent, reversedClientId) {
|
|
198
|
+
let replacedScheme = '';
|
|
199
|
+
const updated = infoPlistContent.replace(
|
|
200
|
+
/(<key>CFBundleURLSchemes<\/key>\s*<array>)([\s\S]*?)(<\/array>)/g,
|
|
201
|
+
(full, open, body, close) => {
|
|
202
|
+
if (replacedScheme || body.includes(`<string>${reversedClientId}</string>`)) {
|
|
203
|
+
return full;
|
|
204
|
+
}
|
|
205
|
+
const nextBody = body.replace(
|
|
206
|
+
/<string>(com\.googleusercontent\.apps\.[^<]+)<\/string>/,
|
|
207
|
+
(stringTag, staleScheme) => {
|
|
208
|
+
replacedScheme = staleScheme;
|
|
209
|
+
return `<string>${reversedClientId}</string>`;
|
|
210
|
+
},
|
|
211
|
+
);
|
|
212
|
+
return `${open}${nextBody}${close}`;
|
|
213
|
+
},
|
|
214
|
+
);
|
|
215
|
+
return { content: updated, replacedScheme };
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function insertGoogleIosUrlScheme(infoPlistContent, reversedClientId) {
|
|
219
|
+
const newEntry = googleIosUrlSchemeEntry(reversedClientId);
|
|
220
|
+
const cfBundleTypesKeyPos = infoPlistContent.indexOf('<key>CFBundleURLTypes</key>');
|
|
221
|
+
|
|
222
|
+
if (cfBundleTypesKeyPos === -1) {
|
|
223
|
+
const rootDictEnd = infoPlistContent.lastIndexOf('</dict>');
|
|
224
|
+
if (rootDictEnd === -1) {
|
|
225
|
+
return { ok: false, error: 'Could not locate root </dict> in Info.plist' };
|
|
226
|
+
}
|
|
227
|
+
const block =
|
|
228
|
+
`\t<key>CFBundleURLTypes</key>\n` +
|
|
229
|
+
`\t<array>\n` +
|
|
230
|
+
newEntry +
|
|
231
|
+
`\t</array>\n`;
|
|
232
|
+
return {
|
|
233
|
+
ok: true,
|
|
234
|
+
content: infoPlistContent.slice(0, rootDictEnd) + block + infoPlistContent.slice(rootDictEnd),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const arrayStartPos = infoPlistContent.indexOf('<array>', cfBundleTypesKeyPos);
|
|
239
|
+
if (arrayStartPos === -1) {
|
|
240
|
+
return { ok: false, error: 'Malformed CFBundleURLTypes in Info.plist' };
|
|
241
|
+
}
|
|
242
|
+
const arrayEndPos = findMatchingArrayEnd(infoPlistContent, arrayStartPos);
|
|
243
|
+
if (arrayEndPos === -1) {
|
|
244
|
+
return { ok: false, error: 'Could not find closing </array> for CFBundleURLTypes' };
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
ok: true,
|
|
248
|
+
content: infoPlistContent.slice(0, arrayEndPos) + newEntry + infoPlistContent.slice(arrayEndPos),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function syncGoogleIosUrlSchemeContent(infoPlistContent, reversedClientId) {
|
|
253
|
+
const schemes = extractBundleUrlSchemes(infoPlistContent);
|
|
254
|
+
if (schemes.includes(reversedClientId)) {
|
|
255
|
+
return { ok: true, content: infoPlistContent, changed: false };
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const replacement = replaceFirstStaleGoogleIosUrlScheme(infoPlistContent, reversedClientId);
|
|
259
|
+
if (replacement.replacedScheme) {
|
|
260
|
+
return {
|
|
261
|
+
ok: true,
|
|
262
|
+
content: replacement.content,
|
|
263
|
+
changed: true,
|
|
264
|
+
detail: `updated stale iOS Google URL scheme ${replacement.replacedScheme}`,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const inserted = insertGoogleIosUrlScheme(infoPlistContent, reversedClientId);
|
|
269
|
+
if (!inserted.ok) return inserted;
|
|
270
|
+
return {
|
|
271
|
+
ok: true,
|
|
272
|
+
content: inserted.content,
|
|
273
|
+
changed: true,
|
|
274
|
+
detail: 'registered iOS Google URL scheme',
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Register the REVERSED_CLIENT_ID from GoogleService-Info.plist as a URL scheme
|
|
280
|
+
* in ios/Runner/Info.plist so that Google Sign-In can redirect back to the app
|
|
281
|
+
* on iOS (ASWebAuthenticationSession callback).
|
|
282
|
+
*
|
|
283
|
+
* Without this, Google Sign-In silently fails on iOS after the Safari modal closes.
|
|
284
|
+
*/
|
|
285
|
+
async function writeGoogleIosUrlScheme(projectDir) {
|
|
286
|
+
const googleServicePlistPath = path.join(
|
|
287
|
+
projectDir,
|
|
288
|
+
'ios',
|
|
289
|
+
'Runner',
|
|
290
|
+
'GoogleService-Info.plist',
|
|
291
|
+
);
|
|
292
|
+
const infoPlistPath = path.join(projectDir, 'ios', 'Runner', 'Info.plist');
|
|
293
|
+
|
|
294
|
+
if (!(await fs.pathExists(googleServicePlistPath))) {
|
|
295
|
+
return { ok: false, error: 'GoogleService-Info.plist not found — skipping iOS URL scheme' };
|
|
296
|
+
}
|
|
297
|
+
if (!(await fs.pathExists(infoPlistPath))) {
|
|
298
|
+
return { ok: false, error: 'ios/Runner/Info.plist not found' };
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
let googleServiceContent;
|
|
302
|
+
try {
|
|
303
|
+
googleServiceContent = await fs.readFile(googleServicePlistPath, 'utf8');
|
|
304
|
+
} catch (err) {
|
|
305
|
+
return { ok: false, error: `Failed to read GoogleService-Info.plist: ${err.message}` };
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const reversedClientId = extractPlistString(googleServiceContent, 'REVERSED_CLIENT_ID');
|
|
309
|
+
if (!reversedClientId) {
|
|
310
|
+
return {
|
|
311
|
+
ok: false,
|
|
312
|
+
error:
|
|
313
|
+
'REVERSED_CLIENT_ID not found in GoogleService-Info.plist. ' +
|
|
314
|
+
'Enable Google Sign-In in Firebase Console first.',
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
let infoPlistContent;
|
|
319
|
+
try {
|
|
320
|
+
infoPlistContent = await fs.readFile(infoPlistPath, 'utf8');
|
|
321
|
+
} catch (err) {
|
|
322
|
+
return { ok: false, error: `Failed to read Info.plist: ${err.message}` };
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const syncResult = syncGoogleIosUrlSchemeContent(infoPlistContent, reversedClientId);
|
|
326
|
+
if (!syncResult.ok) {
|
|
327
|
+
return { ok: false, error: syncResult.error };
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (!syncResult.changed) {
|
|
331
|
+
return { ok: true };
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
try {
|
|
335
|
+
await fs.writeFile(infoPlistPath, syncResult.content, 'utf8');
|
|
336
|
+
return { ok: true, detail: syncResult.detail };
|
|
337
|
+
} catch (err) {
|
|
338
|
+
return { ok: false, error: `Failed to write Info.plist: ${err.message}` };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* After `flutterfire configure --platforms=...,web`, patch web/firebase-messaging-sw.js
|
|
344
|
+
* with the actual Firebase web config values extracted from firebase_options_dev.dart.
|
|
345
|
+
*
|
|
346
|
+
* This is required because the service worker must be self-contained (it cannot import
|
|
347
|
+
* Dart-generated files) and needs the raw Firebase config values.
|
|
348
|
+
*/
|
|
349
|
+
async function patchFirebaseServiceWorker(projectDir) {
|
|
350
|
+
const optionsPath = path.join(projectDir, 'lib', 'firebase_options_dev.dart');
|
|
351
|
+
const swPath = path.join(projectDir, 'web', 'firebase-messaging-sw.js');
|
|
352
|
+
|
|
353
|
+
if (!(await fs.pathExists(optionsPath))) {
|
|
354
|
+
return { ok: false, error: 'firebase_options_dev.dart not found — skipping service worker patch' };
|
|
355
|
+
}
|
|
356
|
+
if (!(await fs.pathExists(swPath))) {
|
|
357
|
+
return { ok: false, error: 'web/firebase-messaging-sw.js not found — skipping service worker patch' };
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
let dartContent;
|
|
361
|
+
try {
|
|
362
|
+
dartContent = await fs.readFile(optionsPath, 'utf8');
|
|
363
|
+
} catch (err) {
|
|
364
|
+
return { ok: false, error: `Failed to read firebase_options_dev.dart: ${err.message}` };
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// Extract the web FirebaseOptions block. flutterfire generates something like:
|
|
368
|
+
// static const FirebaseOptions web = FirebaseOptions(
|
|
369
|
+
// apiKey: '...',
|
|
370
|
+
// appId: '...',
|
|
371
|
+
// messagingSenderId: '...',
|
|
372
|
+
// projectId: '...',
|
|
373
|
+
// authDomain: '...',
|
|
374
|
+
// storageBucket: '...',
|
|
375
|
+
// measurementId: '...',
|
|
376
|
+
// );
|
|
377
|
+
const webBlockMatch = dartContent.match(/static const FirebaseOptions web = FirebaseOptions\(([\s\S]*?)\);/);
|
|
378
|
+
if (!webBlockMatch) {
|
|
379
|
+
return { ok: false, error: 'Could not find web FirebaseOptions block in firebase_options_dev.dart' };
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const webBlock = webBlockMatch[1];
|
|
383
|
+
|
|
384
|
+
function extractField(field) {
|
|
385
|
+
const m = webBlock.match(new RegExp(`${field}:\\s*'([^']*)'`));
|
|
386
|
+
return m ? m[1] : '';
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const apiKey = extractField('apiKey');
|
|
390
|
+
const appId = extractField('appId');
|
|
391
|
+
const messagingSenderId = extractField('messagingSenderId');
|
|
392
|
+
const projectId = extractField('projectId');
|
|
393
|
+
const authDomain = extractField('authDomain');
|
|
394
|
+
const storageBucket = extractField('storageBucket');
|
|
395
|
+
const measurementId = extractField('measurementId');
|
|
396
|
+
|
|
397
|
+
if (!apiKey || !appId || !messagingSenderId || !projectId) {
|
|
398
|
+
return {
|
|
399
|
+
ok: false,
|
|
400
|
+
error: 'Could not extract required Firebase web config fields from firebase_options_dev.dart',
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
let swContent;
|
|
405
|
+
try {
|
|
406
|
+
swContent = await fs.readFile(swPath, 'utf8');
|
|
407
|
+
} catch (err) {
|
|
408
|
+
return { ok: false, error: `Failed to read firebase-messaging-sw.js: ${err.message}` };
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// Replace placeholder values with real ones.
|
|
412
|
+
// The template uses markers like YOUR_FIREBASE_WEB_API_KEY etc.
|
|
413
|
+
swContent = swContent
|
|
414
|
+
.replace(/apiKey:\s*['"][^'"]*['"]/, () => `apiKey: '${apiKey}'`)
|
|
415
|
+
.replace(/appId:\s*['"][^'"]*['"]/, () => `appId: '${appId}'`)
|
|
416
|
+
.replace(/messagingSenderId:\s*['"][^'"]*['"]/, () => `messagingSenderId: '${messagingSenderId}'`)
|
|
417
|
+
.replace(/projectId:\s*['"][^'"]*['"]/, () => `projectId: '${projectId}'`)
|
|
418
|
+
.replace(/authDomain:\s*['"][^'"]*['"]/, () => `authDomain: '${authDomain}'`)
|
|
419
|
+
.replace(/storageBucket:\s*['"][^'"]*['"]/, () => `storageBucket: '${storageBucket}'`);
|
|
420
|
+
|
|
421
|
+
if (measurementId) {
|
|
422
|
+
swContent = swContent.replace(/measurementId:\s*['"][^'"]*['"]/, () => `measurementId: '${measurementId}'`);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
try {
|
|
426
|
+
await fs.writeFile(swPath, swContent, 'utf8');
|
|
427
|
+
return { ok: true };
|
|
428
|
+
} catch (err) {
|
|
429
|
+
return { ok: false, error: `Failed to write firebase-messaging-sw.js: ${err.message}` };
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Write lib/google_auth_options.dart for the Supabase backend.
|
|
435
|
+
* Contains both the Web Client ID (serverClientId) and the iOS Client ID.
|
|
436
|
+
*
|
|
437
|
+
* For Firebase this file is auto-generated from google-services.json.
|
|
438
|
+
* For Supabase we write it directly from the credentials collected by the CLI.
|
|
439
|
+
*/
|
|
440
|
+
async function writeSupabaseGoogleAuthOptions(projectDir, webClientId, iosClientId = '') {
|
|
441
|
+
const content =
|
|
442
|
+
`// Google Sign-In Client IDs for Supabase backend.\n` +
|
|
443
|
+
`//\n` +
|
|
444
|
+
`// ⚠️ Auto-generated by the CLI from the credentials you provided.\n` +
|
|
445
|
+
`// Re-run \`kasy new\` or edit manually to update.\n` +
|
|
446
|
+
`//\n` +
|
|
447
|
+
`// Web Client ID: console.cloud.google.com → Credentials → OAuth 2.0 → Web application\n` +
|
|
448
|
+
`// iOS Client ID: console.cloud.google.com → Credentials → OAuth 2.0 → iOS\n` +
|
|
449
|
+
`\n` +
|
|
450
|
+
`/// Web / Server Client ID — used as serverClientId on Android and for\n` +
|
|
451
|
+
`/// the Supabase provider configuration.\n` +
|
|
452
|
+
`const kGoogleWebClientId = '${webClientId}';\n` +
|
|
453
|
+
`\n` +
|
|
454
|
+
`/// iOS OAuth 2.0 Client ID — required for native Sign-In on iOS.\n` +
|
|
455
|
+
`const kGoogleIosClientId = '${iosClientId}';\n`;
|
|
456
|
+
|
|
457
|
+
try {
|
|
458
|
+
await fs.outputFile(
|
|
459
|
+
path.join(projectDir, 'lib', 'google_auth_options.dart'),
|
|
460
|
+
content,
|
|
461
|
+
'utf8',
|
|
462
|
+
);
|
|
463
|
+
return { ok: true };
|
|
464
|
+
} catch (err) {
|
|
465
|
+
return { ok: false, error: `Failed to write google_auth_options.dart: ${err.message}` };
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Derive the REVERSED_CLIENT_ID from a Google OAuth iOS Client ID and register it
|
|
471
|
+
* as a URL scheme in ios/Runner/Info.plist so Google Sign-In can redirect back
|
|
472
|
+
* to the app after authentication.
|
|
473
|
+
*
|
|
474
|
+
* iOS Client ID format: 123456789-xxxx.apps.googleusercontent.com
|
|
475
|
+
* REVERSED_CLIENT_ID: com.googleusercontent.apps.123456789-xxxx
|
|
476
|
+
*/
|
|
477
|
+
async function writeGoogleIosUrlSchemeFromClientId(projectDir, iosClientId) {
|
|
478
|
+
if (!iosClientId || !iosClientId.trim()) {
|
|
479
|
+
return { ok: false, error: 'No iOS Client ID provided — skipping iOS URL scheme' };
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const reversedClientId = deriveGoogleIosUrlSchemeFromClientId(iosClientId);
|
|
483
|
+
if (!reversedClientId) {
|
|
484
|
+
return { ok: false, error: `Invalid iOS Client ID format: ${iosClientId}` };
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const infoPlistPath = path.join(projectDir, 'ios', 'Runner', 'Info.plist');
|
|
488
|
+
if (!(await fs.pathExists(infoPlistPath))) {
|
|
489
|
+
return { ok: false, error: 'ios/Runner/Info.plist not found' };
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
let infoPlistContent;
|
|
493
|
+
try {
|
|
494
|
+
infoPlistContent = await fs.readFile(infoPlistPath, 'utf8');
|
|
495
|
+
} catch (err) {
|
|
496
|
+
return { ok: false, error: `Failed to read Info.plist: ${err.message}` };
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const syncResult = syncGoogleIosUrlSchemeContent(infoPlistContent, reversedClientId);
|
|
500
|
+
if (!syncResult.ok) {
|
|
501
|
+
return { ok: false, error: syncResult.error };
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
if (!syncResult.changed) {
|
|
505
|
+
return { ok: true };
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
try {
|
|
509
|
+
await fs.writeFile(infoPlistPath, syncResult.content, 'utf8');
|
|
510
|
+
return { ok: true, detail: syncResult.detail };
|
|
511
|
+
} catch (err) {
|
|
512
|
+
return { ok: false, error: `Failed to write Info.plist: ${err.message}` };
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
async function validateGoogleIosUrlScheme(projectDir) {
|
|
517
|
+
const googleServicePlistPath = path.join(
|
|
518
|
+
projectDir,
|
|
519
|
+
'ios',
|
|
520
|
+
'Runner',
|
|
521
|
+
'GoogleService-Info.plist',
|
|
522
|
+
);
|
|
523
|
+
const infoPlistPath = path.join(projectDir, 'ios', 'Runner', 'Info.plist');
|
|
524
|
+
|
|
525
|
+
if (!(await fs.pathExists(googleServicePlistPath))) {
|
|
526
|
+
return { ok: true, skipped: true, reason: 'missing_google_service_plist' };
|
|
527
|
+
}
|
|
528
|
+
if (!(await fs.pathExists(infoPlistPath))) {
|
|
529
|
+
return { ok: false, issue: 'missing_info_plist', error: 'ios/Runner/Info.plist not found' };
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
let googleServiceContent;
|
|
533
|
+
let infoPlistContent;
|
|
534
|
+
try {
|
|
535
|
+
googleServiceContent = await fs.readFile(googleServicePlistPath, 'utf8');
|
|
536
|
+
} catch (err) {
|
|
537
|
+
return { ok: false, issue: 'read_google_service_failed', error: `Failed to read GoogleService-Info.plist: ${err.message}` };
|
|
538
|
+
}
|
|
539
|
+
try {
|
|
540
|
+
infoPlistContent = await fs.readFile(infoPlistPath, 'utf8');
|
|
541
|
+
} catch (err) {
|
|
542
|
+
return { ok: false, issue: 'read_info_plist_failed', error: `Failed to read Info.plist: ${err.message}` };
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
const reversedClientId = extractPlistString(googleServiceContent, 'REVERSED_CLIENT_ID');
|
|
546
|
+
if (!reversedClientId) {
|
|
547
|
+
return {
|
|
548
|
+
ok: false,
|
|
549
|
+
issue: 'missing_reversed_client_id',
|
|
550
|
+
error:
|
|
551
|
+
'REVERSED_CLIENT_ID not found in ios/Runner/GoogleService-Info.plist. ' +
|
|
552
|
+
'Enable Google Sign-In in Firebase Console and re-run flutterfire configure.',
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const schemes = extractBundleUrlSchemes(infoPlistContent);
|
|
557
|
+
if (!schemes.includes(reversedClientId)) {
|
|
558
|
+
return {
|
|
559
|
+
ok: false,
|
|
560
|
+
issue: 'missing_google_ios_url_scheme',
|
|
561
|
+
reversedClientId,
|
|
562
|
+
schemes,
|
|
563
|
+
error:
|
|
564
|
+
`iOS Google Sign-In URL scheme mismatch. Expected ${reversedClientId} from ` +
|
|
565
|
+
'ios/Runner/GoogleService-Info.plist, but ios/Runner/Info.plist does not declare it under CFBundleURLSchemes. ' +
|
|
566
|
+
'Run kasy ios clean or re-run project setup so the CLI can sync the plist before building.',
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
return { ok: true, reversedClientId, schemes };
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Validate that the Apple Sign-In entitlement is present in Runner.entitlements.
|
|
575
|
+
* Required for native iOS Apple Sign-In to work.
|
|
576
|
+
*/
|
|
577
|
+
async function validateAppleSignInEntitlement(projectDir) {
|
|
578
|
+
const entitlementsPath = path.join(projectDir, 'ios', 'Runner', 'Runner.entitlements');
|
|
579
|
+
if (!(await fs.pathExists(entitlementsPath))) {
|
|
580
|
+
return { ok: false, issue: 'missing_entitlements_file', error: 'ios/Runner/Runner.entitlements not found' };
|
|
581
|
+
}
|
|
582
|
+
let content;
|
|
583
|
+
try {
|
|
584
|
+
content = await fs.readFile(entitlementsPath, 'utf8');
|
|
585
|
+
} catch (err) {
|
|
586
|
+
return { ok: false, issue: 'read_entitlements_failed', error: `Failed to read Runner.entitlements: ${err.message}` };
|
|
587
|
+
}
|
|
588
|
+
if (!content.includes('com.apple.developer.applesignin')) {
|
|
589
|
+
return {
|
|
590
|
+
ok: false,
|
|
591
|
+
issue: 'missing_apple_signin_entitlement',
|
|
592
|
+
error:
|
|
593
|
+
'com.apple.developer.applesignin entitlement not found in ios/Runner/Runner.entitlements. ' +
|
|
594
|
+
'Open Xcode → Runner target → Signing & Capabilities → + Capability → Sign In with Apple.',
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
return { ok: true };
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Validate that Facebook placeholders in Info.plist have been replaced with real values.
|
|
602
|
+
*/
|
|
603
|
+
async function validateFacebookInfoPlist(projectDir) {
|
|
604
|
+
const infoPlistPath = path.join(projectDir, 'ios', 'Runner', 'Info.plist');
|
|
605
|
+
if (!(await fs.pathExists(infoPlistPath))) {
|
|
606
|
+
return { ok: true, skipped: true, reason: 'missing_info_plist' };
|
|
607
|
+
}
|
|
608
|
+
let content;
|
|
609
|
+
try {
|
|
610
|
+
content = await fs.readFile(infoPlistPath, 'utf8');
|
|
611
|
+
} catch (err) {
|
|
612
|
+
return { ok: false, issue: 'read_info_plist_failed', error: `Failed to read Info.plist: ${err.message}` };
|
|
613
|
+
}
|
|
614
|
+
if (!content.includes('<key>FacebookAppID</key>')) {
|
|
615
|
+
return { ok: true, skipped: true, reason: 'no_facebook_key' };
|
|
616
|
+
}
|
|
617
|
+
const appIdMatch = content.match(/<key>FacebookAppID<\/key>\s*<string>([^<]+)<\/string>/);
|
|
618
|
+
const tokenMatch = content.match(/<key>FacebookClientToken<\/key>\s*<string>([^<]+)<\/string>/);
|
|
619
|
+
const appId = appIdMatch ? appIdMatch[1].trim() : '';
|
|
620
|
+
const token = tokenMatch ? tokenMatch[1].trim() : '';
|
|
621
|
+
const isPlaceholderId = !appId || /^0+$/.test(appId);
|
|
622
|
+
const isPlaceholderToken = !token || /^0+$/.test(token);
|
|
623
|
+
if (isPlaceholderId || isPlaceholderToken) {
|
|
624
|
+
return {
|
|
625
|
+
ok: false,
|
|
626
|
+
issue: 'facebook_placeholders',
|
|
627
|
+
error:
|
|
628
|
+
'FacebookAppID or FacebookClientToken in ios/Runner/Info.plist still has placeholder values. ' +
|
|
629
|
+
'Replace them with real values from Meta for Developers → Settings → Basic.',
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
return { ok: true };
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
async function validateFacebookAndroidStrings(projectDir) {
|
|
636
|
+
const stringsPath = path.join(projectDir, 'android', 'app', 'src', 'main', 'res', 'values', 'strings.xml');
|
|
637
|
+
if (!(await fs.pathExists(stringsPath))) {
|
|
638
|
+
return { ok: true, skipped: true, reason: 'missing_strings_xml' };
|
|
639
|
+
}
|
|
640
|
+
let content;
|
|
641
|
+
try {
|
|
642
|
+
content = await fs.readFile(stringsPath, 'utf8');
|
|
643
|
+
} catch (err) {
|
|
644
|
+
return { ok: false, issue: 'read_strings_xml_failed', error: `Failed to read strings.xml: ${err.message}` };
|
|
645
|
+
}
|
|
646
|
+
if (!content.includes('facebook_app_id')) {
|
|
647
|
+
return { ok: true, skipped: true, reason: 'no_facebook_key' };
|
|
648
|
+
}
|
|
649
|
+
const appIdMatch = content.match(/name="facebook_app_id"[^>]*>([^<]+)</);
|
|
650
|
+
const tokenMatch = content.match(/name="facebook_client_token"[^>]*>([^<]+)</);
|
|
651
|
+
const appId = appIdMatch ? appIdMatch[1].trim() : '';
|
|
652
|
+
const token = tokenMatch ? tokenMatch[1].trim() : '';
|
|
653
|
+
const isPlaceholderId = !appId || /^0+$/.test(appId);
|
|
654
|
+
const isPlaceholderToken = !token || /^0+$/.test(token);
|
|
655
|
+
if (isPlaceholderId || isPlaceholderToken) {
|
|
656
|
+
return {
|
|
657
|
+
ok: false,
|
|
658
|
+
issue: 'facebook_android_placeholders',
|
|
659
|
+
error:
|
|
660
|
+
'facebook_app_id or facebook_client_token in android/app/src/main/res/values/strings.xml still has placeholder values. ' +
|
|
661
|
+
'Replace them with real values from Meta for Developers → Settings → Basic.',
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
return { ok: true };
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Validate RevenueCat API keys (RC_IOS_API_KEY, RC_ANDROID_API_KEY) from the project Makefile
|
|
669
|
+
* and return the webhook URL derived from kit_setup.json backend config.
|
|
670
|
+
*/
|
|
671
|
+
async function validateRevenueCat(projectDir, config = {}) {
|
|
672
|
+
const makefilePath = path.join(projectDir, 'Makefile');
|
|
673
|
+
if (!(await fs.pathExists(makefilePath))) {
|
|
674
|
+
return { ok: true, skipped: true, reason: 'no_makefile' };
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
let content;
|
|
678
|
+
try {
|
|
679
|
+
content = await fs.readFile(makefilePath, 'utf8');
|
|
680
|
+
} catch (err) {
|
|
681
|
+
return { ok: false, error: `Failed to read Makefile: ${err.message}` };
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// Only consider non-commented lines
|
|
685
|
+
const activeLines = content.split('\n').filter((l) => !/^\s*#/.test(l)).join('\n');
|
|
686
|
+
|
|
687
|
+
const iosMatch = activeLines.match(/RC_IOS_API_KEY=([^\s\\]+)/);
|
|
688
|
+
const androidMatch = activeLines.match(/RC_ANDROID_API_KEY=([^\s\\]+)/);
|
|
689
|
+
|
|
690
|
+
const iosKey = iosMatch ? iosMatch[1].trim() : '';
|
|
691
|
+
const androidKey = androidMatch ? androidMatch[1].trim() : '';
|
|
692
|
+
|
|
693
|
+
const iosEmpty = !iosKey || iosKey === 'xxx';
|
|
694
|
+
const androidEmpty = !androidKey || androidKey === 'xxx';
|
|
695
|
+
|
|
696
|
+
const iosTest = iosKey.startsWith('test_');
|
|
697
|
+
const androidTest = androidKey.startsWith('test_');
|
|
698
|
+
|
|
699
|
+
let webhookUrl = null;
|
|
700
|
+
if (config.backendProvider === 'supabase' && config.supabaseProjectId) {
|
|
701
|
+
webhookUrl = `https://${config.supabaseProjectId}.supabase.co/functions/v1/revenuecat-webhook`;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
return {
|
|
705
|
+
ok: !iosEmpty && !androidEmpty,
|
|
706
|
+
iosKey,
|
|
707
|
+
androidKey,
|
|
708
|
+
iosEmpty,
|
|
709
|
+
androidEmpty,
|
|
710
|
+
bothTest: iosTest && androidTest,
|
|
711
|
+
webhookUrl,
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Read Google credentials from files written by flutterfire configure:
|
|
717
|
+
* - Web Client ID from android/app/google-services.json (client_type: 3)
|
|
718
|
+
* - iOS Client ID from ios/Runner/GoogleService-Info.plist (CLIENT_ID)
|
|
719
|
+
*
|
|
720
|
+
* Returns { webClientId, iosClientId } — empty string if not found.
|
|
721
|
+
*/
|
|
722
|
+
async function readSupabaseGoogleCredentials(projectDir) {
|
|
723
|
+
let webClientId = '';
|
|
724
|
+
let iosClientId = '';
|
|
725
|
+
|
|
726
|
+
// 1. Web Client ID from google-services.json
|
|
727
|
+
try {
|
|
728
|
+
const googleServicesPath = path.join(projectDir, 'android', 'app', 'google-services.json');
|
|
729
|
+
if (await fs.pathExists(googleServicesPath)) {
|
|
730
|
+
const gs = await fs.readJson(googleServicesPath);
|
|
731
|
+
for (const client of gs.client || []) {
|
|
732
|
+
for (const oc of client.oauth_client || []) {
|
|
733
|
+
if (oc.client_type === 3) {
|
|
734
|
+
webClientId = oc.client_id;
|
|
735
|
+
break;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
if (webClientId) break;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
} catch (_) {}
|
|
742
|
+
|
|
743
|
+
// 2. iOS Client ID from GoogleService-Info.plist
|
|
744
|
+
try {
|
|
745
|
+
const plistPath = path.join(projectDir, 'ios', 'Runner', 'GoogleService-Info.plist');
|
|
746
|
+
if (await fs.pathExists(plistPath)) {
|
|
747
|
+
const content = await fs.readFile(plistPath, 'utf8');
|
|
748
|
+
const m = content.match(/<key>CLIENT_ID<\/key>\s*<string>([^<]+)<\/string>/);
|
|
749
|
+
if (m) iosClientId = m[1].trim();
|
|
750
|
+
}
|
|
751
|
+
} catch (_) {}
|
|
752
|
+
|
|
753
|
+
return { webClientId, iosClientId };
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Attempt to retrieve the Google Sign-In client secret from the Firebase project
|
|
758
|
+
* via Identity Toolkit Admin API using the current gcloud access token.
|
|
759
|
+
*
|
|
760
|
+
* Returns the clientSecret string, or empty string if unavailable.
|
|
761
|
+
*/
|
|
762
|
+
async function getGoogleClientSecretViaGcloud(firebaseProjectId) {
|
|
763
|
+
if (!firebaseProjectId) return '';
|
|
764
|
+
try {
|
|
765
|
+
const tokenResult = await run('gcloud auth print-access-token', process.cwd());
|
|
766
|
+
if (!tokenResult.ok || !tokenResult.stdout.trim()) return '';
|
|
767
|
+
const token = tokenResult.stdout.trim();
|
|
768
|
+
|
|
769
|
+
const curlCmd = [
|
|
770
|
+
'curl -sf',
|
|
771
|
+
`-H "Authorization: Bearer ${token}"`,
|
|
772
|
+
`-H "x-goog-user-project: ${firebaseProjectId}"`,
|
|
773
|
+
`"https://identitytoolkit.googleapis.com/admin/v2/projects/${firebaseProjectId}/defaultSupportedIdpConfigs/google.com"`,
|
|
774
|
+
].join(' ');
|
|
775
|
+
|
|
776
|
+
const result = await run(curlCmd, process.cwd());
|
|
777
|
+
if (!result.ok || !result.stdout.trim()) return '';
|
|
778
|
+
|
|
779
|
+
const data = JSON.parse(result.stdout.trim());
|
|
780
|
+
return data.clientSecret || '';
|
|
781
|
+
} catch (_) {
|
|
782
|
+
return '';
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
module.exports = {
|
|
787
|
+
pubGet,
|
|
788
|
+
slangGenerate,
|
|
789
|
+
buildRunner,
|
|
790
|
+
flutterfireConfigure,
|
|
791
|
+
writeGoogleAuthOptions,
|
|
792
|
+
writeGoogleIosUrlScheme,
|
|
793
|
+
writeSupabaseGoogleAuthOptions,
|
|
794
|
+
writeGoogleIosUrlSchemeFromClientId,
|
|
795
|
+
validateGoogleIosUrlScheme,
|
|
796
|
+
validateAppleSignInEntitlement,
|
|
797
|
+
validateFacebookInfoPlist,
|
|
798
|
+
validateFacebookAndroidStrings,
|
|
799
|
+
validateRevenueCat,
|
|
800
|
+
patchFirebaseServiceWorker,
|
|
801
|
+
readSupabaseGoogleCredentials,
|
|
802
|
+
getGoogleClientSecretViaGcloud,
|
|
803
|
+
// Exported for focused unit tests; not part of the public CLI surface.
|
|
804
|
+
_private: {
|
|
805
|
+
deriveGoogleIosUrlSchemeFromClientId,
|
|
806
|
+
extractBundleUrlSchemes,
|
|
807
|
+
syncGoogleIosUrlSchemeContent,
|
|
808
|
+
},
|
|
809
|
+
};
|