Skip to content

Commit

Permalink
Merge pull request #99 from alessioC42/proprietary-components
Browse files Browse the repository at this point in the history
Proprietary components
  • Loading branch information
alessioC42 committed Dec 29, 2023
2 parents 2587b1f + 5899860 commit 1dfbbdb
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 41 deletions.
29 changes: 0 additions & 29 deletions app/android/app/google-services.json

This file was deleted.

3 changes: 0 additions & 3 deletions app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,4 @@

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>

<!-- For apps with targetSDK=31 (Android 12) -->
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
</manifest>
10 changes: 5 additions & 5 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'dart:async';
import 'dart:ui';
import 'dart:io';

import 'package:countly_flutter_np/countly_flutter.dart';

import 'package:countly_flutter/countly_flutter.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:stack_trace/stack_trace.dart';
Expand Down Expand Up @@ -70,7 +70,7 @@ void main() async {
final savedThemeMode = await AdaptiveTheme.getThemeMode();

await initializeDateFormatting();
if (!kDebugMode) {
if (!kDebugMode && (await globalStorage.read(key: "enable-countly")) == "true") {
const String duckDNS = "duckdns.org"; //so web crawlers do not parse the URL from gh
CountlyConfig config = CountlyConfig("https://alessioc42.$duckDNS", "4e7059ab732b4db3baaf75a6b3e1eef6d4aa3927");
config.enableCrashReporting();
Expand All @@ -91,9 +91,9 @@ void main() async {
savedThemeMode: savedThemeMode,
));

}, (obj, stack) {
if (!kDebugMode) {
Countly.recordDartError(obj, stack);
}, (obj, stack) async {
if (!kDebugMode && await globalStorage.read(key: "enable-countly") == "true") {
await Countly.recordDartError(obj, stack);
}
});
}
Expand Down
28 changes: 28 additions & 0 deletions app/lib/view/login/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../client/client.dart';
import '../../client/storage.dart';

class LoginForm extends StatefulWidget {
final Function() afterLogin;
Expand All @@ -28,6 +29,7 @@ class LoginFormState extends State<LoginForm> {
TextEditingController usernameController = TextEditingController();
TextEditingController passwordController = TextEditingController();
bool dseAgree = false;
bool countlyAgree = true;


String selectedSchoolID = "5182";
Expand Down Expand Up @@ -181,6 +183,32 @@ class LoginFormState extends State<LoginForm> {
});
},
),
CheckboxListTile(
value: countlyAgree,
title: RichText(
text: TextSpan(
text: 'Anonyme Bugreports mit ',
style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(
text: 'Countly',
style: TextStyle(color: Theme.of(context).colorScheme.primary),
recognizer: TapGestureRecognizer()
..onTap = () => launchUrl(Uri.parse("https://countly.com/lite")),
),
const TextSpan(
text: ' senden',
),
],
),
),
onChanged: (val) async {
setState(() {
countlyAgree = val!;
});
await globalStorage.write(key: "enable-countly", value: val.toString());
},
),
const SizedBox(height: padding,),
ElevatedButton(
onPressed:dseAgree? () {
Expand Down
12 changes: 12 additions & 0 deletions app/lib/view/settings/settings.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:sph_plan/view/settings/subsettings/about.dart';
import 'package:sph_plan/view/settings/subsettings/countly_analysis.dart';
import 'package:sph_plan/view/settings/subsettings/load_mode.dart';
import 'package:sph_plan/view/settings/subsettings/notifications.dart';
import 'package:sph_plan/view/settings/subsettings/supported_features.dart';
Expand Down Expand Up @@ -84,6 +85,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
},
),
ListTile(
leading: const Icon(Icons.analytics),
title: const Text('Countly Bugreports'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const CountlySettingsScreen()),
);
},
),
ListTile(
leading: const Icon(Icons.qr_code_outlined),
title: const Text('Über die App'),
Expand Down
70 changes: 70 additions & 0 deletions app/lib/view/settings/subsettings/countly_analysis.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../../client/storage.dart';

class CountlySettingsScreen extends StatelessWidget {
const CountlySettingsScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Countly"),
),
body: const Body()
);
}
}

class Body extends StatefulWidget {
const Body({super.key});

@override
State<Body> createState() => _BodyState();
}

class _BodyState extends State<Body> {
bool enabled = true;

@override
void initState() {
super.initState();
globalStorage.read(key: "enable-countly").then((value) {
if (value == null) {
globalStorage.write(key: "enable-countly", value: "false");
enabled = false;
} else {
enabled = value == "true";
}
setState(() {});
});
}

@override
Widget build(BuildContext context) {
return ListView(
children: [
ListTile(
leading: const Icon(Icons.info),
title: const Text('Countly Server'),
subtitle: const Text('Wir nutzen Countly um anonyme Bugreports automatisch an die Entwickler zu senden. Dabei werden keine Daten an dritte weitergegeben.'),
onTap: () {
launchUrl(Uri.parse("https://countly.com/lite")
);
},
),
SwitchListTile(
value: enabled,
title: const Text("Anonyme Bugreports senden"),
onChanged: (state) async {
setState(() {
enabled = state;
});
await globalStorage.write(key: "enable-countly", value: state.toString());
}),
],
);
}
}

6 changes: 3 additions & 3 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.8"
countly_flutter:
countly_flutter_np:
dependency: "direct main"
description:
name: countly_flutter
sha256: "548dc4333f7f94d6914e444d8c0c70279d3e9f2e1e790dde291f9b30e480591a"
name: countly_flutter_np
sha256: "80ebf58adbe56276d73ccdd9da135e5df7f4ed50a903180cd2fb1181c61dd04a"
url: "https://pub.dev"
source: hosted
version: "23.12.0"
Expand Down
2 changes: 1 addition & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ dependencies:
marked: ^0.2.5
styled_text: ^8.1.0
linkify: ^5.0.0
countly_flutter: ^23.12.0
introduction_screen: ^3.1.12
flutter_svg: ^2.0.9
dropdown_search: ^5.0.6
countly_flutter_np: ^23.12.0

flutter_launcher_icons:
android: true
Expand Down

0 comments on commit 1dfbbdb

Please sign in to comment.