diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b4900e34..d42f3d943 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Removed +- Analytics: removed Firebase Analytics (kept Firebase Crashlytics) ## [v1.4.4] - 2021-06-25 ### Added diff --git a/assets/terms.md b/assets/terms.md index 1a35e35a7..752eb1e13 100644 --- a/assets/terms.md +++ b/assets/terms.md @@ -9,7 +9,7 @@ This app is released “as-is”, without any warranty, responsibility or liabil # 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. -__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 [Sources](https://github.com/deckerst/aves) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 8fbfd2bc9..4f1070ee1 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -3,8 +3,8 @@ "@appName": {}, "welcomeMessage": "Welcome to Aves", "@welcomeMessage": {}, - "welcomeAnalyticsToggle": "Allow anonymous analytics and crash reporting (optional)", - "@welcomeAnalyticsToggle": {}, + "welcomeCrashReportToggle": "Allow anonymous crash reporting (optional)", + "@welcomeCrashReportToggle": {}, "welcomeTermsToggle": "I agree to the terms and conditions", "@welcomeTermsToggle": {}, "itemCount": "{count, plural, =1{1 item} other{{count} items}}", @@ -634,8 +634,8 @@ "settingsSectionPrivacy": "Privacy", "@settingsSectionPrivacy": {}, - "settingsEnableAnalytics": "Allow anonymous analytics and crash reporting", - "@settingsEnableAnalytics": {}, + "settingsEnableCrashReport": "Allow anonymous crash reporting", + "@settingsEnableCrashReport": {}, "settingsSaveSearchHistory": "Save search history", "@settingsSaveSearchHistory": {}, diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index f80a4c13a..92f04ce2c 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -1,7 +1,7 @@ { "appName": "아베스", "welcomeMessage": "아베스 사용을 환영합니다", - "welcomeAnalyticsToggle": "진단 데이터를 보내는 것에 동의합니다 (선택)", + "welcomeCrashReportToggle": "오류 보고서를 보내는 것에 동의합니다 (선택)", "welcomeTermsToggle": "이용약관에 동의합니다", "itemCount": "{count, plural, other{{count}개}}", @@ -301,7 +301,7 @@ "settingsSubtitleThemeTextAlignmentRight": "오른쪽", "settingsSectionPrivacy": "개인정보 보호", - "settingsEnableAnalytics": "진단 데이터 보내기", + "settingsEnableCrashReport": "오류 보고서 보내기", "settingsSaveSearchHistory": "검색기록", "settingsHiddenFiltersTile": "숨겨진 필터", diff --git a/lib/model/settings/settings.dart b/lib/model/settings/settings.dart index 18e9cb73b..41b8da7ea 100644 --- a/lib/model/settings/settings.dart +++ b/lib/model/settings/settings.dart @@ -6,7 +6,6 @@ import 'package:aves/model/settings/screen_on.dart'; import 'package:aves/model/source/enums.dart'; import 'package:aves/utils/pedantic.dart'; import 'package:collection/collection.dart'; -import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/material.dart'; @@ -100,11 +99,6 @@ class Settings extends ChangeNotifier { Future initFirebase() async { await Firebase.app().setAutomaticDataCollectionEnabled(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 reset() { diff --git a/lib/model/source/media_store_source.dart b/lib/model/source/media_store_source.dart index 0a4919d78..a464f24ce 100644 --- a/lib/model/source/media_store_source.dart +++ b/lib/model/source/media_store_source.dart @@ -9,9 +9,7 @@ import 'package:aves/model/source/collection_source.dart'; import 'package:aves/model/source/enums.dart'; import 'package:aves/services/services.dart'; import 'package:aves/utils/android_file_utils.dart'; -import 'package:aves/utils/math_utils.dart'; import 'package:collection/collection.dart'; -import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:flutter/material.dart'; class MediaStoreSource extends CollectionSource { @@ -109,22 +107,12 @@ class MediaStoreSource extends CollectionSource { await locateEntries(); stateNotifier.value = SourceState.ready; - _reportCollectionDimensions(); debugPrint('$runtimeType refresh done, elapsed=${stopwatch.elapsed}'); }, 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: // 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 diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index 8d313e1d7..95aabe5d0 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -75,7 +75,7 @@ class Constants { sourceUrl: 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus', ), Dependency( - name: 'FlutterFire (Core, Analytics, Crashlytics)', + name: 'FlutterFire (Core, Crashlytics)', license: 'BSD 3-Clause', licenseUrl: 'https://github.com/FirebaseExtended/flutterfire/blob/master/LICENSE', sourceUrl: 'https://github.com/FirebaseExtended/flutterfire', diff --git a/lib/utils/math_utils.dart b/lib/utils/math_utils.dart index 33c49fe99..2dd6e1ede 100644 --- a/lib/utils/math_utils.dart +++ b/lib/utils/math_utils.dart @@ -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; 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); -} diff --git a/lib/widgets/aves_app.dart b/lib/widgets/aves_app.dart index 388d420c0..ebc14eae1 100644 --- a/lib/widgets/aves_app.dart +++ b/lib/widgets/aves_app.dart @@ -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/home_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_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/foundation.dart'; @@ -140,7 +138,6 @@ class _AvesAppState extends State { await settings.init(); await settings.initFirebase(); _navigatorObservers = [ - FirebaseAnalyticsObserver(analytics: FirebaseAnalytics()), CrashlyticsRouteTracker(), ]; } diff --git a/lib/widgets/debug/firebase.dart b/lib/widgets/debug/firebase.dart index c4c1fee0c..be073a05e 100644 --- a/lib/widgets/debug/firebase.dart +++ b/lib/widgets/debug/firebase.dart @@ -1,6 +1,5 @@ import 'package:aves/widgets/common/identity/aves_expansion_tile.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_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/material.dart'; @@ -15,21 +14,9 @@ class DebugFirebaseSection extends StatelessWidget { children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 8), - child: Row( - children: [ - ElevatedButton( - 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'), - ), - ], + child: ElevatedButton( + onPressed: FirebaseCrashlytics.instance.crash, + child: const Text('Crash'), ), ), Padding( diff --git a/lib/widgets/settings/privacy/privacy.dart b/lib/widgets/settings/privacy/privacy.dart index 713717b38..38bb252a1 100644 --- a/lib/widgets/settings/privacy/privacy.dart +++ b/lib/widgets/settings/privacy/privacy.dart @@ -34,7 +34,7 @@ class PrivacySection extends StatelessWidget { SwitchListTile( value: currentIsCrashlyticsEnabled, onChanged: (v) => settings.isCrashlyticsEnabled = v, - title: Text(context.l10n.settingsEnableAnalytics), + title: Text(context.l10n.settingsEnableCrashReport), ), SwitchListTile( value: currentSaveSearchHistory, diff --git a/lib/widgets/welcome_page.dart b/lib/widgets/welcome_page.dart index b60953993..ac2eb1217 100644 --- a/lib/widgets/welcome_page.dart +++ b/lib/widgets/welcome_page.dart @@ -105,7 +105,7 @@ class _WelcomePageState extends State { onChanged: (v) { if (v != null) setState(() => settings.isCrashlyticsEnabled = v); }, - text: context.l10n.welcomeAnalyticsToggle, + text: context.l10n.welcomeCrashReportToggle, ), LabeledCheckbox( key: const Key('agree-checkbox'), diff --git a/pubspec.lock b/pubspec.lock index d838b9b18..446e3e934 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -229,34 +229,6 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 3508abbaa..a696ad29d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,7 +29,6 @@ dependencies: url: git://github.com/deckerst/fijkplayer.git ref: aves firebase_core: - firebase_analytics: firebase_crashlytics: flex_color_picker: flutter_highlight: diff --git a/test/utils/math_utils_test.dart b/test/utils/math_utils_test.dart index a0440626f..5ae397247 100644 --- a/test/utils/math_utils_test.dart +++ b/test/utils/math_utils_test.dart @@ -25,12 +25,4 @@ void main() { expect(roundToPrecision(1.2345678, decimals: 3), 1.235); 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); - }); }