-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor/sync with core package update #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
70c1339
build(deps): update core dependency
fulleni cbdfa87
refactor(dependencies): update userAppSettings repository and model n…
fulleni efd24c3
refactor(data): update UserAppSettings to AppSettings
fulleni 9c0a23d
refactor(registry): update model config for app settings
fulleni 8a4b5e5
fix(database): rename user_app_settings collection to app_settings
fulleni 84d99dd
refactor(auth): update AuthService and related components
fulleni e7150b3
fix(database): update seeding service for app settings and ad config
fulleni 5260c71
refactor(limit): update user limits configuration retrieval
fulleni a72e689
fix(firebase_push_notification_client): correct notification payload …
fulleni 7e4e077
fix(onesignal): correct payload mapping and enhancement
fulleni 1349628
refactor(push-notification): update notification payload structure
fulleni ffd81d0
fix(push-notification): update push notification configuration path
fulleni d7366ed
feat(models): add push notification request models
fulleni e086620
refactor(push_notification): update FirebaseMessage data payload type
fulleni ecde6b6
refactor(push_notification): update data payload type in OneSignalReq…
fulleni d15de37
refactor(push-notification): use FirebaseRequestBody model for notifi…
fulleni ee0483c
refactor(push-notification): use OneSignalRequestBody model for API r…
fulleni 012443f
build(dev_tools): update dependencies and add build tools
fulleni 1b7e0f4
ci: ignore cast_nullable_to_non_nullable lint rule
fulleni c937a71
build(models): add generated JSON serialization code for push notific…
fulleni 172597f
fix(models): add createFactory: false to JsonSerializable annotation
fulleni f44e32c
build(serialization): generate
fulleni 0c1a585
refactor(routes): update dependency type in middleware
fulleni 6a69485
style: format
fulleni 67d2496
chore: misc
fulleni 25466da
fix(firebase_messaging): make notification body optional
fulleni 0c96edc
fix(onesignal): make notification contents optional
fulleni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export 'push_notification/push_notification.dart'; | ||
| export 'request_id.dart'; |
95 changes: 95 additions & 0 deletions
95
lib/src/models/push_notification/firebase_request_body.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import 'package:core/core.dart'; | ||
| import 'package:equatable/equatable.dart'; | ||
| import 'package:json_annotation/json_annotation.dart'; | ||
|
|
||
| part 'firebase_request_body.g.dart'; | ||
|
|
||
| /// {@template firebase_request_body} | ||
| /// Represents the top-level structure for a Firebase Cloud Messaging | ||
| /// v1 API request. | ||
| /// {@endtemplate} | ||
| @JsonSerializable( | ||
| explicitToJson: true, | ||
| includeIfNull: true, | ||
| checked: true, | ||
| createFactory: false, | ||
| ) | ||
| class FirebaseRequestBody extends Equatable { | ||
| /// {@macro firebase_request_body} | ||
| const FirebaseRequestBody({required this.message}); | ||
|
|
||
| /// The message payload. | ||
| final FirebaseMessage message; | ||
|
|
||
| /// Converts this [FirebaseRequestBody] instance to a JSON map. | ||
| Map<String, dynamic> toJson() => _$FirebaseRequestBodyToJson(this); | ||
|
|
||
| @override | ||
| List<Object> get props => [message]; | ||
| } | ||
|
|
||
| /// {@template firebase_message} | ||
| /// Represents the message object within a Firebase request. | ||
| /// {@endtemplate} | ||
| @JsonSerializable( | ||
| explicitToJson: true, | ||
| includeIfNull: true, | ||
| checked: true, | ||
| createFactory: false, | ||
| ) | ||
| class FirebaseMessage extends Equatable { | ||
| /// {@macro firebase_message} | ||
| const FirebaseMessage({ | ||
| required this.token, | ||
| required this.notification, | ||
| required this.data, | ||
| }); | ||
|
|
||
| /// The registration token of the device to send the message to. | ||
| final String token; | ||
|
|
||
| /// The notification content. | ||
| final FirebaseNotification notification; | ||
|
|
||
| /// The custom data payload. | ||
| final PushNotificationPayload data; | ||
|
|
||
| /// Converts this [FirebaseMessage] instance to a JSON map. | ||
| Map<String, dynamic> toJson() => _$FirebaseMessageToJson(this); | ||
|
|
||
| @override | ||
| List<Object> get props => [token, notification, data]; | ||
| } | ||
|
|
||
| /// {@template firebase_notification} | ||
| /// Represents the notification content within a Firebase message. | ||
| /// {@endtemplate} | ||
| @JsonSerializable( | ||
| explicitToJson: true, | ||
| includeIfNull: true, | ||
| checked: true, | ||
| createFactory: false, | ||
| ) | ||
| class FirebaseNotification extends Equatable { | ||
| /// {@macro firebase_notification} | ||
| const FirebaseNotification({ | ||
| required this.title, | ||
| required this.body, | ||
| this.image, | ||
| }); | ||
|
|
||
| /// The notification's title. | ||
| final String title; | ||
|
|
||
| /// The notification's body text. | ||
| final String body; | ||
|
|
||
| /// The URL of an image to be displayed in the notification. | ||
| final String? image; | ||
|
|
||
| /// Converts this [FirebaseNotification] instance to a JSON map. | ||
| Map<String, dynamic> toJson() => _$FirebaseNotificationToJson(this); | ||
|
|
||
| @override | ||
| List<Object?> get props => [title, body, image]; | ||
| } | ||
37 changes: 37 additions & 0 deletions
37
lib/src/models/push_notification/firebase_request_body.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
lib/src/models/push_notification/onesignal_request_body.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import 'package:core/core.dart'; | ||
| import 'package:equatable/equatable.dart'; | ||
| import 'package:json_annotation/json_annotation.dart'; | ||
|
|
||
| part 'onesignal_request_body.g.dart'; | ||
|
|
||
| /// {@template onesignal_request_body} | ||
| /// Represents the request body for the OneSignal /notifications endpoint. | ||
| /// {@endtemplate} | ||
| @JsonSerializable( | ||
| explicitToJson: true, | ||
| includeIfNull: false, // Do not include null fields in the JSON | ||
| checked: true, | ||
| fieldRename: FieldRename.snake, | ||
| createFactory: false, | ||
| ) | ||
| class OneSignalRequestBody extends Equatable { | ||
| /// {@macro onesignal_request_body} | ||
| const OneSignalRequestBody({ | ||
| required this.appId, | ||
| required this.includePlayerIds, | ||
| required this.headings, | ||
| required this.contents, | ||
| required this.data, | ||
| this.bigPicture, | ||
| }); | ||
|
|
||
| /// The OneSignal App ID. | ||
| final String appId; | ||
|
|
||
| /// A list of OneSignal Player IDs to send the notification to. | ||
| final List<String> includePlayerIds; | ||
|
|
||
| /// The notification's title. | ||
| final Map<String, String> headings; | ||
|
|
||
| /// The notification's content. | ||
| final Map<String, String> contents; | ||
|
|
||
| /// The custom data payload | ||
| final PushNotificationPayload data; | ||
|
|
||
| /// The URL of a large image to display in the notification. | ||
| final String? bigPicture; | ||
|
|
||
| /// Converts this [OneSignalRequestBody] instance to a JSON map. | ||
| Map<String, dynamic> toJson() => _$OneSignalRequestBodyToJson(this); | ||
|
|
||
| @override | ||
| List<Object?> get props => [ | ||
| appId, | ||
| includePlayerIds, | ||
| headings, | ||
| contents, | ||
| data, | ||
| bigPicture, | ||
| ]; | ||
| } | ||
fulleni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
21 changes: 21 additions & 0 deletions
21
lib/src/models/push_notification/onesignal_request_body.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export 'firebase_request_body.dart'; | ||
| export 'onesignal_request_body.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.