From 59263b29bb525cca7da8df68ff92af0c9fa62081 Mon Sep 17 00:00:00 2001 From: Athul A Date: Tue, 18 Apr 2023 23:49:31 +0530 Subject: [PATCH 1/5] Added Support to Specify FirebaseApp --- lib/src/firebase_chat_core.dart | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/src/firebase_chat_core.dart b/lib/src/firebase_chat_core.dart index f95f445..9330ce1 100644 --- a/lib/src/firebase_chat_core.dart +++ b/lib/src/firebase_chat_core.dart @@ -10,10 +10,19 @@ import 'util.dart'; /// FirebaseChatCore.instance to aceess methods. class FirebaseChatCore { FirebaseChatCore._privateConstructor() { + firebaseUser = FirebaseAuth.instance.currentUser; + FirebaseAuth.instance.authStateChanges().listen((User? user) { firebaseUser = user; }); } + FirebaseChatCore._privateConstructorForSpecifiedFirebaseApp(FirebaseApp app) { + firebaseUser = FirebaseAuth.instanceFor(app: app).currentUser; + + FirebaseAuth.instanceFor(app: app).authStateChanges().listen((User? user) { + firebaseUser = user; + }); + } /// Config to set custom names for rooms and users collections. Also /// see [FirebaseChatCoreConfig]. @@ -25,12 +34,24 @@ class FirebaseChatCore { /// Current logged in user in Firebase. Does not update automatically. /// Use [FirebaseAuth.authStateChanges] to listen to the state changes. - User? firebaseUser = FirebaseAuth.instance.currentUser; + User? firebaseUser; /// Singleton instance. static final FirebaseChatCore instance = FirebaseChatCore._privateConstructor(); + /// Returns an instance using a specified [FirebaseApp]. + static FirebaseChatCore instanceFor({required FirebaseApp app}) { + final instance = + FirebaseChatCore._privateConstructorForSpecifiedFirebaseApp(app); + instance.config = FirebaseChatCoreConfig( + app.name, + instance.config.roomsCollectionName, + instance.config.usersCollectionName, + ); + return instance; + } + /// Gets proper [FirebaseFirestore] instance. FirebaseFirestore getFirebaseFirestore() => config.firebaseAppName != null ? FirebaseFirestore.instanceFor( From 35fdaf9ce5d5d215e4346e5e8a835449aa58fd3e Mon Sep 17 00:00:00 2001 From: Athul A Date: Sat, 13 Jul 2024 10:18:13 +0530 Subject: [PATCH 2/5] updated dependencies --- .../linux/flutter/generated_plugin_registrant.cc | 4 ++++ example/linux/flutter/generated_plugins.cmake | 1 + .../windows/flutter/generated_plugin_registrant.cc | 12 ++++++++++++ example/windows/flutter/generated_plugins.cmake | 4 ++++ pubspec.yaml | 14 +++++++------- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/example/linux/flutter/generated_plugin_registrant.cc b/example/linux/flutter/generated_plugin_registrant.cc index f6f23bf..7299b5c 100644 --- a/example/linux/flutter/generated_plugin_registrant.cc +++ b/example/linux/flutter/generated_plugin_registrant.cc @@ -6,9 +6,13 @@ #include "generated_plugin_registrant.h" +#include #include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); + file_selector_plugin_register_with_registrar(file_selector_linux_registrar); g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); diff --git a/example/linux/flutter/generated_plugins.cmake b/example/linux/flutter/generated_plugins.cmake index f16b4c3..786ff5c 100644 --- a/example/linux/flutter/generated_plugins.cmake +++ b/example/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + file_selector_linux url_launcher_linux ) diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc index ec8e8d4..3e6795e 100644 --- a/example/windows/flutter/generated_plugin_registrant.cc +++ b/example/windows/flutter/generated_plugin_registrant.cc @@ -6,12 +6,24 @@ #include "generated_plugin_registrant.h" +#include +#include +#include #include +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + CloudFirestorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("CloudFirestorePluginCApi")); + FileSelectorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FileSelectorWindows")); + FirebaseAuthPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi")); FirebaseCorePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); + FirebaseStoragePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseStoragePluginCApi")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake index 02d26c3..9615bc9 100644 --- a/example/windows/flutter/generated_plugins.cmake +++ b/example/windows/flutter/generated_plugins.cmake @@ -3,7 +3,11 @@ # list(APPEND FLUTTER_PLUGIN_LIST + cloud_firestore + file_selector_windows + firebase_auth firebase_core + firebase_storage url_launcher_windows ) diff --git a/pubspec.yaml b/pubspec.yaml index 3bd95e7..4ed5133 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,16 +11,16 @@ environment: flutter: '>=3.0.0' dependencies: - cloud_firestore: ^4.7.1 - firebase_auth: ^4.6.1 - firebase_core: ^2.13.0 + cloud_firestore: ^5.1.0 + firebase_auth: ^5.1.2 + firebase_core: ^3.2.0 flutter: sdk: flutter - flutter_chat_types: ^3.6.1 - meta: ^1.9.1 + flutter_chat_types: ^3.6.2 + meta: ^1.12.0 dev_dependencies: - dart_code_metrics: ^5.7.3 - flutter_lints: ^2.0.1 + dart_code_metrics: ^5.7.6 + flutter_lints: ^4.0.0 flutter_test: sdk: flutter From cf6fcc4d9dcbbf72527e07a7e79a8daacd0d8058 Mon Sep 17 00:00:00 2001 From: Athul A Date: Sat, 13 Jul 2024 10:57:30 +0530 Subject: [PATCH 3/5] updated dependencies --- example/ios/Podfile.lock | 2 +- example/pubspec.yaml | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 809dda5..d5156d1 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -656,7 +656,7 @@ PODS: - Firebase/Auth (= 10.9.0) - firebase_core - Flutter - - firebase_core (2.13.0): + - firebase_core (3.2.0): - Firebase/CoreOnly (= 10.9.0) - Flutter - firebase_storage (11.2.1): diff --git a/example/pubspec.yaml b/example/pubspec.yaml index ca44674..1b5b51a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -2,7 +2,7 @@ name: example description: A new Flutter project. # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.19.0 <4.0.0' + sdk: ">=2.19.0 <4.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -34,7 +34,7 @@ dependencies: faker: ^2.1.0 file_picker: ^5.3.0 firebase_auth: ^4.6.1 - firebase_core: ^2.13.0 + firebase_core: ^3.2.0 firebase_storage: ^11.2.1 flutter: sdk: flutter @@ -64,7 +64,6 @@ dev_dependencies: # The following section is specific to Flutter packages. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. From d74997d4f750384c6c08ba277b84c8e36965cbee Mon Sep 17 00:00:00 2001 From: Athul A Date: Sat, 13 Jul 2024 11:46:45 +0530 Subject: [PATCH 4/5] Update pubspec.yaml --- example/pubspec.yaml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 1b5b51a..da7eb7d 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -32,30 +32,29 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.5 faker: ^2.1.0 - file_picker: ^5.3.0 - firebase_auth: ^4.6.1 + file_picker: ^8.0.6 + firebase_auth: ^5.1.2 firebase_core: ^3.2.0 - firebase_storage: ^11.2.1 + firebase_storage: ^12.1.1 flutter: sdk: flutter flutter_chat_types: ^3.6.1 flutter_chat_ui: ^1.6.8 flutter_firebase_chat_core: path: ../ - http: ^0.13.6 - image_picker: ^0.8.7+5 + http: ^1.2.1 + image_picker: ^1.1.2 mime: ^1.0.4 open_filex: ^4.3.2 path_provider: ^2.0.15 dev_dependencies: - dart_code_metrics: ^5.7.3 # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^2.0.1 + flutter_lints: ^4.0.0 flutter_test: sdk: flutter From 78fb0b4dd4f233a71c1b2b170be22ce046741dc7 Mon Sep 17 00:00:00 2001 From: Athul A Date: Sat, 31 Aug 2024 23:03:20 +0530 Subject: [PATCH 5/5] updated packages --- example/pubspec.yaml | 3 --- pubspec.yaml | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index da7eb7d..0d94ec8 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,8 +1,5 @@ name: example description: A new Flutter project. -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 diff --git a/pubspec.yaml b/pubspec.yaml index 4ed5133..5fbb7d3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,9 +11,9 @@ environment: flutter: '>=3.0.0' dependencies: - cloud_firestore: ^5.1.0 - firebase_auth: ^5.1.2 - firebase_core: ^3.2.0 + cloud_firestore: ^5.3.0 + firebase_auth: ^5.2.0 + firebase_core: ^3.4.0 flutter: sdk: flutter flutter_chat_types: ^3.6.2