Compare commits
	
		
			5 Commits
		
	
	
		
			a4c73421d2
			...
			bc57974896
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| bc57974896 | |||
| 251e9b28f0 | |||
| 52d60db85e | |||
| 68426786ec | |||
| cccea8de8c | 
| @ -11,124 +11,29 @@ and the Flutter guide for | |||||||
| [developing packages and plugins](https://flutter.dev/developing-packages).  | [developing packages and plugins](https://flutter.dev/developing-packages).  | ||||||
| --> | --> | ||||||
| 
 | 
 | ||||||
| # Cloud Messaging BLoC Base | TODO: Put a short description of the package here that helps potential users | ||||||
| 
 | know whether this package might be useful for them. | ||||||
| <p align="left"> |  | ||||||
|   <a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis"><img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" /></a> |  | ||||||
|   <img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" /> |  | ||||||
| </p> |  | ||||||
| 
 |  | ||||||
| This package serves as an abstraction for managing notifications within Flutter applications. It does not include a built-in data source implementation. Therefore, it is essential to provide your own implementation or utilize one of our various implementations listed below: |  | ||||||
| 
 |  | ||||||
| - [Firebase Cloud Messaging ](https://git.wyatt-studio.fr/Wyatt-FOSS/-/packages/pub/wyatt_cloud_messaging_bloc_base/0.1.1+1) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| This package enables you to easily integrate your data source, allowing the package to handle business logic, error management, and state logic seamlessly. |  | ||||||
| 
 | 
 | ||||||
| ## Features | ## Features | ||||||
| 
 | 
 | ||||||
| * 🧐 Wyatt Architecture | TODO: List what your package can do. Maybe include images, gifs, or videos. | ||||||
| * 🧱 Entities |  | ||||||
|     - `RemoteNotification` -> Contains notification innformations |  | ||||||
| * 🧊 Cubits, why make it complicated when you can make it simple? |  | ||||||
|     - Goes to the essential |  | ||||||
| * 📐 Consistent |  | ||||||
|     - Every class have same naming convention |  | ||||||
| 
 | 
 | ||||||
| ## Getting started | ## Getting started | ||||||
| 
 | 
 | ||||||
| Simply add `wyatt_cloud_messaging_bloc_base` in `pubspec.yaml` , then | TODO: List prerequisites and provide or point to information on how to | ||||||
| 
 | start using the package. | ||||||
| ```dart |  | ||||||
| import 'package:wyatt_cloud_messaging_bloc_base/wyatt_cloud_messaging_bloc_base.dart'; |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| ## Usage | ## Usage | ||||||
| 
 | 
 | ||||||
| ### Data source | TODO: Include short and useful examples for package users. Add longer examples | ||||||
| 
 | to `/example` folder.  | ||||||
| The initial step involves furnishing a data source, presenting you with two options: |  | ||||||
| - You can select from our provided implementations, which are listed above. |  | ||||||
| - Alternatively, you can craft a custom implementation by extending the `CloudMessagingRemoteDataSource` class and implementing all of its methods. |  | ||||||
| 
 |  | ||||||
| In this example, we will use the Firebase Cloud Messaging implementation. |  | ||||||
| 
 | 
 | ||||||
| ```dart | ```dart | ||||||
| getIt.registerLazySingleton<CloudMessagingRemoteDataSource>( | const like = 'sample'; | ||||||
|     () => CloudMessagingFirebaseDataSource()) |  | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| > Here we use GetIt. |  | ||||||
| 
 |  | ||||||
| ### Repository |  | ||||||
| 
 |  | ||||||
| Do the same for the repository. This one is already developed, you just need to inject it. |  | ||||||
| 
 |  | ||||||
| ```dart |  | ||||||
| getIt.registerLazySingleton<CloudMessagingRepository>( |  | ||||||
|     () => CloudMessagingRepositoryImpl( |  | ||||||
|         notificationRemoteDataSource: getIt(), |  | ||||||
|     ), |  | ||||||
| ) |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| ### Use cases |  | ||||||
| 
 |  | ||||||
| Do the same for use cases. Select an inject the ones you need in your app. Here are avalaible use cases:  |  | ||||||
| 
 |  | ||||||
| - `GetCloudMessagingTokenUsCase` |  | ||||||
| - `InitCloudmessagingUseCase` |  | ||||||
| - `ListenCloudMessagingUseCase` |  | ||||||
| - `RequestCloudMessagingPermissionUseCase` |  | ||||||
| - `SubscribeToNotificationTopicUseCase` |  | ||||||
| - `UnsubscribeFromNotificationTopicUseCase` |  | ||||||
| 
 |  | ||||||
| Here is an example with some usecase. |  | ||||||
| 
 |  | ||||||
| ```dart |  | ||||||
| getIt |  | ||||||
|     ..registerLazySingleton<ListenNotificationUseCase>( |  | ||||||
|       () => ListenNotificationUseCase( |  | ||||||
|         notificationRepository: getIt(), |  | ||||||
|       ), |  | ||||||
|     ) |  | ||||||
|     ..registerLazySingleton<GetCloudMessagingTokenUseCase>( |  | ||||||
|       () => GetCloudMessagingTokenUseCase( |  | ||||||
|         notificationRepository: getIt(), |  | ||||||
|       ), |  | ||||||
|     ) |  | ||||||
|     ..registerLazySingleton<RequestCloudMessagingPermissionUseCase>( |  | ||||||
|       () => RequestCloudMessagingPermissionUseCase( |  | ||||||
|         notificationRepository: getIt(), |  | ||||||
|       ), |  | ||||||
|     ); |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| ### Widgets |  | ||||||
| 
 |  | ||||||
| From this point onward, your task simply involves enveloping your app within the `CloudMessagingWrapperScreen`. Subsequently, you can proceed to implement your desired actions for handling incoming notifications. |  | ||||||
| 
 |  | ||||||
| ## Additional information | ## Additional information | ||||||
| 
 | 
 | ||||||
| If necessary, you can access data sources, repositories, and use cases through `getIt`. Here's a helpful example: | TODO: Tell users more about the package: where to find more information, how to  | ||||||
| 
 | contribute to the package, how to file issues, what response they can expect  | ||||||
| ```dart | from the package authors, and more. | ||||||
| abstract class CloudMessagingHelper { |  | ||||||
|   static Future<void> initMessaging() async { |  | ||||||
|     await getIt<RequestCloudMessagingPermissionUseCase>().call(null); |  | ||||||
| 
 |  | ||||||
|     final token = await getIt<GetCloudMessagingTokenUseCase>().call(null); |  | ||||||
|     if (token.isOk) { |  | ||||||
|       await notifLocalDataSource.storeToken(token: token.ok!); |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   static dataProcess(String? path) { |  | ||||||
|     if (PageEnum.values.where((element) => (element.path == path)).isNotEmpty) { |  | ||||||
|       AppRouter.goRouterNavigatorKey.currentState?.context.push(path!); |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -18,25 +18,39 @@ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Cloud Messaging Bloc Firebase Implementation | # Flutter - Cloud Messaging Bloc Firebase | ||||||
| 
 | 
 | ||||||
| <p align="left"> | <p align="left"> | ||||||
|   <a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis"><img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" /></a> |   <a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis"><img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" /></a> | ||||||
|   <img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" /> |   <img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" /> | ||||||
| </p> | </p> | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | A | ||||||
|  | 
 | ||||||
|  | ## Features | ||||||
|  | 
 | ||||||
|  | TODO: List what your package can do. Maybe include images, gifs, or videos. | ||||||
|  | 
 | ||||||
| ## Getting started | ## Getting started | ||||||
| 
 | 
 | ||||||
| Simply add `wyatt_cloud_messaging_bloc_firebase` in `pubspec.yaml` , then | TODO: List prerequisites and provide or point to information on how to | ||||||
|  | start using the package. | ||||||
|  | 
 | ||||||
|  | ## Usage | ||||||
|  | 
 | ||||||
|  | TODO: Include short and useful examples for package users. Add longer examples | ||||||
|  | to `/example` folder.  | ||||||
| 
 | 
 | ||||||
| ```dart | ```dart | ||||||
| import 'package:wyatt_cloud_messaging_bloc_firebase/wyatt_cloud_messaging_bloc_fiebase.dart'; | const like = 'sample'; | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ## Additional information | ## Additional information | ||||||
| 
 | 
 | ||||||
| - This package includes the implementation of the `CloudMessagingRemoteDataSource` found in the [Wyatt Cloud Messaging Bloc Base](https://git.wyatt-studio.fr/Wyatt-FOSS/-/packages/pub/wyatt_cloud_messaging_bloc_base) package, enabling the utilization of Firebase Cloud Messaging. | TODO: Tell users more about the package: where to find more information, how to  | ||||||
| - It's worth noting that this package exports [Wyatt Cloud Messaging Bloc Base](https://git.wyatt-studio.fr/Wyatt-FOSS/-/packages/pub/wyatt_cloud_messaging_bloc_base), so there's no need to import both packages. | contribute to the package, how to file issues, what response they can expect  | ||||||
| - This implementation is kept separate from the package to enhance dependency management efficiency. | from the package authors, and more. | ||||||
| - All the instructions for using this package are provided in the [Wyatt Cloud Messaging Bloc Base](https://git.wyatt-studio.fr/Wyatt-FOSS/-/packages/pub/wyatt_cloud_messaging_bloc_base) package's readme. |  | ||||||
| 
 |  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user