Merge pull request #188 from alibaba/dev/yisheng

增加 firebase 监控插件
This commit is contained in:
ryan730
2019-04-22 15:20:45 +08:00
committed by GitHub
15 changed files with 168 additions and 83 deletions

Binary file not shown.

Binary file not shown.

View File

@ -64,4 +64,18 @@ dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//firebase
implementation 'com.google.firebase:firebase-core:16.0.8'
//Crashlytics SDK
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
// 性能监控
///implementation 'com.google.firebase:firebase-perf:16.2.3'
// 登陆
////implementation 'com.google.firebase:firebase-auth:16.0.3'
} }
//firebase
apply plugin: 'com.google.gms.google-services'
//Crashlytics SDK
apply plugin: 'io.fabric'
// 性能监控
///apply plugin: 'com.google.firebase.firebase-perf'

View File

@ -0,0 +1,47 @@
{
"project_info": {
"project_number": "1002138254102",
//"firebase_url": "https://ali-flutter-go.firebaseio.com",
"project_id": "ali-flutter-go",
"storage_bucket": "ali-flutter-go.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1002138254102:android:00e8533fa0274183",
"android_client_info": {
"package_name": "com.ali.fluttergo"
}
},
"oauth_client": [
{
"client_id": "1002138254102-2r4hs0mm1avp4p1qielecihnbugan693.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDFdL3GSwVDfejIq44pyOpiEBZ32dTGMVA"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1002138254102-2r4hs0mm1avp4p1qielecihnbugan693.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "1002138254102-qo9jp8c3lc69p9lclu0rtp5dmt1kulv7.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.ali.fluttergo"
}
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -3,10 +3,20 @@ buildscript {
repositories { repositories {
google() google()
jcenter() jcenter()
//Crashlytics SDK
maven {
url 'https://maven.fabric.io/public'
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.0' classpath 'com.android.tools.build:gradle:3.2.0'
//firebase
classpath 'com.google.gms:google-services:4.2.0'
//Crashlytics SDK
classpath 'io.fabric.tools:gradle:1.26.1'
// 性能监控
///classpath 'com.google.firebase:firebase-plugins:1.1.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
@ -15,6 +25,10 @@ allprojects {
repositories { repositories {
google() google()
jcenter() jcenter()
//Crashlytics SDK
maven {
url 'https://maven.google.com/'
}
} }
} }

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

View File

@ -1,61 +0,0 @@
PODS:
- city_pickers (0.0.1):
- Flutter
- Flutter (1.0.0)
- flutter_webview_plugin (0.0.1):
- Flutter
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- image_picker (0.0.1):
- Flutter
- shared_preferences (0.0.1):
- Flutter
- sqflite (0.0.1):
- Flutter
- FMDB (~> 2.7.2)
- url_launcher (0.0.1):
- Flutter
DEPENDENCIES:
- city_pickers (from `.symlinks/plugins/city_pickers/ios`)
- Flutter (from `.symlinks/flutter/ios`)
- flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- FMDB
EXTERNAL SOURCES:
city_pickers:
:path: ".symlinks/plugins/city_pickers/ios"
Flutter:
:path: ".symlinks/flutter/ios"
flutter_webview_plugin:
:path: ".symlinks/plugins/flutter_webview_plugin/ios"
image_picker:
:path: ".symlinks/plugins/image_picker/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher:
:path: ".symlinks/plugins/url_launcher/ios"
SPEC CHECKSUMS:
city_pickers: d6a9e81ec99140576f5adf29c75b7080ca9a9f99
Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
flutter_webview_plugin: 116575b48572029304775b768e9f15ebfc316274
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_picker: ee00aab0487cedc80a304085219503cc6d0f2e22
shared_preferences: 5a1d487c427ee18fcd3ea1f2a131569481834b53
sqflite: 801b6b0983f722fa29baf00d1476e4556ada6de4
url_launcher: 92b89c1029a0373879933c21642958c874539095
PODFILE CHECKSUM: 1e5af4103afd21ca5ead147d7b81d06f494f51a2
COCOAPODS: 1.5.3

View File

@ -29,6 +29,7 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 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, ); }; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 94722E5B22511D3600F63900 /* GoogleService-Info.plist */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 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, ); }; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
@ -78,6 +79,7 @@
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 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>"; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
94722E5B22511D3600F63900 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../../../Downloads/GoogleService-Info.plist"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; 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>"; }; 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>"; }; 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
@ -87,6 +89,8 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; 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>"; }; 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>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A9941E6EA19A9CEF6B117A70 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
CBA6E34746642008D95A119D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
DDA792F029EDD7A11295D192 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; DDA792F029EDD7A11295D192 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -129,6 +133,8 @@
0C172CA58CDB230D5DA80034 /* Pods */ = { 0C172CA58CDB230D5DA80034 /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
CBA6E34746642008D95A119D /* Pods-Runner.debug.xcconfig */,
A9941E6EA19A9CEF6B117A70 /* Pods-Runner.release.xcconfig */,
); );
name = Pods; name = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
@ -178,6 +184,7 @@
97C146F01CF9000F007C117D /* Runner */ = { 97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
94722E5B22511D3600F63900 /* GoogleService-Info.plist */,
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FA1CF9000F007C117D /* Main.storyboard */,
@ -282,6 +289,7 @@
0828E49B220692B500A59437 /* iPad Landscape@2x.png in Resources */, 0828E49B220692B500A59437 /* iPad Landscape@2x.png in Resources */,
0828E495220692B500A59437 /* iPhone Portrait-Retina 4.png in Resources */, 0828E495220692B500A59437 /* iPhone Portrait-Retina 4.png in Resources */,
0828E498220692B500A59437 /* iPhone XS Max Portrait.png in Resources */, 0828E498220692B500A59437 /* iPhone XS Max Portrait.png in Resources */,
94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */,
0828E496220692B500A59437 /* iPad Portrait.png in Resources */, 0828E496220692B500A59437 /* iPad Portrait.png in Resources */,
0828E49C220692B500A59437 /* iPhone Landscape-Retina HD 5.5.png in Resources */, 0828E49C220692B500A59437 /* iPhone Landscape-Retina HD 5.5.png in Resources */,
); );
@ -309,15 +317,11 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
inputFileListPaths = (
);
inputPaths = ( inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock", "${PODS_ROOT}/Manifest.lock",
); );
name = "[CP] Check Pods Manifest.lock"; name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = ( outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
); );
@ -345,21 +349,17 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
inputFileListPaths = (
);
inputPaths = ( inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = ( outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
@ -522,7 +522,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.ali.flutterRookieBook; PRODUCT_BUNDLE_IDENTIFIER = com.ali.fluttergo;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
@ -547,7 +547,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.ali.flutterRookieBook; PRODUCT_BUNDLE_IDENTIFIER = com.ali.fluttergo;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };

View File

@ -1,10 +1,15 @@
#include "AppDelegate.h" #include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #include "GeneratedPluginRegistrant.h"
@import Firebase;// firebase
@implementation AppDelegate @implementation AppDelegate
- (BOOL)application:(UIApplication *)application - (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];// firebase
[GeneratedPluginRegistrant registerWithRegistry:self]; [GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch. // Override point for customization after application launch.
[NSThread sleepForTimeInterval:2]; [NSThread sleepForTimeInterval:2];

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>1002138254102-qo9jp8c3lc69p9lclu0rtp5dmt1kulv7.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.1002138254102-qo9jp8c3lc69p9lclu0rtp5dmt1kulv7</string>
<key>API_KEY</key>
<string>AIzaSyD01jR14RevQibnzkg4tBUbFzc7UjKESFQ</string>
<key>GCM_SENDER_ID</key>
<string>1002138254102</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.ali.fluttergo</string>
<key>PROJECT_ID</key>
<string>ali-flutter-go</string>
<key>STORAGE_BUCKET</key>
<string>ali-flutter-go.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:1002138254102:ios:00e8533fa0274183</string>
<key>DATABASE_URL</key>
<string>https://ali-flutter-go.firebaseio.com</string>
</dict>
</plist>

View File

@ -8,6 +8,7 @@ import 'package:flutter_go/utils/provider.dart';
import 'package:flutter_go/utils/shared_preferences.dart'; import 'package:flutter_go/utils/shared_preferences.dart';
import 'package:flutter_go/views/first_page/home.dart'; import 'package:flutter_go/views/first_page/home.dart';
import 'package:flutter_go/model/search_history.dart'; import 'package:flutter_go/model/search_history.dart';
import 'package:flutter_go/utils/analytics.dart' as Analytics;
//import 'views/welcome_page/index.dart'; //import 'views/welcome_page/index.dart';
const int ThemeColor = 0xFFC91B3A; const int ThemeColor = 0xFFC91B3A;
@ -53,6 +54,7 @@ class MyApp extends StatelessWidget {
body: showWelcomePage() body: showWelcomePage()
), ),
onGenerateRoute: Application.router.generator, onGenerateRoute: Application.router.generator,
navigatorObservers: <NavigatorObserver>[Analytics.observer],
); );
} }
} }

View File

@ -1,6 +1,7 @@
import 'package:fluro/fluro.dart'; import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_go/utils/analytics.dart' show analytics;
import '../widgets/index.dart'; import '../widgets/index.dart';
import './router_handler.dart'; import './router_handler.dart';
@ -26,6 +27,9 @@ class Routes {
widgetDemosList.forEach((demo) { widgetDemosList.forEach((demo) {
Handler handler = new Handler( Handler handler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) { handlerFunc: (BuildContext context, Map<String, List<String>> params) {
print('组件路由params=$params widgetsItem=${demo.routerName}');
analytics.logEvent(
name: 'component', parameters: {'name': demo.routerName });
return demo.buildRouter(context); return demo.buildRouter(context);
}); });
router.define('${demo.routerName}', handler: handler); router.define('${demo.routerName}', handler: handler);

7
lib/utils/analytics.dart Normal file
View File

@ -0,0 +1,7 @@
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
//统计
FirebaseAnalytics analytics = FirebaseAnalytics();
FirebaseAnalyticsObserver observer =
FirebaseAnalyticsObserver(analytics: analytics);

View File

@ -14,7 +14,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.1.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -35,7 +35,7 @@ packages:
name: city_pickers name: city_pickers
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.14" version: "0.1.16"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -71,6 +71,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
firebase_analytics:
dependency: "direct main"
description:
name: firebase_analytics
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1+2"
firebase_core:
dependency: "direct main"
description:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.4"
fluro: fluro:
dependency: "direct main" dependency: "direct main"
description: description:
@ -136,7 +150,7 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.3+1" version: "0.12.5"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -164,7 +178,7 @@ packages:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.2"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
@ -183,7 +197,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.4" version: "1.5.5"
sqflite: sqflite:
dependency: "direct main" dependency: "direct main"
description: description:
@ -204,7 +218,7 @@ packages:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.8" version: "2.0.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
@ -232,7 +246,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.2" version: "0.2.4"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -255,5 +269,5 @@ packages:
source: hosted source: hosted
version: "2.0.8" version: "2.0.8"
sdks: sdks:
dart: ">=2.1.1-dev.0.0 <3.0.0" dart: ">=2.2.0 <3.0.0"
flutter: ">=0.5.6 <2.0.0" flutter: ">=0.5.6 <2.0.0"

View File

@ -7,7 +7,7 @@ description: flutter_go
# Both the version and the builder number may be overridden in flutter # Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively. # build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org. # Read more about versioning at semver.org.
version: 0.0.5 #version: 0.0.5firebase_auth
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.0.0-dev.68.0 <3.0.0"
@ -32,6 +32,9 @@ dependencies:
# 日期格式化 # 日期格式化
intl: 0.15.7 intl: 0.15.7
city_pickers: ^0.1.0 city_pickers: ^0.1.0
firebase_analytics: ^2.0.2+1
#firebase_auth: ^0.8.3 #auth
firebase_core: ^0.3.0 # add dependency for Firebase Core
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: