removed firebase analytics

This commit is contained in:
Thibault Deckers 2021-06-29 08:48:11 +09:00
parent a4d142b6d0
commit e76376be91
15 changed files with 15 additions and 90 deletions

View file

@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [Unreleased] ## [Unreleased]
### Removed
- Analytics: removed Firebase Analytics (kept Firebase Crashlytics)
## [v1.4.4] - 2021-06-25 ## [v1.4.4] - 2021-06-25
### Added ### Added

View file

@ -9,7 +9,7 @@ This app is released “as-is”, without any warranty, responsibility or liabil
# Privacy policy # Privacy policy
Aves does not collect any personal data in its standard use. We never have access to your photos and videos. This also means that we cannot get them back for you if you delete them without backing them up. Aves does not collect any personal data in its standard use. We never have access to your photos and videos. This also means that we cannot get them back for you if you delete them without backing them up.
__We collect anonymous data to improve the app.__ We use Google Firebase for Analytics and Crash Reporting, and the anonymous analytics data are stored on their servers. Please note that those are anonymous data, there is absolutely nothing personal about those data. __We collect anonymous data to improve the app.__ We use Google Firebase for Crash Reporting, and the anonymous data are stored on their servers. Please note that those are anonymous data, there is absolutely nothing personal about those data.
## Links ## Links
[Sources](https://github.com/deckerst/aves) [Sources](https://github.com/deckerst/aves)

View file

@ -3,8 +3,8 @@
"@appName": {}, "@appName": {},
"welcomeMessage": "Welcome to Aves", "welcomeMessage": "Welcome to Aves",
"@welcomeMessage": {}, "@welcomeMessage": {},
"welcomeAnalyticsToggle": "Allow anonymous analytics and crash reporting (optional)", "welcomeCrashReportToggle": "Allow anonymous crash reporting (optional)",
"@welcomeAnalyticsToggle": {}, "@welcomeCrashReportToggle": {},
"welcomeTermsToggle": "I agree to the terms and conditions", "welcomeTermsToggle": "I agree to the terms and conditions",
"@welcomeTermsToggle": {}, "@welcomeTermsToggle": {},
"itemCount": "{count, plural, =1{1 item} other{{count} items}}", "itemCount": "{count, plural, =1{1 item} other{{count} items}}",
@ -634,8 +634,8 @@
"settingsSectionPrivacy": "Privacy", "settingsSectionPrivacy": "Privacy",
"@settingsSectionPrivacy": {}, "@settingsSectionPrivacy": {},
"settingsEnableAnalytics": "Allow anonymous analytics and crash reporting", "settingsEnableCrashReport": "Allow anonymous crash reporting",
"@settingsEnableAnalytics": {}, "@settingsEnableCrashReport": {},
"settingsSaveSearchHistory": "Save search history", "settingsSaveSearchHistory": "Save search history",
"@settingsSaveSearchHistory": {}, "@settingsSaveSearchHistory": {},

View file

@ -1,7 +1,7 @@
{ {
"appName": "아베스", "appName": "아베스",
"welcomeMessage": "아베스 사용을 환영합니다", "welcomeMessage": "아베스 사용을 환영합니다",
"welcomeAnalyticsToggle": "진단 데이터를 보내는 것에 동의합니다 (선택)", "welcomeCrashReportToggle": "오류 보고서를 보내는 것에 동의합니다 (선택)",
"welcomeTermsToggle": "이용약관에 동의합니다", "welcomeTermsToggle": "이용약관에 동의합니다",
"itemCount": "{count, plural, other{{count}개}}", "itemCount": "{count, plural, other{{count}개}}",
@ -301,7 +301,7 @@
"settingsSubtitleThemeTextAlignmentRight": "오른쪽", "settingsSubtitleThemeTextAlignmentRight": "오른쪽",
"settingsSectionPrivacy": "개인정보 보호", "settingsSectionPrivacy": "개인정보 보호",
"settingsEnableAnalytics": "진단 데이터 보내기", "settingsEnableCrashReport": "오류 보고서 보내기",
"settingsSaveSearchHistory": "검색기록", "settingsSaveSearchHistory": "검색기록",
"settingsHiddenFiltersTile": "숨겨진 필터", "settingsHiddenFiltersTile": "숨겨진 필터",

View file

@ -6,7 +6,6 @@ import 'package:aves/model/settings/screen_on.dart';
import 'package:aves/model/source/enums.dart'; import 'package:aves/model/source/enums.dart';
import 'package:aves/utils/pedantic.dart'; import 'package:aves/utils/pedantic.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -100,11 +99,6 @@ class Settings extends ChangeNotifier {
Future<void> initFirebase() async { Future<void> initFirebase() async {
await Firebase.app().setAutomaticDataCollectionEnabled(isCrashlyticsEnabled); await Firebase.app().setAutomaticDataCollectionEnabled(isCrashlyticsEnabled);
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(isCrashlyticsEnabled); await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(isCrashlyticsEnabled);
await FirebaseAnalytics().setAnalyticsCollectionEnabled(isCrashlyticsEnabled);
// enable analytics debug mode:
// # %ANDROID_SDK%/platform-tools/adb shell setprop debug.firebase.analytics.app deckers.thibault.aves.debug
// disable analytics debug mode:
// # %ANDROID_SDK%/platform-tools/adb shell setprop debug.firebase.analytics.app .none.
} }
Future<void> reset() { Future<void> reset() {

View file

@ -9,9 +9,7 @@ import 'package:aves/model/source/collection_source.dart';
import 'package:aves/model/source/enums.dart'; import 'package:aves/model/source/enums.dart';
import 'package:aves/services/services.dart'; import 'package:aves/services/services.dart';
import 'package:aves/utils/android_file_utils.dart'; import 'package:aves/utils/android_file_utils.dart';
import 'package:aves/utils/math_utils.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class MediaStoreSource extends CollectionSource { class MediaStoreSource extends CollectionSource {
@ -109,22 +107,12 @@ class MediaStoreSource extends CollectionSource {
await locateEntries(); await locateEntries();
stateNotifier.value = SourceState.ready; stateNotifier.value = SourceState.ready;
_reportCollectionDimensions();
debugPrint('$runtimeType refresh done, elapsed=${stopwatch.elapsed}'); debugPrint('$runtimeType refresh done, elapsed=${stopwatch.elapsed}');
}, },
onError: (error) => debugPrint('$runtimeType stream error=$error'), onError: (error) => debugPrint('$runtimeType stream error=$error'),
); );
} }
void _reportCollectionDimensions() {
if (!settings.isCrashlyticsEnabled) return;
final analytics = FirebaseAnalytics();
analytics.setUserProperty(name: 'local_item_count', value: (ceilBy(allEntries.length, 3)).toString());
analytics.setUserProperty(name: 'album_count', value: (ceilBy(rawAlbums.length, 1)).toString());
analytics.setUserProperty(name: 'tag_count', value: (ceilBy(sortedTags.length, 1)).toString());
analytics.setUserProperty(name: 'country_count', value: (ceilBy(sortedCountries.length, 1)).toString());
}
// returns URIs to retry later. They could be URIs that are: // returns URIs to retry later. They could be URIs that are:
// 1) currently being processed during bulk move/deletion // 1) currently being processed during bulk move/deletion
// 2) registered in the Media Store but still being processed by their owner in a temporary location // 2) registered in the Media Store but still being processed by their owner in a temporary location

View file

@ -75,7 +75,7 @@ class Constants {
sourceUrl: 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus', sourceUrl: 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus',
), ),
Dependency( Dependency(
name: 'FlutterFire (Core, Analytics, Crashlytics)', name: 'FlutterFire (Core, Crashlytics)',
license: 'BSD 3-Clause', license: 'BSD 3-Clause',
licenseUrl: 'https://github.com/FirebaseExtended/flutterfire/blob/master/LICENSE', licenseUrl: 'https://github.com/FirebaseExtended/flutterfire/blob/master/LICENSE',
sourceUrl: 'https://github.com/FirebaseExtended/flutterfire', sourceUrl: 'https://github.com/FirebaseExtended/flutterfire',

View file

@ -10,9 +10,3 @@ double toRadians(num degrees) => degrees * _piOver180;
int highestPowerOf2(num x) => x < 1 ? 0 : pow(2, (log(x) / _log2).floor()) as int; int highestPowerOf2(num x) => x < 1 ? 0 : pow(2, (log(x) / _log2).floor()) as int;
double roundToPrecision(final double value, {required final int decimals}) => (value * pow(10, decimals)).round() / pow(10, decimals); double roundToPrecision(final double value, {required final int decimals}) => (value * pow(10, decimals)).round() / pow(10, decimals);
// e.g. x=12345, precision=3 should return 13000
int ceilBy(num x, int precision) {
final factor = pow(10, precision);
return (x / factor).ceil() * (factor as int);
}

View file

@ -15,8 +15,6 @@ import 'package:aves/widgets/common/extensions/build_context.dart';
import 'package:aves/widgets/common/providers/highlight_info_provider.dart'; import 'package:aves/widgets/common/providers/highlight_info_provider.dart';
import 'package:aves/widgets/home_page.dart'; import 'package:aves/widgets/home_page.dart';
import 'package:aves/widgets/welcome_page.dart'; import 'package:aves/widgets/welcome_page.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
@ -140,7 +138,6 @@ class _AvesAppState extends State<AvesApp> {
await settings.init(); await settings.init();
await settings.initFirebase(); await settings.initFirebase();
_navigatorObservers = [ _navigatorObservers = [
FirebaseAnalyticsObserver(analytics: FirebaseAnalytics()),
CrashlyticsRouteTracker(), CrashlyticsRouteTracker(),
]; ];
} }

View file

@ -1,6 +1,5 @@
import 'package:aves/widgets/common/identity/aves_expansion_tile.dart'; import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
import 'package:aves/widgets/viewer/info/common.dart'; import 'package:aves/widgets/viewer/info/common.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -15,21 +14,9 @@ class DebugFirebaseSection extends StatelessWidget {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row( child: ElevatedButton(
children: [ onPressed: FirebaseCrashlytics.instance.crash,
ElevatedButton( child: const Text('Crash'),
onPressed: FirebaseCrashlytics.instance.crash,
child: const Text('Crash'),
),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => FirebaseAnalytics().logEvent(
name: 'debug_test',
parameters: {'time': DateTime.now().toIso8601String()},
),
child: const Text('Send event'),
),
],
), ),
), ),
Padding( Padding(

View file

@ -34,7 +34,7 @@ class PrivacySection extends StatelessWidget {
SwitchListTile( SwitchListTile(
value: currentIsCrashlyticsEnabled, value: currentIsCrashlyticsEnabled,
onChanged: (v) => settings.isCrashlyticsEnabled = v, onChanged: (v) => settings.isCrashlyticsEnabled = v,
title: Text(context.l10n.settingsEnableAnalytics), title: Text(context.l10n.settingsEnableCrashReport),
), ),
SwitchListTile( SwitchListTile(
value: currentSaveSearchHistory, value: currentSaveSearchHistory,

View file

@ -105,7 +105,7 @@ class _WelcomePageState extends State<WelcomePage> {
onChanged: (v) { onChanged: (v) {
if (v != null) setState(() => settings.isCrashlyticsEnabled = v); if (v != null) setState(() => settings.isCrashlyticsEnabled = v);
}, },
text: context.l10n.welcomeAnalyticsToggle, text: context.l10n.welcomeCrashReportToggle,
), ),
LabeledCheckbox( LabeledCheckbox(
key: const Key('agree-checkbox'), key: const Key('agree-checkbox'),

View file

@ -229,34 +229,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.0" version: "6.1.0"
firebase:
dependency: transitive
description:
name: firebase
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.1"
firebase_analytics:
dependency: "direct main"
description:
name: firebase_analytics
url: "https://pub.dartlang.org"
source: hosted
version: "8.1.2"
firebase_analytics_platform_interface:
dependency: transitive
description:
name: firebase_analytics_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
firebase_analytics_web:
dependency: transitive
description:
name: firebase_analytics_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0+1"
firebase_core: firebase_core:
dependency: "direct main" dependency: "direct main"
description: description:

View file

@ -29,7 +29,6 @@ dependencies:
url: git://github.com/deckerst/fijkplayer.git url: git://github.com/deckerst/fijkplayer.git
ref: aves ref: aves
firebase_core: firebase_core:
firebase_analytics:
firebase_crashlytics: firebase_crashlytics:
flex_color_picker: flex_color_picker:
flutter_highlight: flutter_highlight:

View file

@ -25,12 +25,4 @@ void main() {
expect(roundToPrecision(1.2345678, decimals: 3), 1.235); expect(roundToPrecision(1.2345678, decimals: 3), 1.235);
expect(roundToPrecision(0, decimals: 3), 0); expect(roundToPrecision(0, decimals: 3), 0);
}); });
test('rounding up to a given precision before the decimal', () {
expect(ceilBy(12345.678, 3), 13000);
expect(ceilBy(42, 3), 1000);
expect(ceilBy(0, 3), 0);
expect(ceilBy(-42, 3), 0);
expect(ceilBy(-12345.678, 3), -12000);
});
} }