Skip to content
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

feat(firebase_in_app_messaging)!: federate & rework plugin #7345

Merged
merged 26 commits into from Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ca19a5a
chore: setup federated package
Ehesp Nov 9, 2021
0dedba8
chore: setup delegation flow
Ehesp Nov 9, 2021
c77960a
chore: match native channel names
Ehesp Nov 11, 2021
84e0933
Merge branch 'master' into @invertase/fiam-rework
Ehesp Nov 11, 2021
92dda96
chore: add tests
Ehesp Nov 15, 2021
9eae21b
fix: tests and ci
pr-Mais Nov 16, 2021
b6fdd01
chore: platform interface CHANGELOG
pr-Mais Nov 16, 2021
d35a0e2
fix: method channel delegateFor
pr-Mais Nov 16, 2021
6b004e3
fix: example app
pr-Mais Nov 16, 2021
97442c8
chore: remove training comma ignore
pr-Mais Nov 16, 2021
c909f0b
chore: remove duplicate license header
pr-Mais Nov 16, 2021
c014112
fix: required trainling comma
pr-Mais Nov 17, 2021
c56b85d
chore: example app formatting
pr-Mais Nov 17, 2021
d372954
docs: fiam overview
pr-Mais Nov 17, 2021
6f03996
feat: update Firebase example app
pr-Mais Nov 18, 2021
cbbc577
docs: usage
pr-Mais Nov 18, 2021
99461ad
docs: fix warnings
pr-Mais Nov 18, 2021
b9d34cc
docs: installation ID section
pr-Mais Nov 18, 2021
6d1400b
docs(in-app): update README.md
russellwheatley Dec 2, 2021
935a94d
Merge branch 'dev' of https://github.com/FirebaseExtended/flutterfire…
pr-Mais Dec 4, 2021
e306073
Restore project.pbxproj
Salakar Dec 4, 2021
c70c3d0
Delete GoogleService-Info.plist
Salakar Dec 4, 2021
ec5b3b7
Merge branch 'dev' into @invertase/fiam-rework
Salakar Dec 4, 2021
634a483
cleanup
Salakar Dec 6, 2021
b82888c
ci: setup ci workflow
Salakar Dec 6, 2021
3150cad
fix: native is sent a map for 2 methods, not bools
Salakar Dec 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
115 changes: 115 additions & 0 deletions docs/in-app-messaging/overview.mdx
@@ -0,0 +1,115 @@
---
title: In-App Messaging
sidebar_label: Overview
---

:::caution
This is a beta FlutterFire plugin and therefore is not yet production quality.
:::

## What does it do?

Firebase In-App Messaging helps you engage your app's active users by sending them targeted,
contextual messages that encourage them to use key app features. For example, you could send
an in-app message to get users to subscribe, watch a video, complete a level, or buy an item.
You can customize messages as cards, banners, modals, or images, and set up triggers so that
they appear exactly when they'd benefit your users most.
Use Firebase In-App Messaging to encourage exploration and discovery: highlight a sale or
coupon in your ecommerce app, give clues or tips in your game, or prompt a like or share in
your social media app.

<YouTube id="5MRKpvKV2pg" />

## Installation

Before installing the In-App Messaging for Firebase plugin, ensure that you have followed the [Getting Started](../overview.mdx) documentation
and have initialized FlutterFire.

<Tabs
groupId="legacy-or-nullsafe"
defaultValue="legacy"
values={[
{ label: "Legacy", value: "legacy" },
{ label: "Null safety", value: "null-safe" },
]}
>
<TabItem value="legacy">

For legacy package imports, place the following ignore comment to hide Dart analyzer warnings:

```dart
// ignore: import_of_legacy_library_into_null_safe
import 'package:firebase-in-app-messaging/firebase-in-app-messaging.dart';
```

</TabItem>
<TabItem value="null-safe">

Ensure you're using the Flutter `stable` channel:

```bash
$ flutter channel stable
```

If your app is mixing legacy and null-safe packages, use the `--no-sound-null-safety` flag:

```bash
$ flutter run --no-sound-null-safety
```

</TabItem>
</Tabs>

### 1. Add dependency

<Tabs
groupId="legacy-or-nullsafe"
defaultValue="legacy"
values={[
{ label: "Legacy", value: "legacy" },
{ label: "Null safety", value: "null-safe" },
]}
>
<TabItem value="legacy">

```yaml {5} title="pubspec.yaml"
dependencies:
flutter:
sdk: flutter
firebase_core: '^{{ plugins.firebase_core }}'
firebase_in_app_messaging: '^{{ plugins.firebase_in_app_messaging }}'
```

</TabItem>
<TabItem value="null-safe">

```yaml {5} title="pubspec.yaml"
dependencies:
flutter:
sdk: flutter
firebase_core: '^{{ plugins.firebase_core_ns }}'
firebase_in_app_messaging: '^{{ plugins.firebase_in_app_messaging_ns }}'
```

</TabItem>
</Tabs>

### 2. Download dependency

```
$ flutter pub get
```

### 3. Rebuild your app

Once complete, rebuild your Flutter application:

```bash
$ flutter run
```

## Next Steps

Once installed, you're ready to start using In-App Messaging in your Flutter Project.

View the [Usage documentation](usage.mdx) to get started.
2 changes: 1 addition & 1 deletion docs/in-app-messaging/usage.mdx
Expand Up @@ -3,4 +3,4 @@ title: In-App Messaging
sidebar_label: Usage
---

In-App Messaging usage
# Using Firebase In-App Messaging
7 changes: 6 additions & 1 deletion docs/sidebars.js
Expand Up @@ -94,7 +94,12 @@ module.exports = {
],
// "Dynamic Links": ["dynamic-links/usage", toReferenceAPI("firebase_dynamic_links")],
// "Instance ID": ["iid/usage", toReferenceAPI("firebase_in_app_messaging")],
// "In-App Messaging": ["in-app-messaging/usage", toReferenceAPI("firebase_in_app_messaging")],
"In-App Messaging": [
"in-app-messaging/overview",
"in-app-messaging/usage",
toReferenceAPI("firebase_in_app_messaging"),
toGithubExample("firebase_in_app_messaging"),
],
// "ML Kit Natural Language": ["ml-language/usage"],
// "ML Kit Vision": ["ml-vision/usage", toReferenceAPI("firebase_ml_vision")],
"Remote Config": [
Expand Down
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
252326822744151700470D06 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 252326812744151700470D06 /* GoogleService-Info.plist */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
Expand All @@ -34,6 +35,7 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
1CA58DEFDBF022ED6AD0F24B /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
252326812744151700470D06 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
3AD75DDD4B2054847ECB80CC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -96,6 +98,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
252326812744151700470D06 /* GoogleService-Info.plist */,
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
Expand Down Expand Up @@ -149,7 +152,6 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
B7F1A9EA4C114C29858E66FE /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -199,6 +201,7 @@
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
252326822744151700470D06 /* GoogleService-Info.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
Expand Down
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>448618578101-dgsgte6oqc377gdf80gbb8ovtjbagi49.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.448618578101-dgsgte6oqc377gdf80gbb8ovtjbagi49</string>
<key>ANDROID_CLIENT_ID</key>
<string>448618578101-26jgjs0rtl4ts2i667vjb28kldvs2kp6.apps.googleusercontent.com</string>
<key>API_KEY</key>
<string>AIzaSyAHAsf51D0A407EklG1bs-5wA7EbyfNFg0</string>
<key>GCM_SENDER_ID</key>
<string>448618578101</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>io.flutter.plugins.firebase.storage.example</string>
<key>PROJECT_ID</key>
<string>react-native-firebase-testing</string>
<key>STORAGE_BUCKET</key>
<string>react-native-firebase-testing.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:448618578101:ios:6640d5c29008c2a8ac3efc</string>
<key>DATABASE_URL</key>
<string>https://react-native-firebase-testing.firebaseio.com</string>
</dict>
</plist>
Expand Up @@ -45,21 +45,21 @@ public void onDetachedFromEngine(FlutterPluginBinding binding) {
@Override
public void onMethodCall(MethodCall call, Result result) {
switch (call.method) {
case "triggerEvent":
case "FirebaseInAppMessaging#triggerEvent":
{
String eventName = call.argument("eventName");
instance.triggerEvent(eventName);
result.success(null);
break;
}
case "setMessagesSuppressed":
case "FirebaseInAppMessaging#setMessagesSuppressed":
{
Boolean suppress = (Boolean) call.arguments;
instance.setMessagesSuppressed(suppress);
result.success(null);
break;
}
case "setAutomaticDataCollectionEnabled":
case "FirebaseInAppMessaging#setAutomaticDataCollectionEnabled":
{
Boolean enabled = (Boolean) call.arguments;
instance.setAutomaticDataCollectionEnabled(enabled);
Expand Down
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>9.0</string>
</dict>
</plist>
Expand Up @@ -8,8 +8,8 @@

/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
253A390527457ED5005FA014 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 253A390427457ED5005FA014 /* GoogleService-Info.plist */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
9031715A22DD332B00CA8C68 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9031715922DD332B00CA8C68 /* GoogleService-Info.plist */; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
Expand All @@ -35,13 +35,13 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
253A390427457ED5005FA014 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
2D51D38D6F347D924BF73402 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
4DBCB98EE08F0263FFB39A45 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
9031715922DD332B00CA8C68 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
914982FDACC51A62D1FAC1F1 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
9697814F64329B9DFDDD2D22 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -73,7 +73,6 @@
4DBCB98EE08F0263FFB39A45 /* Pods-Runner.release.xcconfig */,
9697814F64329B9DFDDD2D22 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -118,7 +117,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
9031715922DD332B00CA8C68 /* GoogleService-Info.plist */,
253A390427457ED5005FA014 /* GoogleService-Info.plist */,
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
Expand Down Expand Up @@ -154,7 +153,6 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
9CB2B92FB733B57CFCD2086E /* [CP] Embed Pods Frameworks */,
4E58458F4BA4D6603A0A2A9C /* [CP] Copy Pods Resources */,
);
buildRules = (
Expand Down Expand Up @@ -209,7 +207,7 @@
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
9031715A22DD332B00CA8C68 /* GoogleService-Info.plist in Resources */,
253A390527457ED5005FA014 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -236,9 +234,12 @@
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseInAppMessaging/InAppMessagingDisplayResources.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/InAppMessagingDisplayResources.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand All @@ -259,21 +260,6 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
9CB2B92FB733B57CFCD2086E /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9FEE87118A15F39DB7049483 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -333,7 +319,6 @@
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down Expand Up @@ -407,7 +392,6 @@
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down Expand Up @@ -463,7 +447,6 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Firebase In-App Messaging Example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down