Compare commits
No commits in common. "9b25f3b0e72165710bb88f88cc7a153f41d3d4bf" and "b948959e671ce2a4efab278bc489f7f1228f1f7a" have entirely different histories.
9b25f3b0e7
...
b948959e67
21 changed files with 365 additions and 446 deletions
5
.devcontainer/devcontainer.json
Normal file
5
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name": "Flutter",
|
||||||
|
"image": "matspfeiffer/flutter:beta",
|
||||||
|
"extensions": ["dart-code.dart-code", "dart-code.flutter"]
|
||||||
|
}
|
13
.github/FUNDING.yml
vendored
Normal file
13
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: hernikplays
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
28
.github/ISSUE_TEMPLATE/chybov--hl--en-.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE/chybov--hl--en-.md
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
name: Chybové hlášení
|
||||||
|
about: Použijte tuto předlohu, pokud se něco rozbilo
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: hernikplays
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Popis chyby**
|
||||||
|
Zde popište co se stalo, mělo stát apod.
|
||||||
|
|
||||||
|
**Kroky pro replikaci**
|
||||||
|
Kroky ke spuštění chyby:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Snímky obrazovky**
|
||||||
|
Chcete-li, přiložte snímky
|
||||||
|
|
||||||
|
**Info o zařízení**
|
||||||
|
- Verze systému zařízení: [např. Android 12, iOS 9]
|
||||||
|
- Verze aplikace [např. 0.1.0]
|
||||||
|
|
||||||
|
**Ostatní**
|
||||||
|
Sem vepište doplňující informace
|
11
.github/ISSUE_TEMPLATE/n-pad-na-vylep-en-.md
vendored
Normal file
11
.github/ISSUE_TEMPLATE/n-pad-na-vylep-en-.md
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
name: Nápad na vylepšení
|
||||||
|
about: Navrhněte co změnit nebo přidat do aplikace
|
||||||
|
title: ''
|
||||||
|
labels: vylepšení
|
||||||
|
assignees: hernikplays
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Souvisí váš navrh s nějakým problémem?**
|
||||||
|
Popište váš problém a co čekáte za řešení.
|
8
.github/labeler.yml
vendored
Normal file
8
.github/labeler.yml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
'pr: pubspec':
|
||||||
|
- pubspec.yaml
|
||||||
|
|
||||||
|
'pr: funkce':
|
||||||
|
- lib/*
|
||||||
|
|
||||||
|
'pr: okno':
|
||||||
|
- lib/okna/*
|
14
.github/pull_request_template.md
vendored
Normal file
14
.github/pull_request_template.md
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Opravuje/implementuje # .
|
||||||
|
|
||||||
|
Změny:
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
|
||||||
|
```
|
||||||
|
Text výše slouží jen jako předloha, není nutné se ho držet, ale šetříte ostatním čas
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] Otestoval jsem funkčnost celé aplikace po přidání svého kódu
|
||||||
|
- [ ] Přidaný kód nebo knihovny neobsahují žádný kód pod nekompatibilní licencí
|
||||||
|
|
||||||
|
Doplňující/ostatní informace:
|
30
.github/workflows/main.yml
vendored
Normal file
30
.github/workflows/main.yml
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# This is a basic workflow to help you get started with Actions
|
||||||
|
|
||||||
|
name: Analyze
|
||||||
|
|
||||||
|
# Controls when the workflow will run
|
||||||
|
on:
|
||||||
|
# Triggers the workflow on push or pull request events but only for the main branch
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
|
jobs:
|
||||||
|
fossa-scan:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: fossas/fossa-action@main
|
||||||
|
with:
|
||||||
|
api-key: ${{secrets.fossaApiKey}}
|
||||||
|
analyze:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: subosito/flutter-action@v2
|
||||||
|
with:
|
||||||
|
channel: 'stable'
|
||||||
|
- run: flutter pub get
|
||||||
|
- run: flutter analyze
|
33
.github/workflows/pr.yml
vendored
Normal file
33
.github/workflows/pr.yml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
name: "Lint PR"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
name: Validate PR
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: amannn/action-semantic-pull-request@v4
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- uses: wagoid/commitlint-github-action@v4
|
||||||
|
- uses: actions/labeler@v4
|
||||||
|
with:
|
||||||
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
branch:
|
||||||
|
name: Uzavřít PRy mimo dev větev
|
||||||
|
needs: main
|
||||||
|
if: github.base_ref == 'main' && github.actor != 'hernikplays'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: superbrothers/close-pull-request@v3
|
||||||
|
with:
|
||||||
|
comment: "Všechny pull requesty by měly směřovat na jinou větev, než `main`. Pokud je tohle chyba, napište správci repozitáře."
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,6 +1,3 @@
|
||||||
{
|
{
|
||||||
"dart.flutterSdkPath": ".flutter",
|
"dart.flutterSdkPath": ".flutter",
|
||||||
"conventionalCommits.scopes": [
|
|
||||||
"dependencies"
|
|
||||||
],
|
|
||||||
}
|
}
|
|
@ -1,7 +1,3 @@
|
||||||
# 1.8.0
|
|
||||||
- aktualizace závislostí
|
|
||||||
- předělání nastavení
|
|
||||||
- změna nastavení nyní nevyžaduje restart aplikace
|
|
||||||
# 1.7.0
|
# 1.7.0
|
||||||
- Implementovat Material 3 (Android)
|
- Implementovat Material 3 (Android)
|
||||||
- Upravit chování dle platformy
|
- Upravit chování dle platformy
|
||||||
|
|
|
@ -2,16 +2,6 @@
|
||||||
OpenCanteen je **aplikace** pro přístup do iCanteen. Pokud chcete přispět kód související s komunikací s iCanteen, podívejte se na [canteenlib](https://github.com/hernikplays/canteenlib).
|
OpenCanteen je **aplikace** pro přístup do iCanteen. Pokud chcete přispět kód související s komunikací s iCanteen, podívejte se na [canteenlib](https://github.com/hernikplays/canteenlib).
|
||||||
|
|
||||||
## Jak přispět do vývoje
|
## Jak přispět do vývoje
|
||||||
|
|
||||||
### Používám GitHub pod protestem
|
|
||||||
|
|
||||||
Tento projekt je aktuálně hostován i na GitHubu. To není ideální; GitHub je uzavřený systém plný obchodních tajemství. Doporučuji přečíst si o kampani
|
|
||||||
[Give up GitHub](https://GiveUpGitHub.org) od
|
|
||||||
[Software Freedom Conservancy](https://sfconservancy.org) pro pochopení proč GitHub není ideální místo pro FOSS projekty.
|
|
||||||
|
|
||||||
**Příspěvky do kódu přijímám **pouze** skrz mou Forgejo instanci na adrese https://git.mnau.xyz/hernik/opencanteen**
|
|
||||||
|
|
||||||
Jakékoli použití kódu pro učení umělých inteligencí, které neumožňuje samotná licence GNU GPL 3.0 či novější, je děláno bez mého souhlasu a vědomí.
|
|
||||||
### Nahlašování chyb
|
### Nahlašování chyb
|
||||||
Prosté vyhledání a nahlášení chyby je asi nejjednodušší a zároveň nejpřínosnější způsob přispívání. Stačí vám běžné zařízení a stažená aplikace, pokud objevíte jakoukoliv chybu nebo nesrovnalost, nahlaste ji v [Issues](https://github.com/hernikplays/opencanteen/issues/new/choose).
|
Prosté vyhledání a nahlášení chyby je asi nejjednodušší a zároveň nejpřínosnější způsob přispívání. Stačí vám běžné zařízení a stažená aplikace, pokud objevíte jakoukoliv chybu nebo nesrovnalost, nahlaste ji v [Issues](https://github.com/hernikplays/opencanteen/issues/new/choose).
|
||||||
|
|
||||||
|
|
11
README.md
11
README.md
|
@ -29,20 +29,11 @@ Jednoduchý návod k použití naleznete [zde](https://github.com/hernikplays/op
|
||||||
|
|
||||||
## Přispět
|
## Přispět
|
||||||
Přispět na vývoj můžete skrz
|
Přispět na vývoj můžete skrz
|
||||||
|
- Liberapay: https://liberapay.com/hernikplays
|
||||||
- Monero: `49uzFSxAsT92sXUsCEgh11VX7pmNZcoeKi4fEWbLGc2oWGMUVNcDDqGVB97ak96LqEBqsMXLS752bjgyVzbFcVwLNke4pNd`
|
- Monero: `49uzFSxAsT92sXUsCEgh11VX7pmNZcoeKi4fEWbLGc2oWGMUVNcDDqGVB97ak96LqEBqsMXLS752bjgyVzbFcVwLNke4pNd`
|
||||||
- Bitcoin: `3NzqkBZgWgjj1NYj2JwmBBptPWw6wt7dHS`
|
- Bitcoin: `3NzqkBZgWgjj1NYj2JwmBBptPWw6wt7dHS`
|
||||||
- Kód: viz CONTRIBUTING
|
- Kód: viz CONTRIBUTING
|
||||||
|
|
||||||
## Používám GitHub pod protestem
|
|
||||||
|
|
||||||
Tento projekt je aktuálně hostován i na GitHubu. To není ideální; GitHub je uzavřený systém plný obchodních tajemství. Doporučuji přečíst si o kampani
|
|
||||||
[Give up GitHub](https://GiveUpGitHub.org) od
|
|
||||||
[Software Freedom Conservancy](https://sfconservancy.org) pro pochopení proč GitHub není ideální místo pro FOSS projekty.
|
|
||||||
|
|
||||||
Příspěvky do kódu přijímám **pouze** skrz mou Forgejo instanci na adrese https://git.mnau.xyz/hernik/opencanteen
|
|
||||||
|
|
||||||
Jakékoli použití kódu pro učení umělých inteligencí, které neumožňuje samotná licence GNU GPL 3.0 či novější, je děláno bez mého souhlasu a vědomí.
|
|
||||||
|
|
||||||
## Licence
|
## Licence
|
||||||
**Copyright (c) 2022 Matyáš Caras a přispěvatelé**
|
**Copyright (c) 2022 Matyáš Caras a přispěvatelé**
|
||||||
|
|
||||||
|
|
|
@ -1,82 +1 @@
|
||||||
{
|
{"about":"O Aplikaci","agree":"Souhlasím","appName":"OpenCanteen","balance":"Kredit: ","cannotOrder":"Toto jídlo není možné objednat.","close":"Zavřít","copyright":"© 2022 Matyáš Caras a přispěvatelé","disagree":"Nesouhlasím","errorContacting":"Nastala chyba při kontaktování serveru, zkontrolujte připojení","errorOrdering":"Jídlo se nepodařilo objednat","exchange":"Burza","exchangeError":"Nepodařilo se vložit jídlo na burzu","friday":"Pátek","home":"Domů","httpLogin":"Snažíte se přihlásit přes nešifrované spojení HTTP, jste si jisti, že tak chcete učinit?","iCanteenUrl":"iCanteen URL","inExchange":"V BURZE","license":"Vydáno pod licencí GNU GPLv3","loading":"Načítání...","logIn":"Přihlášení","loggingIn":"Přihlašuji vás...","loginFailed":"Přihlášení se nezdařilo","menu":"Jídelníček","monday":"Pondělí","mustLogout":"Online přejdete přetažením dolů.","no":"Ne","noChange":"Ne, změnit","noExchange":"Žádné jídlo v burze","noFood":"Žádné jídlo pro tento den","notOfficial":"Toto není oficiální aplikace k ovládání iCanteen. Autor neručí za ztráty nebo nefunkčnost v souvislosti s používáním této aplikace. Pokračováním souhlasíte.","offline":"JSTE OFFLINE","ok":"OK","order":"Objednat","orderSuccess":"Jídlo bylo úspěšně objednáno","ordered":"Objednáno","ordering":"Objednávám...","password":"Heslo","pullToReload":"Potáhněte zvrchu pro načtení","rememberMe":"Zapamatovat si mě","reportBugs":"Zpětná vazba","saturday":"Sobota","saveOffline":"Ukládat jídelníček na dnešní den offline","settings":"Nastavení","signOut":"Odhlásit se","skipWeekend":"Při procházení menu přeskočit víkend","sunday":"Neděle","thursday":"Čtvrtek","tuesday":"Úterý","username":"Uživatelské jméno","verifyExchange":"Opravdu chcete vložit jídlo na burzu?","warning":"Pozor!","wednesday":"Středa","yes":"Ano","aboutFromExch":"Žádné jídlo? Žádný problém!","aboutOrder":"Klepnutím objednáte","aboutToExch":"Nemáte chuť?","appDesc":"OpenCanteen je neoficiální aplikace pro přístup do obědového systému iCanteen","howFromExch":"Z vysunovacího menu přejděte do burzy a objednejte si z dostupných jídel","howOrder":"Jednoduše klepněte na jídlo s modrým políčkem a máte objednáno","howToExch":"Stačí dlouze podržet jméno objednaného jídla a můžete ho přesunout na nebo z burzy","welcome":"Vítejte v OpenCanteen","next":"Další","checkOrdered":"Kontrolovat, jestli mám objednáno na příští týden","noOrder":"Na přístí týden nemáte objednané žádné jídlo!","corrupted":"Nastal problém s dešifrováním uložených údajů, prosím zkuste vyčistit veškerá data této aplikace.","notifyAt":"Odeslat v","notifyLunch":"V určený čas odeslat notifikaci s informacemi o obědě","lunchNotif":"Dnes máte objednáno","error":"Chyba","needRemember":"Musíte své přihlašovací údaje uložit na přihlašovací obrazovce","notifyWarning":"Vaše zařízení může mít povolenou optimalizaci baterie, což může způsobovat neodesílání oznámení. Zkontrolujte nastavení ve vašem zařízení.","signOutWarn":"Opravdu se chcete odhlásit?","jump":"Přeskočit","source":"Zdrojový kód","review":"Ohodnotit aplikaci","saveCount":"Počet dnů dostupných offline (Akt. limit je 7)","errorSaving":"Při ukládání offline nastala chyba, zkuste to znovu později.","todayTooltip":"Přejít na dnešní jídelníček"}
|
||||||
"about": "O Aplikaci",
|
|
||||||
"agree": "Souhlasím",
|
|
||||||
"appName": "OpenCanteen",
|
|
||||||
"balance": "Kredit: ",
|
|
||||||
"cannotOrder": "Toto jídlo není možné objednat.",
|
|
||||||
"close": "Zavřít",
|
|
||||||
"copyright": "© 2022 Matyáš Caras a přispěvatelé",
|
|
||||||
"disagree": "Nesouhlasím",
|
|
||||||
"errorContacting": "Nastala chyba při kontaktování serveru, zkontrolujte připojení",
|
|
||||||
"errorOrdering": "Jídlo se nepodařilo objednat",
|
|
||||||
"exchange": "Burza",
|
|
||||||
"exchangeError": "Nepodařilo se vložit jídlo na burzu",
|
|
||||||
"friday": "Pátek",
|
|
||||||
"home": "Domů",
|
|
||||||
"httpLogin": "Snažíte se přihlásit přes nešifrované spojení HTTP, jste si jisti, že tak chcete učinit?",
|
|
||||||
"iCanteenUrl": "iCanteen URL",
|
|
||||||
"inExchange": "V BURZE",
|
|
||||||
"license": "Vydáno pod licencí GNU GPLv3",
|
|
||||||
"loading": "Načítání...",
|
|
||||||
"logIn": "Přihlášení",
|
|
||||||
"loggingIn": "Přihlašuji vás...",
|
|
||||||
"loginFailed": "Přihlášení se nezdařilo",
|
|
||||||
"menu": "Jídelníček",
|
|
||||||
"monday": "Pondělí",
|
|
||||||
"mustLogout": "Online přejdete přetažením dolů.",
|
|
||||||
"no": "Ne",
|
|
||||||
"noChange": "Ne, změnit",
|
|
||||||
"noExchange": "Žádné jídlo v burze",
|
|
||||||
"noFood": "Žádné jídlo pro tento den",
|
|
||||||
"notOfficial": "Toto není oficiální aplikace k ovládání iCanteen. Autor neručí za ztráty nebo nefunkčnost v souvislosti s používáním této aplikace. Pokračováním souhlasíte.",
|
|
||||||
"offline": "JSTE OFFLINE",
|
|
||||||
"ok": "OK",
|
|
||||||
"order": "Objednat",
|
|
||||||
"orderSuccess": "Jídlo bylo úspěšně objednáno",
|
|
||||||
"ordered": "Objednáno",
|
|
||||||
"ordering": "Objednávám...",
|
|
||||||
"password": "Heslo",
|
|
||||||
"pullToReload": "Potáhněte zvrchu pro načtení",
|
|
||||||
"rememberMe": "Zapamatovat si mě",
|
|
||||||
"reportBugs": "Zpětná vazba",
|
|
||||||
"saturday": "Sobota",
|
|
||||||
"saveOffline": "Ukládat jídelníček offline",
|
|
||||||
"settings": "Nastavení",
|
|
||||||
"signOut": "Odhlásit se",
|
|
||||||
"skipWeekend": "Při procházení menu přeskočit víkend",
|
|
||||||
"sunday": "Neděle",
|
|
||||||
"thursday": "Čtvrtek",
|
|
||||||
"tuesday": "Úterý",
|
|
||||||
"username": "Uživatelské jméno",
|
|
||||||
"verifyExchange": "Opravdu chcete vložit jídlo na burzu?",
|
|
||||||
"warning": "Pozor!",
|
|
||||||
"wednesday": "Středa",
|
|
||||||
"yes": "Ano",
|
|
||||||
"aboutFromExch": "Žádné jídlo? Žádný problém!",
|
|
||||||
"aboutOrder": "Klepnutím objednáte",
|
|
||||||
"aboutToExch": "Nemáte chuť?",
|
|
||||||
"appDesc": "OpenCanteen je neoficiální aplikace pro přístup do obědového systému iCanteen",
|
|
||||||
"howFromExch": "Z vysunovacího menu přejděte do burzy a objednejte si z dostupných jídel",
|
|
||||||
"howOrder": "Jednoduše klepněte na jídlo s modrým políčkem a máte objednáno",
|
|
||||||
"howToExch": "Stačí dlouze podržet jméno objednaného jídla a můžete ho přesunout na nebo z burzy",
|
|
||||||
"welcome": "Vítejte v OpenCanteen",
|
|
||||||
"next": "Další",
|
|
||||||
"checkOrdered": "Kontrolovat, jestli mám objednáno na příští týden",
|
|
||||||
"noOrder": "Na přístí týden nemáte objednané žádné jídlo!",
|
|
||||||
"corrupted": "Nastal problém s dešifrováním uložených údajů, prosím zkuste vyčistit veškerá data této aplikace.",
|
|
||||||
"notifyAt": "Odeslat v",
|
|
||||||
"notifyLunch": "V určený čas odeslat notifikaci s informacemi o obědě",
|
|
||||||
"lunchNotif": "Dnes máte objednáno",
|
|
||||||
"error": "Chyba",
|
|
||||||
"needRemember": "Musíte své přihlašovací údaje uložit na přihlašovací obrazovce",
|
|
||||||
"notifyWarning": "Vaše zařízení může mít povolenou optimalizaci baterie, což může způsobovat neodesílání oznámení. Zkontrolujte nastavení ve vašem zařízení.",
|
|
||||||
"signOutWarn": "Opravdu se chcete odhlásit?",
|
|
||||||
"jump": "Přeskočit",
|
|
||||||
"source": "Zdrojový kód",
|
|
||||||
"review": "Ohodnotit aplikaci",
|
|
||||||
"saveCount": "Počet dnů dostupných offline (Akt. limit je 7)",
|
|
||||||
"errorSaving": "Při ukládání offline nastala chyba, zkuste to znovu později.",
|
|
||||||
"todayTooltip": "Přejít na dnešní jídelníček",
|
|
||||||
"settingsExperience":"Zážitek",
|
|
||||||
"settingsFunctions":"Extra funkce"
|
|
||||||
}
|
|
|
@ -1,82 +1 @@
|
||||||
{
|
{"about":"About","agree":"I agree","appName":"OpenCanteen","balance":"Balance: ","cannotOrder":"This food cannot be ordered.","close":"Close","copyright":"© 2022 Matyáš Caras and contributors","disagree":"I disagree","errorContacting":"Failed to contact the server, check your connection.","errorOrdering":"Could not order food.","exchange":"Exchange","exchangeError":"Could not put food on exchange.","friday":"Friday","home":"Home","httpLogin":"You are trying to sign in using an insecure HTTP connection, are you sure you want to continue?","iCanteenUrl":"iCanteen URL","inExchange":"ON EXCHANGE","license":"Released under the GNU GPLv3","loading":"Loading...","logIn":"Sign in","loggingIn":"Signing you in...","loginFailed":"Sign in failed","menu":"Food Menu","monday":"Monday","mustLogout":"To go online, pull down.","no":"No","noChange":"No, change","noExchange":"No meal in exchange","noFood":"No meal for this day","notOfficial":"This is not an official app for accessing iCanteen. The author is not responsible for non-functionality or losses while using this app. By continuing you agree.","offline":"YOU ARE OFFLINE","ok":"OK","order":"Order","orderSuccess":"Meal ordered succesfully","ordered":"Ordered","ordering":"Ordering...","password":"Password","pullToReload":"Pull to reload","rememberMe":"Remember me","reportBugs":"Feedback","saturday":"Saturday","saveOffline":"Save today's menu offline","settings":"Settings","signOut":"Sign out","skipWeekend":"Skip weekends when browsing menu","sunday":"Sunday","thursday":"Thursday","tuesday":"Tuesday","username":"Username","verifyExchange":"Are you sure you want to put this meal on exchange?","warning":"Warning!","wednesday":"Wednesday","yes":"Yes","appDesc":"OpenCanteen is a mobile app for accessing iCanteen.","welcome":"Welcome to OpenCanteen","aboutOrder":"Order with a tap","howOrder":"Simply tap on a meal with a blue checkbox next to it and it's done!","aboutToExch":"Don't want your food?","howToExch":"If you cannot cancel your order, simply long-tap on the ordered food and put it into the exchange.","aboutFromExch":"No food? No problem!","howFromExch":"Simply check the exchange from the sidebar and order when a meal is available.","next":"Next","checkOrdered":"Check if I have ordered food for the next week","noOrder":"You did not order any food for the next week!","corrupted":"The saved credentials seem to be corrupted, please try clearing the application's data.","notifyAt":"Send notification at","notifyLunch":"Send a notification with meal info","lunchNotif":"Today's ordered meal","error":"Error","needRemember":"You need to save your login details on the login screen first","notifyWarning":"Your device may have battery optimization enabled. This may cause notifications to not be sent. Check the application info in your device's settings.","signOutWarn":"Do you really want to sign out?","jump":"Jump","source":"Source code","review":"Review the app","saveCount":"Number of days to save offline (Current limit is 7)","errorSaving":"An error occured while trying to save menu offline, try again later.","todayTooltip":"Go to today's meal"}
|
||||||
"about": "About",
|
|
||||||
"agree": "I agree",
|
|
||||||
"appName": "OpenCanteen",
|
|
||||||
"balance": "Balance: ",
|
|
||||||
"cannotOrder": "This food cannot be ordered.",
|
|
||||||
"close": "Close",
|
|
||||||
"copyright": "© 2022 Matyáš Caras and contributors",
|
|
||||||
"disagree": "I disagree",
|
|
||||||
"errorContacting": "Failed to contact the server, check your connection.",
|
|
||||||
"errorOrdering": "Could not order food.",
|
|
||||||
"exchange": "Exchange",
|
|
||||||
"exchangeError": "Could not put food on exchange.",
|
|
||||||
"friday": "Friday",
|
|
||||||
"home": "Home",
|
|
||||||
"httpLogin": "You are trying to sign in using an insecure HTTP connection, are you sure you want to continue?",
|
|
||||||
"iCanteenUrl": "iCanteen URL",
|
|
||||||
"inExchange": "ON EXCHANGE",
|
|
||||||
"license": "Released under the GNU GPLv3",
|
|
||||||
"loading": "Loading...",
|
|
||||||
"logIn": "Sign in",
|
|
||||||
"loggingIn": "Signing you in...",
|
|
||||||
"loginFailed": "Sign in failed",
|
|
||||||
"menu": "Food Menu",
|
|
||||||
"monday": "Monday",
|
|
||||||
"mustLogout": "To go online, pull down.",
|
|
||||||
"no": "No",
|
|
||||||
"noChange": "No, change",
|
|
||||||
"noExchange": "No meal in exchange",
|
|
||||||
"noFood": "No meal for this day",
|
|
||||||
"notOfficial": "This is not an official app for accessing iCanteen. The author is not responsible for non-functionality or losses while using this app. By continuing you agree.",
|
|
||||||
"offline": "YOU ARE OFFLINE",
|
|
||||||
"ok": "OK",
|
|
||||||
"order": "Order",
|
|
||||||
"orderSuccess": "Meal ordered succesfully",
|
|
||||||
"ordered": "Ordered",
|
|
||||||
"ordering": "Ordering...",
|
|
||||||
"password": "Password",
|
|
||||||
"pullToReload": "Pull to reload",
|
|
||||||
"rememberMe": "Remember me",
|
|
||||||
"reportBugs": "Feedback",
|
|
||||||
"saturday": "Saturday",
|
|
||||||
"saveOffline": "Save menu offline",
|
|
||||||
"settings": "Settings",
|
|
||||||
"signOut": "Sign out",
|
|
||||||
"skipWeekend": "Skip weekends when browsing menu",
|
|
||||||
"sunday": "Sunday",
|
|
||||||
"thursday": "Thursday",
|
|
||||||
"tuesday": "Tuesday",
|
|
||||||
"username": "Username",
|
|
||||||
"verifyExchange": "Are you sure you want to put this meal on exchange?",
|
|
||||||
"warning": "Warning!",
|
|
||||||
"wednesday": "Wednesday",
|
|
||||||
"yes": "Yes",
|
|
||||||
"appDesc": "OpenCanteen is a mobile app for accessing iCanteen.",
|
|
||||||
"welcome": "Welcome to OpenCanteen",
|
|
||||||
"aboutOrder": "Order with a tap",
|
|
||||||
"howOrder": "Simply tap on a meal with a blue checkbox next to it and it's done!",
|
|
||||||
"aboutToExch": "Don't want your food?",
|
|
||||||
"howToExch": "If you cannot cancel your order, simply long-tap on the ordered food and put it into the exchange.",
|
|
||||||
"aboutFromExch": "No food? No problem!",
|
|
||||||
"howFromExch": "Simply check the exchange from the sidebar and order when a meal is available.",
|
|
||||||
"next": "Next",
|
|
||||||
"checkOrdered": "Check if I have ordered food for the next week",
|
|
||||||
"noOrder": "You did not order any food for the next week!",
|
|
||||||
"corrupted": "The saved credentials seem to be corrupted, please try clearing the application's data.",
|
|
||||||
"notifyAt": "Send notification at",
|
|
||||||
"notifyLunch": "Send a notification with meal info",
|
|
||||||
"lunchNotif": "Today's ordered meal",
|
|
||||||
"error": "Error",
|
|
||||||
"needRemember": "You need to save your login details on the login screen first",
|
|
||||||
"notifyWarning": "Your device may have battery optimization enabled. This may cause notifications to not be sent. Check the application info in your device's settings.",
|
|
||||||
"signOutWarn": "Do you really want to sign out?",
|
|
||||||
"jump": "Jump",
|
|
||||||
"source": "Source code",
|
|
||||||
"review": "Review the app",
|
|
||||||
"saveCount": "Number of days to save offline (Current limit is 7)",
|
|
||||||
"errorSaving": "An error occured while trying to save menu offline, try again later.",
|
|
||||||
"todayTooltip": "Go to today's meal",
|
|
||||||
"settingsExperience":"App Experience",
|
|
||||||
"settingsFunctions":"Extra Functions"
|
|
||||||
}
|
|
|
@ -35,7 +35,6 @@ Copyright (C) 2022 Matyáš Caras a přispěvatelé
|
||||||
|
|
||||||
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||||
FlutterLocalNotificationsPlugin();
|
FlutterLocalNotificationsPlugin();
|
||||||
final settings = SettingsManager();
|
|
||||||
|
|
||||||
/// Used to setup notifications about ordered food
|
/// Used to setup notifications about ordered food
|
||||||
void setupNotification(SharedPreferences prefs, tz.Location l) async {
|
void setupNotification(SharedPreferences prefs, tz.Location l) async {
|
||||||
|
@ -105,9 +104,6 @@ void main() async {
|
||||||
if (prefs.getBool("oznamit") ?? false) {
|
if (prefs.getBool("oznamit") ?? false) {
|
||||||
setupNotification(prefs, l);
|
setupNotification(prefs, l);
|
||||||
}
|
}
|
||||||
settings.checkOrdered = prefs.getBool("tyden") ?? false;
|
|
||||||
settings.saveOffline = prefs.getBool("oznamit") ?? false;
|
|
||||||
settings.skipWeekend = prefs.getBool("skip") ?? false;
|
|
||||||
|
|
||||||
// notif library setup
|
// notif library setup
|
||||||
const AndroidInitializationSettings initializationSettingsAndroid =
|
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||||
|
|
|
@ -4,7 +4,6 @@ import 'dart:io';
|
||||||
import 'package:canteenlib/canteenlib.dart';
|
import 'package:canteenlib/canteenlib.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:opencanteen/main.dart';
|
|
||||||
import 'package:opencanteen/okna/login.dart';
|
import 'package:opencanteen/okna/login.dart';
|
||||||
import 'package:opencanteen/okna/nastaveni.dart';
|
import 'package:opencanteen/okna/nastaveni.dart';
|
||||||
import 'package:opencanteen/pw/platformbutton.dart';
|
import 'package:opencanteen/pw/platformbutton.dart';
|
||||||
|
@ -29,9 +28,11 @@ class _MealViewState extends State<MealView> {
|
||||||
DateTime day = DateTime.now();
|
DateTime day = DateTime.now();
|
||||||
String dayOWeek = "";
|
String dayOWeek = "";
|
||||||
double balance = 0.0;
|
double balance = 0.0;
|
||||||
|
bool _skipWeekend = false;
|
||||||
|
|
||||||
void checkWeek(BuildContext context) async {
|
void checkWeek(BuildContext context) async {
|
||||||
if (settings.checkOrdered) {
|
var prefs = await SharedPreferences.getInstance();
|
||||||
|
if (prefs.getBool("tyden") ?? false) {
|
||||||
// Check if user has ordered a meal in the next week
|
// Check if user has ordered a meal in the next week
|
||||||
var pristi = day.add(const Duration(days: 6));
|
var pristi = day.add(const Duration(days: 6));
|
||||||
for (var i = 0; i < 5; i++) {
|
for (var i = 0; i < 5; i++) {
|
||||||
|
@ -86,16 +87,15 @@ class _MealViewState extends State<MealView> {
|
||||||
default:
|
default:
|
||||||
dayOWeek = AppLocalizations.of(context)!.monday;
|
dayOWeek = AppLocalizations.of(context)!.monday;
|
||||||
}
|
}
|
||||||
Uzivatel uzivatel;
|
var uzivatel = await widget.canteen.ziskejUzivatele().catchError(
|
||||||
try {
|
(o) {
|
||||||
uzivatel = await widget.canteen.ziskejUzivatele();
|
if (!widget.canteen.prihlasen) {
|
||||||
} catch (e) {
|
Navigator.pushReplacement(
|
||||||
if (!widget.canteen.prihlasen) {
|
context, platformRouter((c) => const LoginPage()));
|
||||||
Navigator.pushReplacement(
|
}
|
||||||
context, platformRouter((c) => const LoginPage()));
|
return Uzivatel(kredit: 0);
|
||||||
}
|
},
|
||||||
return;
|
);
|
||||||
}
|
|
||||||
balance = uzivatel.kredit;
|
balance = uzivatel.kredit;
|
||||||
var jd = await widget.canteen.jidelnicekDen(den: day).catchError((_) {
|
var jd = await widget.canteen.jidelnicekDen(den: day).catchError((_) {
|
||||||
showInfo(context, AppLocalizations.of(context)!.errorContacting);
|
showInfo(context, AppLocalizations.of(context)!.errorContacting);
|
||||||
|
@ -386,54 +386,58 @@ class _MealViewState extends State<MealView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadSettings() async {
|
void loadSettings() async {
|
||||||
|
var prefs = await SharedPreferences.getInstance();
|
||||||
|
_skipWeekend = prefs.getBool("skip") ?? false;
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
checkWeek(context);
|
checkWeek(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveOffline() async {
|
void saveOffline() async {
|
||||||
if (!settings.saveOffline) return;
|
|
||||||
// clear offline storage
|
|
||||||
Directory appDocDir = await getApplicationDocumentsDirectory();
|
|
||||||
for (var f in appDocDir.listSync()) {
|
|
||||||
if (f.path.contains("jidelnicek")) {
|
|
||||||
f.deleteSync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var prefs = await SharedPreferences.getInstance();
|
var prefs = await SharedPreferences.getInstance();
|
||||||
// save X meal lists
|
if (prefs.getBool("offline") ?? false) {
|
||||||
var pocet = prefs.getInt("offline_pocet") ?? 1;
|
// clear offline storage
|
||||||
if (pocet > 7) pocet = 7;
|
Directory appDocDir = await getApplicationDocumentsDirectory();
|
||||||
for (var i = 0; i < pocet; i++) {
|
for (var f in appDocDir.listSync()) {
|
||||||
var d = day.add(Duration(days: i));
|
if (f.path.contains("jidelnicek")) {
|
||||||
Jidelnicek? j;
|
f.deleteSync();
|
||||||
try {
|
|
||||||
j = await widget.canteen.jidelnicekDen(den: d);
|
|
||||||
} catch (e) {
|
|
||||||
if (!widget.canteen.prihlasen) {
|
|
||||||
if (!mounted) return;
|
|
||||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
|
||||||
content: Text(AppLocalizations.of(context)!.errorSaving),
|
|
||||||
duration: const Duration(seconds: 5),
|
|
||||||
));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var soubor = File(
|
|
||||||
"${appDocDir.path}/jidelnicek_${d.year}-${d.month}-${d.day}.json");
|
// save X meal lists
|
||||||
soubor.createSync();
|
var pocet = prefs.getInt("offline_pocet") ?? 1;
|
||||||
var jidla = [];
|
if (pocet > 7) pocet = 7;
|
||||||
for (var jidlo in j!.jidla) {
|
for (var i = 0; i < pocet; i++) {
|
||||||
jidla.add({
|
var d = day.add(Duration(days: i));
|
||||||
"nazev": jidlo.nazev,
|
Jidelnicek? j;
|
||||||
"varianta": jidlo.varianta,
|
try {
|
||||||
"objednano": jidlo.objednano,
|
j = await widget.canteen.jidelnicekDen(den: d);
|
||||||
"cena": jidlo.cena,
|
} catch (e) {
|
||||||
"naBurze": jidlo.naBurze,
|
if (!widget.canteen.prihlasen) {
|
||||||
"den": d.toString()
|
if (!mounted) return;
|
||||||
});
|
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||||
|
content: Text(AppLocalizations.of(context)!.errorSaving),
|
||||||
|
duration: const Duration(seconds: 5),
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var soubor = File(
|
||||||
|
"${appDocDir.path}/jidelnicek_${d.year}-${d.month}-${d.day}.json");
|
||||||
|
soubor.createSync();
|
||||||
|
var jidla = [];
|
||||||
|
for (var jidlo in j!.jidla) {
|
||||||
|
jidla.add({
|
||||||
|
"nazev": jidlo.nazev,
|
||||||
|
"varianta": jidlo.varianta,
|
||||||
|
"objednano": jidlo.objednano,
|
||||||
|
"cena": jidlo.cena,
|
||||||
|
"naBurze": jidlo.naBurze,
|
||||||
|
"den": d.toString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await soubor.writeAsString(json.encode(jidla));
|
||||||
}
|
}
|
||||||
await soubor.writeAsString(json.encode(jidla));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,7 +491,7 @@ class _MealViewState extends State<MealView> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
day = day.subtract(const Duration(days: 1));
|
day = day.subtract(const Duration(days: 1));
|
||||||
if (day.weekday == 7 && settings.skipWeekend) {
|
if (day.weekday == 7 && _skipWeekend) {
|
||||||
day = day.subtract(const Duration(days: 2));
|
day = day.subtract(const Duration(days: 2));
|
||||||
}
|
}
|
||||||
loadMeals();
|
loadMeals();
|
||||||
|
@ -515,7 +519,7 @@ class _MealViewState extends State<MealView> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
day = day.add(const Duration(days: 1));
|
day = day.add(const Duration(days: 1));
|
||||||
if (day.weekday == 6 && settings.skipWeekend) {
|
if (day.weekday == 6 && _skipWeekend) {
|
||||||
day = day.add(const Duration(days: 2));
|
day = day.add(const Duration(days: 2));
|
||||||
}
|
}
|
||||||
loadMeals();
|
loadMeals();
|
||||||
|
@ -552,7 +556,7 @@ class _MealViewState extends State<MealView> {
|
||||||
if (details.primaryVelocity?.compareTo(0) == -1) {
|
if (details.primaryVelocity?.compareTo(0) == -1) {
|
||||||
setState(() {
|
setState(() {
|
||||||
day = day.add(const Duration(days: 1));
|
day = day.add(const Duration(days: 1));
|
||||||
if (day.weekday == 6 && settings.skipWeekend) {
|
if (day.weekday == 6 && _skipWeekend) {
|
||||||
day = day.add(const Duration(days: 2));
|
day = day.add(const Duration(days: 2));
|
||||||
}
|
}
|
||||||
loadMeals();
|
loadMeals();
|
||||||
|
@ -561,7 +565,7 @@ class _MealViewState extends State<MealView> {
|
||||||
setState(
|
setState(
|
||||||
() {
|
() {
|
||||||
day = day.subtract(const Duration(days: 1));
|
day = day.subtract(const Duration(days: 1));
|
||||||
if (day.weekday == 7 && settings.skipWeekend) {
|
if (day.weekday == 7 && _skipWeekend) {
|
||||||
day = day.subtract(const Duration(days: 2));
|
day = day.subtract(const Duration(days: 2));
|
||||||
}
|
}
|
||||||
loadMeals();
|
loadMeals();
|
||||||
|
|
|
@ -10,7 +10,6 @@ import 'package:opencanteen/pw/platformdialog.dart';
|
||||||
import 'package:opencanteen/pw/platformfield.dart';
|
import 'package:opencanteen/pw/platformfield.dart';
|
||||||
import 'package:opencanteen/pw/platformswitch.dart';
|
import 'package:opencanteen/pw/platformswitch.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:settings_ui/settings_ui.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:timezone/timezone.dart' as tz;
|
import 'package:timezone/timezone.dart' as tz;
|
||||||
|
|
||||||
|
@ -77,177 +76,167 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(AppLocalizations.of(context)!.settings),
|
title: Text(AppLocalizations.of(context)!.settings),
|
||||||
),
|
),
|
||||||
body: SettingsList(
|
body: Center(
|
||||||
platform: DevicePlatform.device,
|
child: SizedBox(
|
||||||
sections: [
|
width: MediaQuery.of(context).size.width / 1.1,
|
||||||
SettingsSection(
|
child: Column(
|
||||||
tiles: [
|
children: [
|
||||||
SettingsTile.switchTile(
|
Row(
|
||||||
initialValue: _saveOffline,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
onToggle: (value) {
|
children: [
|
||||||
_saveOffline = value;
|
Text(AppLocalizations.of(context)!.saveOffline),
|
||||||
settings.saveOffline = value;
|
PlatformSwitch(
|
||||||
changeSetting("offline", value);
|
value: _saveOffline,
|
||||||
setState(() {});
|
onChanged: (value) {
|
||||||
},
|
setState(() {
|
||||||
title: Text(AppLocalizations.of(context)!.saveOffline),
|
_saveOffline = value;
|
||||||
|
clear(value);
|
||||||
|
changeSetting("offline", value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
CustomSettingsTile(
|
Row(
|
||||||
child: Row(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
children: [
|
Text(AppLocalizations.of(context)!.saveCount),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.76,
|
width: 35,
|
||||||
child: Text(
|
child: PlatformField(
|
||||||
AppLocalizations.of(context)!.saveCount,
|
controller: _countController,
|
||||||
softWrap: true,
|
enabled: _saveOffline,
|
||||||
style: TextStyle(
|
keyboardType: TextInputType.number,
|
||||||
fontSize: (Platform.isAndroid) ? 18 : 17,
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||||
fontWeight:
|
onChanged: (c) {
|
||||||
(Platform.isAndroid) ? FontWeight.w400 : null,
|
var cislo = int.tryParse(c);
|
||||||
),
|
if (cislo != null) {
|
||||||
),
|
preferences!.setInt("offline_pocet", cislo);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(
|
)
|
||||||
width: 10,
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
Row(
|
||||||
width: 35,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
child: PlatformField(
|
children: [
|
||||||
controller: _countController,
|
Text(AppLocalizations.of(context)!.skipWeekend),
|
||||||
enabled: _saveOffline,
|
PlatformSwitch(
|
||||||
keyboardType: TextInputType.number,
|
value: _skipWeekend,
|
||||||
inputFormatters: [
|
onChanged: (value) {
|
||||||
FilteringTextInputFormatter.digitsOnly
|
setState(
|
||||||
],
|
() {
|
||||||
onChanged: (c) {
|
_skipWeekend = value;
|
||||||
var cislo = int.tryParse(c);
|
changeSetting("skip", value);
|
||||||
if (cislo != null) {
|
|
||||||
preferences!.setInt("offline_pocet", cislo);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SettingsTile.switchTile(
|
|
||||||
initialValue: _skipWeekend,
|
|
||||||
onToggle: (value) {
|
|
||||||
_skipWeekend = value;
|
|
||||||
settings.skipWeekend = value;
|
|
||||||
changeSetting("skip", value);
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
title: Text(AppLocalizations.of(context)!.skipWeekend),
|
|
||||||
),
|
|
||||||
SettingsTile.switchTile(
|
|
||||||
initialValue: _checkWeek,
|
|
||||||
onToggle: (value) {
|
|
||||||
_checkWeek = value;
|
|
||||||
settings.checkOrdered = value;
|
|
||||||
changeSetting("tyden", value);
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
title: Text(AppLocalizations.of(context)!.checkOrdered),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
title: Text(AppLocalizations.of(context)!.settingsExperience),
|
|
||||||
),
|
|
||||||
SettingsSection(
|
|
||||||
tiles: [
|
|
||||||
SettingsTile.switchTile(
|
|
||||||
initialValue: _notifyMeal,
|
|
||||||
enabled: _remember,
|
|
||||||
onToggle: (value) {
|
|
||||||
if (!_remember) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (bc) => PlatformDialog(
|
|
||||||
title: AppLocalizations.of(context)!.error,
|
|
||||||
content: AppLocalizations.of(context)!.needRemember,
|
|
||||||
actions: [
|
|
||||||
PlatformButton(
|
|
||||||
text: AppLocalizations.of(context)!.ok,
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(bc).pop();
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
_notifyMeal = value;
|
|
||||||
if (_notifyMeal) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => PlatformDialog(
|
|
||||||
title: AppLocalizations.of(context)!.warning,
|
|
||||||
content: AppLocalizations.of(context)!.notifyWarning,
|
|
||||||
actions: [
|
|
||||||
PlatformButton(
|
|
||||||
text: AppLocalizations.of(context)!.ok,
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
createNotif(timeToDate(_notifTime));
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Text(AppLocalizations.of(context)!.checkOrdered)),
|
||||||
|
PlatformSwitch(
|
||||||
|
value: _checkWeek,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
_checkWeek = value;
|
||||||
|
changeSetting("tyden", value);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Text(AppLocalizations.of(context)!.notifyLunch)),
|
||||||
|
PlatformSwitch(
|
||||||
|
value: _notifyMeal,
|
||||||
|
thumbColor: (!_remember ? Colors.grey : null),
|
||||||
|
onChanged: (value) {
|
||||||
|
if (!_remember) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (bc) => PlatformDialog(
|
||||||
|
title: AppLocalizations.of(context)!.error,
|
||||||
|
content: AppLocalizations.of(context)!.needRemember,
|
||||||
|
actions: [
|
||||||
|
PlatformButton(
|
||||||
|
text: AppLocalizations.of(context)!.ok,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_notifyMeal = value;
|
||||||
|
if (_notifyMeal) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => PlatformDialog(
|
||||||
|
title: AppLocalizations.of(context)!.warning,
|
||||||
|
content:
|
||||||
|
AppLocalizations.of(context)!.notifyWarning,
|
||||||
|
actions: [
|
||||||
|
PlatformButton(
|
||||||
|
text: AppLocalizations.of(context)!.ok,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
createNotif(timeToDate(_notifTime));
|
||||||
|
}
|
||||||
|
changeSetting("oznamit", value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(AppLocalizations.of(context)!.notifyAt),
|
||||||
|
PlatformButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (_notifyMeal) {
|
||||||
|
var cas = await showTimePicker(
|
||||||
|
context: context, initialTime: _notifTime);
|
||||||
|
if (cas != null) {
|
||||||
|
var prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.setString(
|
||||||
|
"oznameni_cas",
|
||||||
|
timeToDate(cas)
|
||||||
|
.toString()); // aktualizovat vybraný čas
|
||||||
|
var den = timeToDate(cas);
|
||||||
|
debugPrint(den.isAfter(DateTime.now()).toString());
|
||||||
|
if (den.isAfter(DateTime.now())) {
|
||||||
|
// znovu vytvořit oznámení POUZE když je čas v budoucnosti
|
||||||
|
createNotif(den);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
changeSetting("oznamit", value);
|
setState(() {
|
||||||
setState(() {});
|
_notifTime = cas ?? _notifTime;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
title: Text(
|
text:
|
||||||
AppLocalizations.of(context)!.notifyLunch,
|
"${(_notifTime.hour < 10 ? "0" : "") + _notifTime.hour.toString()}:${(_notifTime.minute < 10 ? "0" : "") + _notifTime.minute.toString()}",
|
||||||
),
|
|
||||||
),
|
),
|
||||||
CustomSettingsTile(
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context)!.notifyAt,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: (Platform.isAndroid) ? 18 : 17,
|
|
||||||
fontWeight:
|
|
||||||
(Platform.isAndroid) ? FontWeight.w400 : null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
PlatformButton(
|
|
||||||
textStyle:
|
|
||||||
TextStyle(fontSize: (Platform.isAndroid ? 18 : 17)),
|
|
||||||
text: _notifTime.format(context),
|
|
||||||
onPressed: () async {
|
|
||||||
if (!_notifyMeal) return;
|
|
||||||
var cas = await showTimePicker(
|
|
||||||
context: context, initialTime: _notifTime);
|
|
||||||
if (cas == null) return;
|
|
||||||
var prefs = await SharedPreferences.getInstance();
|
|
||||||
prefs.setString(
|
|
||||||
"oznameni_cas",
|
|
||||||
timeToDate(cas)
|
|
||||||
.toString()); // aktualizovat vybraný čas
|
|
||||||
var den = timeToDate(cas);
|
|
||||||
debugPrint(den.isAfter(DateTime.now()).toString());
|
|
||||||
if (den.isAfter(DateTime.now())) {
|
|
||||||
// znovu vytvořit oznámení POUZE když je čas v budoucnosti
|
|
||||||
createNotif(den);
|
|
||||||
}
|
|
||||||
|
|
||||||
_notifTime = cas;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
title: Text(AppLocalizations.of(context)!.settingsFunctions),
|
),
|
||||||
)
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,23 +5,14 @@ import 'package:opencanteen/pw/platformwidget.dart';
|
||||||
class PlatformButton extends PlatformWidget<TextButton, CupertinoButton> {
|
class PlatformButton extends PlatformWidget<TextButton, CupertinoButton> {
|
||||||
final String text;
|
final String text;
|
||||||
final void Function()? onPressed;
|
final void Function()? onPressed;
|
||||||
|
|
||||||
final TextStyle? textStyle;
|
|
||||||
const PlatformButton(
|
const PlatformButton(
|
||||||
{super.key, required this.text, required this.onPressed, this.textStyle});
|
{super.key, required this.text, required this.onPressed});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TextButton createAndroidWidget(BuildContext context) => TextButton(
|
TextButton createAndroidWidget(BuildContext context) =>
|
||||||
onPressed: onPressed,
|
TextButton(onPressed: onPressed, child: Text(text));
|
||||||
child: Text(
|
|
||||||
text,
|
|
||||||
style: textStyle,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
CupertinoButton createIosWidget(BuildContext context) => CupertinoButton(
|
CupertinoButton createIosWidget(BuildContext context) =>
|
||||||
onPressed: onPressed,
|
CupertinoButton(onPressed: onPressed, child: Text(text));
|
||||||
child: Text(text, style: textStyle),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,9 +123,3 @@ Route platformRouter(Widget Function(BuildContext context) builder) =>
|
||||||
(Platform.isAndroid)
|
(Platform.isAndroid)
|
||||||
? MaterialPageRoute(builder: builder)
|
? MaterialPageRoute(builder: builder)
|
||||||
: CupertinoPageRoute(builder: builder);
|
: CupertinoPageRoute(builder: builder);
|
||||||
|
|
||||||
class SettingsManager {
|
|
||||||
bool skipWeekend = false;
|
|
||||||
bool checkOrdered = false;
|
|
||||||
bool saveOffline = false;
|
|
||||||
}
|
|
||||||
|
|
12
pubspec.lock
12
pubspec.lock
|
@ -29,10 +29,10 @@ packages:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: canteenlib
|
name: canteenlib
|
||||||
sha256: "4b04a2e3d206e66931b8285fa0f6ab4436d267ce9c8169a210045f735195f480"
|
sha256: c15aa1d11fb9d6d01d633b8cbb6780d3e63c9058f8cc3b0f7de2fbc21cf4903d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.2"
|
version: "1.1.1"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -464,14 +464,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.4"
|
version: "4.2.4"
|
||||||
settings_ui:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: settings_ui
|
|
||||||
sha256: d9838037cb554b24b4218b2d07666fbada3478882edefae375ee892b6c820ef3
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.2"
|
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -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.8.0+28
|
version: 1.7.0+27
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.2 <3.0.0"
|
sdk: ">=2.18.2 <3.0.0"
|
||||||
|
@ -16,7 +16,7 @@ dependencies:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
canteenlib: ^1.1.2
|
canteenlib: ^1.1.1
|
||||||
flutter_secure_storage: ^7.0.1
|
flutter_secure_storage: ^7.0.1
|
||||||
url_launcher: ^6.0.20
|
url_launcher: ^6.0.20
|
||||||
path_provider: ^2.0.9
|
path_provider: ^2.0.9
|
||||||
|
@ -28,7 +28,6 @@ dependencies:
|
||||||
intl: ^0.17.0
|
intl: ^0.17.0
|
||||||
package_info_plus: ^1.4.3+1
|
package_info_plus: ^1.4.3+1
|
||||||
fluttertoast: ^8.1.2
|
fluttertoast: ^8.1.2
|
||||||
settings_ui: ^2.0.2
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_lints: ^2.0.1
|
flutter_lints: ^2.0.1
|
||||||
|
|
Reference in a new issue