diff --git a/.github/workflows/firebase_installations.yaml b/.github/workflows/firebase_installations.yaml index 314d6eeb4f8a..59125449cffa 100644 --- a/.github/workflows/firebase_installations.yaml +++ b/.github/workflows/firebase_installations.yaml @@ -13,8 +13,8 @@ on: - '**.md' env: - FLUTTERFIRE_PLUGIN_SCOPE: '*firebase_installations*' - FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE: '*firebase_installations_example*' + FLUTTERFIRE_PLUGIN_SCOPE: '*installations*' + FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE: '*installations_example*' jobs: android: diff --git a/docs/installations/overview.mdx b/docs/installations/overview.mdx index f96056006d27..393e42f14e01 100644 --- a/docs/installations/overview.mdx +++ b/docs/installations/overview.mdx @@ -18,22 +18,22 @@ Internally, the installation ID is used by the following Firebase Services: - Firebase Remote Config - Firebase ML -Tpically, Firebase services use the Firebase installations service without requiring developers to interact directly with the FIS API. However, there are cases where app developers might want to directly call the FIS API, such as: +Typically, Firebase services use the Firebase installations service without requiring developers to interact directly with the FIS API. However, there are cases where app developers might want to directly call the FIS API, such as: -- To delete a Firebase installation and data tied to the installation. -- To retrieve identifiers (Firebase installation IDs) in order to target specific app installations. -- To retrieve installation auth tokens to authenticate Firebase installations. +- Delete a Firebase installation and data tied to the installation. +- Retrieve identifiers (Firebase installation IDs) in order to target specific app installations. +- Retrieve installation auth tokens to authenticate Firebase installations. ## Installation -Add the `firebase_installations` dependency to your projects `pubspec.yaml` file: +Add the `flutterfire_installations` dependency to your projects `pubspec.yaml` file: ```yaml {5} title="pubspec.yaml" dependencies: flutter: sdk: flutter firebase_core: "^{{ plugins.firebase_core_ns }}" - firebase_installations: "^{{ plugins.firebase_installations_ns }}" + flutterfire_installations: "^{{ plugins.flutterfire_installations_ns }}" ``` ### 2. Download dependency diff --git a/docs/installations/usage.mdx b/docs/installations/usage.mdx index a63d86dd0496..c5b40cf45ee3 100644 --- a/docs/installations/usage.mdx +++ b/docs/installations/usage.mdx @@ -6,7 +6,7 @@ sidebar_label: Usage To start using the Firebase Installations package within your project, import it at the top of your project files: ```dart -import 'package:firebase_installations/firebase_installations.dart'; +import 'package:flutterfire_installations/flutterfire_installations.dart'; ``` Before using Firebase Installations, you must first have ensured you have [initialized FlutterFire](../overview.mdx#initializing-flutterfire). @@ -45,7 +45,7 @@ To delete an FID, call the `delete` method on the [`FirebaseInstallations`](!fir await FirebaseInstallations.instance.delete(); ``` -## Retrieve client identifers +## Retrieve client identifiers If you have a requirement to identify particular installations of your app, you can do so by retrieving the Firebase installation ID. For example, to perform testing during Firebase In-App Messaging development, you can identify and target the correct test device using @@ -65,8 +65,8 @@ you can authenticate a targeted test device using an installation auth token. An installation auth token is a short-lived bearer token in JSON web token (JWT) format containing the following information for an installation: - The Firebase installation ID -- The associated project (projectNumber) -- The associated Firebase application ID (appId) +- The associated project (`projectNumber`) +- The associated Firebase application ID (`appId`) - The token's expiration date An installation auth token cannot be revoked, and remains valid until its expiration date. The default token lifetime is one week. @@ -83,24 +83,24 @@ Optionally, you can force a token refresh when called: String token = await FirebaseInstallations.instance.getToken(true); ``` -## Monitor the Firebase installation ID lifecycle +## Monitor the Firebase Installation ID -During the normal operation of an app, Firebase installation IDs (FIDs) don't require special monitoring. However, apps that explictly retrieve and +During the normal operation of an app, Firebase installation IDs (FIDs) don't require special monitoring. However, apps that explicitly retrieve and use FIDs should add logic to monitor the potential deletion or rotation of the FID. Here are some cases where FIDs could be deleted or rotated: -- Uninstallation or reinstallation of the app, for instance when an end user installs on a new device. +- Uninstallation or re-installation of the app, for instance when an end user installs on a new device. - The end user clears the cache of the app or the device. - FID deletion is triggered in the backend due to app inactivity (currently the threshold for this is 270 days of inactivity). -When apps experience FID rotation or deletion in these kinds of cases, they are assigned a new FID. Also, the installation auth token associated with +When apps experience a FID rotation or deletion in these kinds of cases, they are assigned a new FID. Also, the installation auth token associated with a deleted FID is deleted, regardless of its own maturity, and is replaced with a new installation auth token. Apps can monitor these changes and respond accordingly. -To monitor the FID token, listen to the `Stream` returned from the `idTokenChanges` getter: +To monitor the FID token, listen to the `Stream` returned from the `onIdChange` getter: ```dart -FirebaseInstallations.instance.idTokenChanges.listen((token) { +FirebaseInstallations.instance.onIdChange.listen((token) { print('FID token: $token'); }); ``` diff --git a/docs/versions.js b/docs/versions.js index 158068e201f2..128d6e89b742 100644 --- a/docs/versions.js +++ b/docs/versions.js @@ -31,7 +31,7 @@ export default { firebase_performance_ns: PUB_NS_FIREBASE_PERFORMANCE, firebase_remote_config: PUB_FIREBASE_REMOTE_CONFIG, firebase_remote_config_ns: PUB_NS_FIREBASE_REMOTE_CONFIG, - firebase_installations_ns: PUB_NS_FIREBASE_INSTALLATIONS, + flutterfire_installations: PUB_NS_FLUTTERFIRE_INSTALLATIONS, google_sign_in: '^4.4.4', }, android: { diff --git a/packages/firebase_installations/firebase_installations/README.md b/packages/firebase_installations/firebase_installations/README.md index 82997b0d8659..f905a19cb839 100644 --- a/packages/firebase_installations/firebase_installations/README.md +++ b/packages/firebase_installations/firebase_installations/README.md @@ -2,7 +2,7 @@ A Flutter plugin to use the [Firebase Installations API](https://firebase.google.com/docs/projects/manage-installations). -[![pub package](https://img.shields.io/pub/v/firebase_installations.svg)](https://pub.dev/packages/firebase_installations) +[![pub package](https://img.shields.io/pub/v/flutterfire_installations.svg)](https://pub.dev/packages/flutterfire_installations) ## Getting Started diff --git a/packages/firebase_installations/firebase_installations/example/lib/main.dart b/packages/firebase_installations/firebase_installations/example/lib/main.dart index 8f210ff84e3d..8c8e1dd62e9a 100644 --- a/packages/firebase_installations/firebase_installations/example/lib/main.dart +++ b/packages/firebase_installations/firebase_installations/example/lib/main.dart @@ -4,7 +4,7 @@ import 'package:firebase_installations_example/firebase_config.dart'; import 'package:flutter/material.dart'; import 'package:firebase_core/firebase_core.dart'; -import 'package:firebase_installations/firebase_installations.dart'; +import 'package:flutterfire_installations/flutterfire_installations.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -45,7 +45,7 @@ class _InstallationsCardState extends State { init(); // Listen to changes - FirebaseInstallations.instance.idChanges.listen((event) { + FirebaseInstallations.instance.onIdChange.listen((event) { setState(() { id = event; }); diff --git a/packages/firebase_installations/firebase_installations/example/pubspec.yaml b/packages/firebase_installations/firebase_installations/example/pubspec.yaml index 708b85541971..805605bea706 100644 --- a/packages/firebase_installations/firebase_installations/example/pubspec.yaml +++ b/packages/firebase_installations/firebase_installations/example/pubspec.yaml @@ -28,7 +28,7 @@ environment: # versions available, run `flutter pub outdated`. dependencies: firebase_core: ^1.10.0 - firebase_installations: + flutterfire_installations: path: ../ flutter: sdk: flutter @@ -36,7 +36,11 @@ dependencies: dependency_overrides: firebase_core: path: ../../../firebase_core/firebase_core - + firebase_installations_web: + path: ../../firebase_installations_web + firebase_installations_platform_interface: + path: ../../firebase_installations_platform_interface + dev_dependencies: drive: ^1.0.0-1.0.nullsafety.1 flutter_driver: diff --git a/packages/firebase_installations/firebase_installations/example/test_driver/firebase_installations_e2e.dart b/packages/firebase_installations/firebase_installations/example/test_driver/flutterfire_installations_e2e.dart similarity index 94% rename from packages/firebase_installations/firebase_installations/example/test_driver/firebase_installations_e2e.dart rename to packages/firebase_installations/firebase_installations/example/test_driver/flutterfire_installations_e2e.dart index 1f2f6b0ab45c..bb98192407b1 100644 --- a/packages/firebase_installations/firebase_installations/example/test_driver/firebase_installations_e2e.dart +++ b/packages/firebase_installations/firebase_installations/example/test_driver/flutterfire_installations_e2e.dart @@ -4,7 +4,7 @@ import 'package:drive/drive.dart' as drive; import 'package:firebase_core/firebase_core.dart'; -import 'package:firebase_installations/firebase_installations.dart'; +import 'package:flutterfire_installations/flutterfire_installations.dart'; import 'package:flutter_test/flutter_test.dart'; import 'firebase_config.dart'; diff --git a/packages/firebase_installations/firebase_installations/example/test_driver/firebase_installations_e2e_test.dart b/packages/firebase_installations/firebase_installations/example/test_driver/flutterfire_installations_e2e_test.dart similarity index 100% rename from packages/firebase_installations/firebase_installations/example/test_driver/firebase_installations_e2e_test.dart rename to packages/firebase_installations/firebase_installations/example/test_driver/flutterfire_installations_e2e_test.dart diff --git a/packages/firebase_installations/firebase_installations/lib/firebase_installations.dart b/packages/firebase_installations/firebase_installations/lib/flutterfire_installations.dart similarity index 86% rename from packages/firebase_installations/firebase_installations/lib/firebase_installations.dart rename to packages/firebase_installations/firebase_installations/lib/flutterfire_installations.dart index 2b0a9e656263..456ea64ec417 100644 --- a/packages/firebase_installations/firebase_installations/lib/firebase_installations.dart +++ b/packages/firebase_installations/firebase_installations/lib/flutterfire_installations.dart @@ -2,11 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library firebase_installations; +library flutterfire_installations; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' show FirebasePluginPlatform; import 'package:firebase_installations_platform_interface/firebase_installations_platform_interface.dart'; -part 'src/firebase_installations.dart'; +part 'src/flutterfire_installations.dart'; diff --git a/packages/firebase_installations/firebase_installations/lib/src/firebase_installations.dart b/packages/firebase_installations/firebase_installations/lib/src/flutterfire_installations.dart similarity index 95% rename from packages/firebase_installations/firebase_installations/lib/src/firebase_installations.dart rename to packages/firebase_installations/firebase_installations/lib/src/flutterfire_installations.dart index 65da91be33d8..3fbc142f23a4 100644 --- a/packages/firebase_installations/firebase_installations/lib/src/firebase_installations.dart +++ b/packages/firebase_installations/firebase_installations/lib/src/flutterfire_installations.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -part of firebase_installations; +part of flutterfire_installations; class FirebaseInstallations extends FirebasePluginPlatform { FirebaseInstallations._({required this.app}) @@ -56,7 +56,7 @@ class FirebaseInstallations extends FirebasePluginPlatform { } /// Sends a new event via a [Stream] whenever the Installation ID changes. - Stream get idChanges { - return _delegate.idChanges; + Stream get onIdChange { + return _delegate.onIdChange; } } diff --git a/packages/firebase_installations/firebase_installations/pubspec.yaml b/packages/firebase_installations/firebase_installations/pubspec.yaml index 6dc2adb41772..e588b8843ac1 100644 --- a/packages/firebase_installations/firebase_installations/pubspec.yaml +++ b/packages/firebase_installations/firebase_installations/pubspec.yaml @@ -1,12 +1,13 @@ -name: firebase_installations +# FlutterFire_X naming due to package being take already on Pub.dev. +name: flutterfire_installations description: A Flutter plugin allowing you to use Firebase Installations. version: 0.0.1 homepage: https://firebase.flutter.dev/docs/installations/overview repository: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_installations/firebase_installations environment: - sdk: '>=2.12.0 <3.0.0' - flutter: '>=1.20.0' + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" dependencies: firebase_core: ^1.10.0 diff --git a/packages/firebase_installations/firebase_installations/test/firebase_installations_test.dart b/packages/firebase_installations/firebase_installations/test/firebase_installations_test.dart index 3eaaa5da8673..6893112283e5 100644 --- a/packages/firebase_installations/firebase_installations/test/firebase_installations_test.dart +++ b/packages/firebase_installations/firebase_installations/test/firebase_installations_test.dart @@ -5,7 +5,7 @@ import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'; -import 'package:firebase_installations/firebase_installations.dart'; +import 'package:flutterfire_installations/flutterfire_installations.dart'; import 'package:firebase_installations_platform_interface/firebase_installations_platform_interface.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/packages/firebase_installations/firebase_installations_platform_interface/README.md b/packages/firebase_installations/firebase_installations_platform_interface/README.md index 3aff0262f878..00f6dfe07c3c 100644 --- a/packages/firebase_installations/firebase_installations_platform_interface/README.md +++ b/packages/firebase_installations/firebase_installations_platform_interface/README.md @@ -2,13 +2,13 @@ A common platform interface for the [`firebase_installations`][1] plugin. -This interface allows platform-specific implementations of the `cloud_firestore` +This interface allows platform-specific implementations of the `flutterfire_installations` plugin, as well as the plugin itself, to ensure they are supporting the same interface. ## Usage -To implement a new platform-specific implementation of `firebase_installations`, extend +To implement a new platform-specific implementation of `flutterfire_installations`, extend [`FirebaseInstallationsPlatform`][2] with an implementation that performs the platform-specific behavior, and when you register your plugin, set the default `FirebaseInstallationsPlatform` by calling diff --git a/packages/firebase_installations/firebase_installations_platform_interface/lib/src/method_channel/method_channel_firebase_installations.dart b/packages/firebase_installations/firebase_installations_platform_interface/lib/src/method_channel/method_channel_firebase_installations.dart index 35feeea0e720..debfe37e5924 100644 --- a/packages/firebase_installations/firebase_installations_platform_interface/lib/src/method_channel/method_channel_firebase_installations.dart +++ b/packages/firebase_installations/firebase_installations_platform_interface/lib/src/method_channel/method_channel_firebase_installations.dart @@ -100,7 +100,7 @@ class MethodChannelFirebaseInstallations extends FirebaseInstallationsPlatform { } @override - Stream get idChanges { + Stream get onIdChange { return _idTokenChangesListeners[app!.name]!.stream; } } diff --git a/packages/firebase_installations/firebase_installations_platform_interface/lib/src/platform_interface/firebase_installations_platform_interface.dart b/packages/firebase_installations/firebase_installations_platform_interface/lib/src/platform_interface/firebase_installations_platform_interface.dart index 238591c84660..14ee6412ea35 100644 --- a/packages/firebase_installations/firebase_installations_platform_interface/lib/src/platform_interface/firebase_installations_platform_interface.dart +++ b/packages/firebase_installations/firebase_installations_platform_interface/lib/src/platform_interface/firebase_installations_platform_interface.dart @@ -63,7 +63,7 @@ abstract class FirebaseInstallationsPlatform extends PlatformInterface { } /// Sends a new event via a [Stream] whenever the Installation ID changes. - Stream get idChanges { - throw UnimplementedError('get idTokenChanges is not implemented'); + Stream get onIdChange { + throw UnimplementedError('get onIdChange is not implemented'); } } diff --git a/packages/firebase_installations/firebase_installations_web/README.md b/packages/firebase_installations/firebase_installations_web/README.md index c7f041e2a230..001155ac60ea 100644 --- a/packages/firebase_installations/firebase_installations_web/README.md +++ b/packages/firebase_installations/firebase_installations_web/README.md @@ -1,12 +1,12 @@ # firebase_installations_web -The web implementation of `firebase_installations`. +The web implementation of `flutterfire_installations`. ## Getting Started -To get started with Cloud Firestore Web, please [see the documentation](https://firebase.flutter.dev/docs/installations/overview) +To get started with Firebase Installations Web, please [see the documentation](https://firebase.flutter.dev/docs/installations/overview) available at [https://firebase.flutter.dev](https://firebase.flutter.dev) -Once installed, Firestore needs to be configured for Web Installation. Please [see the documentation](https://firebase.flutter.dev/docs/installations/overview#3-web-only-add-the-sdk) on Web Installation +Once installed, Firebase Installations needs to be configured for Web Installation. Please [see the documentation](https://firebase.flutter.dev/docs/installations/overview#3-web-only-add-the-sdk) on Web Installation To learn more about managing Firebase Installations for you project, please visit the [Firebase website](https://firebase.google.com/docs/projects/manage-installations) diff --git a/website/plugins.js b/website/plugins.js index 19a02b437d88..4ab7ab4d10ee 100644 --- a/website/plugins.js +++ b/website/plugins.js @@ -73,7 +73,7 @@ module.exports = [ }, { name: 'Installations', - pub: 'installations', + pub: 'flutterfire_installations', firebase: 'https://firebase.google.com/docs/projects/manage-installations', status: 'Stable', documentation: 'https://firebase.flutter.dev/docs/installations/overview',