Initial release of Firebase performance monitoring (#508) * Initial 'flutter create' commit * Added Firebase and updated channel name * Added basic functions for performance monitoring * Added license and app information * Fixed iOS updating collection status * Added testing for peformance collection * Implemented Trace and added testing * Implemented start and stop methods for trace * Implemented Android trace methods * Implemented performance traces on iOS * Implemented more trace testing * Added iOS attributes for traces * Added comments and Licenses * Updated comments and added debug prints * Added README info * Added more debugging prints * Fix formatting issues * Fixed unused variable * More format changes * Formatting * Removed widget test * Added dev dependencies * Added documentation and constants * Removed a space * Added performance to flutterfire and readme * New trace created only on dart side * Updated test to use setMockMethodChannel * Method renames * Fixed a bunch of pull request comments * Added trace asserts * Dart reformat * Fix tests * Cleaned up UI code * Comments and variable names * Formatting * Reverted analytics file back to upstream/master * Formatting * Removed gradle files * PR comment changes * Updated tests to use 'handle' as id key * Removed assert descriptions
diff --git a/FlutterFire.md b/FlutterFire.md index cf6b375..6a78cc9 100644 --- a/FlutterFire.md +++ b/FlutterFire.md
@@ -22,6 +22,7 @@ | [cloud_firestore][firestore_pub] | [Cloud Firestore][firestore_product] | [`packages/cloud_firestore`][firestore_code] | | [firebase_messaging][messaging_pub] | [Firebase Cloud Messaging][messaging_product] | [`packages/firebase_messaging`][messaging_code] | | [firebase_storage][storage_pub] | [Firebase Cloud Storage][storage_product] | [`packages/firebase_storage`][storage_code] | +| [firebase_performance][storage_pub] | [Firebase Performance Monitoring][performance_product] | [`packages/firebase_performance`][performance_code] | [admob_pub]: https://pub.dartlang.org/packages/firebase_admob [admob_product]: https://firebase.google.com/docs/admob/ @@ -54,3 +55,7 @@ [storage_pub]: https://pub.dartlang.org/packages/firebase_storage [storage_product]: https://firebase.google.com/products/storage/ [storage_code]: https://github.com/flutter/plugins/tree/master/packages/firebase_storage + +[performance_pub]: https://pub.dartlang.org/packages/firebase_performance +[performance_product]: https://firebase.google.com/products/performance/ +[performance_code]: https://github.com/flutter/plugins/tree/master/packages/firebase_performance
diff --git a/README.md b/README.md index 33c1ddb..84354f6 100644 --- a/README.md +++ b/README.md
@@ -65,5 +65,6 @@ | [firebase_database](./packages/firebase_database/) | [](https://pub.dartlang.org/packages/firebase_database) | | [firebase_messaging](./packages/firebase_messaging/) | [](https://pub.dartlang.org/packages/firebase_messaging) | | [firebase_storage](./packages/firebase_storage/) | [](https://pub.dartlang.org/packages/firebase_storage) | +| [firebase_performance](./packages/firebase_performance/) | [](https://pub.dartlang.org/packages/firebase_performance) | Learn more about [FlutterFire](https://github.com/flutter/plugins/blob/master/FlutterFire.md).
diff --git a/packages/firebase_performance/.gitignore b/packages/firebase_performance/.gitignore new file mode 100644 index 0000000..7ecebb4 --- /dev/null +++ b/packages/firebase_performance/.gitignore
@@ -0,0 +1,8 @@ +.DS_Store +.dart_tool/ + +.packages +.pub/ +pubspec.lock + +build/
diff --git a/packages/firebase_performance/CHANGELOG.md b/packages/firebase_performance/CHANGELOG.md new file mode 100644 index 0000000..95948be --- /dev/null +++ b/packages/firebase_performance/CHANGELOG.md
@@ -0,0 +1,3 @@ +## 0.0.1 + +* Initial Release
diff --git a/packages/firebase_performance/LICENSE b/packages/firebase_performance/LICENSE new file mode 100644 index 0000000..c892933 --- /dev/null +++ b/packages/firebase_performance/LICENSE
@@ -0,0 +1,27 @@ +// Copyright 2017 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.
diff --git a/packages/firebase_performance/README.md b/packages/firebase_performance/README.md new file mode 100644 index 0000000..d78bebd --- /dev/null +++ b/packages/firebase_performance/README.md
@@ -0,0 +1,36 @@ +# Google Performance Monitoring for Firebase + +[](https://pub.dartlang.org/packages/firebase_performance) + +A Flutter plugin to use the [Google Performance Monitoring for Firebase API](https://firebase.google.com/docs/perf-mon/). + +For Flutter plugins for other Firebase products, see [FlutterFire.md](https://github.com/flutter/plugins/blob/master/FlutterFire.md). + +*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_performance` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). You must also configure firebase performance monitoring 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). + +## Define a Custom Trace + +A custom trace is a report of performance data associated with some of the code in your app. To learn more about custom traces, see the [Performance Monitoring overview](https://firebase.google.com/docs/perf-mon/#how_does_it_work). + +```dart + +Trace myTrace = FirebasePerformance.instance.newTrace("test_trace"); +myTrace.start(); + +Item item = cache.fetch("item"); +if (item != null) { + myTrace.incrementCounter("item_cache_hit"); +} else { + myTrace.incrementCounter("item_cache_miss"); +} + +myTrace.stop(); + +``` + +## Getting Started + +See the `example` directory for a complete sample app using Google Performance Monitoring for Firebase. \ No newline at end of file
diff --git a/packages/firebase_performance/android/.gitignore b/packages/firebase_performance/android/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/packages/firebase_performance/android/.gitignore
@@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures
diff --git a/packages/firebase_performance/android/build.gradle b/packages/firebase_performance/android/build.gradle new file mode 100644 index 0000000..f5f426a --- /dev/null +++ b/packages/firebase_performance/android/build.gradle
@@ -0,0 +1,37 @@ +group 'io.flutter.plugins.firebaseperformance' +version '1.0-SNAPSHOT' + +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.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-perf:15.0.0' + } +}
diff --git a/packages/firebase_performance/android/gradle.properties b/packages/firebase_performance/android/gradle.properties new file mode 100644 index 0000000..8bd86f6 --- /dev/null +++ b/packages/firebase_performance/android/gradle.properties
@@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M
diff --git a/packages/firebase_performance/android/settings.gradle b/packages/firebase_performance/android/settings.gradle new file mode 100644 index 0000000..50c3a2d --- /dev/null +++ b/packages/firebase_performance/android/settings.gradle
@@ -0,0 +1 @@ +rootProject.name = 'firebase_performance'
diff --git a/packages/firebase_performance/android/src/main/AndroidManifest.xml b/packages/firebase_performance/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000..4708a5e --- /dev/null +++ b/packages/firebase_performance/android/src/main/AndroidManifest.xml
@@ -0,0 +1,5 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="io.flutter.plugins.firebaseperformance"> + + <uses-permission android:name="android.permission.INTERNET" /> +</manifest>
diff --git a/packages/firebase_performance/android/src/main/java/io/flutter/plugins/firebaseperformance/FirebasePerformancePlugin.java b/packages/firebase_performance/android/src/main/java/io/flutter/plugins/firebaseperformance/FirebasePerformancePlugin.java new file mode 100644 index 0000000..a688085 --- /dev/null +++ b/packages/firebase_performance/android/src/main/java/io/flutter/plugins/firebaseperformance/FirebasePerformancePlugin.java
@@ -0,0 +1,91 @@ +// Copyright 2017 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. + +package io.flutter.plugins.firebaseperformance; + +import android.util.SparseArray; +import com.google.firebase.perf.FirebasePerformance; +import com.google.firebase.perf.metrics.Trace; +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.Map; + +/** FirebasePerformancePlugin */ +public class FirebasePerformancePlugin implements MethodCallHandler { + private FirebasePerformance firebasePerformance; + + private final SparseArray<Trace> traces = new SparseArray<>(); + + public static void registerWith(Registrar registrar) { + final MethodChannel channel = + new MethodChannel(registrar.messenger(), "plugins.flutter.io/firebase_performance"); + channel.setMethodCallHandler(new FirebasePerformancePlugin()); + } + + private FirebasePerformancePlugin() { + firebasePerformance = FirebasePerformance.getInstance(); + } + + @Override + public void onMethodCall(MethodCall call, Result result) { + switch (call.method) { + case "FirebasePerformance#isPerformanceCollectionEnabled": + result.success(firebasePerformance.isPerformanceCollectionEnabled()); + break; + case "FirebasePerformance#setPerformanceCollectionEnabled": + final boolean enabled = (boolean) call.arguments; + firebasePerformance.setPerformanceCollectionEnabled(enabled); + result.success(null); + break; + case "Trace#start": + handleTraceStart(call, result); + break; + case "Trace#stop": + handleTraceStop(call, result); + break; + default: + result.notImplemented(); + } + } + + private void handleTraceStart(MethodCall call, Result result) { + Map<String, Object> arguments = call.arguments(); + + int handle = (int) arguments.get("handle"); + String name = (String) arguments.get("name"); + + Trace trace = firebasePerformance.newTrace(name); + + traces.put(handle, trace); + + trace.start(); + result.success(null); + } + + private void handleTraceStop(MethodCall call, Result result) { + Map<String, Object> arguments = call.arguments(); + + int handle = (int) arguments.get("handle"); + Trace trace = traces.get(handle); + + @SuppressWarnings("unchecked") + Map<String, Integer> counters = (Map<String, Integer>) arguments.get("counters"); + for (Map.Entry<String, Integer> entry : counters.entrySet()) { + trace.incrementCounter(entry.getKey(), entry.getValue()); + } + + @SuppressWarnings("unchecked") + Map<String, String> attributes = (Map<String, String>) arguments.get("attributes"); + for (Map.Entry<String, String> entry : attributes.entrySet()) { + trace.putAttribute(entry.getKey(), entry.getValue()); + } + + trace.stop(); + traces.remove(handle); + result.success(null); + } +}
diff --git a/packages/firebase_performance/example/.gitignore b/packages/firebase_performance/example/.gitignore new file mode 100644 index 0000000..dee655c --- /dev/null +++ b/packages/firebase_performance/example/.gitignore
@@ -0,0 +1,9 @@ +.DS_Store +.dart_tool/ + +.packages +.pub/ + +build/ + +.flutter-plugins
diff --git a/packages/firebase_performance/example/.metadata b/packages/firebase_performance/example/.metadata new file mode 100644 index 0000000..866a061 --- /dev/null +++ b/packages/firebase_performance/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_performance/example/README.md b/packages/firebase_performance/example/README.md new file mode 100644 index 0000000..cb4342d --- /dev/null +++ b/packages/firebase_performance/example/README.md
@@ -0,0 +1,8 @@ +# firebase_performance_example + +Demonstrates how to use the firebase_performance plugin. + +## Getting Started + +For help getting started with Flutter, view our online +[documentation](https://flutter.io/).
diff --git a/packages/firebase_performance/example/android/.gitignore b/packages/firebase_performance/example/android/.gitignore new file mode 100644 index 0000000..e335c6e --- /dev/null +++ b/packages/firebase_performance/example/android/.gitignore
@@ -0,0 +1,14 @@ +*.iml +*.class +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +GeneratedPluginRegistrant.java + +/gradle/wrapper/gradle-wrapper.jar +/gradlew +/gradlew.bat \ No newline at end of file
diff --git a/packages/firebase_performance/example/android/app/build.gradle b/packages/firebase_performance/example/android/app/build.gradle new file mode 100644 index 0000000..d2db55d --- /dev/null +++ b/packages/firebase_performance/example/android/app/build.gradle
@@ -0,0 +1,49 @@ +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.firebaseperformanceexample" + minSdkVersion 16 + targetSdkVersion 27 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { +} + +apply plugin: 'com.google.gms.google-services' \ No newline at end of file
diff --git a/packages/firebase_performance/example/android/app/google-services.json b/packages/firebase_performance/example/android/app/google-services.json new file mode 100644 index 0000000..007c845 --- /dev/null +++ b/packages/firebase_performance/example/android/app/google-services.json
@@ -0,0 +1,62 @@ +{ + "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: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-3nf0of470m8do5qa83e8tiivv7e1thq1.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebasePerfExample" + } + }, + { + "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_performance/example/android/app/local.properties b/packages/firebase_performance/example/android/app/local.properties new file mode 100644 index 0000000..534a6f7 --- /dev/null +++ b/packages/firebase_performance/example/android/app/local.properties
@@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Wed Apr 18 10:11:17 PDT 2018 +sdk.dir=/Users/bmparr/Library/Android/sdk
diff --git a/packages/firebase_performance/example/android/app/src/main/AndroidManifest.xml b/packages/firebase_performance/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..1e529d8 --- /dev/null +++ b/packages/firebase_performance/example/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,26 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="io.flutter.plugins.firebaseperformanceexample"> + + <uses-permission android:name="android.permission.INTERNET"/> + + <application + android:name="io.flutter.app.FlutterApplication" + android:label="firebase_performance_example" + android:icon="@mipmap/ic_launcher"> + <activity + android:name=".MainActivity" + android:launchMode="singleTop" + android:theme="@style/LaunchTheme" + android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density" + android:hardwareAccelerated="true" + android:windowSoftInputMode="adjustResize"> + <meta-data + android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" + android:value="true" /> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + </application> +</manifest>
diff --git a/packages/firebase_performance/example/android/app/src/main/java/io/flutter/plugins/firebaseperformanceexample/MainActivity.java b/packages/firebase_performance/example/android/app/src/main/java/io/flutter/plugins/firebaseperformanceexample/MainActivity.java new file mode 100644 index 0000000..945f065 --- /dev/null +++ b/packages/firebase_performance/example/android/app/src/main/java/io/flutter/plugins/firebaseperformanceexample/MainActivity.java
@@ -0,0 +1,13 @@ +package io.flutter.plugins.firebaseperformanceexample; + +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_performance/example/android/app/src/main/res/drawable/launch_background.xml b/packages/firebase_performance/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/packages/firebase_performance/example/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Modify this file to customize your launch splash screen --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@android:color/white" /> + + <!-- You can insert your own image assets here --> + <!-- <item> + <bitmap + android:gravity="center" + android:src="@mipmap/launch_image" /> + </item> --> +</layer-list>
diff --git a/packages/firebase_performance/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/firebase_performance/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 --- /dev/null +++ b/packages/firebase_performance/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differ
diff --git a/packages/firebase_performance/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/firebase_performance/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 --- /dev/null +++ b/packages/firebase_performance/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differ
diff --git a/packages/firebase_performance/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/firebase_performance/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 --- /dev/null +++ b/packages/firebase_performance/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differ
diff --git a/packages/firebase_performance/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/firebase_performance/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d --- /dev/null +++ b/packages/firebase_performance/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differ
diff --git a/packages/firebase_performance/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/firebase_performance/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e --- /dev/null +++ b/packages/firebase_performance/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differ
diff --git a/packages/firebase_performance/example/android/app/src/main/res/values/styles.xml b/packages/firebase_performance/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..00fa441 --- /dev/null +++ b/packages/firebase_performance/example/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> + <!-- Show a splash screen on the activity. Automatically removed when + Flutter draws its first frame --> + <item name="android:windowBackground">@drawable/launch_background</item> + </style> +</resources>
diff --git a/packages/firebase_performance/example/android/build.gradle b/packages/firebase_performance/example/android/build.gradle new file mode 100644 index 0000000..6d31bc0 --- /dev/null +++ b/packages/firebase_performance/example/android/build.gradle
@@ -0,0 +1,32 @@ +buildscript { + repositories { + google() + jcenter() + mavenLocal() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.google.gms:google-services:3.1.2' + } +} + +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_performance/example/android/gradle.properties b/packages/firebase_performance/example/android/gradle.properties new file mode 100644 index 0000000..8bd86f6 --- /dev/null +++ b/packages/firebase_performance/example/android/gradle.properties
@@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M
diff --git a/packages/firebase_performance/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/firebase_performance/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..aa901e1 --- /dev/null +++ b/packages/firebase_performance/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
diff --git a/packages/firebase_performance/example/android/settings.gradle b/packages/firebase_performance/example/android/settings.gradle new file mode 100644 index 0000000..5a2f14f --- /dev/null +++ b/packages/firebase_performance/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_performance/example/firebase_performance_example.iml b/packages/firebase_performance/example/firebase_performance_example.iml new file mode 100644 index 0000000..e5c8371 --- /dev/null +++ b/packages/firebase_performance/example/firebase_performance_example.iml
@@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> + <excludeFolder url="file://$MODULE_DIR$/.dart_tool" /> + <excludeFolder url="file://$MODULE_DIR$/.idea" /> + <excludeFolder url="file://$MODULE_DIR$/.pub" /> + <excludeFolder url="file://$MODULE_DIR$/build" /> + </content> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="Dart SDK" level="project" /> + <orderEntry type="library" name="Flutter Plugins" level="project" /> + <orderEntry type="library" name="Dart Packages" level="project" /> + </component> +</module> \ No newline at end of file
diff --git a/packages/firebase_performance/example/firebase_performance_example_android.iml b/packages/firebase_performance/example/firebase_performance_example_android.iml new file mode 100644 index 0000000..b050030 --- /dev/null +++ b/packages/firebase_performance/example/firebase_performance_example_android.iml
@@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="FacetManager"> + <facet type="android" name="Android"> + <configuration> + <option name="ALLOW_USER_CONFIGURATION" value="false" /> + <option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/android/gen" /> + <option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/android/gen" /> + <option name="MANIFEST_FILE_RELATIVE_PATH" value="/android/AndroidManifest.xml" /> + <option name="RES_FOLDER_RELATIVE_PATH" value="/android/res" /> + <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/android/assets" /> + <option name="LIBS_FOLDER_RELATIVE_PATH" value="/android/libs" /> + <option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/android/proguard_logs" /> + </configuration> + </facet> + </component> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/android"> + <sourceFolder url="file://$MODULE_DIR$/android/app/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/android/gen" isTestSource="false" generated="true" /> + </content> + <orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="Flutter for Android" level="project" /> + </component> +</module>
diff --git a/packages/firebase_performance/example/ios/.gitignore b/packages/firebase_performance/example/ios/.gitignore new file mode 100644 index 0000000..2a8c8b6 --- /dev/null +++ b/packages/firebase_performance/example/ios/.gitignore
@@ -0,0 +1,44 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/app.flx +/Flutter/app.zip +/Flutter/flutter_assets/ +/Flutter/App.framework +/Flutter/Flutter.framework +/Flutter/Generated.xcconfig +/ServiceDefinitions.json + +Pods/
diff --git a/packages/firebase_performance/example/ios/Flutter/AppFrameworkInfo.plist b/packages/firebase_performance/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..6c2de80 --- /dev/null +++ b/packages/firebase_performance/example/ios/Flutter/AppFrameworkInfo.plist
@@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>App</string> + <key>CFBundleIdentifier</key> + <string>io.flutter.flutter.app</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>App</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>UIRequiredDeviceCapabilities</key> + <array> + <string>arm64</string> + </array> + <key>MinimumOSVersion</key> + <string>8.0</string> +</dict> +</plist>
diff --git a/packages/firebase_performance/example/ios/Flutter/Debug.xcconfig b/packages/firebase_performance/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..e8efba1 --- /dev/null +++ b/packages/firebase_performance/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_performance/example/ios/Flutter/Release.xcconfig b/packages/firebase_performance/example/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..399e934 --- /dev/null +++ b/packages/firebase_performance/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_performance/example/ios/Podfile b/packages/firebase_performance/example/ios/Podfile new file mode 100644 index 0000000..dc1da60 --- /dev/null +++ b/packages/firebase_performance/example/ios/Podfile
@@ -0,0 +1,63 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +def parse_KV_file(file, separator='=') + file_abs_path = File.expand_path(file) + if !File.exists? file_abs_path + return []; + end + pods_ary = [] + skip_line_start_symbols = ["#", "/"] + File.foreach(file_abs_path) { |line| + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } + plugin = line.split(pattern=separator) + if plugin.length == 2 + podname = plugin[0].strip() + path = plugin[1].strip() + podpath = File.expand_path("#{path}", file_abs_path) + pods_ary.push({:name => podname, :path => podpath}); + else + puts "Invalid plugin specification: #{line}" + end + } + return pods_ary +end + +target 'Runner' do + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock + # referring to absolute paths on developers' machines. + system('rm -rf Pods/.symlinks') + system('mkdir -p Pods/.symlinks/plugins') + + # Flutter Pods + generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') + if generated_xcode_build_settings.empty? + puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." + end + generated_xcode_build_settings.map { |p| + if p[:name] == 'FLUTTER_FRAMEWORK_DIR' + symlink = File.join('Pods', '.symlinks', 'flutter') + File.symlink(File.dirname(p[:path]), symlink) + pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) + end + } + + # Plugin Pods + plugin_pods = parse_KV_file('../.flutter-plugins') + plugin_pods.map { |p| + symlink = File.join('Pods', '.symlinks', 'plugins', p[:name]) + File.symlink(p[:path], symlink) + pod p[:name], :path => File.join(symlink, 'ios') + } +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['ENABLE_BITCODE'] = 'NO' + end + end +end
diff --git a/packages/firebase_performance/example/ios/Runner.xcodeproj/project.pbxproj b/packages/firebase_performance/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..ee8a6c5 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner.xcodeproj/project.pbxproj
@@ -0,0 +1,501 @@ +// !$*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, ); }; }; + 4F30D5F713FAE573DBE831BD /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AADA30890C75F448DA1E1040 /* libPods-Runner.a */; }; + 8FF7AD1520880821009B43A2 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8FF7AD1420880820009B43A2 /* GoogleService-Info.plist */; }; + 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 = "<group>"; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; + 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 = "<group>"; }; + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; + 8FF7AD1420880820009B43A2 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; }; + 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 = "<group>"; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + AADA30890C75F448DA1E1040 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + 4F30D5F713FAE573DBE831BD /* libPods-Runner.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 556632B50846818D9A90AA4B /* Frameworks */ = { + isa = PBXGroup; + children = ( + AADA30890C75F448DA1E1040 /* libPods-Runner.a */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; + 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 = "<group>"; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + DE7EB5CF2B4FC4A8BCD09CC6 /* Pods */, + 556632B50846818D9A90AA4B /* Frameworks */, + ); + sourceTree = "<group>"; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, + 8FF7AD1420880820009B43A2 /* 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 = "<group>"; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 97C146F21CF9000F007C117D /* main.m */, + ); + name = "Supporting Files"; + sourceTree = "<group>"; + }; + DE7EB5CF2B4FC4A8BCD09CC6 /* Pods */ = { + isa = PBXGroup; + children = ( + ); + name = Pods; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 92CA2C06BD2DACC2EF38987C /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + EEF842937EAC4019A711CBB3 /* [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; + }; + }; + }; + 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 */, + 8FF7AD1520880821009B43A2 /* 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"; + }; + 92CA2C06BD2DACC2EF38987C /* [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; + }; + 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"; + }; + EEF842937EAC4019A711CBB3 /* [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; + }; +/* 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 = "<group>"; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = "<group>"; + }; +/* 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; + CURRENT_PROJECT_VERSION = 1; + 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 = io.flutter.plugins.firebasePerformanceExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; + 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 = io.flutter.plugins.firebasePerformanceExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + 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_performance/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/firebase_performance/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "group:Runner.xcodeproj"> + </FileRef> +</Workspace>
diff --git a/packages/firebase_performance/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/firebase_performance/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..1263ac8 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0910" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "97C146ED1CF9000F007C117D" + BuildableName = "Runner.app" + BlueprintName = "Runner" + ReferencedContainer = "container:Runner.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + </Testables> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "97C146ED1CF9000F007C117D" + BuildableName = "Runner.app" + BlueprintName = "Runner" + ReferencedContainer = "container:Runner.xcodeproj"> + </BuildableReference> + </MacroExpansion> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "97C146ED1CF9000F007C117D" + BuildableName = "Runner.app" + BlueprintName = "Runner" + ReferencedContainer = "container:Runner.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "97C146ED1CF9000F007C117D" + BuildableName = "Runner.app" + BlueprintName = "Runner" + ReferencedContainer = "container:Runner.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme>
diff --git a/packages/firebase_performance/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/firebase_performance/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "group:Runner.xcodeproj"> + </FileRef> + <FileRef + location = "group:Pods/Pods.xcodeproj"> + </FileRef> +</Workspace>
diff --git a/packages/firebase_performance/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/firebase_performance/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IDEDidComputeMac32BitWarning</key> + <true/> +</dict> +</plist>
diff --git a/packages/firebase_performance/example/ios/Runner/AppDelegate.h b/packages/firebase_performance/example/ios/Runner/AppDelegate.h new file mode 100644 index 0000000..36e21bb --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/AppDelegate.h
@@ -0,0 +1,6 @@ +#import <Flutter/Flutter.h> +#import <UIKit/UIKit.h> + +@interface AppDelegate : FlutterAppDelegate + +@end
diff --git a/packages/firebase_performance/example/ios/Runner/AppDelegate.m b/packages/firebase_performance/example/ios/Runner/AppDelegate.m new file mode 100644 index 0000000..59a72e9 --- /dev/null +++ b/packages/firebase_performance/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_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/packages/firebase_performance/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_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..3d43d11 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..28c6bf0 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..2ccbfd9 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..f091b6b --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cde121 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..d0ef06e --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..dcdc230 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..2ccbfd9 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..c8f9ed8 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..a6d6b86 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..a6d6b86 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..75b2d16 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..c4df70d --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..6a84f41 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..d0e1f58 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/packages/firebase_performance/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_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png Binary files differ
diff --git a/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/firebase_performance/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/packages/firebase_performance/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_performance/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/firebase_performance/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="EHf-IW-A2E"> + <objects> + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/> + <viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"> + </imageView> + </subviews> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/> + <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/> + </constraints> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="53" y="375"/> + </scene> + </scenes> + <resources> + <image name="LaunchImage" width="168" height="185"/> + </resources> +</document>
diff --git a/packages/firebase_performance/example/ios/Runner/Base.lproj/Main.storyboard b/packages/firebase_performance/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Base.lproj/Main.storyboard
@@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> + </dependencies> + <scenes> + <!--Flutter View Controller--> + <scene sceneID="tne-QT-ifu"> + <objects> + <viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> + <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> + <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> + </objects> + </scene> + </scenes> +</document>
diff --git a/packages/firebase_performance/example/ios/Runner/GoogleService-Info.plist b/packages/firebase_performance/example/ios/Runner/GoogleService-Info.plist new file mode 100644 index 0000000..2064ea6 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/GoogleService-Info.plist
@@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>AD_UNIT_ID_FOR_BANNER_TEST</key> + <string>ca-app-pub-3940256099942544/2934735716</string> + <key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key> + <string>ca-app-pub-3940256099942544/4411468910</string> + <key>CLIENT_ID</key> + <string>479882132969-sbr97a40ji0hqujs9ksm2lrm1mfhdum3.apps.googleusercontent.com</string> + <key>REVERSED_CLIENT_ID</key> + <string>com.googleusercontent.apps.479882132969-sbr97a40ji0hqujs9ksm2lrm1mfhdum3</string> + <key>API_KEY</key> + <string>AIzaSyBECOwLTAN6PU4Aet1b2QLGIb3kRK8Xjew</string> + <key>GCM_SENDER_ID</key> + <string>479882132969</string> + <key>PLIST_VERSION</key> + <string>1</string> + <key>BUNDLE_ID</key> + <string>io.flutter.plugins.firebasePerformanceExample</string> + <key>PROJECT_ID</key> + <string>my-flutter-proj</string> + <key>STORAGE_BUCKET</key> + <string>my-flutter-proj.appspot.com</string> + <key>IS_ADS_ENABLED</key> + <true></true> + <key>IS_ANALYTICS_ENABLED</key> + <false></false> + <key>IS_APPINVITE_ENABLED</key> + <false></false> + <key>IS_GCM_ENABLED</key> + <true></true> + <key>IS_SIGNIN_ENABLED</key> + <true></true> + <key>GOOGLE_APP_ID</key> + <string>1:479882132969:ios:0f2b615ff954f3ae</string> + <key>DATABASE_URL</key> + <string>https://my-flutter-proj.firebaseio.com</string> +</dict> +</plist> \ No newline at end of file
diff --git a/packages/firebase_performance/example/ios/Runner/Info.plist b/packages/firebase_performance/example/ios/Runner/Info.plist new file mode 100644 index 0000000..930df5b --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/Info.plist
@@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>firebase_performance_example</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>UILaunchStoryboardName</key> + <string>LaunchScreen</string> + <key>UIMainStoryboardFile</key> + <string>Main</string> + <key>UIRequiredDeviceCapabilities</key> + <array> + <string>arm64</string> + </array> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>UIViewControllerBasedStatusBarAppearance</key> + <false/> +</dict> +</plist>
diff --git a/packages/firebase_performance/example/ios/Runner/main.m b/packages/firebase_performance/example/ios/Runner/main.m new file mode 100644 index 0000000..dff6597 --- /dev/null +++ b/packages/firebase_performance/example/ios/Runner/main.m
@@ -0,0 +1,9 @@ +#import <Flutter/Flutter.h> +#import <UIKit/UIKit.h> +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +}
diff --git a/packages/firebase_performance/example/lib/main.dart b/packages/firebase_performance/example/lib/main.dart new file mode 100644 index 0000000..8600ff3 --- /dev/null +++ b/packages/firebase_performance/example/lib/main.dart
@@ -0,0 +1,93 @@ +// Copyright 2017, 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 'dart:async'; + +import 'package:flutter/material.dart'; + +import 'package:firebase_performance/firebase_performance.dart'; + +void main() => runApp(new MyApp()); + +class MyApp extends StatefulWidget { + @override + _MyAppState createState() => new _MyAppState(); +} + +class _MyAppState extends State<MyApp> { + FirebasePerformance _performance = FirebasePerformance.instance; + bool _isPerformanceCollectionEnabled = false; + String _performanceCollectionMessage = + 'Unknown status of performance collection.'; + bool _traceHasRan = false; + + @override + void initState() { + super.initState(); + _togglePerformanceCollection(); + } + + Future<void> _togglePerformanceCollection() async { + await _performance + .setPerformanceCollectionEnabled(!_isPerformanceCollectionEnabled); + + final bool isEnabled = await _performance.isPerformanceCollectionEnabled(); + setState(() { + _isPerformanceCollectionEnabled = isEnabled; + _performanceCollectionMessage = _isPerformanceCollectionEnabled + ? 'Performance collection is enabled.' + : 'Performance collection is disabled.'; + }); + } + + Future<void> _testTrace() async { + final Trace trace = _performance.newTrace("test"); + trace.incrementCounter("counter1", 16); + trace.putAttribute("favorite_color", "blue"); + + await trace.start(); + + int sum = 0; + for (int i = 0; i < 10000000; i++) { + sum += i; + } + print(sum); + + await trace.stop(); + + setState(() { + _traceHasRan = true; + }); + } + + @override + Widget build(BuildContext context) { + return new MaterialApp( + home: new Scaffold( + appBar: new AppBar( + title: const Text('Firebase Performance Example'), + ), + body: new Center( + child: new Column( + children: <Widget>[ + new Text(_performanceCollectionMessage), + new RaisedButton( + onPressed: _togglePerformanceCollection, + child: const Text('Toggle Data Collection'), + ), + new RaisedButton( + onPressed: _testTrace, + child: const Text('Run Trace'), + ), + new Text( + _traceHasRan ? 'Trace Ran!' : '', + style: const TextStyle( + color: Colors.lightGreenAccent, fontSize: 25.0), + ) + ], + )), + ), + ); + } +}
diff --git a/packages/firebase_performance/example/pubspec.yaml b/packages/firebase_performance/example/pubspec.yaml new file mode 100644 index 0000000..f4370fe --- /dev/null +++ b/packages/firebase_performance/example/pubspec.yaml
@@ -0,0 +1,55 @@ +name: firebase_performance_example +description: Demonstrates how to use the firebase_performance plugin. + +dependencies: + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter + + firebase_performance: + path: ../ + +# For information on the generic Dart part of this file, see the +# following page: https://www.dartlang.org/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.io/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.io/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.io/custom-fonts/#from-packages
diff --git a/packages/firebase_performance/firebase_performance.iml b/packages/firebase_performance/firebase_performance.iml new file mode 100644 index 0000000..73e7ebd --- /dev/null +++ b/packages/firebase_performance/firebase_performance.iml
@@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" /> + <excludeFolder url="file://$MODULE_DIR$/.dart_tool" /> + <excludeFolder url="file://$MODULE_DIR$/.idea" /> + <excludeFolder url="file://$MODULE_DIR$/.pub" /> + <excludeFolder url="file://$MODULE_DIR$/build" /> + <excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" /> + <excludeFolder url="file://$MODULE_DIR$/example/.pub" /> + <excludeFolder url="file://$MODULE_DIR$/example/build" /> + </content> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="Dart SDK" level="project" /> + <orderEntry type="library" name="Flutter Plugins" level="project" /> + </component> +</module> \ No newline at end of file
diff --git a/packages/firebase_performance/firebase_performance_android.iml b/packages/firebase_performance/firebase_performance_android.iml new file mode 100644 index 0000000..ac5d744 --- /dev/null +++ b/packages/firebase_performance/firebase_performance_android.iml
@@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="FacetManager"> + <facet type="android" name="Android"> + <configuration> + <option name="ALLOW_USER_CONFIGURATION" value="false" /> + <option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/android/gen" /> + <option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/android/gen" /> + <option name="MANIFEST_FILE_RELATIVE_PATH" value="/android/AndroidManifest.xml" /> + <option name="RES_FOLDER_RELATIVE_PATH" value="/android/res" /> + <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/android/assets" /> + <option name="LIBS_FOLDER_RELATIVE_PATH" value="/android/libs" /> + <option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/android/proguard_logs" /> + </configuration> + </facet> + </component> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/android"> + <sourceFolder url="file://$MODULE_DIR$/android/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/android/gen" isTestSource="false" generated="true" /> + </content> + <content url="file://$MODULE_DIR$/example/android"> + <sourceFolder url="file://$MODULE_DIR$/example/android/app/src/main/java" isTestSource="false" /> + </content> + <orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="Flutter for Android" level="project" /> + </component> +</module>
diff --git a/packages/firebase_performance/ios/.gitignore b/packages/firebase_performance/ios/.gitignore new file mode 100644 index 0000000..710ec6c --- /dev/null +++ b/packages/firebase_performance/ios/.gitignore
@@ -0,0 +1,36 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/Generated.xcconfig
diff --git a/packages/firebase_performance/ios/Assets/.gitkeep b/packages/firebase_performance/ios/Assets/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/packages/firebase_performance/ios/Assets/.gitkeep
diff --git a/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.h b/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.h new file mode 100644 index 0000000..7d3fe91 --- /dev/null +++ b/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.h
@@ -0,0 +1,4 @@ +#import <Flutter/Flutter.h> + +@interface FLTFirebasePerformancePlugin : NSObject<FlutterPlugin> +@end
diff --git a/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.m b/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.m new file mode 100644 index 0000000..ef7000b --- /dev/null +++ b/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.m
@@ -0,0 +1,79 @@ +// Copyright 2017 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 "FirebasePerformancePlugin.h" + +#import <Firebase/Firebase.h> + +@interface FLTFirebasePerformancePlugin () +@property(nonatomic, retain) NSMutableDictionary *traces; +@end + +@implementation FLTFirebasePerformancePlugin ++ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar { + FlutterMethodChannel *channel = + [FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/firebase_performance" + binaryMessenger:[registrar messenger]]; + FLTFirebasePerformancePlugin *instance = [[FLTFirebasePerformancePlugin alloc] init]; + [registrar addMethodCallDelegate:instance channel:channel]; +} + +- (instancetype)init { + self = [super init]; + if (self) { + if (![FIRApp defaultApp]) { + [FIRApp configure]; + _traces = [[NSMutableDictionary alloc] init]; + } + } + + return self; +} + +- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result { + if ([@"FirebasePerformance#isPerformanceCollectionEnabled" isEqualToString:call.method]) { + result(@([[FIRPerformance sharedInstance] isDataCollectionEnabled])); + } else if ([@"FirebasePerformance#setPerformanceCollectionEnabled" isEqualToString:call.method]) { + NSNumber *enable = call.arguments; + [[FIRPerformance sharedInstance] setDataCollectionEnabled:[enable boolValue]]; + result(nil); + } else if ([@"Trace#start" isEqualToString:call.method]) { + [self handleTraceStart:call result:result]; + } else if ([@"Trace#stop" isEqualToString:call.method]) { + [self handleTraceStop:call result:result]; + } else { + result(FlutterMethodNotImplemented); + } +} + +- (void)handleTraceStart:(FlutterMethodCall *)call result:(FlutterResult)result { + NSNumber *handle = call.arguments[@"handle"]; + NSString *name = call.arguments[@"name"]; + + FIRTrace *trace = [[FIRPerformance sharedInstance] traceWithName:name]; + [_traces setObject:trace forKey:handle]; + [trace start]; + result(nil); +} + +- (void)handleTraceStop:(FlutterMethodCall *)call result:(FlutterResult)result { + NSNumber *handle = call.arguments[@"handle"]; + FIRTrace *trace = [_traces objectForKey:handle]; + + NSDictionary *counters = call.arguments[@"counters"]; + [counters enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSNumber *value, BOOL *stop) { + [trace incrementCounterNamed:key by:[value integerValue]]; + }]; + + NSDictionary *attributes = call.arguments[@"attributes"]; + [attributes enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL *stop) { + [trace setValue:key forAttribute:value]; + }]; + + [trace stop]; + [_traces removeObjectForKey:handle]; + result(nil); +} + +@end
diff --git a/packages/firebase_performance/ios/firebase_performance.podspec b/packages/firebase_performance/ios/firebase_performance.podspec new file mode 100644 index 0000000..cb981c5 --- /dev/null +++ b/packages/firebase_performance/ios/firebase_performance.podspec
@@ -0,0 +1,22 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# +Pod::Spec.new do |s| + s.name = 'firebase_performance' + s.version = '0.0.1' + s.summary = 'Firebase Performance plugin for Flutter.' + s.description = <<-DESC +Firebase Performance plugin for Flutter. + DESC + s.homepage = 'https://github.com/flutter/plugins/tree/master/packages/firebase_performance' + 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/Core' + s.dependency 'Firebase/Performance' + s.ios.deployment_target = '8.0' +end +
diff --git a/packages/firebase_performance/lib/firebase_performance.dart b/packages/firebase_performance/lib/firebase_performance.dart new file mode 100644 index 0000000..ae6167d --- /dev/null +++ b/packages/firebase_performance/lib/firebase_performance.dart
@@ -0,0 +1,14 @@ +// Copyright 2017, 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. + +library firebase_performance; + +import 'dart:async'; +import 'dart:collection'; + +import 'package:flutter/services.dart'; +import 'package:flutter/foundation.dart'; + +part 'src/firebase_performance.dart'; +part 'src/trace.dart';
diff --git a/packages/firebase_performance/lib/src/firebase_performance.dart b/packages/firebase_performance/lib/src/firebase_performance.dart new file mode 100644 index 0000000..f94b922 --- /dev/null +++ b/packages/firebase_performance/lib/src/firebase_performance.dart
@@ -0,0 +1,62 @@ +// Copyright 2017, 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. + +part of firebase_performance; + +/// The Firebase Performance API. +/// +/// You can get an instance by calling [FirebasePerformance.instance]. +class FirebasePerformance { + FirebasePerformance._(); + + static int _traceCount = 0; + + @visibleForTesting + static const MethodChannel channel = + const MethodChannel('plugins.flutter.io/firebase_performance'); + + /// Singleton of [FirebasePerformance]. + static final FirebasePerformance instance = new FirebasePerformance._(); + + /// Determines whether performance monitoring is enabled or disabled. + /// + /// true if performance monitoring is enabled and false if performance + /// monitoring is disabled. This is for dynamic enable/disable state. This + /// does not reflect whether instrumentation is enabled/disabled. + Future<bool> isPerformanceCollectionEnabled() async { + final bool isEnabled = await channel + .invokeMethod('FirebasePerformance#isPerformanceCollectionEnabled'); + return isEnabled; + } + + /// Enables or disables performance monitoring. + /// + /// Enables or disables performance monitoring. This setting is persisted and + /// applied on future invocations of your application. By default, performance + /// monitoring is enabled. + Future<void> setPerformanceCollectionEnabled(bool enable) async { + await channel.invokeMethod( + 'FirebasePerformance#setPerformanceCollectionEnabled', enable); + } + + /// Creates a [Trace] object with given [name]. + /// + /// [name]: name of the trace. Requires no leading or trailing whitespace, no + /// leading underscore _ character, max length of [Trace.maxTraceNameLength] + /// characters. + Trace newTrace(String name) { + return new Trace._(_traceCount++, name); + } + + /// Creates a [Trace] object with given [name] and start the trace. + /// + /// [name]: name of the trace. Requires no leading or trailing whitespace, no + /// leading underscore _ character, max length of [Trace.maxTraceNameLength] + /// characters. + static Future<Trace> startTrace(String name) async { + final Trace trace = instance.newTrace(name); + await trace.start(); + return trace; + } +}
diff --git a/packages/firebase_performance/lib/src/trace.dart b/packages/firebase_performance/lib/src/trace.dart new file mode 100644 index 0000000..9da17a5 --- /dev/null +++ b/packages/firebase_performance/lib/src/trace.dart
@@ -0,0 +1,131 @@ +// Copyright 2017, 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. + +part of firebase_performance; + +/// Trace allows you to set beginning and end of a certain action in your app. +class Trace { + Trace._(this._handle, this._name) { + assert(_name != null); + assert(!_name.startsWith(new RegExp(r'[_\s]'))); + assert(!_name.contains(new RegExp(r'[_\s]$'))); + assert(_name.length <= maxTraceNameLength); + } + + /// Maximum allowed length of a key passed to [putAttribute]. + static const int maxAttributeKeyLength = 40; + + /// Maximum allowed length of a value passed to [putAttribute]. + static const int maxAttributeValueLength = 100; + + /// Maximum allowed number of attributes that can be added. + static const int maxTraceCustomAttributes = 5; + + /// Maximum allowed length of the name of a [Trace]. + static const int maxTraceNameLength = 100; + + final int _handle; + final String _name; + + bool _hasStarted = false; + bool _hasStopped = false; + + final HashMap<String, int> _counters = new HashMap<String, int>(); + final HashMap<String, String> _attributes = new HashMap<String, String>(); + + /// All the attributes added to this trace. + Map<String, String> get attributes => + Map<String, String>.unmodifiable(_attributes); + + /// Starts this trace. + /// + /// Using ```await``` with this method is only necessary when accurate timing + /// is relevant. + Future<void> start() { + assert(!_hasStarted); + + _hasStarted = true; + return FirebasePerformance.channel + .invokeMethod('Trace#start', <String, dynamic>{ + 'handle': _handle, + 'name': _name, + }); + } + + /// Stops this trace. + /// + /// Using ```await``` with this method is only necessary when accurate timing + /// is relevant. + Future<void> stop() { + assert(!_hasStopped); + assert(_hasStarted); + + final Map<String, dynamic> data = <String, dynamic>{ + 'handle': _handle, + 'name': _name, + 'counters': _counters, + 'attributes': _attributes, + }; + + _hasStopped = true; + return FirebasePerformance.channel.invokeMethod('Trace#stop', data); + } + + /// Increments the counter with the given [name] by [incrementBy]. + /// + /// The counter is incremented by 1 if [incrementBy] was not passed. If a + /// counter does not already exist, a new one will be created. If the trace + /// has not been started or has already been stopped, returns immediately + /// without taking action. + /// + /// The name of the counter requires no leading or + /// trailing whitespace, no leading underscore _ character, and max length of + /// 32 characters. + void incrementCounter(String name, [int incrementBy = 1]) { + assert(!_hasStopped); + assert(name != null); + assert(!name.startsWith(new RegExp(r'[_\s]'))); + assert(!name.contains(new RegExp(r'[_\s]$'))); + assert(name.length <= 32); + + _counters.putIfAbsent(name, () => 0); + _counters[name] += incrementBy; + } + + /// Sets a String [value] for the specified [attribute]. + /// + /// Updates the value of the attribute if the attribute already exists. If the + /// trace has been stopped, this method returns without adding the attribute. + /// The maximum number of attributes that can be added to a Trace are + /// [maxTraceCustomAttributes]. + /// + /// Name of the attribute has max length of [maxAttributeKeyLength] + /// characters. Value of the attribute has max length of + /// [maxAttributeValueLength] characters. + void putAttribute(String attribute, String value) { + assert(!_hasStopped); + assert(attribute != null); + assert(!attribute.startsWith(new RegExp(r'[_\s]'))); + assert(!attribute.contains(new RegExp(r'[_\s]$'))); + assert(attribute.length <= maxAttributeKeyLength); + assert(value.length <= maxAttributeValueLength); + assert(_attributes.length < maxTraceCustomAttributes); + + _attributes.putIfAbsent(attribute, () => value); + _attributes[attribute] = value; + } + + /// Removes an already added [attribute]. + /// + /// If the trace has been stopped, this method returns without removing the + /// attribute. + void removeAttribute(String attribute) { + assert(!_hasStopped); + + _attributes.remove(attribute); + } + + /// Returns the value of an [attribute]. + String getAttribute(String attribute) => _attributes[attribute]; +}
diff --git a/packages/firebase_performance/pubspec.yaml b/packages/firebase_performance/pubspec.yaml new file mode 100644 index 0000000..b1848f4 --- /dev/null +++ b/packages/firebase_performance/pubspec.yaml
@@ -0,0 +1,25 @@ +name: firebase_performance +description: Flutter plugin for Google Performance Monitoring for Firebase, an app + measurement solution that monitors traces and HTTP/S network requests on Android and + iOS. +version: 0.0.1 +author: Flutter Team <flutter-dev@googlegroups.com> +homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_performance + +dependencies: + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter + +flutter: + plugin: + androidPackage: io.flutter.plugins.firebaseperformance + iosPrefix: FLT + pluginClass: FirebasePerformancePlugin + +environment: + sdk: ">=2.0.0-dev.28.0 <3.0.0" + flutter: ">=0.2.4 <2.0.0" \ No newline at end of file
diff --git a/packages/firebase_performance/test/firebase_performance_test.dart b/packages/firebase_performance/test/firebase_performance_test.dart new file mode 100644 index 0000000..e370f92 --- /dev/null +++ b/packages/firebase_performance/test/firebase_performance_test.dart
@@ -0,0 +1,196 @@ +// Copyright 2017 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_performance/firebase_performance.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('$FirebasePerformance', () { + final FirebasePerformance performance = FirebasePerformance.instance; + final List<MethodCall> log = <MethodCall>[]; + bool performanceCollectionEnable = true; + int currentTraceHandle; + + setUp(() { + FirebasePerformance.channel + .setMockMethodCallHandler((MethodCall methodCall) async { + log.add(methodCall); + switch (methodCall.method) { + case 'FirebasePerformance#isPerformanceCollectionEnabled': + return performanceCollectionEnable; + case 'FirebasePerformance#setPerformanceCollectionEnabled': + performanceCollectionEnable = methodCall.arguments; + return null; + case 'Trace#start': + currentTraceHandle = methodCall.arguments['handle']; + return null; + case 'Trace#stop': + return null; + default: + return null; + } + }); + log.clear(); + }); + + test('isPerformanceCollectionEnabled', () async { + final bool enabled = await performance.isPerformanceCollectionEnabled(); + + expect(performanceCollectionEnable, enabled); + expect(log, <Matcher>[ + isMethodCall('FirebasePerformance#isPerformanceCollectionEnabled', + arguments: null), + ]); + }); + + test('setPerformanceCollectionEnabled', () async { + await performance.setPerformanceCollectionEnabled(true); + performanceCollectionEnable = true; + + await performance.setPerformanceCollectionEnabled(false); + performanceCollectionEnable = false; + + expect(log, <Matcher>[ + isMethodCall('FirebasePerformance#setPerformanceCollectionEnabled', + arguments: true), + isMethodCall('FirebasePerformance#setPerformanceCollectionEnabled', + arguments: false), + ]); + }); + + test('newTrace', () async { + final Trace trace = performance.newTrace('test-trace'); + await trace.start(); + + expect(log, <Matcher>[ + isMethodCall('Trace#start', arguments: <String, Object>{ + 'handle': currentTraceHandle, + 'name': 'test-trace', + }), + ]); + }); + + test('startTrace', () async { + await FirebasePerformance.startTrace('startTrace-test'); + + expect(log, <Matcher>[ + isMethodCall('Trace#start', arguments: <String, Object>{ + 'handle': currentTraceHandle, + 'name': 'startTrace-test', + }), + ]); + }); + + group('$Trace', () { + Trace testTrace; + + setUp(() { + testTrace = performance.newTrace('test'); + }); + + test('start', () async { + await testTrace.start(); + + expect(log, <Matcher>[ + isMethodCall('Trace#start', arguments: <String, Object>{ + 'handle': currentTraceHandle, + 'name': 'test', + }), + ]); + }); + + test('stop', () async { + await testTrace.start(); + await testTrace.stop(); + + expect(log, <Matcher>[ + isMethodCall('Trace#start', arguments: <String, Object>{ + 'handle': currentTraceHandle, + 'name': 'test', + }), + isMethodCall('Trace#stop', arguments: <String, dynamic>{ + 'handle': currentTraceHandle, + 'name': 'test', + 'counters': <String, int>{}, + 'attributes': <String, String>{}, + }), + ]); + }); + + test('incrementCounter', () async { + final Trace trace = performance.newTrace("test"); + trace.incrementCounter('counter1'); + + trace.incrementCounter('counter2'); + trace.incrementCounter('counter2'); + + trace.incrementCounter('counter3', 5); + trace.incrementCounter('counter3', 5); + + trace.incrementCounter('counter4', -5); + + await trace.start(); + await trace.stop(); + + expect(log, <Matcher>[ + isMethodCall('Trace#start', arguments: <String, Object>{ + 'handle': currentTraceHandle, + 'name': 'test', + }), + isMethodCall('Trace#stop', arguments: <String, dynamic>{ + 'handle': currentTraceHandle, + 'name': 'test', + 'counters': <String, int>{ + 'counter1': 1, + 'counter2': 2, + 'counter3': 10, + 'counter4': -5, + }, + 'attributes': <String, String>{}, + }), + ]); + }); + + test('putAttribute', () async { + testTrace.putAttribute('attr1', 'apple'); + testTrace.putAttribute('attr2', 'are'); + expect(testTrace.attributes, <String, String>{ + 'attr1': 'apple', + 'attr2': 'are', + }); + + testTrace.putAttribute('attr1', 'delicious'); + expect(testTrace.attributes, <String, String>{ + 'attr1': 'delicious', + 'attr2': 'are', + }); + }); + + test('removeAttribute', () async { + testTrace.putAttribute('attr1', 'apple'); + testTrace.putAttribute('attr2', 'are'); + testTrace.removeAttribute('no-attr'); + expect(testTrace.attributes, <String, String>{ + 'attr1': 'apple', + 'attr2': 'are', + }); + + testTrace.removeAttribute('attr1'); + expect(testTrace.attributes, <String, String>{ + 'attr2': 'are', + }); + }); + + test('getAttribute', () { + testTrace.putAttribute('attr1', 'apple'); + testTrace.putAttribute('attr2', 'are'); + expect(testTrace.getAttribute('attr1'), 'apple'); + + expect(testTrace.getAttribute('attr3'), isNull); + }); + }); + }); +}