docs: přidat komentáře
This commit is contained in:
parent
d57b30b0bf
commit
38f5e0b331
1 changed files with 12 additions and 2 deletions
|
@ -65,8 +65,12 @@ void oznamitPredem(SharedPreferences prefs, tz.Location l) async {
|
||||||
if (await c.login(d["user"]!, d["pass"]!)) {
|
if (await c.login(d["user"]!, d["pass"]!)) {
|
||||||
var jidla = await c.jidelnicekDen();
|
var jidla = await c.jidelnicekDen();
|
||||||
try {
|
try {
|
||||||
var jidlo = jidla.jidla.singleWhere((element) => element.objednano);
|
var jidlo = jidla.jidla.singleWhere(
|
||||||
var kdy = DateTime.parse(prefs.getString("oznameni_cas")!);
|
(element) => element.objednano); // získá objednané jídlo
|
||||||
|
var kdy = DateTime.parse(prefs.getString(
|
||||||
|
"oznameni_cas")!); // uložíme čas, kdy se má odeslat oznámení
|
||||||
|
|
||||||
|
// data o oznámení
|
||||||
const AndroidNotificationDetails androidSpec =
|
const AndroidNotificationDetails androidSpec =
|
||||||
AndroidNotificationDetails('predobedem', 'Oznámení před obědem',
|
AndroidNotificationDetails('predobedem', 'Oznámení před obědem',
|
||||||
channelDescription: 'Oznámení o dnešním jídle',
|
channelDescription: 'Oznámení o dnešním jídle',
|
||||||
|
@ -75,6 +79,8 @@ void oznamitPredem(SharedPreferences prefs, tz.Location l) async {
|
||||||
ticker: 'today meal');
|
ticker: 'today meal');
|
||||||
const IOSNotificationDetails iOSpec =
|
const IOSNotificationDetails iOSpec =
|
||||||
IOSNotificationDetails(presentAlert: true, presentBadge: true);
|
IOSNotificationDetails(presentAlert: true, presentBadge: true);
|
||||||
|
|
||||||
|
// naplánovat
|
||||||
await flutterLocalNotificationsPlugin.zonedSchedule(
|
await flutterLocalNotificationsPlugin.zonedSchedule(
|
||||||
0,
|
0,
|
||||||
title,
|
title,
|
||||||
|
@ -107,6 +113,7 @@ void main() async {
|
||||||
oznamitPredem(prefs, l);
|
oznamitPredem(prefs, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nastavit oznámení
|
||||||
const AndroidInitializationSettings initializationSettingsAndroid =
|
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||||
AndroidInitializationSettings('notif_icon');
|
AndroidInitializationSettings('notif_icon');
|
||||||
|
|
||||||
|
@ -130,6 +137,8 @@ void main() async {
|
||||||
debugPrint('notification payload: $payload');
|
debugPrint('notification payload: $payload');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// spustit aplikaci
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,6 +409,7 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Získá offline soubor a zobrazí údaje
|
||||||
void goOffline() async {
|
void goOffline() async {
|
||||||
Directory appDocDir = await getApplicationDocumentsDirectory();
|
Directory appDocDir = await getApplicationDocumentsDirectory();
|
||||||
var den = DateTime.now();
|
var den = DateTime.now();
|
||||||
|
|
Reference in a new issue