welcome: crash reporting opt-out
This commit is contained in:
parent
fe12767b4a
commit
ebe02f4dfb
4 changed files with 35 additions and 10 deletions
|
@ -7,6 +7,7 @@ import 'package:aves/widgets/home_page.dart';
|
||||||
import 'package:aves/widgets/welcome_page.dart';
|
import 'package:aves/widgets/welcome_page.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/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:overlay_support/overlay_support.dart';
|
import 'package:overlay_support/overlay_support.dart';
|
||||||
|
@ -47,7 +48,16 @@ class _AvesAppState extends State<AvesApp> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _setup() async {
|
Future<void> _setup() async {
|
||||||
await Firebase.initializeApp().then((app) => FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError);
|
await Firebase.initializeApp().then((app) {
|
||||||
|
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
|
||||||
|
FirebaseCrashlytics.instance.setCustomKey(
|
||||||
|
'build_mode',
|
||||||
|
kReleaseMode
|
||||||
|
? 'release'
|
||||||
|
: kProfileMode
|
||||||
|
? 'profile'
|
||||||
|
: 'debug');
|
||||||
|
});
|
||||||
await settings.init();
|
await settings.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Settings extends ChangeNotifier {
|
||||||
|
|
||||||
set hasAcceptedTerms(bool newValue) => setAndNotify(hasAcceptedTermsKey, newValue);
|
set hasAcceptedTerms(bool newValue) => setAndNotify(hasAcceptedTermsKey, newValue);
|
||||||
|
|
||||||
bool get isCrashlyticsEnabled => getBoolOrDefault(isCrashlyticsEnabledKey, false);
|
bool get isCrashlyticsEnabled => getBoolOrDefault(isCrashlyticsEnabledKey, true);
|
||||||
|
|
||||||
set isCrashlyticsEnabled(bool newValue) {
|
set isCrashlyticsEnabled(bool newValue) {
|
||||||
setAndNotify(isCrashlyticsEnabledKey, newValue);
|
setAndNotify(isCrashlyticsEnabledKey, newValue);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import 'package:aves/widgets/common/data_providers/media_store_collection_provid
|
||||||
import 'package:aves/widgets/common/routes.dart';
|
import 'package:aves/widgets/common/routes.dart';
|
||||||
import 'package:aves/widgets/filter_grids/albums_page.dart';
|
import 'package:aves/widgets/filter_grids/albums_page.dart';
|
||||||
import 'package:aves/widgets/fullscreen/fullscreen_page.dart';
|
import 'package:aves/widgets/fullscreen/fullscreen_page.dart';
|
||||||
|
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
import 'package:pedantic/pedantic.dart';
|
||||||
|
@ -94,6 +95,7 @@ class _HomePageState extends State<HomePage> {
|
||||||
_shortcutFilters = extraFilters != null ? (extraFilters as List).cast<String>() : null;
|
_shortcutFilters = extraFilters != null ? (extraFilters as List).cast<String>() : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unawaited(FirebaseCrashlytics.instance.setCustomKey('app_mode', AvesApp.mode.toString()));
|
||||||
|
|
||||||
if (AvesApp.mode != AppMode.view) {
|
if (AvesApp.mode != AppMode.view) {
|
||||||
_mediaStore = MediaStoreSource();
|
_mediaStore = MediaStoreSource();
|
||||||
|
|
|
@ -52,6 +52,7 @@ class _WelcomePageState extends State<WelcomePage> {
|
||||||
children: [
|
children: [
|
||||||
..._buildTop(context),
|
..._buildTop(context),
|
||||||
Flexible(child: _buildTerms(terms)),
|
Flexible(child: _buildTerms(terms)),
|
||||||
|
SizedBox(height: 16),
|
||||||
..._buildBottomControls(context),
|
..._buildBottomControls(context),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -92,12 +93,23 @@ class _WelcomePageState extends State<WelcomePage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildBottomControls(BuildContext context) {
|
List<Widget> _buildBottomControls(BuildContext context) {
|
||||||
final checkbox = LabeledCheckbox(
|
final checkboxes = Column(
|
||||||
key: Key('agree-checkbox'),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
value: _hasAcceptedTerms,
|
children: [
|
||||||
onChanged: (v) => setState(() => _hasAcceptedTerms = v),
|
LabeledCheckbox(
|
||||||
text: 'I agree to the terms and conditions',
|
value: settings.isCrashlyticsEnabled,
|
||||||
|
onChanged: (v) => setState(() => settings.isCrashlyticsEnabled = v),
|
||||||
|
text: 'Allow anonymous crash reporting',
|
||||||
|
),
|
||||||
|
LabeledCheckbox(
|
||||||
|
key: Key('agree-termsCheckbox'),
|
||||||
|
value: _hasAcceptedTerms,
|
||||||
|
onChanged: (v) => setState(() => _hasAcceptedTerms = v),
|
||||||
|
text: 'I agree to the terms and conditions',
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
final button = RaisedButton(
|
final button = RaisedButton(
|
||||||
key: Key('continue-button'),
|
key: Key('continue-button'),
|
||||||
child: Text('Continue'),
|
child: Text('Continue'),
|
||||||
|
@ -114,16 +126,17 @@ class _WelcomePageState extends State<WelcomePage> {
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
return MediaQuery.of(context).orientation == Orientation.portrait
|
return MediaQuery.of(context).orientation == Orientation.portrait
|
||||||
? [
|
? [
|
||||||
checkbox,
|
checkboxes,
|
||||||
button,
|
button,
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
SizedBox(height: 16),
|
|
||||||
Row(
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
checkbox,
|
checkboxes,
|
||||||
Spacer(),
|
Spacer(),
|
||||||
button,
|
button,
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue