diff --git a/packages/firebase_in_app_messaging/CHANGELOG.md b/packages/firebase_in_app_messaging/CHANGELOG.md new file mode 100644 index 000000000000..29f648fd17f1 --- /dev/null +++ b/packages/firebase_in_app_messaging/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* Initial release diff --git a/packages/firebase_in_app_messaging/LICENSE b/packages/firebase_in_app_messaging/LICENSE new file mode 100644 index 000000000000..03118dc2b39b --- /dev/null +++ b/packages/firebase_in_app_messaging/LICENSE @@ -0,0 +1,27 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/packages/firebase_in_app_messaging/README.md b/packages/firebase_in_app_messaging/README.md new file mode 100644 index 000000000000..ca8f46b1a42c --- /dev/null +++ b/packages/firebase_in_app_messaging/README.md @@ -0,0 +1,15 @@ +# Firebase In-App Messaging + +[![pub package](https://img.shields.io/pub/v/firebase_app_messaging.svg)](https://pub.dartlang.org/packages/firebase_app_messaging) + +A Flutter plugin to use the [Firebase App Messaging API](https://firebase.google.com/products/in-app-messaging/). + +*Note*: This plugin is still under development, and some APIs might not be available yet. [Feedback](https://github.com/flutter/flutter/issues) and [Pull Requests](https://github.com/flutter/plugins/pulls) are most welcome! + +## Usage + +To use this plugin, add `firebase_app_messaging` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). You must also configure firebase dynamic links for each platform project: Android and iOS (see the example folder or https://codelabs.developers.google.com/codelabs/flutter-firebase/#4 for step by step details). + +## Getting Started + +See the `example` directory for a complete sample app using Firebase App Messaging. \ No newline at end of file diff --git a/packages/firebase_in_app_messaging/android/build.gradle b/packages/firebase_in_app_messaging/android/build.gradle new file mode 100644 index 000000000000..0a16652ef398 --- /dev/null +++ b/packages/firebase_in_app_messaging/android/build.gradle @@ -0,0 +1,37 @@ +group 'io.flutter.plugins.firebaseappmessaging' +version '1.0-SNAPSHOT' + +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.2.1' + } +} + +rootProject.allprojects { + repositories { + google() + jcenter() + } +} + +apply plugin: 'com.android.library' + +android { + compileSdkVersion 27 + + defaultConfig { + minSdkVersion 16 + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + lintOptions { + disable 'InvalidPackage' + } + dependencies { + api 'com.google.firebase:firebase-app-messaging:16.1.2' + } +} diff --git a/packages/firebase_in_app_messaging/android/gradle.properties b/packages/firebase_in_app_messaging/android/gradle.properties new file mode 100644 index 000000000000..8bd86f680510 --- /dev/null +++ b/packages/firebase_in_app_messaging/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/packages/firebase_in_app_messaging/android/settings.gradle b/packages/firebase_in_app_messaging/android/settings.gradle new file mode 100644 index 000000000000..5acadf0260d0 --- /dev/null +++ b/packages/firebase_in_app_messaging/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'firebase_app_messaging' diff --git a/packages/firebase_in_app_messaging/android/src/main/AndroidManifest.xml b/packages/firebase_in_app_messaging/android/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..72bbc756d08d --- /dev/null +++ b/packages/firebase_in_app_messaging/android/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + diff --git a/packages/firebase_in_app_messaging/android/src/main/java/io/flutter/plugins/firebaseappmessaging/FirebaseAppMessagingPlugin.java b/packages/firebase_in_app_messaging/android/src/main/java/io/flutter/plugins/firebaseappmessaging/FirebaseAppMessagingPlugin.java new file mode 100644 index 000000000000..fce0888aa657 --- /dev/null +++ b/packages/firebase_in_app_messaging/android/src/main/java/io/flutter/plugins/firebaseappmessaging/FirebaseAppMessagingPlugin.java @@ -0,0 +1,266 @@ +package io.flutter.plugins.firebasedynamiclinks; + +import android.net.Uri; +import android.support.annotation.NonNull; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.dynamiclinks.DynamicLink; +import com.google.firebase.dynamiclinks.FirebaseDynamicLinks; +import com.google.firebase.dynamiclinks.PendingDynamicLinkData; +import com.google.firebase.dynamiclinks.ShortDynamicLink; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.MethodChannel.MethodCallHandler; +import io.flutter.plugin.common.MethodChannel.Result; +import io.flutter.plugin.common.PluginRegistry.Registrar; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** FirebaseDynamicLinksPlugin */ +public class FirebaseDynamicLinksPlugin implements MethodCallHandler { + private Registrar registrar; + + private FirebaseDynamicLinksPlugin(Registrar registrar) { + this.registrar = registrar; + } + + public static void registerWith(Registrar registrar) { + final MethodChannel channel = + new MethodChannel(registrar.messenger(), "plugins.flutter.io/firebase_dynamic_links"); + channel.setMethodCallHandler(new FirebaseDynamicLinksPlugin(registrar)); + } + + @Override + public void onMethodCall(MethodCall call, Result result) { + switch (call.method) { + case "DynamicLinkParameters#buildUrl": + DynamicLink.Builder urlBuilder = setupParameters(call); + result.success(urlBuilder.buildDynamicLink().getUri().toString()); + break; + case "DynamicLinkParameters#buildShortLink": + DynamicLink.Builder shortLinkBuilder = setupParameters(call); + buildShortDynamicLink(shortLinkBuilder, call, createShortLinkListener(result)); + break; + case "DynamicLinkParameters#shortenUrl": + DynamicLink.Builder builder = FirebaseDynamicLinks.getInstance().createDynamicLink(); + + Uri url = Uri.parse((String) call.argument("url")); + builder.setLongLink(url); + buildShortDynamicLink(builder, call, createShortLinkListener(result)); + break; + case "FirebaseDynamicLinks#retrieveDynamicLink": + handleRetrieveDynamicLink(result); + break; + default: + result.notImplemented(); + break; + } + } + + private void handleRetrieveDynamicLink(final Result result) { + FirebaseDynamicLinks.getInstance() + .getDynamicLink(registrar.activity().getIntent()) + .addOnCompleteListener( + registrar.activity(), + new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + if (task.isSuccessful()) { + PendingDynamicLinkData data = task.getResult(); + if (data != null) { + Map dynamicLink = new HashMap<>(); + dynamicLink.put("link", data.getLink().toString()); + + Map androidData = new HashMap<>(); + androidData.put("clickTimestamp", data.getClickTimestamp()); + androidData.put("minimumVersion", data.getMinimumAppVersion()); + + dynamicLink.put("android", androidData); + result.success(dynamicLink); + return; + } + } + result.success(null); + } + }); + } + + private OnCompleteListener createShortLinkListener(final Result result) { + return new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + if (task.isSuccessful()) { + Map url = new HashMap<>(); + url.put("url", task.getResult().getShortLink().toString()); + + List warnings = new ArrayList<>(); + for (ShortDynamicLink.Warning warning : task.getResult().getWarnings()) { + warnings.add(warning.getMessage()); + } + url.put("warnings", warnings); + + result.success(url); + } else { + Exception exception = task.getException(); + String errMsg = "Unable to create short link"; + if (exception != null && exception.getLocalizedMessage() != null) { + errMsg = exception.getLocalizedMessage(); + } + result.error("short_link_error", errMsg, null); + } + } + }; + } + + private void buildShortDynamicLink( + DynamicLink.Builder builder, MethodCall call, OnCompleteListener listener) { + Integer suffix = null; + + Map dynamicLinkParametersOptions = + call.argument("dynamicLinkParametersOptions"); + if (dynamicLinkParametersOptions != null) { + Integer shortDynamicLinkPathLength = + (Integer) dynamicLinkParametersOptions.get("shortDynamicLinkPathLength"); + if (shortDynamicLinkPathLength != null) { + switch (shortDynamicLinkPathLength) { + case 0: + suffix = ShortDynamicLink.Suffix.UNGUESSABLE; + break; + case 1: + suffix = ShortDynamicLink.Suffix.SHORT; + break; + default: + break; + } + } + } + + if (suffix != null) { + builder.buildShortDynamicLink(suffix).addOnCompleteListener(listener); + } else { + builder.buildShortDynamicLink().addOnCompleteListener(listener); + } + } + + private DynamicLink.Builder setupParameters(MethodCall call) { + DynamicLink.Builder dynamicLinkBuilder = FirebaseDynamicLinks.getInstance().createDynamicLink(); + + String domain = call.argument("domain"); + String link = call.argument("link"); + + dynamicLinkBuilder.setDynamicLinkDomain(domain); + dynamicLinkBuilder.setLink(Uri.parse(link)); + + Map androidParameters = call.argument("androidParameters"); + if (androidParameters != null) { + String packageName = valueFor("packageName", androidParameters); + String fallbackUrl = valueFor("fallbackUrl", androidParameters); + Integer minimumVersion = valueFor("minimumVersion", androidParameters); + + DynamicLink.AndroidParameters.Builder builder = + new DynamicLink.AndroidParameters.Builder(packageName); + + if (fallbackUrl != null) builder.setFallbackUrl(Uri.parse(fallbackUrl)); + if (minimumVersion != null) builder.setMinimumVersion(minimumVersion); + + dynamicLinkBuilder.setAndroidParameters(builder.build()); + } + + Map googleAnalyticsParameters = call.argument("googleAnalyticsParameters"); + if (googleAnalyticsParameters != null) { + String campaign = valueFor("campaign", googleAnalyticsParameters); + String content = valueFor("content", googleAnalyticsParameters); + String medium = valueFor("medium", googleAnalyticsParameters); + String source = valueFor("source", googleAnalyticsParameters); + String term = valueFor("term", googleAnalyticsParameters); + + DynamicLink.GoogleAnalyticsParameters.Builder builder = + new DynamicLink.GoogleAnalyticsParameters.Builder(); + + if (campaign != null) builder.setCampaign(campaign); + if (content != null) builder.setContent(content); + if (medium != null) builder.setMedium(medium); + if (source != null) builder.setSource(source); + if (term != null) builder.setTerm(term); + + dynamicLinkBuilder.setGoogleAnalyticsParameters(builder.build()); + } + + Map iosParameters = call.argument("iosParameters"); + if (iosParameters != null) { + String bundleId = valueFor("bundleId", iosParameters); + String appStoreId = valueFor("appStoreId", iosParameters); + String customScheme = valueFor("customScheme", iosParameters); + String fallbackUrl = valueFor("fallbackUrl", iosParameters); + String ipadBundleId = valueFor("ipadBundleId", iosParameters); + String ipadFallbackUrl = valueFor("ipadFallbackUrl", iosParameters); + String minimumVersion = valueFor("minimumVersion", iosParameters); + + DynamicLink.IosParameters.Builder builder = new DynamicLink.IosParameters.Builder(bundleId); + + if (appStoreId != null) builder.setAppStoreId(appStoreId); + if (customScheme != null) builder.setCustomScheme(customScheme); + if (fallbackUrl != null) builder.setFallbackUrl(Uri.parse(fallbackUrl)); + if (ipadBundleId != null) builder.setIpadBundleId(ipadBundleId); + if (ipadFallbackUrl != null) builder.setIpadFallbackUrl(Uri.parse(ipadFallbackUrl)); + if (minimumVersion != null) builder.setMinimumVersion(minimumVersion); + + dynamicLinkBuilder.setIosParameters(builder.build()); + } + + Map itunesConnectAnalyticsParameters = + call.argument("itunesConnectAnalyticsParameters"); + if (itunesConnectAnalyticsParameters != null) { + String affiliateToken = valueFor("affiliateToken", itunesConnectAnalyticsParameters); + String campaignToken = valueFor("campaignToken", itunesConnectAnalyticsParameters); + String providerToken = valueFor("providerToken", itunesConnectAnalyticsParameters); + + DynamicLink.ItunesConnectAnalyticsParameters.Builder builder = + new DynamicLink.ItunesConnectAnalyticsParameters.Builder(); + + if (affiliateToken != null) builder.setAffiliateToken(affiliateToken); + if (campaignToken != null) builder.setCampaignToken(campaignToken); + if (providerToken != null) builder.setProviderToken(providerToken); + + dynamicLinkBuilder.setItunesConnectAnalyticsParameters(builder.build()); + } + + Map navigationInfoParameters = call.argument("navigationInfoParameters"); + if (navigationInfoParameters != null) { + Boolean forcedRedirectEnabled = valueFor("forcedRedirectEnabled", navigationInfoParameters); + + DynamicLink.NavigationInfoParameters.Builder builder = + new DynamicLink.NavigationInfoParameters.Builder(); + + if (forcedRedirectEnabled != null) builder.setForcedRedirectEnabled(forcedRedirectEnabled); + + dynamicLinkBuilder.setNavigationInfoParameters(builder.build()); + } + + Map socialMetaTagParameters = call.argument("socialMetaTagParameters"); + if (socialMetaTagParameters != null) { + String description = valueFor("description", socialMetaTagParameters); + String imageUrl = valueFor("imageUrl", socialMetaTagParameters); + String title = valueFor("title", socialMetaTagParameters); + + DynamicLink.SocialMetaTagParameters.Builder builder = + new DynamicLink.SocialMetaTagParameters.Builder(); + + if (description != null) builder.setDescription(description); + if (imageUrl != null) builder.setImageUrl(Uri.parse(imageUrl)); + if (title != null) builder.setTitle(title); + + dynamicLinkBuilder.setSocialMetaTagParameters(builder.build()); + } + + return dynamicLinkBuilder; + } + + private static T valueFor(String key, Map map) { + @SuppressWarnings("unchecked") + T result = (T) map.get(key); + return result; + } +} diff --git a/packages/firebase_in_app_messaging/example/.metadata b/packages/firebase_in_app_messaging/example/.metadata new file mode 100644 index 000000000000..866a061a7a7f --- /dev/null +++ b/packages/firebase_in_app_messaging/example/.metadata @@ -0,0 +1,8 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: f408bb06f9361793ca85493c38d809ee1e2f7e30 + channel: master diff --git a/packages/firebase_in_app_messaging/example/README.md b/packages/firebase_in_app_messaging/example/README.md new file mode 100644 index 000000000000..e098704eddc5 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/README.md @@ -0,0 +1,12 @@ +# firebase_dynamic_links_example + +Demonstrates how to use the firebase_dynamic_links plugin. + +## *Important* + +The example app for this plugin only receives links on Android. Xcode has signing requirements that must be configured with an iOS app developer team id. Check the `firebase_dynamic_links/README.md` for more details. + +## Getting Started + +For help getting started with Flutter, view our online +[documentation](https://flutter.io/). diff --git a/packages/firebase_in_app_messaging/example/android/app/build.gradle b/packages/firebase_in_app_messaging/example/android/app/build.gradle new file mode 100644 index 000000000000..aac18d2ba06b --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/app/build.gradle @@ -0,0 +1,44 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 27 + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + applicationId "io.flutter.plugins.firebasedynamiclinksexample" + minSdkVersion 16 + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { +} + +apply plugin: 'com.google.gms.google-services' diff --git a/packages/firebase_in_app_messaging/example/android/app/google-services.json b/packages/firebase_in_app_messaging/example/android/app/google-services.json new file mode 100644 index 000000000000..7123ea9b2ebd --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/app/google-services.json @@ -0,0 +1,113 @@ +{ + "project_info": { + "project_number": "479882132969", + "firebase_url": "https://my-flutter-proj.firebaseio.com", + "project_id": "my-flutter-proj", + "storage_bucket": "my-flutter-proj.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:479882132969:android:632cdf3fc0a17139", + "android_client_info": { + "package_name": "io.flutter.plugins.firebasedynamiclinksexample" + } + }, + "oauth_client": [ + { + "client_id": "479882132969-32qusitiag53931ck80h121ajhlc5a7e.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebasedynamiclinksexample", + "certificate_hash": "e733b7a303250b63e06de6f7c9767c517d69cfa0" + } + }, + { + "client_id": "479882132969-0d20fkjtr1p8evfomfkf3vmi50uajml2.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCrZz9T0Pg0rDnpxfNuPBrOxGhXskfebXs" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "479882132969-pkn7lcq09ln9vfk4k52r634vh805dk3g.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "cvbxvzv" + } + }, + { + "client_id": "479882132969-0d20fkjtr1p8evfomfkf3vmi50uajml2.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:479882132969:android:215a22700e1b466b", + "android_client_info": { + "package_name": "io.flutter.plugins.firebaseperformanceexample" + } + }, + "oauth_client": [ + { + "client_id": "479882132969-8h4kiv8m7ho4tvn6uuujsfcrf69unuf7.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebaseperformanceexample", + "certificate_hash": "e733b7a303250b63e06de6f7c9767c517d69cfa0" + } + }, + { + "client_id": "479882132969-0d20fkjtr1p8evfomfkf3vmi50uajml2.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCrZz9T0Pg0rDnpxfNuPBrOxGhXskfebXs" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "479882132969-pkn7lcq09ln9vfk4k52r634vh805dk3g.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "cvbxvzv" + } + }, + { + "client_id": "479882132969-0d20fkjtr1p8evfomfkf3vmi50uajml2.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/packages/firebase_in_app_messaging/example/android/app/src/main/AndroidManifest.xml b/packages/firebase_in_app_messaging/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..ed3cca73d5d3 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + diff --git a/packages/firebase_in_app_messaging/example/android/app/src/main/java/io/flutter/plugins/firebasedynamiclinksexample/MainActivity.java b/packages/firebase_in_app_messaging/example/android/app/src/main/java/io/flutter/plugins/firebasedynamiclinksexample/MainActivity.java new file mode 100644 index 000000000000..885f28ec4efc --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/app/src/main/java/io/flutter/plugins/firebasedynamiclinksexample/MainActivity.java @@ -0,0 +1,13 @@ +package io.flutter.plugins.firebasedynamiclinksexample; + +import android.os.Bundle; +import io.flutter.app.FlutterActivity; +import io.flutter.plugins.GeneratedPluginRegistrant; + +public class MainActivity extends FlutterActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + GeneratedPluginRegistrant.registerWith(this); + } +} diff --git a/packages/firebase_in_app_messaging/example/android/app/src/main/res/drawable/launch_background.xml b/packages/firebase_in_app_messaging/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 000000000000..304732f88420 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000000..db77bb4b7b09 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000000..17987b79bb8a Binary files /dev/null and b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000000..09d4391482be Binary files /dev/null and b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000000..d5f1c8d34e7a Binary files /dev/null and b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000000..4d6372eebdb2 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/packages/firebase_in_app_messaging/example/android/app/src/main/res/values/styles.xml b/packages/firebase_in_app_messaging/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 000000000000..00fa4417cfbe --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + diff --git a/packages/firebase_in_app_messaging/example/android/build.gradle b/packages/firebase_in_app_messaging/example/android/build.gradle new file mode 100644 index 000000000000..02952e08c58c --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.google.gms:google-services:4.2.0' + } +} + +allprojects { + repositories { + google() + jcenter() + mavenLocal() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/packages/firebase_in_app_messaging/example/android/gradle.properties b/packages/firebase_in_app_messaging/example/android/gradle.properties new file mode 100644 index 000000000000..8bd86f680510 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/packages/firebase_in_app_messaging/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/firebase_in_app_messaging/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..019065d1d650 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/packages/firebase_in_app_messaging/example/android/settings.gradle b/packages/firebase_in_app_messaging/example/android/settings.gradle new file mode 100644 index 000000000000..5a2f14fb18f6 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/android/settings.gradle @@ -0,0 +1,15 @@ +include ':app' + +def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + +def plugins = new Properties() +def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') +if (pluginsFile.exists()) { + pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } +} + +plugins.each { name, path -> + def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() + include ":$name" + project(":$name").projectDir = pluginDirectory +} diff --git a/packages/firebase_in_app_messaging/example/ios/Flutter/AppFrameworkInfo.plist b/packages/firebase_in_app_messaging/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 000000000000..6c2de8086bcd --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + UIRequiredDeviceCapabilities + + arm64 + + MinimumOSVersion + 8.0 + + diff --git a/packages/firebase_in_app_messaging/example/ios/Flutter/Debug.xcconfig b/packages/firebase_in_app_messaging/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 000000000000..e8efba114687 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/firebase_in_app_messaging/example/ios/Flutter/Release.xcconfig b/packages/firebase_in_app_messaging/example/ios/Flutter/Release.xcconfig new file mode 100644 index 000000000000..399e9340e6f6 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/firebase_in_app_messaging/example/ios/Runner.xcodeproj/project.pbxproj b/packages/firebase_in_app_messaging/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000000..ce7d3163f7ac --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,519 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 8FE60D1920C0959F00E3A541 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8FE60D1820C0959F00E3A541 /* GoogleService-Info.plist */; }; + 8FF283695FD42FAFAA6F2588 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BEA489D8A0A4C9E6F14F37D /* libPods-Runner.a */; }; + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; + 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 3BEA489D8A0A4C9E6F14F37D /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 8FE60D1820C0959F00E3A541 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + 8FE60D1A20C0962300E3A541 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + 8FF283695FD42FAFAA6F2588 /* libPods-Runner.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, + 3B80C3931E831B6300D905FE /* App.framework */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEBA1CF902C7004384FC /* Flutter.framework */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + C265487490C4649DB6EB38D8 /* Pods */, + FB89BCA43D68B61E6BC59A86 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 8FE60D1A20C0962300E3A541 /* Runner.entitlements */, + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, + 8FE60D1820C0959F00E3A541 /* GoogleService-Info.plist */, + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + ); + path = Runner; + sourceTree = ""; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 97C146F21CF9000F007C117D /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + C265487490C4649DB6EB38D8 /* Pods */ = { + isa = PBXGroup; + children = ( + ); + name = Pods; + sourceTree = ""; + }; + FB89BCA43D68B61E6BC59A86 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3BEA489D8A0A4C9E6F14F37D /* libPods-Runner.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + DFB8FA600F7B599A94289A9E /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 852BEAA0EB8653502C27C0BD /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0910; + ORGANIZATIONNAME = "The Chromium Authors"; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.SafariKeychain = { + enabled = 0; + }; + }; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 8FE60D1920C0959F00E3A541 /* GoogleService-Info.plist in Resources */, + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + }; + 852BEAA0EB8653502C27C0BD /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", + "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + DFB8FA600F7B599A94289A9E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, + 97C146F31CF9000F007C117D /* main.m in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = ""; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.google.FirebaseCppDynamicLinksTestApp.dev; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + PROVISIONING_PROFILE_SPECIFIER = ""; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = ""; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.google.FirebaseCppDynamicLinksTestApp.dev; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + PROVISIONING_PROFILE_SPECIFIER = ""; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/packages/firebase_in_app_messaging/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/firebase_in_app_messaging/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000000..1d526a16ed0f --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/firebase_in_app_messaging/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/firebase_in_app_messaging/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000000..1263ac84b105 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/firebase_in_app_messaging/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/firebase_in_app_messaging/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000000..21a3cc14c74e --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/packages/firebase_in_app_messaging/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/firebase_in_app_messaging/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000000..18d981003d68 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/firebase_in_app_messaging/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/firebase_in_app_messaging/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000000..949b67898200 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Original + + diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/AppDelegate.h b/packages/firebase_in_app_messaging/example/ios/Runner/AppDelegate.h new file mode 100644 index 000000000000..36e21bbf9cf4 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/AppDelegate.h @@ -0,0 +1,6 @@ +#import +#import + +@interface AppDelegate : FlutterAppDelegate + +@end diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/AppDelegate.m b/packages/firebase_in_app_messaging/example/ios/Runner/AppDelegate.m new file mode 100644 index 000000000000..59a72e90be12 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/AppDelegate.m @@ -0,0 +1,13 @@ +#include "AppDelegate.h" +#include "GeneratedPluginRegistrant.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [GeneratedPluginRegistrant registerWithRegistry:self]; + // Override point for customization after application launch. + return [super application:application didFinishLaunchingWithOptions:launchOptions]; +} + +@end diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000000..d36b1fab2d9d --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000000..3d43d11e66f4 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 000000000000..28c6bf03016f Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 000000000000..2ccbfd967d96 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 000000000000..f091b6b0bca8 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 000000000000..4cde12118dda Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 000000000000..d0ef06e7edb8 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 000000000000..dcdc2306c285 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 000000000000..2ccbfd967d96 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 000000000000..c8f9ed8f5cee Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 000000000000..a6d6b8609df0 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 000000000000..a6d6b8609df0 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 000000000000..75b2d164a5a9 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 000000000000..c4df70d39da7 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 000000000000..6a84f41e14e2 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 000000000000..d0e1f5853602 Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000000..0bedcf2fd467 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000000..9da19eacad3b Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000000..9da19eacad3b Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000000..9da19eacad3b Binary files /dev/null and b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000000..89c2725b70f1 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/firebase_in_app_messaging/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000000..f2e259c7c939 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Base.lproj/Main.storyboard b/packages/firebase_in_app_messaging/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 000000000000..f3c28516fb38 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/GoogleService-Info.plist b/packages/firebase_in_app_messaging/example/ios/Runner/GoogleService-Info.plist new file mode 100644 index 000000000000..ac0d4c98b0d0 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,42 @@ + + + + + AD_UNIT_ID_FOR_BANNER_TEST + ca-app-pub-3940256099942544/2934735716 + AD_UNIT_ID_FOR_INTERSTITIAL_TEST + ca-app-pub-3940256099942544/4411468910 + CLIENT_ID + 479882132969-pn2ancg65o0e7r5ikte1qiciuvdghqf9.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.479882132969-pn2ancg65o0e7r5ikte1qiciuvdghqf9 + ANDROID_CLIENT_ID + 479882132969-32qusitiag53931ck80h121ajhlc5a7e.apps.googleusercontent.com + API_KEY + AIzaSyBECOwLTAN6PU4Aet1b2QLGIb3kRK8Xjew + GCM_SENDER_ID + 479882132969 + PLIST_VERSION + 1 + BUNDLE_ID + com.google.FirebaseCppDynamicLinksTestApp.dev + PROJECT_ID + my-flutter-proj + STORAGE_BUCKET + my-flutter-proj.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:479882132969:ios:36e157824ba4dd3d + DATABASE_URL + https://my-flutter-proj.firebaseio.com + + \ No newline at end of file diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Info.plist b/packages/firebase_in_app_messaging/example/ios/Runner/Info.plist new file mode 100644 index 000000000000..f24bc9d4f80d --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/Info.plist @@ -0,0 +1,62 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + firebase_dynamic_links_example + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + Bundle ID + CFBundleURLSchemes + + com.google.FirebaseCppDynamicLinksTestApp.dev + + + + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/Runner.entitlements b/packages/firebase_in_app_messaging/example/ios/Runner/Runner.entitlements new file mode 100644 index 000000000000..0c67376ebacb --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/Runner.entitlements @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/firebase_in_app_messaging/example/ios/Runner/main.m b/packages/firebase_in_app_messaging/example/ios/Runner/main.m new file mode 100644 index 000000000000..dff6597e4513 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/ios/Runner/main.m @@ -0,0 +1,9 @@ +#import +#import +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/packages/firebase_in_app_messaging/example/lib/main.dart b/packages/firebase_in_app_messaging/example/lib/main.dart new file mode 100644 index 000000000000..cabe2fc104c6 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/lib/main.dart @@ -0,0 +1,48 @@ +// Copyright 2018, the Flutter project authors. Please see the AUTHORS file +// 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. + +import 'package:flutter/material.dart'; +import 'package:firebase_in_app_messaging/firebase_in_app_messaging.dart'; + +void main() { + runApp(MaterialApp( + title: 'App Messaging Example', + home: _MainScreen(), + )); +} + +class _MainScreen extends StatefulWidget { + @override + State createState() => _MainScreenState(); +} + +class _MainScreenState extends State<_MainScreen> { + String _message = "Waiting for messages..."; + + @override + void initState() { + FirebaseInAppMessaging.instance.setMessagingDisplay( + (InAppMessagingDisplayMessage message, InAppMessagingDisplayDelegate delegate) { + setState(() { + _message = 'Message: $message'; + }); + }, + ); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Material( + child: Scaffold( + appBar: AppBar( + title: const Text('App Messaging Example'), + ), + body: Center( + child: Text(_message), + ), + ), + ); + } +} diff --git a/packages/firebase_in_app_messaging/example/pubspec.yaml b/packages/firebase_in_app_messaging/example/pubspec.yaml new file mode 100644 index 000000000000..5c876a2ff6e8 --- /dev/null +++ b/packages/firebase_in_app_messaging/example/pubspec.yaml @@ -0,0 +1,15 @@ +name: firebase_in_app_messaging_example +description: Demonstrates how to use the firebase_in_app_messaging plugin. + +dependencies: + flutter: + sdk: flutter + + firebase_in_app_messaging: + path: ../ + firebase_core: ^0.2.5+1 + + url_launcher: ^3.0.3 + +flutter: + uses-material-design: true diff --git a/packages/firebase_in_app_messaging/ios/Assets/.gitkeep b/packages/firebase_in_app_messaging/ios/Assets/.gitkeep new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/firebase_in_app_messaging/ios/Classes/FirebaseInAppMessagingPlugin.h b/packages/firebase_in_app_messaging/ios/Classes/FirebaseInAppMessagingPlugin.h new file mode 100644 index 000000000000..25f4c1d8b8ca --- /dev/null +++ b/packages/firebase_in_app_messaging/ios/Classes/FirebaseInAppMessagingPlugin.h @@ -0,0 +1,4 @@ +#import + +@interface FLTFirebaseDynamicLinksPlugin : NSObject +@end diff --git a/packages/firebase_in_app_messaging/ios/Classes/FirebaseInAppMessagingPlugin.m b/packages/firebase_in_app_messaging/ios/Classes/FirebaseInAppMessagingPlugin.m new file mode 100644 index 000000000000..d791d1719bfa --- /dev/null +++ b/packages/firebase_in_app_messaging/ios/Classes/FirebaseInAppMessagingPlugin.m @@ -0,0 +1,276 @@ +#import "FirebaseInAppMessagingPlugin.h" + +#import "Firebase/Firebase.h" + +@interface NSError (FlutterError) +@property(readonly, nonatomic) FlutterError *flutterError; +@end + +@implementation NSError (FlutterError) +- (FlutterError *)flutterError { + return [FlutterError errorWithCode:[NSString stringWithFormat:@"Error %d", (int)self.code] + message:self.domain + details:self.localizedDescription]; +} +@end + +@interface FLTFirebaseDynamicLinksPlugin () +@property(nonatomic, retain) FIRDynamicLink *dynamicLink; +@end + +@implementation FLTFirebaseDynamicLinksPlugin ++ (void)registerWithRegistrar:(NSObject *)registrar { + FlutterMethodChannel *channel = + [FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/firebase_dynamic_links" + binaryMessenger:[registrar messenger]]; + FLTFirebaseDynamicLinksPlugin *instance = [[FLTFirebaseDynamicLinksPlugin alloc] init]; + [registrar addMethodCallDelegate:instance channel:channel]; + [registrar addApplicationDelegate:instance]; +} + +- (instancetype)init { + self = [super init]; + if (self) { + if (![FIRApp defaultApp]) { + [FIRApp configure]; + } + } + return self; +} + +- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result { + if ([@"DynamicLinkParameters#buildUrl" isEqualToString:call.method]) { + FIRDynamicLinkComponents *components = [self setupParameters:call.arguments]; + result([components.url absoluteString]); + } else if ([@"DynamicLinkParameters#buildShortLink" isEqualToString:call.method]) { + FIRDynamicLinkComponents *components = [self setupParameters:call.arguments]; + [components shortenWithCompletion:[self createShortLinkCompletion:result]]; + } else if ([@"DynamicLinkParameters#shortenUrl" isEqualToString:call.method]) { + FIRDynamicLinkComponentsOptions *options = [self setupOptions:call.arguments]; + NSURL *url = [NSURL URLWithString:call.arguments[@"url"]]; + [FIRDynamicLinkComponents shortenURL:url + options:options + completion:[self createShortLinkCompletion:result]]; + } else if ([@"FirebaseDynamicLinks#retrieveDynamicLink" isEqualToString:call.method]) { + result([self retrieveDynamicLink]); + } else { + result(FlutterMethodNotImplemented); + } +} + +- (NSMutableDictionary *)retrieveDynamicLink { + if (_dynamicLink != nil) { + NSMutableDictionary *dynamicLink = [[NSMutableDictionary alloc] init]; + dynamicLink[@"link"] = _dynamicLink.url.absoluteString; + + NSMutableDictionary *iosData = [[NSMutableDictionary alloc] init]; + if (_dynamicLink.minimumAppVersion) { + iosData[@"minimumVersion"] = _dynamicLink.minimumAppVersion; + } + _dynamicLink = nil; + dynamicLink[@"ios"] = iosData; + return dynamicLink; + } else { + return nil; + } +} + +- (BOOL)application:(UIApplication *)application + openURL:(NSURL *)url + options:(NSDictionary *)options { + return [self checkForDynamicLink:url]; +} + +- (BOOL)application:(UIApplication *)application + openURL:(NSURL *)url + sourceApplication:(NSString *)sourceApplication + annotation:(id)annotation { + return [self checkForDynamicLink:url]; +} + +- (BOOL)checkForDynamicLink:(NSURL *)url { + FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url]; + if (dynamicLink) { + if (dynamicLink.url) _dynamicLink = dynamicLink; + return YES; + } + return NO; +} + +- (BOOL)application:(UIApplication *)application + continueUserActivity:(NSUserActivity *)userActivity + restorationHandler:(void (^)(NSArray *))restorationHandler { + BOOL handled = [[FIRDynamicLinks dynamicLinks] + handleUniversalLink:userActivity.webpageURL + completion:^(FIRDynamicLink *_Nullable dynamicLink, NSError *_Nullable error) { + self.dynamicLink = dynamicLink; + }]; + return handled; +} + +- (FIRDynamicLinkShortenerCompletion)createShortLinkCompletion:(FlutterResult)result { + return ^(NSURL *_Nullable shortURL, NSArray *_Nullable warnings, NSError *_Nullable error) { + if (error) { + result([error flutterError]); + } else { + result(@{@"url" : [shortURL absoluteString], @"warnings" : warnings}); + } + }; +} + +- (FIRDynamicLinkComponentsOptions *)setupOptions:(NSDictionary *)arguments { + FIRDynamicLinkComponentsOptions *options; + if (![arguments[@"dynamicLinkParametersOptions"] isEqual:[NSNull null]]) { + NSDictionary *params = arguments[@"dynamicLinkParametersOptions"]; + + options = [FIRDynamicLinkComponentsOptions options]; + + NSNumber *shortDynamicLinkPathLength = params[@"shortDynamicLinkPathLength"]; + if (![shortDynamicLinkPathLength isEqual:[NSNull null]]) { + switch (shortDynamicLinkPathLength.intValue) { + case 0: + options.pathLength = FIRShortDynamicLinkPathLengthUnguessable; + break; + case 1: + options.pathLength = FIRShortDynamicLinkPathLengthShort; + break; + default: + break; + } + } + } + + return options; +} + +- (FIRDynamicLinkComponents *)setupParameters:(NSDictionary *)arguments { + NSURL *link = [NSURL URLWithString:arguments[@"link"]]; + NSString *domain = arguments[@"domain"]; + + FIRDynamicLinkComponents *components = [FIRDynamicLinkComponents componentsWithLink:link + domain:domain]; + + if (![arguments[@"androidParameters"] isEqual:[NSNull null]]) { + NSDictionary *params = arguments[@"androidParameters"]; + + FIRDynamicLinkAndroidParameters *androidParams = + [FIRDynamicLinkAndroidParameters parametersWithPackageName:params[@"packageName"]]; + + NSString *fallbackUrl = params[@"fallbackUrl"]; + NSNumber *minimumVersion = params[@"minimumVersion"]; + + if (![fallbackUrl isEqual:[NSNull null]]) + androidParams.fallbackURL = [NSURL URLWithString:fallbackUrl]; + if (![minimumVersion isEqual:[NSNull null]]) + androidParams.minimumVersion = ((NSNumber *)minimumVersion).integerValue; + + components.androidParameters = androidParams; + } + + if (![arguments[@"dynamicLinkComponentsOptions"] isEqual:[NSNull null]]) { + components.options = [self setupOptions:arguments]; + } + + if (![arguments[@"googleAnalyticsParameters"] isEqual:[NSNull null]]) { + NSDictionary *params = arguments[@"googleAnalyticsParameters"]; + + FIRDynamicLinkGoogleAnalyticsParameters *googleAnalyticsParameters = + [FIRDynamicLinkGoogleAnalyticsParameters parameters]; + + NSString *campaign = params[@"campaign"]; + NSString *content = params[@"content"]; + NSString *medium = params[@"medium"]; + NSString *source = params[@"source"]; + NSString *term = params[@"term"]; + + if (![campaign isEqual:[NSNull null]]) googleAnalyticsParameters.campaign = campaign; + if (![content isEqual:[NSNull null]]) googleAnalyticsParameters.content = content; + if (![medium isEqual:[NSNull null]]) googleAnalyticsParameters.medium = medium; + if (![source isEqual:[NSNull null]]) googleAnalyticsParameters.source = source; + if (![term isEqual:[NSNull null]]) googleAnalyticsParameters.term = term; + + components.analyticsParameters = googleAnalyticsParameters; + } + + if (![arguments[@"iosParameters"] isEqual:[NSNull null]]) { + NSDictionary *params = arguments[@"iosParameters"]; + + FIRDynamicLinkIOSParameters *iosParameters = + [FIRDynamicLinkIOSParameters parametersWithBundleID:params[@"bundleId"]]; + + NSString *appStoreID = params[@"appStoreId"]; + NSString *customScheme = params[@"customScheme"]; + NSString *fallbackURL = params[@"fallbackUrl"]; + NSString *iPadBundleID = params[@"ipadBundleId"]; + NSString *iPadFallbackURL = params[@"ipadFallbackUrl"]; + NSString *minimumAppVersion = params[@"minimumVersion"]; + + if (![appStoreID isEqual:[NSNull null]]) iosParameters.appStoreID = appStoreID; + if (![customScheme isEqual:[NSNull null]]) iosParameters.customScheme = customScheme; + if (![fallbackURL isEqual:[NSNull null]]) + iosParameters.fallbackURL = [NSURL URLWithString:fallbackURL]; + if (![iPadBundleID isEqual:[NSNull null]]) iosParameters.iPadBundleID = iPadBundleID; + if (![iPadFallbackURL isEqual:[NSNull null]]) + iosParameters.iPadFallbackURL = [NSURL URLWithString:iPadFallbackURL]; + if (![minimumAppVersion isEqual:[NSNull null]]) + iosParameters.minimumAppVersion = minimumAppVersion; + + components.iOSParameters = iosParameters; + } + + if (![arguments[@"itunesConnectAnalyticsParameters"] isEqual:[NSNull null]]) { + NSDictionary *params = arguments[@"itunesConnectAnalyticsParameters"]; + + FIRDynamicLinkItunesConnectAnalyticsParameters *itunesConnectAnalyticsParameters = + [FIRDynamicLinkItunesConnectAnalyticsParameters parameters]; + + NSString *affiliateToken = params[@"affiliateToken"]; + NSString *campaignToken = params[@"campaignToken"]; + NSString *providerToken = params[@"providerToken"]; + + if (![affiliateToken isEqual:[NSNull null]]) + itunesConnectAnalyticsParameters.affiliateToken = affiliateToken; + if (![campaignToken isEqual:[NSNull null]]) + itunesConnectAnalyticsParameters.campaignToken = campaignToken; + if (![providerToken isEqual:[NSNull null]]) + itunesConnectAnalyticsParameters.providerToken = providerToken; + + components.iTunesConnectParameters = itunesConnectAnalyticsParameters; + } + + if (![arguments[@"navigationInfoParameters"] isEqual:[NSNull null]]) { + NSDictionary *params = arguments[@"navigationInfoParameters"]; + + FIRDynamicLinkNavigationInfoParameters *navigationInfoParameters = + [FIRDynamicLinkNavigationInfoParameters parameters]; + + NSNumber *forcedRedirectEnabled = params[@"forcedRedirectEnabled"]; + if (![forcedRedirectEnabled isEqual:[NSNull null]]) + navigationInfoParameters.forcedRedirectEnabled = [forcedRedirectEnabled boolValue]; + + components.navigationInfoParameters = navigationInfoParameters; + } + + if (![arguments[@"socialMetaTagParameters"] isEqual:[NSNull null]]) { + NSDictionary *params = arguments[@"socialMetaTagParameters"]; + + FIRDynamicLinkSocialMetaTagParameters *socialMetaTagParameters = + [FIRDynamicLinkSocialMetaTagParameters parameters]; + + NSString *descriptionText = params[@"description"]; + NSString *imageURL = params[@"imageUrl"]; + NSString *title = params[@"title"]; + + if (![descriptionText isEqual:[NSNull null]]) + socialMetaTagParameters.descriptionText = descriptionText; + if (![imageURL isEqual:[NSNull null]]) + socialMetaTagParameters.imageURL = [NSURL URLWithString:imageURL]; + if (![title isEqual:[NSNull null]]) socialMetaTagParameters.title = title; + + components.socialMetaTagParameters = socialMetaTagParameters; + } + + return components; +} + +@end diff --git a/packages/firebase_in_app_messaging/ios/firebase_in_app_messaging.podspec b/packages/firebase_in_app_messaging/ios/firebase_in_app_messaging.podspec new file mode 100644 index 000000000000..ffc4514f1dec --- /dev/null +++ b/packages/firebase_in_app_messaging/ios/firebase_in_app_messaging.podspec @@ -0,0 +1,21 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# +Pod::Spec.new do |s| + s.name = 'firebase_in_app_messaging' + s.version = '0.0.1' + s.summary = 'Firebase In-App Messaging plugin for Flutter.' + s.description = <<-DESC +Flutter plugin for Firebase In-App Messaging, which helps you engage users who are actively using your app by sending them targeted and contextual messages that nudge them to complete key in-app actions. + DESC + s.homepage = 'https://github.com/flutter/plugins/tree/master/packages/firebase_in_app_messaging' + s.license = { :file => '../LICENSE' } + s.author = { 'Flutter Team' => 'flutter-dev@googlegroups.com' } + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.public_header_files = 'Classes/**/*.h' + s.dependency 'Flutter' + s.dependency 'Firebase/InAppMessaging' + s.ios.deployment_target = '8.0' + s.static_framework = true +end diff --git a/packages/firebase_in_app_messaging/lib/firebase_in_app_messaging.dart b/packages/firebase_in_app_messaging/lib/firebase_in_app_messaging.dart new file mode 100644 index 000000000000..780fceb6edc0 --- /dev/null +++ b/packages/firebase_in_app_messaging/lib/firebase_in_app_messaging.dart @@ -0,0 +1,16 @@ +// Copyright 2019 The Chromium Authors. 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_in_app_messaging; + +import 'dart:async'; +import 'dart:ui'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; + +part 'src/firebase_in_app_messaging.dart'; +part 'src/in_app_messaging_display.dart'; +part 'src/in_app_messaging_display_delegate.dart'; +part 'src/in_app_messaging_display_message.dart'; diff --git a/packages/firebase_in_app_messaging/lib/src/firebase_in_app_messaging.dart b/packages/firebase_in_app_messaging/lib/src/firebase_in_app_messaging.dart new file mode 100644 index 000000000000..21e04f97f3a5 --- /dev/null +++ b/packages/firebase_in_app_messaging/lib/src/firebase_in_app_messaging.dart @@ -0,0 +1,43 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of firebase_in_app_messaging; + +/// Firebase In-App Messages API. +/// +/// You can get an instance by calling [FirebaseInAppMessaging.instance]. +class FirebaseInAppMessaging { + FirebaseInAppMessaging._(); + + @visibleForTesting + static const MethodChannel channel = + MethodChannel('plugins.flutter.io/firebase_in_app_messaging'); + + /// Singleton of [FirebaseInAppMessaging]. + static final FirebaseInAppMessaging instance = FirebaseInAppMessaging._(); + + Future setMessageDisplaySuppressed(bool suppressed) { + return channel.invokeMethod('FirebaseInAppMessaging#setMessageDisplaySuppressed', suppressed); + } + + Future setAutomaticDataCollectionEnabled(bool enabled) { + return channel.invokeMethod('FirebaseInAppMessaging#setAutomaticDataCollectionEnabled', enabled); + } + + Future setMessagingDisplay(InAppMessagingDisplay messageDisplay) async { + channel.setMethodCallHandler((MethodCall call) { + assert(call.method == 'FirebaseInAppMessaging#_displayMessage'); + String messageID = call.arguments['messageID']; + bool renderAsTestMessage = call.arguments['renderAsTestMessage']; + InAppMessagingDisplayMessage message = InAppMessagingDisplayMessage._( + messageID: messageID, + renderAsTestMessage: renderAsTestMessage, + ); + InAppMessagingDisplayDelegate delegate = InAppMessagingDisplayDelegate(); + if (messageDisplay != null) + messageDisplay(message, delegate); + }); + return channel.invokeMethod('FirebaseInAppMessaging#useFlutterMessageDisplayComponent', messageDisplay != null); + } +} diff --git a/packages/firebase_in_app_messaging/lib/src/in_app_messaging_display.dart b/packages/firebase_in_app_messaging/lib/src/in_app_messaging_display.dart new file mode 100644 index 000000000000..f05901c5f151 --- /dev/null +++ b/packages/firebase_in_app_messaging/lib/src/in_app_messaging_display.dart @@ -0,0 +1,7 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of firebase_in_app_messaging; + +typedef void InAppMessagingDisplay(InAppMessagingDisplayMessage message, InAppMessagingDisplayDelegate delegate); diff --git a/packages/firebase_in_app_messaging/lib/src/in_app_messaging_display_delegate.dart b/packages/firebase_in_app_messaging/lib/src/in_app_messaging_display_delegate.dart new file mode 100644 index 000000000000..09b57d14595f --- /dev/null +++ b/packages/firebase_in_app_messaging/lib/src/in_app_messaging_display_delegate.dart @@ -0,0 +1,34 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of firebase_in_app_messaging; + +enum InAppMessagingDismissType { + /// user swipes away the banner view + InAppMessagingDismissTypeUserSwipe, + + /// user clicks on close buttons + InAppMessagingDismissTypeUserTapClose, + + /// automatic dismiss from banner view + InAppMessagingDismissTypeAuto, + + /// message is dismissed, but not belonging to any + /// above dismiss category + InAppMessagingDismissUnspecified, +} + +class InAppMessagingDisplayDelegate { + // TODO(jackson): Implement + void messageDismissed(InAppMessagingDismissType type) {} + + // TODO(jackson): Implement + void messageClicked() {} + + // TODO(jackson): Implement + void impressionDetected() {} + + // TODO(jackson): Implement + void displayErrorEncountered(dynamic error) {} +} diff --git a/packages/firebase_in_app_messaging/lib/src/in_app_messaging_display_message.dart b/packages/firebase_in_app_messaging/lib/src/in_app_messaging_display_message.dart new file mode 100644 index 000000000000..e85ca29a53c6 --- /dev/null +++ b/packages/firebase_in_app_messaging/lib/src/in_app_messaging_display_message.dart @@ -0,0 +1,24 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of firebase_in_app_messaging; + +class InAppMessagingDisplayMessage { + InAppMessagingDisplayMessage._({ this.messageID, this.renderAsTestMessage }); + final String messageID; + final bool renderAsTestMessage; + + @override + String toString() => '$runtimeType[$messageID, $renderAsTestMessage]'; + + @override + bool operator ==(Object o) { + return o is InAppMessagingDisplayMessage && + messageID == o.messageID && + renderAsTestMessage == o.renderAsTestMessage; + } + + @override + int get hashCode => hashValues(messageID, renderAsTestMessage); +} \ No newline at end of file diff --git a/packages/firebase_in_app_messaging/pubspec.yaml b/packages/firebase_in_app_messaging/pubspec.yaml new file mode 100644 index 000000000000..5d7a30b18380 --- /dev/null +++ b/packages/firebase_in_app_messaging/pubspec.yaml @@ -0,0 +1,25 @@ +name: firebase_in_app_messaging +description: Flutter plugin for Firebase In-App Messaging, which helps you engage users who are actively using your app by sending them targeted and contextual messages that nudge them to complete key in-app actions. +version: 0.0.1 + +author: Flutter Team +homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_app_messaging + +dependencies: + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter + firebase_core: ^0.2.5+1 + +flutter: + plugin: + androidPackage: io.flutter.plugins.firebaseinappmessaging + iosPrefix: FLT + pluginClass: FirebaseInAppMessagingPlugin + +environment: + sdk: ">=2.0.0-dev.28.0 <3.0.0" + flutter: ">=0.2.4 <2.0.0" diff --git a/packages/firebase_in_app_messaging/test/firebase_in_app_messaging_test.dart b/packages/firebase_in_app_messaging/test/firebase_in_app_messaging_test.dart new file mode 100644 index 000000000000..c0abe0c047ef --- /dev/null +++ b/packages/firebase_in_app_messaging/test/firebase_in_app_messaging_test.dart @@ -0,0 +1,103 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/services.dart'; + +import 'package:firebase_in_app_messaging/firebase_in_app_messaging.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('$FirebaseInAppMessaging', () { + final List log = []; + + setUp(() { + FirebaseInAppMessaging.channel + .setMockMethodCallHandler((MethodCall methodCall) async { + log.add(methodCall); + return null; + }); + log.clear(); + }); + + test('setMessageDisplaySuppressed', () async { + await FirebaseInAppMessaging.instance.setMessageDisplaySuppressed(true); + expect(log, [ + isMethodCall( + 'FirebaseInAppMessaging#setMessageDisplaySuppressed', + arguments: true, + ) + ]); + log.clear(); + await FirebaseInAppMessaging.instance.setMessageDisplaySuppressed(false); + expect(log, [ + isMethodCall( + 'FirebaseInAppMessaging#setMessageDisplaySuppressed', + arguments: false, + ) + ]); + }); + + test('setAutomaticDataCollectionEnabled', () async { + await FirebaseInAppMessaging.instance.setAutomaticDataCollectionEnabled(true); + expect(log, [ + isMethodCall( + 'FirebaseInAppMessaging#setAutomaticDataCollectionEnabled', + arguments: true, + ) + ]); + log.clear(); + await FirebaseInAppMessaging.instance.setAutomaticDataCollectionEnabled(false); + expect(log, [ + isMethodCall( + 'FirebaseInAppMessaging#setAutomaticDataCollectionEnabled', + arguments: false, + ) + ]); + }); + + test('setMessagingDisplay', () async { + InAppMessagingDisplayMessage _message; + InAppMessagingDisplayDelegate _delegate; + FirebaseInAppMessaging.instance.setMessagingDisplay((message, delegate) { + _message = message; + _delegate = delegate; + }); + expect(log, [ + isMethodCall( + 'FirebaseInAppMessaging#useFlutterMessageDisplayComponent', + arguments: true, + ) + ]); + log.clear(); + + await BinaryMessages.handlePlatformMessage( + FirebaseInAppMessaging.channel.name, + FirebaseInAppMessaging.channel.codec.encodeMethodCall( + MethodCall( + 'FirebaseInAppMessaging#_displayMessage', + { + 'message': { + 'messageID': '42', + 'renderAsTestMessage': true, + }, + 'delegate': 1, + }, + ), + ), + (_) {}, + ); + expect(_message.messageID, equals(42)); + expect(_message.renderAsTestMessage, equals(true)); + // TODO(jackson): More tests + + await FirebaseInAppMessaging.instance.setMessagingDisplay(null); + expect(log, [ + isMethodCall( + 'FirebaseInAppMessaging#useFlutterMessageDisplayComponent', + arguments: false, + ) + ]); + }); + }); +}