forked from firka/student-legacy
edit stuff, maybe it workie now
This commit is contained in:
parent
4cde28cd72
commit
250ed2f105
@ -23,17 +23,17 @@ class FilcAPI {
|
||||
// Public API
|
||||
static const schoolList = "https://api.refilcapp.hu/v3/public/school-list";
|
||||
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
|
||||
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 reportApi = "$baseUrl/v3/private/crash-report";
|
||||
static const rfPlus = "0.0.0.0/v3/rf-plus";
|
||||
static const plusAuthLogin = "0.0.0.0/auth/login";
|
||||
static const plusAuthCallback = "0.0.0.0/auth/callback";
|
||||
static const plusActivation = "0.0.0.0/activate";
|
||||
static const plusScopes = "0.0.0.0/scopes";
|
||||
static const rfPlus = "0.0.0.0";
|
||||
static const plusAuthLogin = "0.0.0.0";
|
||||
static const plusAuthCallback = "0.0.0.0";
|
||||
static const plusActivation = "0.0.0.0";
|
||||
static const plusScopes = "0.0.0.0/";
|
||||
|
||||
// Updates
|
||||
static const repo = "refilc/naplo";
|
||||
@ -42,21 +42,21 @@ class FilcAPI {
|
||||
// Share API
|
||||
static const themeShare = "https://api.refilcapp.hu/v3/shared/theme/add";
|
||||
static const themeGet = "https://api.refilcapp.hu/v3/shared/theme/get";
|
||||
static const allThemes = "https://api.refilcapp.hu/all";
|
||||
static const themeByID = "https://api.refilcapp.hu/";
|
||||
static const allThemes = "$themeGet/all";
|
||||
static const themeByID = "$themeGet/";
|
||||
|
||||
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 allGradeColors = "https://api.refilcapp.hu/all";
|
||||
static const gradeColorsByID = "https://api.refilcapp.hu/";
|
||||
static const allGradeColors = "gradeColorsGet/all";
|
||||
static const gradeColorsByID = "gradeColorsGet/";
|
||||
|
||||
// Payment API
|
||||
static const payment = "0.0.0.0/v4/payment";
|
||||
static const stripeSheet = "0.0.0.0/stripe-sheet";
|
||||
static const payment = "0.0.0.0";
|
||||
static const stripeSheet = "0.0.0.0";
|
||||
|
||||
// Cloud Sync
|
||||
// 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 =>
|
||||
(await Connectivity().checkConnectivity())[0] != ConnectivityResult.none;
|
||||
@ -94,9 +94,7 @@ class FilcAPI {
|
||||
"rf-platform-version": settings.analyticsEnabled
|
||||
? Platform.operatingSystemVersion
|
||||
: "unknown",
|
||||
"rf-app-version": settings.analyticsEnabled
|
||||
? const String.fromEnvironment("APPVER", defaultValue: "?")
|
||||
: "unknown",
|
||||
"rf-app-version": const String.fromEnvironment("APPVER", defaultValue: "?"),
|
||||
"rf-uinid": settings.xFilcId,
|
||||
};
|
||||
|
||||
|
@ -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/api/providers/user_provider.dart';
|
||||
import 'package:refilc/api/providers/database_provider.dart';
|
||||
|
||||
// import 'package:refilc/utils/format.dart';
|
||||
import 'package:refilc/models/settings.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_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_item.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/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/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/widgets/update/updates_view.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/settings/accounts/account_tile.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/modify_subject_names.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/personalize_screen.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
// import 'package:refilc_plus/models/premium_scopes.dart';
|
||||
import 'package:refilc_plus/providers/plus_provider.dart';
|
||||
|
||||
// import 'package:refilc_plus/ui/mobile/plus/upsell.dart';
|
||||
// import 'package:refilc_plus/ui/mobile/settings/app_icon_screen.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
// import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
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:refilc_mobile_ui/screens/settings/user/nickname.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/welcome_message.dart';
|
||||
// import 'package:refilc_mobile_ui/screens/error_screen.dart';
|
||||
@ -97,7 +107,8 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
|
||||
late AnimationController _hideContainersController;
|
||||
|
||||
Future<void> restore() => Future.wait([
|
||||
Future<void> restore() =>
|
||||
Future.wait([
|
||||
Provider.of<GradeProvider>(context, listen: false).restore(),
|
||||
Provider.of<TimetableProvider>(context, listen: false).restoreUser(),
|
||||
Provider.of<ExamProvider>(context, listen: false).restore(),
|
||||
@ -142,7 +153,8 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
name: _firstName,
|
||||
role: account.role,
|
||||
profilePictureString: account.picture,
|
||||
backgroundColor: Theme.of(context)
|
||||
backgroundColor: Theme
|
||||
.of(context)
|
||||
.colorScheme
|
||||
.tertiary, //!settings.presentationMode
|
||||
//? ColorUtils.stringToColor(account.name)
|
||||
@ -156,7 +168,8 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
if (err != null) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
builder: (_) =>
|
||||
AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0)),
|
||||
title: Text('oopsie'.i18n),
|
||||
@ -170,16 +183,26 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
|
||||
// delete user
|
||||
user.removeUser(userId);
|
||||
await Provider.of<DatabaseProvider>(context,
|
||||
await Provider
|
||||
.of<DatabaseProvider>(context,
|
||||
listen: false)
|
||||
.store
|
||||
.removeUser(userId);
|
||||
|
||||
// if no users, show login, else login with back button
|
||||
if (user.getUsers().isNotEmpty) {
|
||||
user.setUser(user.getUsers().first.id);
|
||||
if (user
|
||||
.getUsers()
|
||||
.isNotEmpty) {
|
||||
user.setUser(user
|
||||
.getUsers()
|
||||
.first
|
||||
.id);
|
||||
restore().then(
|
||||
(_) => user.setUser(user.getUsers().first.id));
|
||||
(_) =>
|
||||
user.setUser(user
|
||||
.getUsers()
|
||||
.first
|
||||
.id));
|
||||
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context)
|
||||
@ -190,7 +213,8 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
} else {
|
||||
Navigator.of(context).pop();
|
||||
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(
|
||||
"https://dkttanulo.e-kreta.hu/sso?id_token=${kretaClient.idToken}"),
|
||||
customTabsOptions: tabs.CustomTabsOptions(
|
||||
showTitle: true,
|
||||
colorSchemes: tabs.CustomTabsColorSchemes(
|
||||
defaultPrams: tabs.CustomTabsColorSchemeParams(
|
||||
toolbarColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
toolbarColor: Theme
|
||||
.of(context)
|
||||
.scaffoldBackgroundColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -309,7 +336,8 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
|
||||
return AnimatedBuilder(
|
||||
animation: _hideContainersController,
|
||||
builder: (context, child) => Opacity(
|
||||
builder: (context, child) =>
|
||||
Opacity(
|
||||
opacity: 1 - _hideContainersController.value,
|
||||
child: Column(
|
||||
children: [
|
||||
@ -358,7 +386,10 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
icon: Icon(FeatherIcons.x,
|
||||
color: AppColors.of(context).text.withOpacity(0.8)),
|
||||
color: AppColors
|
||||
.of(context)
|
||||
.text
|
||||
.withOpacity(0.8)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5.0,
|
||||
@ -379,7 +410,8 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
role: user.role,
|
||||
profilePictureString: user.picture,
|
||||
gradeStreak: (user.gradeStreak ?? 0) > 1,
|
||||
backgroundColor: Theme.of(context)
|
||||
backgroundColor: Theme
|
||||
.of(context)
|
||||
.colorScheme
|
||||
.tertiary, //!settings.presentationMode
|
||||
//? ColorUtils.stringToColor(user.displayName ?? "?")
|
||||
@ -403,7 +435,9 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
style: TextStyle(
|
||||
fontSize: 22.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.of(context).text),
|
||||
color: AppColors
|
||||
.of(context)
|
||||
.text),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -424,10 +458,14 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
leading: Icon(
|
||||
FeatherIcons.info,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
color: AppColors
|
||||
.of(context)
|
||||
.text
|
||||
.withOpacity(0.95),
|
||||
),
|
||||
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
|
||||
const MenuCloudSyncSettings(
|
||||
@ -443,10 +481,14 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
leading: Icon(
|
||||
FeatherIcons.grid,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
color: AppColors
|
||||
.of(context)
|
||||
.text
|
||||
.withOpacity(0.95),
|
||||
),
|
||||
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
|
||||
PanelButton(
|
||||
@ -456,10 +498,14 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
leading: Icon(
|
||||
FeatherIcons.edit3,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
color: AppColors
|
||||
.of(context)
|
||||
.text
|
||||
.withOpacity(0.95),
|
||||
),
|
||||
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
|
||||
PanelButton(
|
||||
@ -476,10 +522,14 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
leading: Icon(
|
||||
FeatherIcons.users,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
color: AppColors
|
||||
.of(context)
|
||||
.text
|
||||
.withOpacity(0.95),
|
||||
),
|
||||
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
|
||||
PanelButton(
|
||||
@ -489,15 +539,25 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
|
||||
// delete user
|
||||
user.removeUser(userId);
|
||||
await Provider.of<DatabaseProvider>(context, listen: false)
|
||||
await Provider
|
||||
.of<DatabaseProvider>(context, listen: false)
|
||||
.store
|
||||
.removeUser(userId);
|
||||
|
||||
// if no users, show login
|
||||
if (user.getUsers().isNotEmpty) {
|
||||
user.setUser(user.getUsers().first.id);
|
||||
if (user
|
||||
.getUsers()
|
||||
.isNotEmpty) {
|
||||
user.setUser(user
|
||||
.getUsers()
|
||||
.first
|
||||
.id);
|
||||
restore()
|
||||
.then((_) => user.setUser(user.getUsers().first.id));
|
||||
.then((_) =>
|
||||
user.setUser(user
|
||||
.getUsers()
|
||||
.first
|
||||
.id));
|
||||
} else {
|
||||
Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil("login", (_) => false);
|
||||
@ -506,11 +566,14 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
title: Text("log_out".i18n),
|
||||
leading: Icon(
|
||||
FeatherIcons.logOut,
|
||||
color: AppColors.of(context).red,
|
||||
color: AppColors
|
||||
.of(context)
|
||||
.red,
|
||||
size: 22.0,
|
||||
),
|
||||
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(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
@ -1376,34 +1439,18 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
child: FutureBuilder<Map>(
|
||||
future: futureRelease,
|
||||
builder: (context, release) {
|
||||
if (release.hasData) {
|
||||
return DefaultTextStyle(
|
||||
style: Theme.of(context)
|
||||
.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"),
|
||||
);
|
||||
String versionText;
|
||||
if (release.hasData && release.data != null) {
|
||||
versionText = "v${release.data!['version']}, modosítva a Filc csapat által";
|
||||
} else {
|
||||
String envAppVer = const String.fromEnvironment(
|
||||
"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"),
|
||||
);
|
||||
versionText = "reFilc, modosí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: () {
|
||||
@ -1430,16 +1477,20 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
,
|
||||
);
|
||||
}
|
||||
|
||||
void _openNews(BuildContext context) =>
|
||||
Navigator.of(context, rootNavigator: true)
|
||||
.push(CupertinoPageRoute(builder: (context) => const NewsScreen()));
|
||||
|
||||
void _openUpdates(BuildContext context) =>
|
||||
UpdateView.show(updateProvider.releases.first, context: context);
|
||||
|
||||
void _openPrivacy(BuildContext context) => PrivacyView.show(context);
|
||||
|
||||
// void _openNotes(BuildContext context, Map<String, bool> doneItems) async =>
|
||||
// Navigator.of(context, rootNavigator: true).push(CupertinoPageRoute(
|
||||
// builder: (context) => NotesScreen(
|
||||
|
Loading…
x
Reference in New Issue
Block a user