Skip to content

Commit

Permalink
Merge pull request #4 from flowbehappy/pingyu/add-google-analytics
Browse files Browse the repository at this point in the history
*: add Google Analytics
  • Loading branch information
flowbehappy authored Jul 25, 2023
2 parents 13fa35e + c470e66 commit 26bfc58
Show file tree
Hide file tree
Showing 19 changed files with 432 additions and 4 deletions.
3 changes: 3 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ if (flutterVersionName == null) {
}

apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

Expand Down
46 changes: 46 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"project_info": {
"project_number": "940446628757",
"project_id": "moyubie-cbfbb",
"storage_bucket": "moyubie-cbfbb.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:940446628757:android:5a9bc1d91ac4ce0ab5549c",
"android_client_info": {
"package_name": "com.moyuteam.moyubie"
}
},
"oauth_client": [
{
"client_id": "940446628757-qsrankia3v57ht9hic95ertjvfk77fne.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCClhx2WxuK2Mn3iuzsdfP5lCa_RETQIbs"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "940446628757-qsrankia3v57ht9hic95ertjvfk77fne.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "940446628757-qcck4cjmcbej8q4esctbf7lagpmb1nlt.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.moyuteam.moyubie"
}
}
]
}
}
}
],
"configuration_version": "1"
}
3 changes: 3 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.10'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
114 changes: 114 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,103 @@
PODS:
- device_info_plus (0.0.1):
- Flutter
- Firebase/Analytics (10.12.0):
- Firebase/Core
- Firebase/Core (10.12.0):
- Firebase/CoreOnly
- FirebaseAnalytics (~> 10.12.0)
- Firebase/CoreOnly (10.12.0):
- FirebaseCore (= 10.12.0)
- firebase_analytics (10.4.4):
- Firebase/Analytics (= 10.12.0)
- firebase_core
- Flutter
- firebase_core (2.15.0):
- Firebase/CoreOnly (= 10.12.0)
- Flutter
- FirebaseAnalytics (10.12.0):
- FirebaseAnalytics/AdIdSupport (= 10.12.0)
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- FirebaseAnalytics/AdIdSupport (10.12.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleAppMeasurement (= 10.12.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- FirebaseCore (10.12.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Logger (~> 7.8)
- FirebaseCoreInternal (10.12.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseInstallations (10.12.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- Flutter (1.0.0)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- GoogleAppMeasurement (10.12.0):
- GoogleAppMeasurement/AdIdSupport (= 10.12.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (10.12.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.12.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (10.12.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleUtilities/AppDelegateSwizzler (7.11.1):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.11.1):
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.11.1):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (7.11.1):
- GoogleUtilities/Logger
- GoogleUtilities/Network (7.11.1):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.11.1)"
- GoogleUtilities/Reachability (7.11.1):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.11.1):
- GoogleUtilities/Logger
- nanopb (2.30909.0):
- nanopb/decode (= 2.30909.0)
- nanopb/encode (= 2.30909.0)
- nanopb/decode (2.30909.0)
- nanopb/encode (2.30909.0)
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- PromisesObjC (2.2.0)
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
Expand All @@ -22,6 +110,8 @@ PODS:

DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- Flutter (from `Flutter`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
Expand All @@ -32,11 +122,24 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- Firebase
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreInternal
- FirebaseInstallations
- FMDB
- GoogleAppMeasurement
- GoogleUtilities
- nanopb
- PromisesObjC

EXTERNAL SOURCES:
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
firebase_analytics:
:path: ".symlinks/plugins/firebase_analytics/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
Flutter:
:path: Flutter
package_info_plus:
Expand All @@ -54,10 +157,21 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
Firebase: 07150e75d142fb9399f6777fa56a187b17f833a0
firebase_analytics: 3ff822ee2e90f95b61f0da300df20b378d380fbb
firebase_core: e477125798fc37cd4ab43ca6a8536bf7e0929c00
FirebaseAnalytics: 0270389efbe3022b54ec4588862dabec3477ee98
FirebaseCore: f86a1394906b97ac445ae49c92552a9425831bed
FirebaseCoreInternal: 950500ad8a08963657f6d8c67b579740c06d6aa1
FirebaseInstallations: 7b99ef103f013624444c614397038219c45f8e63
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
GoogleAppMeasurement: 2d800fab85e7848b1e66a6f8ce5bca06c5aad892
GoogleUtilities: 9aa0ad5a7bc171f8bae016300bfcfa3fb8425749
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
vibration: 7d883d141656a1c1a6d8d238616b2042a51a1241
Expand Down
4 changes: 4 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
64427A76CF302576989D068C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 513E20570F3897783A8AD9E0 /* GoogleService-Info.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
8092DD86CE987ED8CD14719E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 841D33EE2B99B7B56EBEC80B /* Pods_Runner.framework */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
Expand All @@ -35,6 +36,7 @@
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
4C14E965B0A1E2B5BD4784F5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
513E20570F3897783A8AD9E0 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -90,6 +92,7 @@
97C146EF1CF9000F007C117D /* Products */,
8BCFB1034CF6AFBB12705849 /* Pods */,
C0786FBBE77AE2E51A89DD32 /* Frameworks */,
513E20570F3897783A8AD9E0 /* GoogleService-Info.plist */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -191,6 +194,7 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
64427A76CF302576989D068C /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
6 changes: 6 additions & 0 deletions ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-FIRAnalyticsDebugEnabled"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
Expand Down
34 changes: 34 additions & 0 deletions ios/Runner/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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>940446628757-qcck4cjmcbej8q4esctbf7lagpmb1nlt.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.940446628757-qcck4cjmcbej8q4esctbf7lagpmb1nlt</string>
<key>API_KEY</key>
<string>AIzaSyBb-3PpZS9shNJW6MFwOjval9KpPxL60SM</string>
<key>GCM_SENDER_ID</key>
<string>940446628757</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.moyuteam.moyubie</string>
<key>PROJECT_ID</key>
<string>moyubie-cbfbb</string>
<key>STORAGE_BUCKET</key>
<string>moyubie-cbfbb.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<true></true>
<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:940446628757:ios:97d377b8187c8e5db5549c</string>
</dict>
</plist>
7 changes: 7 additions & 0 deletions ios/firebase_app_id_file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"file_generated_by": "FlutterFire CLI",
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
"GOOGLE_APP_ID": "1:940446628757:ios:97d377b8187c8e5db5549c",
"FIREBASE_PROJECT_ID": "moyubie-cbfbb",
"GCM_SENDER_ID": "940446628757"
}
17 changes: 13 additions & 4 deletions lib/components/news.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:io';

import 'package:dual_screen/dual_screen.dart';
import 'package:easy_refresh/easy_refresh.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:moyubie/components/chat_room.dart';
Expand Down Expand Up @@ -591,7 +592,10 @@ class _NewsWindowState extends State<NewsWindow>
key: _tab_key[0],
controller: _rfrctl,
header: refreshHeader,
onRefresh: refreshNews,
onRefresh: () async {
FirebaseAnalytics.instance.logEvent(name: "refresh_news");
await refreshNews();
},
child: ListView(
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
children: [
Expand All @@ -606,7 +610,10 @@ class _NewsWindowState extends State<NewsWindow>
key: _tab_key[1],
controller: _rfrctl,
header: aiPromoteHeader,
onRefresh: promoteNews,
onRefresh: () async {
FirebaseAnalytics.instance.logEvent(name: "promote_news");
await promoteNews();
},
child: ListView(
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
children: [
Expand Down Expand Up @@ -667,8 +674,10 @@ class _NewsWindowState extends State<NewsWindow>
const MaterialStatePropertyAll(TextStyle(color: Colors.white)),
trailing: [
IconButton(
onPressed: () {
refreshNews();
onPressed: () async {
FirebaseAnalytics.instance.logEvent(
name: "search_news", parameters: {"query": _search.text});
await refreshNews();
},
icon: const Icon(
Icons.search,
Expand Down
Loading

0 comments on commit 26bfc58

Please sign in to comment.