Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Privacy Policy and Open-Source Licenses #189

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/base/localization/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"hideFailedGrades":"Durchgefallene Noten ausblenden",
"defaultMapsApplication":"Standard-Kartenanwendung",
"map":"Karte",
"contactUs":"Kontaktiere uns",
"contactMore":"Kontakt & Mehr",
"tokenPermissions":"Berechtigungen für Token",
"permissionChangePossibleInTUMonline":"Du kannst deine Berechtigungen in TUMOnline ändern",
"logout":"Abmelden",
Expand Down Expand Up @@ -272,5 +272,7 @@
"location":"Standort",
"locationOnboarding":"Aktiviere Standorte, um personalisierte Erlebnisse zu erreichen und Deinen Standort auf Raumfinder-Karten zu sehen.",
"continueOnboarding":"Weiter",
"showMore":"Mehr Anzeigen"
"showMore":"Mehr Anzeigen",
"licenses":"Lizenzen",
"privacyPolicy":"Datenschutzrichtlinie"
}
6 changes: 4 additions & 2 deletions lib/base/localization/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"hideFailedGrades":"Hide Failed Grades",
"defaultMapsApplication":"Default Maps Application",
"map":"Map",
"contactUs":"Contact Us",
"contactMore":"Contact & More",
"tokenPermissions":"Token Permissions",
"permissionChangePossibleInTUMonline":"You can change your permissions on TUMOnline",
"logout":"Logout",
Expand Down Expand Up @@ -272,5 +272,7 @@
"location":"Location",
"locationOnboarding":"Enable locations to access personalized experiences and your location on the room finder maps.",
"continueOnboarding":"Continue",
"showMore":"Show More"
"showMore":"Show More",
"licenses":"Licenses",
"privacyPolicy":"Privacy Policy"
}
112 changes: 112 additions & 0 deletions lib/settingsComponent/views/appearance_settings_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import 'dart:io';

import 'package:campus_flutter/base/enums/appearance.dart';
import 'package:campus_flutter/base/extensions/context.dart';
import 'package:campus_flutter/base/helpers/icon_text.dart';
import 'package:campus_flutter/base/views/seperated_list.dart';
import 'package:campus_flutter/gradeComponent/viewModels/grade_viewmodel.dart';
import 'package:campus_flutter/homeComponent/widgetComponent/views/widget_frame_view.dart';
import 'package:campus_flutter/main.dart';
import 'package:campus_flutter/settingsComponent/viewModels/user_preferences_viewmodel.dart';
import 'package:campus_flutter/settingsComponent/views/default_maps_picker_view.dart';
import 'package:campus_flutter/settingsComponent/views/settings_view.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:map_launcher/map_launcher.dart';

class AppearanceSettingsView extends ConsumerWidget {
const AppearanceSettingsView({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
return WidgetFrameView(
title: context.localizations.appearance,
child: Card(
child: SeparatedList.widgets(
widgets: [
_appearanceSelection(context, ref),
if (!kIsWeb && Platform.isIOS) _useWebView(context, ref),
_hideFailedGrades(context, ref),
if (!kIsWeb && getIt.get<List<AvailableMap>>().isNotEmpty)
const DefaultMapsPickerView(),
],
),
),
);
}

Widget _appearanceSelection(BuildContext context, WidgetRef ref) {
return ListTile(
dense: true,
title: Text(
context.localizations.theme,
style: Theme.of(context).textTheme.bodyMedium,
),
trailing: DropdownButton(
onChanged: (Appearance? newAppearance) {
if (newAppearance != null) {
ref.read(appearance.notifier).state = newAppearance;
ref
.read(userPreferencesViewModel)
.saveUserPreference(UserPreference.theme, newAppearance);
}
},
value: ref.watch(appearance),
items: Appearance.values
.map(
(e) => DropdownMenuItem(
value: e,
child: IconText(
iconData: e.icon,
iconColor: Theme.of(context).primaryColor,
label: ref.read(locale).languageCode == "de"
? e.german
: e.english,
),
),
)
.toList(),
),
);
}

Widget _useWebView(BuildContext context, WidgetRef ref) {
return ListTile(
dense: true,
title: Text(
context.localizations.useWebView,
style: Theme.of(context).textTheme.bodyMedium,
),
trailing: Switch(
value: ref.watch(useWebView),
onChanged: (showWebView) {
ref
.read(userPreferencesViewModel)
.saveUserPreference(UserPreference.webView, showWebView);
ref.read(useWebView.notifier).state = showWebView;
},
),
);
}

Widget _hideFailedGrades(BuildContext context, WidgetRef ref) {
return ListTile(
dense: true,
title: Text(
context.localizations.hideFailedGrades,
style: Theme.of(context).textTheme.bodyMedium,
),
trailing: Switch(
value: ref.watch(hideFailedGrades),
onChanged: (value) {
ref
.read(userPreferencesViewModel)
.saveUserPreference(UserPreference.hideFailedGrades, value);
ref.read(hideFailedGrades.notifier).state = value;
ref.read(gradeViewModel).fetch(false);
},
),
);
}
}
85 changes: 85 additions & 0 deletions lib/settingsComponent/views/contact_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import 'dart:io';

import 'package:campus_flutter/base/extensions/context.dart';
import 'package:campus_flutter/base/helpers/hyperlink_text.dart';
import 'package:campus_flutter/base/views/seperated_list.dart';
import 'package:campus_flutter/feedbackComponent/views/feedback_form_view.dart';
import 'package:campus_flutter/homeComponent/widgetComponent/views/widget_frame_view.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class ContactView extends ConsumerWidget {
const ContactView({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
return WidgetFrameView(
title: context.localizations.contactMore,
child: Card(
child: SeparatedList.widgets(
widgets: [
if (!kIsWeb)
HyperLinkListTile(
dense: true,
link: _betaTester(),
label: context.localizations.becomeABetaTester,
),
HyperLinkListTile(
dense: true,
link: "https://github.com/TUM-Dev",
label: context.localizations.usOnGitHub,
),
const HyperLinkListTile(
dense: true,
link: "https://app.tum.de",
label: "TUM Dev Website",
),
HyperLinkListTile(
dense: true,
link: "https://www.tum.app/privacy",
label: context.localizations.privacyPolicy,
),
_licensesButton(context),
_feedbackButton(context),
],
),
),
);
}

String _betaTester() {
if (Platform.isAndroid) {
return "https://play.google.com/store/apps/details?id=de.tum.tca_flutter";
} else {
return "https://testflight.apple.com/join/4Ddi6f2f";
}
}

Widget _feedbackButton(BuildContext context) {
return ListTile(
dense: true,
title: Text(
"Feedback",
style: Theme.of(context).textTheme.bodyMedium,
),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const FeedbackFormScaffold(),
),
),
);
}

Widget _licensesButton(BuildContext context) {
return ListTile(
dense: true,
title: Text(
context.localizations.licenses,
style: Theme.of(context).textTheme.bodyMedium,
),
onTap: () => showLicensePage(context: context),
);
}
}
75 changes: 75 additions & 0 deletions lib/settingsComponent/views/general_settings_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import 'package:campus_flutter/base/extensions/context.dart';
import 'package:campus_flutter/base/views/seperated_list.dart';
import 'package:campus_flutter/homeComponent/widgetComponent/views/widget_frame_view.dart';
import 'package:campus_flutter/loginComponent/views/permission_check_view.dart';
import 'package:campus_flutter/base/extensions/locale_fullname.dart';
import 'package:campus_flutter/main.dart';
import 'package:campus_flutter/settingsComponent/viewModels/user_preferences_viewmodel.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class GeneralSettingsView extends ConsumerWidget {
const GeneralSettingsView({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
return WidgetFrameView(
title: context.localizations.generalSettings,
child: Card(
child: SeparatedList.widgets(
widgets: [
_tokenPermission(context),
_localeSelection(context, ref),
],
),
),
);
}

Widget _tokenPermission(BuildContext context) {
return ListTile(
dense: true,
leading: Icon(Icons.key, size: 20, color: Theme.of(context).primaryColor),
title: Text(
context.localizations.tokenPermissions,
style: Theme.of(context).textTheme.bodyMedium,
),
trailing: const Icon(Icons.arrow_forward_ios, size: 15),
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const PermissionCheckView(isSettingsView: true),
),
),
);
}

Widget _localeSelection(BuildContext context, WidgetRef ref) {
return ListTile(
dense: true,
leading: Icon(
Icons.language,
size: 20,
color: Theme.of(context).primaryColor,
),
title: Text(
context.localizations.language,
style: Theme.of(context).textTheme.bodyMedium,
),
trailing: DropdownButton(
onChanged: (Locale? newLocale) {
if (newLocale != null) {
ref
.read(userPreferencesViewModel)
.saveUserPreference(UserPreference.locale, newLocale);
ref.read(locale.notifier).state = newLocale;
}
},
value: ref.watch(locale),
items: AppLocalizations.supportedLocales
.map((e) => DropdownMenuItem(value: e, child: Text(e.fullName())))
.toList(),
),
);
}
}
Loading