Skip to content

Commit a8f1fe8

Browse files
Merge pull request #21 from collinjackson/migrate_fiam
[firebase_in_app_messaging] migrate to new repository
2 parents 7153c28 + abe060f commit a8f1fe8

File tree

77 files changed

+2111
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2111
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
.dart_tool/
3+
4+
.packages
5+
.pub/
6+
7+
build/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 2e540931f73593e35627592ca4f9a4ca3035ed31
8+
channel: stable
9+
10+
project_type: plugin
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## 0.0.1+3
2+
3+
* Update AGP, gradle and inappmessaging-display versions on Android.
4+
5+
## 0.0.1+2
6+
7+
* Remove dependency `androidx.annotation:annotation:1.0.0`.
8+
9+
## 0.0.1+1
10+
11+
* Update google-services Android gradle plugin to 4.3.0 in documentation and examples.
12+
13+
## 0.0.1
14+
15+
* Initial release.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright 2018, the Chromium project authors. All rights reserved.
2+
Redistribution and use in source and binary forms, with or without
3+
modification, are permitted provided that the following conditions are
4+
met:
5+
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above
9+
copyright notice, this list of conditions and the following
10+
disclaimer in the documentation and/or other materials provided
11+
with the distribution.
12+
* Neither the name of Google Inc. nor the names of its
13+
contributors may be used to endorse or promote products derived
14+
from this software without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# firebase_in_app_messaging plugin
2+
3+
A Flutter plugin to use the [Firebase In-App Messaging API](https://firebase.google.com/products/in-app-messaging).
4+
5+
*Note*: This plugin is still under development, and some APIs might not be available yet. [Feedback](https://github.com/FirebaseExtended/flutterfire/issues) and [Pull Requests](https://github.com/FirebaseExtended/flutterfire/pulls) are most welcome!
6+
7+
## Usage
8+
9+
### Import the firebase_in_app_messaging plugin
10+
To use the firebase_in_app_messaging plugin, follow the [plugin installation instructions](https://pub.dartlang.org/packages/firebase_in_app_messaging#pub-pkg-tab-installing).
11+
12+
### Android integration
13+
14+
There are a few extra steps required for the Android integration. Enable the Google services by configuring the Gradle scripts as such.
15+
16+
1. Add the classpath to the `[project]/android/build.gradle` file.
17+
```gradle
18+
dependencies {
19+
// Example existing classpath
20+
classpath 'com.android.tools.build:gradle:3.3.0'
21+
// Add the google services classpath
22+
classpath 'com.google.gms:google-services:4.3.0'
23+
}
24+
```
25+
26+
2. Add the apply plugin to the `[project]/android/app/build.gradle` file.
27+
```gradle
28+
// ADD THIS AT THE BOTTOM
29+
apply plugin: 'com.google.gms.google-services'
30+
```
31+
32+
*Note:* If this section is not completed you will get an error like this:
33+
```
34+
java.lang.IllegalStateException:
35+
Default FirebaseApp is not initialized in this process [package name].
36+
Make sure to call FirebaseApp.initializeApp(Context) first.
37+
```
38+
39+
*Note:* When you are debugging on Android, use a device or AVD with Google Play services.
40+
Otherwise you will not be able to use Firebase In-App Messaging.
41+
42+
### Use the plugin
43+
44+
To show In-App Messages in your app, no extra setup is required - just import the plugin and you
45+
are good to go. However, to modify message behavior (as documented [here](https://firebase.google.com/docs/in-app-messaging/modify-message-behavior)), the plugin provides the following methods -
46+
47+
First off, add the following imports to your Dart code:
48+
```dart
49+
import 'package:firebase_in_app_messaging/firebase_in_app_messaging.dart';
50+
```
51+
52+
#### Programmatic Triggers ([docs](https://firebase.google.com/docs/in-app-messaging/modify-message-behavior?platform=android#trigger_in-app_messages_programmatically))
53+
54+
To trigger in-app messages programmatically
55+
56+
```dart
57+
FirebaseInAppMessaging.triggerEvent('eventName');
58+
```
59+
60+
#### Temporarily disable in-app messages ([docs](https://firebase.google.com/docs/in-app-messaging/modify-message-behavior?platform=android#temporarily_disable_in-app_messages))
61+
62+
If you'd like to suppress message displays for any reason, for example to avoid interrupting a sequence of payment processing screens, you can do that the following
63+
64+
```dart
65+
FirebaseInAppMessaging.setMessagesSuppressed(true);
66+
67+
68+
// To re-enable
69+
FirebaseInAppMessaging.setMessagesSuppressed(false);
70+
```
71+
72+
#### Enable opt-out message delivery ([docs](https://firebase.google.com/docs/in-app-messaging/modify-message-behavior?platform=android#enable_opt-out_message_delivery))
73+
74+
First, follow the step outlined [here](https://firebase.google.com/docs/in-app-messaging/modify-message-behavior#enable_opt-out_message_delivery) for both iOS and Android. Then add the following code in your app:
75+
76+
```dart
77+
FirebaseInAppMessaging.setAutomaticDataCollectionEnabled(false);
78+
```
79+
80+
## Example
81+
82+
See the [example application](https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_in_app_messaging/example) source
83+
for a complete sample app using the Firebase In-App Messaging.
84+
85+
## Issues and feedback
86+
87+
Please file [issues](https://github.com/flutter/flutter/issues/new)
88+
to send feedback or report a bug. Thank you!
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
group 'com.example.firebase_in_app_messaging'
2+
version '1.0-SNAPSHOT'
3+
4+
buildscript {
5+
repositories {
6+
google()
7+
jcenter()
8+
}
9+
10+
dependencies {
11+
classpath 'com.android.tools.build:gradle:3.4.2'
12+
}
13+
}
14+
15+
rootProject.allprojects {
16+
repositories {
17+
google()
18+
jcenter()
19+
}
20+
}
21+
22+
apply plugin: 'com.android.library'
23+
24+
android {
25+
compileSdkVersion 28
26+
27+
defaultConfig {
28+
minSdkVersion 16
29+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
30+
}
31+
lintOptions {
32+
disable 'InvalidPackage'
33+
}
34+
dependencies {
35+
api 'com.google.firebase:firebase-inappmessaging-display:18.0.2'
36+
}
37+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.gradle.jvmargs=-Xmx1536M
2+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'firebase_in_app_messaging'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.example.firebase_in_app_messaging">
3+
</manifest>

0 commit comments

Comments
 (0)