feat: přidat zobrazení alergenů, opravit věci po upgradu závislostí #52
15 changed files with 54 additions and 25 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
# 1.10.0
|
||||||
|
- Aktualizovat závislosti
|
||||||
|
- Změnit minSdk na 21
|
||||||
|
- Přidat možnost zobrazit alergeny
|
||||||
|
- Změnit fungování oznámení s aktualizací knihovny
|
||||||
|
- Žádost o oprávnění k posílání oznámení by se mělo posílat už jen v případě, že uživatel bude chtít používat funkci oznámení
|
||||||
# 1.9.1
|
# 1.9.1
|
||||||
- Opravit chybu s propisováním HTML do názvu obědů
|
- Opravit chybu s propisováním HTML do názvu obědů
|
||||||
# 1.9.0
|
# 1.9.0
|
||||||
|
|
|
@ -51,7 +51,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cz.hernikplays.opencanteen"
|
applicationId "cz.hernikplays.opencanteen"
|
||||||
minSdkVersion 19
|
minSdkVersion 21
|
||||||
targetSdkVersion 33
|
targetSdkVersion 33
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="cz.hernikplays.opencanteen">
|
package="cz.hernikplays.opencanteen">
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||||
<application
|
<application
|
||||||
android:label="OpenCanteen"
|
android:label="OpenCanteen"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
|
|
@ -78,5 +78,6 @@
|
||||||
"errorSaving": "Při ukládání offline nastala chyba, zkuste to znovu později.",
|
"errorSaving": "Při ukládání offline nastala chyba, zkuste to znovu později.",
|
||||||
"todayTooltip": "Přejít na dnešní jídelníček",
|
"todayTooltip": "Přejít na dnešní jídelníček",
|
||||||
"settingsExperience":"Zážitek",
|
"settingsExperience":"Zážitek",
|
||||||
"settingsFunctions":"Extra funkce"
|
"settingsFunctions":"Extra funkce",
|
||||||
|
"showAllergens":"Zobrazovat alergeny, jsou-li dostupné"
|
||||||
}
|
}
|
|
@ -78,5 +78,6 @@
|
||||||
"errorSaving": "An error occured while trying to save menu offline, try again later.",
|
"errorSaving": "An error occured while trying to save menu offline, try again later.",
|
||||||
"todayTooltip": "Go to today's meal",
|
"todayTooltip": "Go to today's meal",
|
||||||
"settingsExperience":"App Experience",
|
"settingsExperience":"App Experience",
|
||||||
"settingsFunctions":"Extra Functions"
|
"settingsFunctions":"Extra Functions",
|
||||||
|
"showAllergens":"Show allergens, if available"
|
||||||
}
|
}
|
|
@ -84,7 +84,7 @@ void setupNotification(SharedPreferences prefs, tz.Location l) async {
|
||||||
"${jidlo.varianta} - ${jidlo.nazev}",
|
"${jidlo.varianta} - ${jidlo.nazev}",
|
||||||
tz.TZDateTime.from(cas, l),
|
tz.TZDateTime.from(cas, l),
|
||||||
const NotificationDetails(android: androidSpec),
|
const NotificationDetails(android: androidSpec),
|
||||||
androidAllowWhileIdle: true,
|
androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle,
|
||||||
uiLocalNotificationDateInterpretation:
|
uiLocalNotificationDateInterpretation:
|
||||||
UILocalNotificationDateInterpretation.absoluteTime);
|
UILocalNotificationDateInterpretation.absoluteTime);
|
||||||
} on StateError catch (_) {
|
} on StateError catch (_) {
|
||||||
|
@ -108,6 +108,7 @@ void main() async {
|
||||||
settings.checkOrdered = prefs.getBool("tyden") ?? false;
|
settings.checkOrdered = prefs.getBool("tyden") ?? false;
|
||||||
settings.saveOffline = prefs.getBool("oznamit") ?? false;
|
settings.saveOffline = prefs.getBool("oznamit") ?? false;
|
||||||
settings.skipWeekend = prefs.getBool("skip") ?? false;
|
settings.skipWeekend = prefs.getBool("skip") ?? false;
|
||||||
|
settings.allergens = prefs.getBool("allergens") ?? false;
|
||||||
|
|
||||||
// notif library setup
|
// notif library setup
|
||||||
const AndroidInitializationSettings initializationSettingsAndroid =
|
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||||
|
@ -123,7 +124,7 @@ void main() async {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:opencanteen/util.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
class BurzaView extends StatefulWidget {
|
class BurzaView extends StatefulWidget {
|
||||||
const BurzaView({Key? key, required this.canteen}) : super(key: key);
|
const BurzaView({super.key, required this.canteen});
|
||||||
final Canteen canteen;
|
final Canteen canteen;
|
||||||
@override
|
@override
|
||||||
State<BurzaView> createState() => _BurzaViewState();
|
State<BurzaView> createState() => _BurzaViewState();
|
||||||
|
|
|
@ -18,7 +18,7 @@ import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
class MealView extends StatefulWidget {
|
class MealView extends StatefulWidget {
|
||||||
const MealView({Key? key, required this.canteen}) : super(key: key);
|
const MealView({super.key, required this.canteen});
|
||||||
final Canteen canteen;
|
final Canteen canteen;
|
||||||
@override
|
@override
|
||||||
State<MealView> createState() => _MealViewState();
|
State<MealView> createState() => _MealViewState();
|
||||||
|
@ -90,7 +90,7 @@ class _MealViewState extends State<MealView> {
|
||||||
try {
|
try {
|
||||||
uzivatel = await widget.canteen.ziskejUzivatele();
|
uzivatel = await widget.canteen.ziskejUzivatele();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!widget.canteen.prihlasen) {
|
if (!widget.canteen.prihlasen && mounted) {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
context, platformRouter((c) => const LoginPage()));
|
context, platformRouter((c) => const LoginPage()));
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,9 @@ class _MealViewState extends State<MealView> {
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
j.nazev,
|
(settings.allergens && j.alergeny.isNotEmpty)
|
||||||
|
? "${j.nazev} (${j.alergeny.map<String>((e) => (e.kod != null) ? e.kod.toString() : e.nazev).join(', ')})"
|
||||||
|
: j.nazev,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text((j.naBurze)
|
Text((j.naBurze)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:canteenlib/canteenlib.dart';
|
import 'package:canteenlib/canteenlib.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:opencanteen/okna/welcome.dart';
|
import 'package:opencanteen/okna/welcome.dart';
|
||||||
import 'package:opencanteen/pw/platformbutton.dart';
|
import 'package:opencanteen/pw/platformbutton.dart';
|
||||||
|
@ -9,14 +8,13 @@ import 'package:opencanteen/pw/platformfield.dart';
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import '../../loginmanager.dart';
|
import '../../loginmanager.dart';
|
||||||
import '../../main.dart';
|
|
||||||
import '../../util.dart';
|
import '../../util.dart';
|
||||||
import '../pw/platformswitch.dart';
|
import '../pw/platformswitch.dart';
|
||||||
import 'jidelnicek.dart';
|
import 'jidelnicek.dart';
|
||||||
import 'offline_jidelnicek.dart';
|
import 'offline_jidelnicek.dart';
|
||||||
|
|
||||||
class LoginPage extends StatefulWidget {
|
class LoginPage extends StatefulWidget {
|
||||||
const LoginPage({Key? key}) : super(key: key);
|
const LoginPage({super.key});
|
||||||
@override
|
@override
|
||||||
State<LoginPage> createState() => _LoginPageState();
|
State<LoginPage> createState() => _LoginPageState();
|
||||||
}
|
}
|
||||||
|
@ -33,12 +31,6 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
LoginManager.getDetails().then((r) async {
|
LoginManager.getDetails().then((r) async {
|
||||||
// request android notification access
|
|
||||||
flutterLocalNotificationsPlugin
|
|
||||||
.resolvePlatformSpecificImplementation<
|
|
||||||
AndroidFlutterLocalNotificationsPlugin>()
|
|
||||||
?.requestPermission();
|
|
||||||
|
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
// Autologin
|
// Autologin
|
||||||
showDialog(
|
showDialog(
|
||||||
|
|
|
@ -19,7 +19,7 @@ import '../../main.dart';
|
||||||
import '../../util.dart';
|
import '../../util.dart';
|
||||||
|
|
||||||
class AndroidNastaveni extends StatefulWidget {
|
class AndroidNastaveni extends StatefulWidget {
|
||||||
const AndroidNastaveni({Key? key}) : super(key: key);
|
const AndroidNastaveni({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AndroidNastaveni> createState() => _AndroidNastaveniState();
|
State<AndroidNastaveni> createState() => _AndroidNastaveniState();
|
||||||
|
@ -31,6 +31,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
|
||||||
bool _checkWeek = false;
|
bool _checkWeek = false;
|
||||||
bool _notifyMeal = false;
|
bool _notifyMeal = false;
|
||||||
bool _remember = false;
|
bool _remember = false;
|
||||||
|
bool _allergens = false;
|
||||||
TimeOfDay _notifTime = TimeOfDay.now();
|
TimeOfDay _notifTime = TimeOfDay.now();
|
||||||
final TextEditingController _countController =
|
final TextEditingController _countController =
|
||||||
TextEditingController(text: "1");
|
TextEditingController(text: "1");
|
||||||
|
@ -81,6 +82,16 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
|
||||||
sections: [
|
sections: [
|
||||||
SettingsSection(
|
SettingsSection(
|
||||||
tiles: [
|
tiles: [
|
||||||
|
SettingsTile.switchTile(
|
||||||
|
initialValue: _allergens,
|
||||||
|
onToggle: (value) {
|
||||||
|
_allergens = value;
|
||||||
|
settings.allergens = value;
|
||||||
|
changeSetting("allergens", _allergens);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
title: Text(AppLocalizations.of(context)!.showAllergens),
|
||||||
|
),
|
||||||
SettingsTile.switchTile(
|
SettingsTile.switchTile(
|
||||||
initialValue: _saveOffline,
|
initialValue: _saveOffline,
|
||||||
onToggle: (value) {
|
onToggle: (value) {
|
||||||
|
@ -281,6 +292,19 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
|
||||||
ticker: 'today meal');
|
ticker: 'today meal');
|
||||||
var l =
|
var l =
|
||||||
tz.getLocation(await FlutterNativeTimezone.getLocalTimezone());
|
tz.getLocation(await FlutterNativeTimezone.getLocalTimezone());
|
||||||
|
var notifGranted = await flutterLocalNotificationsPlugin
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
AndroidFlutterLocalNotificationsPlugin>()
|
||||||
|
?.requestNotificationsPermission() ??
|
||||||
|
true; // request android notification access
|
||||||
|
|
||||||
|
var granted = await flutterLocalNotificationsPlugin
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
AndroidFlutterLocalNotificationsPlugin>()
|
||||||
|
?.requestExactAlarmsPermission() ??
|
||||||
|
true; // request android exact alarm permission
|
||||||
|
|
||||||
|
if (!granted || !notifGranted) return;
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
await flutterLocalNotificationsPlugin.zonedSchedule(
|
await flutterLocalNotificationsPlugin.zonedSchedule(
|
||||||
// schedules a notification
|
// schedules a notification
|
||||||
|
@ -289,7 +313,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
|
||||||
"${jidlo.varianta} - ${jidlo.nazev}",
|
"${jidlo.varianta} - ${jidlo.nazev}",
|
||||||
tz.TZDateTime.from(den, l),
|
tz.TZDateTime.from(den, l),
|
||||||
const NotificationDetails(android: androidSpec),
|
const NotificationDetails(android: androidSpec),
|
||||||
androidAllowWhileIdle: true,
|
androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle,
|
||||||
uiLocalNotificationDateInterpretation:
|
uiLocalNotificationDateInterpretation:
|
||||||
UILocalNotificationDateInterpretation.absoluteTime);
|
UILocalNotificationDateInterpretation.absoluteTime);
|
||||||
} on StateError catch (_) {
|
} on StateError catch (_) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
class OfflineMealView extends StatefulWidget {
|
class OfflineMealView extends StatefulWidget {
|
||||||
const OfflineMealView({Key? key}) : super(key: key);
|
const OfflineMealView({super.key});
|
||||||
@override
|
@override
|
||||||
State<OfflineMealView> createState() => _OfflineMealViewState();
|
State<OfflineMealView> createState() => _OfflineMealViewState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import 'package:opencanteen/okna/jidelnicek.dart';
|
||||||
import 'package:opencanteen/util.dart';
|
import 'package:opencanteen/util.dart';
|
||||||
|
|
||||||
class WelcomePage extends StatefulWidget {
|
class WelcomePage extends StatefulWidget {
|
||||||
const WelcomePage({Key? key, required this.canteen}) : super(key: key);
|
const WelcomePage({super.key, required this.canteen});
|
||||||
|
|
||||||
final Canteen canteen;
|
final Canteen canteen;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:opencanteen/pw/platformwidget.dart';
|
||||||
|
|
||||||
class PlatformField extends PlatformWidget<TextField, CupertinoTextField> {
|
class PlatformField extends PlatformWidget<TextField, CupertinoTextField> {
|
||||||
final TextEditingController? controller;
|
final TextEditingController? controller;
|
||||||
final bool? enabled;
|
final bool enabled;
|
||||||
final bool obscureText;
|
final bool obscureText;
|
||||||
final String? labelText;
|
final String? labelText;
|
||||||
final bool autocorrect;
|
final bool autocorrect;
|
||||||
|
@ -16,13 +16,13 @@ class PlatformField extends PlatformWidget<TextField, CupertinoTextField> {
|
||||||
const PlatformField({
|
const PlatformField({
|
||||||
super.key,
|
super.key,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.enabled,
|
|
||||||
this.labelText,
|
this.labelText,
|
||||||
this.obscureText = false,
|
this.obscureText = false,
|
||||||
this.autocorrect = false,
|
this.autocorrect = false,
|
||||||
this.keyboardType,
|
this.keyboardType,
|
||||||
this.inputFormatters = const [],
|
this.inputFormatters = const [],
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
|
this.enabled = true,
|
||||||
this.autofillHints,
|
this.autofillHints,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -128,4 +128,5 @@ class SettingsManager {
|
||||||
bool skipWeekend = false;
|
bool skipWeekend = false;
|
||||||
bool checkOrdered = false;
|
bool checkOrdered = false;
|
||||||
bool saveOffline = false;
|
bool saveOffline = false;
|
||||||
|
bool allergens = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ publish_to: 'none'
|
||||||
# The following defines the version and build number for your application.
|
# The following defines the version and build number for your application.
|
||||||
# A version number is three numbers separated by dots, like 1.2.43
|
# A version number is three numbers separated by dots, like 1.2.43
|
||||||
# followed by an optional build number separated by a +.
|
# followed by an optional build number separated by a +.
|
||||||
version: 1.9.1+31
|
version: 1.10.0+32
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.2 <3.0.0"
|
sdk: ">=2.18.2 <3.0.0"
|
||||||
|
|
Reference in a new issue