feat: oznámení o neobjednaném jídle
This commit is contained in:
parent
f369239473
commit
3ab7759981
9 changed files with 87 additions and 3 deletions
|
@ -1,3 +1,6 @@
|
|||
# 1.2.0
|
||||
- Přidat možnost zobrazení oznámení v případě neobjednaného jídla na příští týden
|
||||
- Přidat oznámení o rozbitých uložených údajích
|
||||
# 1.1.2
|
||||
- Přidat chybějící knihovnu do O Aplikaci (licence)
|
||||
# 1.1.1
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
<application
|
||||
android:label="OpenCanteen"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
android:icon="@mipmap/launcher_icon"
|
||||
android:allowBackup="false"
|
||||
android:fullBackupContent="false">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
|
|
@ -41,6 +41,8 @@ abstract class Languages {
|
|||
|
||||
String get warning;
|
||||
|
||||
String get corrupted;
|
||||
|
||||
// Jídelníček
|
||||
|
||||
String get loading;
|
||||
|
@ -85,6 +87,8 @@ abstract class Languages {
|
|||
|
||||
String get balance;
|
||||
|
||||
String get noOrder;
|
||||
|
||||
// Uvítací obrazovka
|
||||
|
||||
String get welcome;
|
||||
|
@ -131,7 +135,7 @@ abstract class Languages {
|
|||
|
||||
String get copyright;
|
||||
|
||||
// Settings
|
||||
// Nastavení
|
||||
|
||||
String get settings;
|
||||
|
||||
|
@ -139,6 +143,8 @@ abstract class Languages {
|
|||
|
||||
String get skipWeekend;
|
||||
|
||||
String get checkOrdered;
|
||||
|
||||
// Offline
|
||||
String get offline;
|
||||
|
||||
|
|
|
@ -196,4 +196,15 @@ class LanguageCz extends Languages {
|
|||
|
||||
@override
|
||||
String get next => "Další";
|
||||
|
||||
@override
|
||||
String get checkOrdered =>
|
||||
"Kontrolovat, jestli mám objednáno na příští týden";
|
||||
|
||||
@override
|
||||
String get noOrder => "Na přístí týden nemáte objednané žádné jídlo!";
|
||||
|
||||
@override
|
||||
String get corrupted =>
|
||||
"Nastal problém s dešifrováním uložených údajů, prosím zkuste vyčistit veškerá data této aplikace.";
|
||||
}
|
||||
|
|
|
@ -196,4 +196,14 @@ class LanguageEn extends Languages {
|
|||
|
||||
@override
|
||||
String get next => "Next";
|
||||
|
||||
@override
|
||||
String get checkOrdered => "Check if I have ordered food for the next week";
|
||||
|
||||
@override
|
||||
String get noOrder => "You did not order any food for the next week!";
|
||||
|
||||
@override
|
||||
String get corrupted =>
|
||||
"The saved credentials seem to be corrupted, please try clearing the application's data.";
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:opencanteen/lang/lang_cz.dart';
|
||||
|
@ -136,6 +137,13 @@ class _LoginPageState extends State<LoginPage> {
|
|||
)),
|
||||
);
|
||||
}
|
||||
} on PlatformException {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(Languages.of(context)!.corrupted),
|
||||
),
|
||||
);
|
||||
} catch (_) {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
|
@ -271,6 +279,13 @@ class _LoginPageState extends State<LoginPage> {
|
|||
)),
|
||||
);
|
||||
}
|
||||
} on PlatformException {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(Languages.of(context)!.corrupted),
|
||||
),
|
||||
);
|
||||
} on Exception catch (_) {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
|
|
|
@ -27,6 +27,26 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
|
|||
String denTydne = "";
|
||||
double kredit = 0.0;
|
||||
bool _skipWeekend = false;
|
||||
|
||||
void kontrolaTyden(BuildContext context) async {
|
||||
var prefs = await SharedPreferences.getInstance();
|
||||
if (prefs.getBool("tyden") ?? false) {
|
||||
// Zjistit jestli je objednáno na přístí týden
|
||||
var pristi = den.add(const Duration(days: 7));
|
||||
var jidelnicek = await widget.canteen.jidelnicekDen(den: pristi);
|
||||
if (jidelnicek.jidla.isNotEmpty &&
|
||||
!jidelnicek.jidla.any((element) => element.objednano == true)) {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(Languages.of(context)!.noOrder),
|
||||
duration: const Duration(seconds: 5),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> nactiJidlo() async {
|
||||
obsah = [const CircularProgressIndicator()];
|
||||
switch (den.weekday) {
|
||||
|
@ -270,6 +290,7 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
|
|||
);
|
||||
}
|
||||
}
|
||||
kontrolaTyden(context);
|
||||
});
|
||||
});
|
||||
}).catchError((o) {
|
||||
|
|
|
@ -16,12 +16,14 @@ class Nastaveni extends StatefulWidget {
|
|||
class _NastaveniState extends State<Nastaveni> {
|
||||
bool _ukladatOffline = false;
|
||||
bool _preskakovatVikend = false;
|
||||
bool _kontrolovatTyden = false;
|
||||
|
||||
void najitNastaveni() async {
|
||||
var preferences = await SharedPreferences.getInstance();
|
||||
setState(() {
|
||||
_ukladatOffline = preferences.getBool("offline") ?? false;
|
||||
_preskakovatVikend = preferences.getBool("skip") ?? false;
|
||||
_kontrolovatTyden = preferences.getBool("tyden") ?? false;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -75,6 +77,20 @@ class _NastaveniState extends State<Nastaveni> {
|
|||
});
|
||||
})
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(child: Text(Languages.of(context)!.checkOrdered)),
|
||||
Switch(
|
||||
value: _kontrolovatTyden,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_kontrolovatTyden = value;
|
||||
zmenitNastaveni("tyden", value);
|
||||
});
|
||||
})
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
|
@ -6,7 +6,7 @@ publish_to: 'none'
|
|||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
version: 1.1.3+7
|
||||
version: 1.2.0+14
|
||||
|
||||
environment:
|
||||
sdk: ">=2.16.1 <3.0.0"
|
||||
|
|
Reference in a new issue