Skip to content

Conversation

@xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Sep 12, 2025

FLU-244

Description of the pull request

This commit introduces comprehensive support for handling push notifications in the sample app. It includes new models for different notification types, a service to manage local and push notifications, and integration with Firebase Cloud Messaging (FCM).

This commit updates the user data and API key used in the sample application.

Key changes:
- Replaced "luke_skywalker" user with new users: "sahil", "rene", and "maciej".
- Updated user details (name, image URL, and corresponding tokens) for existing users (martin, tommaso, thierry, marcelo, kanat, toomas) to reflect real Stream team members.
- Changed the production API key in `DemoAppConfig`.
- Removed manual sorting of the user list in `UserCredentials.builtIn` as the list is now provided in a pre-sorted order.
- Added a `Key` to the `ListTile` in `ChooseUserScreen` for better widget identification.
This commit integrates Firebase into the sample app to enable push notifications.

Key changes include:
- Added Firebase configuration files (`google-services.json` for Android and `GoogleService-Info.plist` for iOS).
- Included `firebase_core` plugin in `pubspec.yaml`.
- Generated `firebase_options.dart` using FlutterFire CLI.
- Updated Android and iOS project files to include Firebase dependencies and configurations.
- Modified Android `build.gradle.kts` and `settings.gradle.kts` to apply the Google Services plugin.
- Updated `Info.plist` with a new display name and bundle name.
- Updated `AndroidManifest.xml` with a new application label.
- Updated Windows `generated_plugins.cmake` to include `firebase_core`.
This file configures Firebase for the Android and iOS platforms within the sample application. It specifies project IDs, app IDs, and output locations for configuration files.
This commit introduces launcher icons for Android, iOS, Web, macOS, Linux and Windows platforms.

Key changes:
- Added `flutter_launcher_icons` dev dependency to `pubspec.yaml`.
- Created `flutter_launcher_icons.yaml` configuration file specifying icon paths and platform generation options.
- Added launcher icon assets (`ic_launcher.png`, `ic_launcher_background.png`, `ic_launcher_foreground.png`) to the `assets` directory.
- Updated Android (`mipmap` and `drawable` resources, `ic_launcher.xml`), iOS (`Assets.xcassets`), macOS (`Assets.xcassets`, `project.pbxproj`, `Podfile`), Linux (`my_application.cc`), and Web (`icons`, `favicon.png`) and Windows (`app_icon.ico`) to use the new icons.
- Updated the application title in `my_application.cc` for Linux.
- Updated iOS project settings for asset catalog compiler extensions.
This commit modifies the `flutter_launcher_icons.yaml` to set `adaptive_icon_foreground_inset` to `0`.

The corresponding change in `sample_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml` updates the `android:inset` attribute for the foreground drawable from `16%` to `0%`.

This ensures the adaptive icon foreground utilizes the full available space without any inset.
This commit updates the sample application to include Firebase configurations for macOS, web, and Windows platforms.

Key changes:

- **Added `GoogleService-Info.plist` for macOS:** This file contains the necessary Firebase project details for macOS.
- **Updated `firebase.json`:** Added configurations for macOS, web, and Windows, specifying project IDs, app IDs, and output file paths.
- **Updated `firebase_options.dart`:**
    - Removed `UnsupportedError` for web, macOS, and Windows platforms.
    - Added new `FirebaseOptions` constants: `web`, `macos`, and `windows` with their respective Firebase configuration details.
    - Updated `currentPlatform` getter to return the appropriate `FirebaseOptions` based on the current platform.

These changes ensure that the sample application can now utilize Firebase services across these additional platforms.
This commit updates the macOS application name from the generic "sample" to "Stream Feeds" for better identification.

Changes were made in:
- `sample_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme`: Updated `BuildableName`
- `sample_app/macos/Runner/Configs/AppInfo.xcconfig`: Updated `PRODUCT_NAME`
This commit introduces comprehensive support for handling push notifications in the sample app. It includes new models for different notification types, a service to manage local and push notifications, and integration with Firebase Cloud Messaging (FCM).

Key changes:

- **Notification Models:**
    - Added a sealed class `FeedsNotification` and specific notification types (e.g., `ActivityAddedNotification`, `CommentAddedNotification`).
    - Implemented JSON serialization/deserialization for these models.
- **NotificationService:**
    - Created `NotificationService` to handle initialization, permission requests, and display of local notifications.
    - Integrated with FCM for receiving push notifications in foreground and background.
    - Added a background message handler (`onBackgroundMessageHandler`) for Android.
- **PushManager:**
    - Simplified logging in `PushManager`.
- **DI Configuration:**
    - Updated DI setup to use `lazySingleton` for several services to improve startup performance.
- **UI Integration:**
    - Added `createNotificationActivity` flag to relevant API calls (follow, add reaction, add comment) to trigger notifications.
    - Implemented a tap handler in `AppContent` to process notification taps (currently logs information).
- **Assets & Configuration:**
    - Added a notification icon for Android.
    - Included `build.yaml` for build_runner configuration.
    - Updated `melos.yaml` with new dependencies.
    - Added `GoogleService-Info.plist` to the macOS project.
    - Updated iOS and macOS entitlement files for file access.
- **Serializer Utility:**
    - Introduced a `Serializer` mixin to handle moving unknown JSON keys to a `custom` field during deserialization.
- **FeedState:**
    - Added `onNotificationFeedUpdated` to `FeedState` to handle updates from notification feed events.

This enhancement allows the app to receive and process various types of push notifications related to feed activity, improving user engagement.
…ications

# Conflicts:
#	sample_app/lib/app/app_state.dart
#	sample_app/lib/core/di/di_module.dart
#	sample_app/lib/core/models/user_credentials.dart
The import path for the `stream_feed` package has been changed from `stream_feeds/stream_feeds.dart` to `stream_feed/stream_feed.dart`.

This commit updates the import statements in the sample application to reflect this change.

Additionally, dependency versions for `characters`, `collection`, `meta`, and `vector_math` have been adjusted in `pubspec.lock` and the Dart SDK constraint has been updated.
@xsahil03x xsahil03x requested a review from a team as a code owner September 12, 2025 06:55
This commit updates the app icon and related assets.

- The app logo SVG has been redesigned.
- Launcher icons for Android, iOS, macOS, web, and Windows have been updated.
- Added monochrome adaptive icon for Android.
- Ensured iOS icons have no transparency as per App Store requirements.
- Removed the old XML notification icon for Android.
- Updated various PNG assets for different resolutions and platforms.
The class `PushManager` has been renamed to `PushTokenManager` to better reflect its responsibility of managing push notification tokens.

Additionally, the `dispose` methods in `PushTokenManager` and `NotificationService` are now `async` to properly await the cancellation of subscriptions.

A minor documentation update was made to specify `dart` for a code block in `theme.dart`.
This commit updates the lint rules in `all_lint_rules.yaml` and adjusts the `analysis_options.yaml` files accordingly.

The following changes were made:

- **Enabled new lint rules:** A significant number of new lint rules from the Flutter and Dart linters have been added to `all_lint_rules.yaml`.
- **Removed deprecated/conflicting lint rules:**
    - `always_require_non_null_named_parameters`
    - `avoid_returning_null`
    - `avoid_returning_null_for_future`
    - `iterable_contains_unrelated_type` (replaced by stricter checks)
    - `list_remove_unrelated_type` (replaced by stricter checks)
    - `package_api_docs`
    - `prefer_equal_for_default_values`
- **Adjusted `analysis_options.yaml`:**
    - Added `packages/*/lib/**/*.freezed.dart` to the exclude list.
    - Disabled `document_ignores` as it's considered redundant.
    - Disabled `specify_nonobvious_local_variable_types` and `specify_nonobvious_property_types` due to conflict with `omit_local_variable_types`.
    - Temporarily disabled `public_member_api_docs` (moved from `avoid_print`).
- **Adjusted `sample_app/analysis_options.yaml`:**
    - Added `lib/**/*.g.dart` and `lib/**/*.freezed.dart` to the exclude list (as a temporary workaround for an issue with root analysis file exclusion).
This commit addresses several lint warnings by:
- Explicitly typing static final fields in query classes.
- Adding the `async` keyword to methods that return Futures where it was missing.
- Using `var` for local variables where the type can be inferred.

Additionally, the `avoid_types_on_closure_parameters` and `omit_local_variable_types` lint rules have been enabled in `analysis_options.yaml`. The `unsafe_variance` rule has been temporarily disabled due to false positives.
@xsahil03x xsahil03x force-pushed the feat/sample-app-notifications branch from ebc33f7 to 88066b5 Compare September 15, 2025 11:28
This commit includes formatting changes in `sample_app/lib/navigation/app_router.gr.dart` and `sample_app/lib/firebase_options.dart`.

In `app_router.gr.dart`, the constructors for `ChooseUserRoute`, `HomeRoute`, and `UserFeedRoute` have been reformatted.

In `firebase_options.dart`, the `androidClientId` and `iosClientId` values have been reformatted for improved readability.
@codecov
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 2.12%. Comparing base (ff3eaa8) to head (1f11e6c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
..._feeds/lib/src/state/event/feed_event_handler.dart 0.00% 5 Missing ⚠️
...ackages/stream_feeds/lib/src/state/feed_state.dart 0.00% 3 Missing ⚠️
...stream_feeds/lib/src/client/feeds_client_impl.dart 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff            @@
##            main     #32      +/-   ##
========================================
- Coverage   2.13%   2.12%   -0.01%     
========================================
  Files        117     117              
  Lines       3140    3148       +8     
========================================
  Hits          67      67              
- Misses      3073    3081       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The `firebase_options.dart` file is generated and should not be analyzed. This commit adds it to the exclude list in `analysis_options.yaml`.

Additionally, the exclusion pattern for generated files has been updated to be more specific.
…ications

# Conflicts:
#	pubspec.lock
#	sample_app/analysis_options.yaml
#	sample_app/android/app/build.gradle.kts
#	sample_app/android/settings.gradle.kts
#	sample_app/lib/app/app_state.dart
#	sample_app/lib/core/di/di_initializer.config.dart
#	sample_app/lib/core/di/di_module.dart
#	sample_app/pubspec.yaml
@xsahil03x xsahil03x merged commit f94982f into main Sep 17, 2025
7 of 8 checks passed
@xsahil03x xsahil03x deleted the feat/sample-app-notifications branch September 17, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants