Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Salakar committed Dec 6, 2021
1 parent 1e3fad5 commit f32fecc
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/firebase_installations.yaml
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions docs/installations/overview.mdx
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions docs/installations/usage.mdx
Expand Up @@ -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).
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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:

```dart
FirebaseInstallations.instance.idTokenChanges.listen((token) {
FirebaseInstallations.instance.idChanges.listen((token) {
print('FID token: $token');
});
```
Expand Down
2 changes: 1 addition & 1 deletion docs/versions.js
Expand Up @@ -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: {
Expand Down
Expand Up @@ -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

Expand Down
Expand Up @@ -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();
Expand Down
Expand Up @@ -28,15 +28,19 @@ environment:
# versions available, run `flutter pub outdated`.
dependencies:
firebase_core: ^1.10.0
firebase_installations:
flutterfire_installations:
path: ../
flutter:
sdk: flutter

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:
Expand Down
Expand Up @@ -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';
Expand Down
Expand Up @@ -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';
Expand Up @@ -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})
Expand Down
@@ -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
Expand Down
Expand Up @@ -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';
Expand Down
Expand Up @@ -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
Expand Down
@@ -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)
2 changes: 1 addition & 1 deletion website/plugins.js
Expand Up @@ -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',
Expand Down

0 comments on commit f32fecc

Please sign in to comment.