edit stuff, maybe it workie now

This commit is contained in:
BalazsManus 2025-02-14 14:30:31 +01:00
parent 4cde28cd72
commit 250ed2f105
2 changed files with 1157 additions and 1108 deletions

View File

@ -23,17 +23,17 @@ class FilcAPI {
// Public API // Public API
static const schoolList = "https://api.refilcapp.hu/v3/public/school-list"; static const schoolList = "https://api.refilcapp.hu/v3/public/school-list";
static const news = "https://staticrf-api.pages.dev/news/index.json"; static const news = "https://staticrf-api.pages.dev/news/index.json";
static const supporters = "0.0.0.0/v3/public/supporters"; static const supporters = "0.0.0.0";
// Private API // Private API
static const ads = "0.0.0.0/v3/private/ads"; static const ads = "0.0.0.0";
static const config = "$baseUrl/v3/private/config"; static const config = "$baseUrl/v3/private/config";
static const reportApi = "$baseUrl/v3/private/crash-report"; static const reportApi = "$baseUrl/v3/private/crash-report";
static const rfPlus = "0.0.0.0/v3/rf-plus"; static const rfPlus = "0.0.0.0";
static const plusAuthLogin = "0.0.0.0/auth/login"; static const plusAuthLogin = "0.0.0.0";
static const plusAuthCallback = "0.0.0.0/auth/callback"; static const plusAuthCallback = "0.0.0.0";
static const plusActivation = "0.0.0.0/activate"; static const plusActivation = "0.0.0.0";
static const plusScopes = "0.0.0.0/scopes"; static const plusScopes = "0.0.0.0/";
// Updates // Updates
static const repo = "refilc/naplo"; static const repo = "refilc/naplo";
@ -42,21 +42,21 @@ class FilcAPI {
// Share API // Share API
static const themeShare = "https://api.refilcapp.hu/v3/shared/theme/add"; static const themeShare = "https://api.refilcapp.hu/v3/shared/theme/add";
static const themeGet = "https://api.refilcapp.hu/v3/shared/theme/get"; static const themeGet = "https://api.refilcapp.hu/v3/shared/theme/get";
static const allThemes = "https://api.refilcapp.hu/all"; static const allThemes = "$themeGet/all";
static const themeByID = "https://api.refilcapp.hu/"; static const themeByID = "$themeGet/";
static const gradeColorsShare = "https://api.refilcapp.hu/v3/shared/grade-colors/add"; static const gradeColorsShare = "https://api.refilcapp.hu/v3/shared/grade-colors/add";
static const gradeColorsGet = "https://api.refilcapp.hu/v3/shared/grade-colors/get"; static const gradeColorsGet = "https://api.refilcapp.hu/v3/shared/grade-colors/get";
static const allGradeColors = "https://api.refilcapp.hu/all"; static const allGradeColors = "gradeColorsGet/all";
static const gradeColorsByID = "https://api.refilcapp.hu/"; static const gradeColorsByID = "gradeColorsGet/";
// Payment API // Payment API
static const payment = "0.0.0.0/v4/payment"; static const payment = "0.0.0.0";
static const stripeSheet = "0.0.0.0/stripe-sheet"; static const stripeSheet = "0.0.0.0";
// Cloud Sync // Cloud Sync
// cloud sync? for what reason // cloud sync? for what reason
static const cloudSyncApi = "0.0.0.0/v4/me/cloud-sync"; static const cloudSyncApi = "0.0.0.0";
static Future<bool> checkConnectivity() async => static Future<bool> checkConnectivity() async =>
(await Connectivity().checkConnectivity())[0] != ConnectivityResult.none; (await Connectivity().checkConnectivity())[0] != ConnectivityResult.none;
@ -94,9 +94,7 @@ class FilcAPI {
"rf-platform-version": settings.analyticsEnabled "rf-platform-version": settings.analyticsEnabled
? Platform.operatingSystemVersion ? Platform.operatingSystemVersion
: "unknown", : "unknown",
"rf-app-version": settings.analyticsEnabled "rf-app-version": const String.fromEnvironment("APPVER", defaultValue: "?"),
? const String.fromEnvironment("APPVER", defaultValue: "?")
: "unknown",
"rf-uinid": settings.xFilcId, "rf-uinid": settings.xFilcId,
}; };

View File

@ -16,6 +16,7 @@ import 'package:refilc_kreta_api/providers/note_provider.dart';
import 'package:refilc_kreta_api/providers/timetable_provider.dart'; import 'package:refilc_kreta_api/providers/timetable_provider.dart';
import 'package:refilc/api/providers/user_provider.dart'; import 'package:refilc/api/providers/user_provider.dart';
import 'package:refilc/api/providers/database_provider.dart'; import 'package:refilc/api/providers/database_provider.dart';
// import 'package:refilc/utils/format.dart'; // import 'package:refilc/utils/format.dart';
import 'package:refilc/models/settings.dart'; import 'package:refilc/models/settings.dart';
import 'package:refilc/models/user.dart'; import 'package:refilc/models/user.dart';
@ -23,20 +24,25 @@ import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc_kreta_api/client/client.dart'; import 'package:refilc_kreta_api/client/client.dart';
import 'package:refilc_mobile_ui/common/action_button.dart'; import 'package:refilc_mobile_ui/common/action_button.dart';
import 'package:refilc_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu.dart'; import 'package:refilc_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu.dart';
// import 'package:refilc_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu_item.dart'; // import 'package:refilc_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu_item.dart';
import 'package:refilc_mobile_ui/common/panel/panel.dart'; import 'package:refilc_mobile_ui/common/panel/panel.dart';
import 'package:refilc_mobile_ui/common/panel/panel_button.dart'; import 'package:refilc_mobile_ui/common/panel/panel_button.dart';
import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart'; import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart';
import 'package:refilc_mobile_ui/common/soon_alert/soon_alert.dart'; import 'package:refilc_mobile_ui/common/soon_alert/soon_alert.dart';
// import 'package:refilc_mobile_ui/common/soon_alert/soon_alert.dart'; // import 'package:refilc_mobile_ui/common/soon_alert/soon_alert.dart';
import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart'; import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart';
import 'package:refilc_mobile_ui/common/system_chrome.dart'; import 'package:refilc_mobile_ui/common/system_chrome.dart';
// import 'package:refilc_mobile_ui/common/system_chrome.dart'; // import 'package:refilc_mobile_ui/common/system_chrome.dart';
import 'package:refilc_mobile_ui/common/widgets/update/updates_view.dart'; import 'package:refilc_mobile_ui/common/widgets/update/updates_view.dart';
import 'package:refilc_mobile_ui/screens/news/news_screen.dart'; import 'package:refilc_mobile_ui/screens/news/news_screen.dart';
// import 'package:refilc_mobile_ui/screens/notes/notes_screen.dart'; // import 'package:refilc_mobile_ui/screens/notes/notes_screen.dart';
import 'package:refilc_mobile_ui/screens/settings/accounts/account_tile.dart'; import 'package:refilc_mobile_ui/screens/settings/accounts/account_tile.dart';
import 'package:refilc_mobile_ui/screens/settings/accounts/account_view.dart'; import 'package:refilc_mobile_ui/screens/settings/accounts/account_view.dart';
// import 'package:refilc_mobile_ui/screens/settings/debug/subject_icon_gallery.dart'; // import 'package:refilc_mobile_ui/screens/settings/debug/subject_icon_gallery.dart';
// import 'package:refilc_mobile_ui/screens/settings/modify_subject_names.dart'; // import 'package:refilc_mobile_ui/screens/settings/modify_subject_names.dart';
import 'package:refilc_mobile_ui/screens/settings/notifications_screen.dart'; import 'package:refilc_mobile_ui/screens/settings/notifications_screen.dart';
@ -46,11 +52,14 @@ import 'package:refilc_mobile_ui/screens/settings/submenu/code_scanner.dart';
import 'package:refilc_mobile_ui/screens/settings/submenu/extras_screen.dart'; import 'package:refilc_mobile_ui/screens/settings/submenu/extras_screen.dart';
import 'package:refilc_mobile_ui/screens/settings/submenu/personalize_screen.dart'; import 'package:refilc_mobile_ui/screens/settings/submenu/personalize_screen.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
// import 'package:refilc_plus/models/premium_scopes.dart'; // import 'package:refilc_plus/models/premium_scopes.dart';
import 'package:refilc_plus/providers/plus_provider.dart'; import 'package:refilc_plus/providers/plus_provider.dart';
// import 'package:refilc_plus/ui/mobile/plus/upsell.dart'; // import 'package:refilc_plus/ui/mobile/plus/upsell.dart';
// import 'package:refilc_plus/ui/mobile/settings/app_icon_screen.dart'; // import 'package:refilc_plus/ui/mobile/settings/app_icon_screen.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
// import 'package:flutter/foundation.dart'; // import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart' as tabs; import 'package:flutter_custom_tabs/flutter_custom_tabs.dart' as tabs;
@ -64,6 +73,7 @@ import 'settings_screen.i18n.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:refilc_mobile_ui/screens/settings/user/nickname.dart'; import 'package:refilc_mobile_ui/screens/settings/user/nickname.dart';
import 'package:refilc_mobile_ui/screens/settings/user/profile_pic.dart'; import 'package:refilc_mobile_ui/screens/settings/user/profile_pic.dart';
// import 'package:refilc_plus/ui/mobile/settings/modify_teacher_names.dart'; // import 'package:refilc_plus/ui/mobile/settings/modify_teacher_names.dart';
// import 'package:refilc_plus/ui/mobile/settings/welcome_message.dart'; // import 'package:refilc_plus/ui/mobile/settings/welcome_message.dart';
// import 'package:refilc_mobile_ui/screens/error_screen.dart'; // import 'package:refilc_mobile_ui/screens/error_screen.dart';
@ -97,7 +107,8 @@ class SettingsScreenState extends State<SettingsScreen>
late AnimationController _hideContainersController; late AnimationController _hideContainersController;
Future<void> restore() => Future.wait([ Future<void> restore() =>
Future.wait([
Provider.of<GradeProvider>(context, listen: false).restore(), Provider.of<GradeProvider>(context, listen: false).restore(),
Provider.of<TimetableProvider>(context, listen: false).restoreUser(), Provider.of<TimetableProvider>(context, listen: false).restoreUser(),
Provider.of<ExamProvider>(context, listen: false).restore(), Provider.of<ExamProvider>(context, listen: false).restore(),
@ -142,7 +153,8 @@ class SettingsScreenState extends State<SettingsScreen>
name: _firstName, name: _firstName,
role: account.role, role: account.role,
profilePictureString: account.picture, profilePictureString: account.picture,
backgroundColor: Theme.of(context) backgroundColor: Theme
.of(context)
.colorScheme .colorScheme
.tertiary, //!settings.presentationMode .tertiary, //!settings.presentationMode
//? ColorUtils.stringToColor(account.name) //? ColorUtils.stringToColor(account.name)
@ -156,7 +168,8 @@ class SettingsScreenState extends State<SettingsScreen>
if (err != null) { if (err != null) {
showDialog( showDialog(
context: context, context: context,
builder: (_) => AlertDialog( builder: (_) =>
AlertDialog(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0)), borderRadius: BorderRadius.circular(12.0)),
title: Text('oopsie'.i18n), title: Text('oopsie'.i18n),
@ -170,16 +183,26 @@ class SettingsScreenState extends State<SettingsScreen>
// delete user // delete user
user.removeUser(userId); user.removeUser(userId);
await Provider.of<DatabaseProvider>(context, await Provider
.of<DatabaseProvider>(context,
listen: false) listen: false)
.store .store
.removeUser(userId); .removeUser(userId);
// if no users, show login, else login with back button // if no users, show login, else login with back button
if (user.getUsers().isNotEmpty) { if (user
user.setUser(user.getUsers().first.id); .getUsers()
.isNotEmpty) {
user.setUser(user
.getUsers()
.first
.id);
restore().then( restore().then(
(_) => user.setUser(user.getUsers().first.id)); (_) =>
user.setUser(user
.getUsers()
.first
.id));
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.of(context) Navigator.of(context)
@ -190,7 +213,8 @@ class SettingsScreenState extends State<SettingsScreen>
} else { } else {
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.of(context) Navigator.of(context)
.pushNamedAndRemoveUntil("login", (_) => false); .pushNamedAndRemoveUntil(
"login", (_) => false);
} }
}) })
], ],
@ -236,14 +260,17 @@ class SettingsScreenState extends State<SettingsScreen>
]); ]);
} }
void _openDKT(User u) => tabs.launchUrl( void _openDKT(User u) =>
tabs.launchUrl(
Uri.parse( Uri.parse(
"https://dkttanulo.e-kreta.hu/sso?id_token=${kretaClient.idToken}"), "https://dkttanulo.e-kreta.hu/sso?id_token=${kretaClient.idToken}"),
customTabsOptions: tabs.CustomTabsOptions( customTabsOptions: tabs.CustomTabsOptions(
showTitle: true, showTitle: true,
colorSchemes: tabs.CustomTabsColorSchemes( colorSchemes: tabs.CustomTabsColorSchemes(
defaultPrams: tabs.CustomTabsColorSchemeParams( defaultPrams: tabs.CustomTabsColorSchemeParams(
toolbarColor: Theme.of(context).scaffoldBackgroundColor, toolbarColor: Theme
.of(context)
.scaffoldBackgroundColor,
), ),
), ),
), ),
@ -309,7 +336,8 @@ class SettingsScreenState extends State<SettingsScreen>
return AnimatedBuilder( return AnimatedBuilder(
animation: _hideContainersController, animation: _hideContainersController,
builder: (context, child) => Opacity( builder: (context, child) =>
Opacity(
opacity: 1 - _hideContainersController.value, opacity: 1 - _hideContainersController.value,
child: Column( child: Column(
children: [ children: [
@ -358,7 +386,10 @@ class SettingsScreenState extends State<SettingsScreen>
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
icon: Icon(FeatherIcons.x, icon: Icon(FeatherIcons.x,
color: AppColors.of(context).text.withOpacity(0.8)), color: AppColors
.of(context)
.text
.withOpacity(0.8)),
), ),
const SizedBox( const SizedBox(
width: 5.0, width: 5.0,
@ -379,7 +410,8 @@ class SettingsScreenState extends State<SettingsScreen>
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,
gradeStreak: (user.gradeStreak ?? 0) > 1, gradeStreak: (user.gradeStreak ?? 0) > 1,
backgroundColor: Theme.of(context) backgroundColor: Theme
.of(context)
.colorScheme .colorScheme
.tertiary, //!settings.presentationMode .tertiary, //!settings.presentationMode
//? ColorUtils.stringToColor(user.displayName ?? "?") //? ColorUtils.stringToColor(user.displayName ?? "?")
@ -403,7 +435,9 @@ class SettingsScreenState extends State<SettingsScreen>
style: TextStyle( style: TextStyle(
fontSize: 22.0, fontSize: 22.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: AppColors.of(context).text), color: AppColors
.of(context)
.text),
), ),
), ),
), ),
@ -424,10 +458,14 @@ class SettingsScreenState extends State<SettingsScreen>
leading: Icon( leading: Icon(
FeatherIcons.info, FeatherIcons.info,
size: 22.0, size: 22.0,
color: AppColors.of(context).text.withOpacity(0.95), color: AppColors
.of(context)
.text
.withOpacity(0.95),
), ),
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(
top: Radius.circular(12.0), bottom: Radius.circular(4.0)), top: Radius.circular(12.0),
bottom: Radius.circular(4.0)),
), ),
// cloud-sync // cloud-sync
const MenuCloudSyncSettings( const MenuCloudSyncSettings(
@ -443,10 +481,14 @@ class SettingsScreenState extends State<SettingsScreen>
leading: Icon( leading: Icon(
FeatherIcons.grid, FeatherIcons.grid,
size: 22.0, size: 22.0,
color: AppColors.of(context).text.withOpacity(0.95), color: AppColors
.of(context)
.text
.withOpacity(0.95),
), ),
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(
top: Radius.circular(4.0), bottom: Radius.circular(4.0)), top: Radius.circular(4.0),
bottom: Radius.circular(4.0)),
), ),
// edit user // edit user
PanelButton( PanelButton(
@ -456,10 +498,14 @@ class SettingsScreenState extends State<SettingsScreen>
leading: Icon( leading: Icon(
FeatherIcons.edit3, FeatherIcons.edit3,
size: 22.0, size: 22.0,
color: AppColors.of(context).text.withOpacity(0.95), color: AppColors
.of(context)
.text
.withOpacity(0.95),
), ),
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(
top: Radius.circular(4.0), bottom: Radius.circular(4.0)), top: Radius.circular(4.0),
bottom: Radius.circular(4.0)),
), ),
// switch account // switch account
PanelButton( PanelButton(
@ -476,10 +522,14 @@ class SettingsScreenState extends State<SettingsScreen>
leading: Icon( leading: Icon(
FeatherIcons.users, FeatherIcons.users,
size: 22.0, size: 22.0,
color: AppColors.of(context).text.withOpacity(0.95), color: AppColors
.of(context)
.text
.withOpacity(0.95),
), ),
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(
top: Radius.circular(4.0), bottom: Radius.circular(4.0)), top: Radius.circular(4.0),
bottom: Radius.circular(4.0)),
), ),
// log user out // log user out
PanelButton( PanelButton(
@ -489,15 +539,25 @@ class SettingsScreenState extends State<SettingsScreen>
// delete user // delete user
user.removeUser(userId); user.removeUser(userId);
await Provider.of<DatabaseProvider>(context, listen: false) await Provider
.of<DatabaseProvider>(context, listen: false)
.store .store
.removeUser(userId); .removeUser(userId);
// if no users, show login // if no users, show login
if (user.getUsers().isNotEmpty) { if (user
user.setUser(user.getUsers().first.id); .getUsers()
.isNotEmpty) {
user.setUser(user
.getUsers()
.first
.id);
restore() restore()
.then((_) => user.setUser(user.getUsers().first.id)); .then((_) =>
user.setUser(user
.getUsers()
.first
.id));
} else { } else {
Navigator.of(context) Navigator.of(context)
.pushNamedAndRemoveUntil("login", (_) => false); .pushNamedAndRemoveUntil("login", (_) => false);
@ -506,11 +566,14 @@ class SettingsScreenState extends State<SettingsScreen>
title: Text("log_out".i18n), title: Text("log_out".i18n),
leading: Icon( leading: Icon(
FeatherIcons.logOut, FeatherIcons.logOut,
color: AppColors.of(context).red, color: AppColors
.of(context)
.red,
size: 22.0, size: 22.0,
), ),
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(
top: Radius.circular(4.0), bottom: Radius.circular(12.0)), top: Radius.circular(4.0),
bottom: Radius.circular(12.0)),
), ),
// SplittedMenuOption( // SplittedMenuOption(
// padding: const EdgeInsets.all(8.0), // padding: const EdgeInsets.all(8.0),
@ -1376,34 +1439,18 @@ class SettingsScreenState extends State<SettingsScreen>
child: FutureBuilder<Map>( child: FutureBuilder<Map>(
future: futureRelease, future: futureRelease,
builder: (context, release) { builder: (context, release) {
if (release.hasData) { String versionText;
return DefaultTextStyle( if (release.hasData && release.data != null) {
style: Theme.of(context) versionText = "v${release.data!['version']}, modosítva a Filc csapat által";
.textTheme
.titleMedium!
.copyWith(
fontWeight: FontWeight.w600,
color: AppColors.of(context)
.text
.withOpacity(0.65)),
child: Text("v${release.data!['version']}, módosítva a Filc csapat által"),
);
} else { } else {
String envAppVer = const String.fromEnvironment( versionText = "reFilc, modosítva a Filc csapat által";
"APPVER",
defaultValue: "?");
return DefaultTextStyle(
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontWeight: FontWeight.w600,
color: AppColors.of(context)
.text
.withOpacity(0.65)),
child: Text("reFilc, módosítva a Filc csapat által"),
);
} }
return DefaultTextStyle(
style: Theme.of(context).textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w600,
color: AppColors.of(context).text.withOpacity(0.65)),
child: Text(versionText),
);
}, },
), ),
onTap: () { onTap: () {
@ -1430,16 +1477,20 @@ class SettingsScreenState extends State<SettingsScreen>
), ),
], ],
), ),
), )
,
); );
} }
void _openNews(BuildContext context) => void _openNews(BuildContext context) =>
Navigator.of(context, rootNavigator: true) Navigator.of(context, rootNavigator: true)
.push(CupertinoPageRoute(builder: (context) => const NewsScreen())); .push(CupertinoPageRoute(builder: (context) => const NewsScreen()));
void _openUpdates(BuildContext context) => void _openUpdates(BuildContext context) =>
UpdateView.show(updateProvider.releases.first, context: context); UpdateView.show(updateProvider.releases.first, context: context);
void _openPrivacy(BuildContext context) => PrivacyView.show(context); void _openPrivacy(BuildContext context) => PrivacyView.show(context);
// void _openNotes(BuildContext context, Map<String, bool> doneItems) async => // void _openNotes(BuildContext context, Map<String, bool> doneItems) async =>
// Navigator.of(context, rootNavigator: true).push(CupertinoPageRoute( // Navigator.of(context, rootNavigator: true).push(CupertinoPageRoute(
// builder: (context) => NotesScreen( // builder: (context) => NotesScreen(