+
+ Okres klasyfikacyjny:
+
+ 1
+ 2
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/Start.html b/api/src/test/resources/io/github/wulkanowy/api/Start.html
new file mode 100644
index 000000000..40e691610
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/Start.html
@@ -0,0 +1,24 @@
+
+
+
+
+
Uonet+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/attendance/Frekwencja-excellent.html b/api/src/test/resources/io/github/wulkanowy/api/attendance/Frekwencja-excellent.html
new file mode 100644
index 000000000..5eaf50dfe
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/attendance/Frekwencja-excellent.html
@@ -0,0 +1,408 @@
+
+
+
+
+
Witryna ucznia i rodzica – Frekwencja
+
+
+
+
+ Frekwencja
+
+
+
+ Lekcja
+ poniedziałek 31.08.2015
+ wtorek 01.09.2015
+ środa 02.09.2015
+ czwartek 03.09.2015
+ piątek 04.09.2015
+
+
+
+
+ 0
+
+
+
+
+
+
+
+ 1
+
+
+
+ Uroczyste rozpoczęcie roku szkolnego 2015/2016
+
+
+
+
+ Wychowanie do życia w rodzinie
+
+
+
+
+
+ Urządzenia techniki komputerowej
+
+
+
+
+ 2
+
+
+
+
+ Język angielski
+
+
+
+
+ Język niemiecki
+
+
+
+
+ Urządzenia techniki komputerowej
+
+
+
+
+ 3
+
+
+
+
+ Systemy operacyjne
+
+
+
+
+ Chemia
+
+
+
+
+ Urządzenia techniki komputerowej
+
+
+
+
+ 4
+
+
+
+
+ Systemy operacyjne
+
+
+
+
+ Geografia
+
+
+
+
+ Urządzenia techniki komputerowej
+
+
+
+
+ 5
+
+
+
+
+ Tworzenie stron internetowych
+
+
+
+
+ Matematyka
+
+
+
+
+ Język polski
+
+
+
+
+ 6
+
+
+
+
+ Tworzenie stron internetowych
+
+
+
+
+ Fizyka
+
+
+
+
+ Matematyka
+
+
+
+
+ 7
+
+
+
+
+ Wychowanie fizyczne
+
+
+
+
+ Język polski
+
+
+
+
+ Historia
+
+
+
+
+ 8
+
+
+
+
+ Wychowanie fizyczne
+
+
+
+
+
+
+ 9
+
+
+
+
+
+
+
+ 10
+
+
+
+
+
+
+
+ 11
+
+
+
+
+
+
+
+ 12
+
+
+
+
+
+
+
+ 13
+
+
+
+
+
+
+
+
+ Statystyki
+
+ Przedmiot:
+
+ Wszystkie
+ Religia
+ Język polski
+ Język angielski
+ Język niemiecki
+ Historia
+ Wiedza o społeczeństwie
+ Matematyka
+ Fizyka
+ Chemia
+ Biologia
+ Geografia
+ Informatyka
+ Wychowanie fizyczne
+ Edukacja dla bezpieczeństwa
+ Wychowanie do życia w rodzinie
+ Zajęcia z wychowawcą
+ Techniki biurowe
+ Urządzenia techniki komputerowej
+ Naprawa komputera
+ Systemy operacyjne
+ Sieci komputerowe i administrowanie sieciami
+ Tworzenie stron internetowych
+ Opieka nad uczniami
+ Fizyka doświadczalna
+ Brak opisu lekcji
+
+
+ Frekwencja od początku roku szkolnego: 100,00%
+
+
+
+
+ IX
+ X
+ XI
+ XII
+ I
+ II
+ III
+ IV
+ V
+ VI
+ VII
+ VIII
+ Razem
+
+
+
+
+ Obecność
+ 142
+ 143
+ 139
+ 110
+ 131
+ 75
+ 126
+ 139
+ 92
+ 114
+
+
+ 1211
+
+
+ Nieobecność nieusprawiedliwiona
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Nieobecność usprawiedliwiona
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Nieobecność z przyczyn szkolnych
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Spóźnienie nieusprawiedliwione
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Spóźnienie usprawiedliwione
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Zwolnienie
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/attendance/Frekwencja-full.html b/api/src/test/resources/io/github/wulkanowy/api/attendance/Frekwencja-full.html
new file mode 100644
index 000000000..aa9953053
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/attendance/Frekwencja-full.html
@@ -0,0 +1,498 @@
+
+
+
+
+
Witryna ucznia i rodzica – Frekwencja
+
+
+
+
+ Frekwencja
+
+
+
+ Lekcja
+ poniedziałek 05.09.2016
+ wtorek 06.09.2016
+ środa 07.09.2016
+ czwartek 08.09.2016
+ piątek 09.09.2016
+
+
+
+
+ 0
+
+
+
+
+
+
+
+ 1
+
+
+ Urządzenia techniki komputerowej
+
+
+
+
+ Multimedia i grafika komputerowa
+
+
+
+
+ Użytkowanie urządzeń peryferyjnych komputera
+
+
+
+
+ Religia
+
+
+
+
+
+ 2
+
+
+ Urządzenia techniki komputerowej
+
+
+
+
+ Język niemiecki
+
+
+
+
+ Użytkowanie urządzeń peryferyjnych komputera
+
+
+
+
+ Język niemiecki
+
+
+
+
+ Sieci komputerowe i administrowanie sieciami
+
+
+
+
+ 3
+
+
+ Urządzenia techniki komputerowej
+
+
+
+
+ Fizyka
+
+
+
+
+ Historia
+
+
+
+
+ Wychowanie fizyczne
+
+
+
+
+ Wiedza o kulturze
+
+
+
+
+ 4
+
+
+ Naprawa komputera
+
+
+
+
+ Wychowanie fizyczne
+
+
+
+
+ Język angielski
+
+
+
+
+ Wychowanie fizyczne
+
+
+
+
+ Język polski
+
+
+
+
+ 5
+
+
+ Sieci komputerowe i administrowanie sieciami
+
+
+
+
+ Metodologia programowania
+
+
+
+
+ Urządzenia techniki komputerowej
+
+
+
+
+ Matematyka
+
+
+
+
+ Metodologia programowania
+
+
+
+
+ 6
+
+
+ Język niemiecki
+
+
+
+
+ Sieci komputerowe i administrowanie sieciami
+
+
+
+
+ Język polski
+
+
+
+
+ Podstawy przedsiębiorczości
+
+
+
+
+ Matematyka
+
+
+
+
+ 7
+
+
+ Fizyka
+
+
+
+
+ Język polski
+
+
+
+
+ Systemy operacyjne
+
+
+
+
+ Zajęcia z wychowawcą
+
+
+
+
+ Religia
+
+
+
+
+ 8
+
+
+
+ Naprawa komputera
+
+
+
+
+ Systemy operacyjne
+
+
+
+
+ Urządzenia techniki komputerowej
+
+
+
+
+ Zajęcia z wychowawcą
+
+
+
+
+ 9
+
+
+
+
+
+
+
+ 10
+
+
+
+
+
+
+
+ 11
+
+
+
+
+
+
+
+ 12
+
+
+
+
+
+
+
+ 13
+
+
+
+
+
+
+
+
+ Statystyki
+
+ Przedmiot:
+
+ Wszystkie
+ Religia
+ Język polski
+ Język angielski
+ Język niemiecki
+ Historia
+ Wiedza o kulturze
+ Matematyka
+ Fizyka
+ Podstawy przedsiębiorczości
+ Wychowanie fizyczne
+ Praktyka zawodowa
+ Wychowanie do życia w rodzinie
+ Zajęcia z wychowawcą
+ Urządzenia techniki komputerowej
+ Naprawa komputera
+ Użytkowanie urządzeń peryferyjnych komputera
+ Systemy operacyjne
+ Sieci komputerowe i administrowanie sieciami
+ Multimedia i grafika komputerowa
+ Metodologia programowania
+ Opieka nad uczniami
+ Brak opisu lekcji
+
+
+ Frekwencja od początku roku szkolnego: 80,94%
+
+
+
+
+ IX
+ X
+ XI
+ XII
+ I
+ II
+ III
+ IV
+ V
+ VI
+ VII
+ VIII
+ Razem
+
+
+
+
+ Obecność
+ 135
+ 103
+ 108
+ 54
+ 37
+ 100
+ 33
+ 90
+ 103
+ 59
+
+
+ 822
+
+
+ Nieobecność nieusprawiedliwiona
+
+
+
+
+
+ 2
+
+
+
+ 4
+
+
+ 6
+
+
+ Nieobecność usprawiedliwiona
+ 6
+ 27
+ 29
+ 30
+ 44
+
+
+ 16
+ 13
+ 27
+
+
+ 192
+
+
+ Nieobecność z przyczyn szkolnych
+
+
+
+
+
+ 7
+
+
+
+
+
+
+ 7
+
+
+ Spóźnienie nieusprawiedliwione
+ 4
+
+ 1
+
+
+ 2
+ 2
+
+ 2
+ 1
+
+
+ 12
+
+
+ Spóźnienie usprawiedliwione
+ 1
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+ Zwolnienie
+
+ 1
+
+
+
+ 1
+
+
+
+
+
+
+ 2
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/exams/Sprawdziany-one-per-day.html b/api/src/test/resources/io/github/wulkanowy/api/exams/Sprawdziany-one-per-day.html
new file mode 100644
index 000000000..ecc48cf16
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/exams/Sprawdziany-one-per-day.html
@@ -0,0 +1,85 @@
+
+
+
+
+
Witryna ucznia i rodzica – Terminarz sprawdzianów
+
+
+
+ Sprawdziany
+ Tydzień 23.10.2017 - 29.10.2017
+
+
poniedziałek, 23.10.2017
+
+
+
Przedmiot i grupa:
+
Sieci komputerowe 3Ti|zaw2
+
+
+
Rodzaj sprawdzianu:
+
Sprawdzian
+
+
+
+
Nauczyciel i data wpisu:
+
Adam Wiśniewski [AW], 16.10.2017
+
+
+
+
+
wtorek, 24.10.2017
+
+
+
Przedmiot i grupa:
+
Język angielski 3Ti|J1
+
+
+
Rodzaj sprawdzianu:
+
Sprawdzian
+
+
+
Opis:
+
Czasy teraźniejsze
+
+
+
Nauczyciel i data wpisu:
+
Natalia Nowak [NN], 17.10.2017
+
+
+
+
+
+
+
piątek, 27.10.2017
+
+
+
Przedmiot i grupa:
+
Metodologia programowania 3Ti|zaw2
+
+
+
Rodzaj sprawdzianu:
+
Sprawdzian
+
+
+
+
Nauczyciel i data wpisu:
+
Małgorzata Nowacka [MN], 16.10.2017
+
+
+
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-filled.html b/api/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-filled.html
new file mode 100644
index 000000000..a229d1d53
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-filled.html
@@ -0,0 +1,108 @@
+
+
+
+
+
Witryna ucznia i rodzica – Oceny
+
+
+
+ Oceny
+
+
+ Okres klasyfikacyjny:
+
+ 1
+ 2
+
+
+
+
+
+
+ Przedmiot
+ Ocena cząstkowa
+ Opis
+ Waga
+ Data
+ Nauczyciel
+
+
+
+
+ Zachowanie
+ Brak ocen
+
+
+
+
+
+
+ Zajęcia z wychowawcą
+
+ 5
+
+ A1, Dzień Kobiet w naszej klasie
+ 1,00
+ 21.03.2017
+ Patryk Maciejewski
+
+
+ Edukacja dla bezpieczeństwa
+
+ 4-
+
+ S1, PIERWSZA POMOC I RESUSCYTACJA
+ 5,00
+ 31.03.2017
+ Weronika Ratajczak
+
+
+ Fizyka
+
+ 2
+
+ O, Odpowiedź
+ 3,00
+ 25.06.2017
+ Jakub Michalak
+
+
+ Język angielski
+
+ 5
+
+ BW3, Writing
+ 3,00
+ 02.06.2017
+ Oliwia Woźniak
+
+
+ Wiedza o społeczeństwie
+ Brak ocen
+
+
+
+
+
+
+ Wychowanie fizyczne
+ 1
+ STR
+ 8,00
+ 02.04.2017
+ Klaudia Dziedzic
+
+
+ Język polski
+ 1
+ K, Kordian
+ 5,00
+ 06.02.2017
+ Amelia Stępień
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects-average.html b/api/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects-average.html
new file mode 100644
index 000000000..023b5405e
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects-average.html
@@ -0,0 +1,70 @@
+
+
+
+
+
Witryna ucznia i rodzica – Oceny
+
+
+
+ Oceny
+
+
+ Okres klasyfikacyjny:
+
+ 1
+ 2
+
+
+
+
+
+
+ Przedmiot
+ Oceny cząstkowe
+ Średnia
+ Przewidywana ocena roczna
+ Ocena roczna
+
+
+
+
+ Zachowanie
+ Brak ocen
+ -
+ bardzo dobre
+ bardzo dobre
+
+
+ Język polski
+ 0
+ 3,53
+ -
+ dobry
+
+
+ Wychowanie fizyczne
+ 0
+ 5,05
+ bardzo dobry
+ celujący
+
+
+ Język angielski
+ 0
+ 4,4
+ 4/5
+ bardzo dobry
+
+
+ Wiedza o społeczeństwie
+ Brak ocen
+ -
+ -
+ -
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects.html b/api/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects.html
new file mode 100644
index 000000000..0f6da4148
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects.html
@@ -0,0 +1,64 @@
+
+
+
+
+
Witryna ucznia i rodzica – Oceny
+
+
+
+ Oceny
+
+
+ Okres klasyfikacyjny:
+
+ 1
+ 2
+
+
+
+
+
+
+ Przedmiot
+ Oceny cząstkowe
+ Przewidywana ocena roczna
+ Ocena roczna
+
+
+
+
+ Zachowanie
+ -
+ bardzo dobre
+ bardzo dobre
+
+
+ Praktyka zawodowa
+ -
+ -
+ celujący
+
+
+ Metodologia programowania
+ -
+ bardzo dobry
+ celujący
+
+
+ Podstawy przedsiębiorczości
+ -
+ 3/4
+ dostateczny
+
+
+ Wychowanie do życia w rodzinie
+ -
+ -
+ -
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-brak-dostepu.html b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-brak-dostepu.html
new file mode 100644
index 000000000..2911f1d24
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-brak-dostepu.html
@@ -0,0 +1,15 @@
+
+
+
+
Logowanie
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-certyfikat.html b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-certyfikat.html
new file mode 100644
index 000000000..a8496cd1b
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-certyfikat.html
@@ -0,0 +1,17 @@
+
+
+
Working...
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-error.html b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-error.html
new file mode 100644
index 000000000..087131882
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-error.html
@@ -0,0 +1,18 @@
+
+
+
+
Logowanie (demo123)
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-notLoggedIn.html b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-notLoggedIn.html
new file mode 100644
index 000000000..f961bf82c
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-notLoggedIn.html
@@ -0,0 +1,22 @@
+
+
+
+
+
Dziennik UONET+
+
+
+
+
+
+
Uonet+ wersja 17.09.0007.26300
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-success.html b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-success.html
new file mode 100644
index 000000000..23c27a3fe
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-success.html
@@ -0,0 +1,16 @@
+
+
+
+
+
Uonet+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/login/PrzerwaTechniczna.html b/api/src/test/resources/io/github/wulkanowy/api/login/PrzerwaTechniczna.html
new file mode 100644
index 000000000..062f9b60c
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/login/PrzerwaTechniczna.html
@@ -0,0 +1,23 @@
+
+
+
+
+
Przerwa techniczna
+
+
+
+
+
+
Przerwa techniczna
+
Aktualnie trwają prace konserwacyjne. Witryna będzie dostępna za kilka minut.
>
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/login/cert.xml b/api/src/test/resources/io/github/wulkanowy/api/login/cert.xml
new file mode 100644
index 000000000..549b2d424
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/login/cert.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ Default
+ demo12345
+ incorrect value
+ warszawa
+ asdf
+ asdfsdf
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/messages/GetTrescWiadomosci.json b/api/src/test/resources/io/github/wulkanowy/api/messages/GetTrescWiadomosci.json
new file mode 100644
index 000000000..1ba54a32c
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/messages/GetTrescWiadomosci.json
@@ -0,0 +1,7 @@
+{
+ "success": true,
+ "data": {
+ "Id": 12345,
+ "Tresc": "Witam, …. \nPozdrawiam Krzysztof Czerkas"
+ }
+}
diff --git a/api/src/test/resources/io/github/wulkanowy/api/messages/GetWiadomosciOdebrane.json b/api/src/test/resources/io/github/wulkanowy/api/messages/GetWiadomosciOdebrane.json
new file mode 100644
index 000000000..326390ed6
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/messages/GetWiadomosciOdebrane.json
@@ -0,0 +1,35 @@
+{
+ "success": true,
+ "data": [
+ {
+ "Nieprzeczytana": false,
+ "Data": "2016-03-15 09:00:00",
+ "Tresc": null,
+ "Temat": "Wycieczka",
+ "NadawcaNazwa": "Kowalski Jan",
+ "IdWiadomosci": 1234,
+ "IdNadawca": 4321,
+ "Id": 12345
+ },
+ {
+ "Nieprzeczytana": true,
+ "Data": "2016-04-20 22:00:00",
+ "Tresc": null,
+ "Temat": "\"Dzień dobrego słowa\"",
+ "NadawcaNazwa": "Pazura Agnieszka",
+ "IdWiadomosci": 1235,
+ "IdNadawca": 12,
+ "Id": 12346
+ },
+ {
+ "Nieprzeczytana": false,
+ "Data": "2016-04-29 10:00:00",
+ "Tresc": null,
+ "Temat": "Rozdajemy oceny celujące",
+ "NadawcaNazwa": "Kowalski Jan",
+ "IdWiadomosci": 1236,
+ "IdNadawca": 4321,
+ "Id": 12347
+ }
+ ]
+}
diff --git a/api/src/test/resources/io/github/wulkanowy/api/messages/GetWiadomosciUsuniete-empty.json b/api/src/test/resources/io/github/wulkanowy/api/messages/GetWiadomosciUsuniete-empty.json
new file mode 100644
index 000000000..36f89aa1e
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/messages/GetWiadomosciUsuniete-empty.json
@@ -0,0 +1,4 @@
+{
+ "success": true,
+ "data": []
+}
diff --git a/api/src/test/resources/io/github/wulkanowy/api/messages/PageError.html b/api/src/test/resources/io/github/wulkanowy/api/messages/PageError.html
new file mode 100644
index 000000000..ae976af1f
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/messages/PageError.html
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
Błąd strony
+
+
+
+
+
+
+
+
Wystąpił nieoczekiwany błąd
+
+
Wystąpił błąd aplikacji. Prosimy zalogować się ponownie. Jeśli problem będzie się powtarzał, prosimy o kontakt z serwisem.
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/messages/UndefinedError.txt b/api/src/test/resources/io/github/wulkanowy/api/messages/UndefinedError.txt
new file mode 100644
index 000000000..c8d55a96c
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/messages/UndefinedError.txt
@@ -0,0 +1 @@
+The custom error module does not recognize this error.
\ No newline at end of file
diff --git a/api/src/test/resources/io/github/wulkanowy/api/notes/UwagiOsiagniecia-empty.html b/api/src/test/resources/io/github/wulkanowy/api/notes/UwagiOsiagniecia-empty.html
new file mode 100644
index 000000000..b15bb6e70
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/notes/UwagiOsiagniecia-empty.html
@@ -0,0 +1,20 @@
+
+
+
+
+
Witryna ucznia i rodzica – Uwagi i osiągnięcia
+
+
+
+
+
Uwagi
+ Brak informacji do wyświetlenia
+
+
+
Osiągnięcia
+ Brak informacji do wyświetlenia
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/notes/UwagiOsiagniecia-filled.html b/api/src/test/resources/io/github/wulkanowy/api/notes/UwagiOsiagniecia-filled.html
new file mode 100644
index 000000000..50e740585
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/notes/UwagiOsiagniecia-filled.html
@@ -0,0 +1,65 @@
+
+
+
+
+
Witryna ucznia i rodzica – Uwagi i osiągnięcia
+
+
+
+
+
Uwagi
+
06.06.2017
+
+
+
Nauczyciel:
+
Jan Kowalski [JK]
+
+
+
Kategoria:
+
Zaangażowanie społeczne
+
+
+
Treść:
+
Pomoc przy pikniku charytatywnym
+
+
+
01.12.2016
+
+
+
Nauczyciel:
+
Ochocka Zofia [PZ]
+
+
+
Kategoria:
+
Reprezentowanie szkoły
+
+
+
Treść:
+
Udział w przygotowaniu spektaklu
+
+
+
01.10.2016
+
+
+
Nauczyciel:
+
Kochański Leszek [KL]
+
+
+
Kategoria:
+
Zachowanie na lekcji
+
+
+
Treść:
+
Przeszkadzanie w prowadzeniu lekcji
+
+
+
+
+
Osiągnięcia
+
I miejsce w ogólnopolskim konkursie ortograficznym
+
III miejsce w ogólnopolskim konkursie plastycznym
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/school/Szkola.html b/api/src/test/resources/io/github/wulkanowy/api/school/Szkola.html
new file mode 100644
index 000000000..05a698a04
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/school/Szkola.html
@@ -0,0 +1,136 @@
+
+
+
+
+
Witryna ucznia i rodzica – Szkoła i nauczyciele
+
+
+
+ Szkoła
+
+
+ Nazwa szkoły:
+ Zespół Szkół nr 64
+
+
+ Adres szkoły:
+ ul. Wiśniowa 128, 01-234 Rogalowo, Nibylandia
+
+
+ Telefon:
+ 55 5555555
+
+
+ Imię i nazwisko dyrektora:
+ Antoni Sobczyk
+
+
+ Imię i nazwisko pedagoga:
+ Zofia Czerwińska [ZC], Aleksander Krzemiński [AK], Karolina Kowalska [KK], Bartek Dąbrowski [BD]
+
+
+ Nauczyciele
+
+ Klasa: 1a, Wychowawcy:
+ Karolina Kowalska [AN], Antoni Sobczyk [AS]
+
+
+
+
+ Lp.
+ Przedmiot
+ Nauczyciel
+
+
+
+
+ 1
+ Biologia
+ Karolina Kowalska [AN]
+
+
+ 2
+ Chemia
+ Zofia Czerwińska [NA]
+
+
+ 3
+ Edukacja dla bezpieczeństwa
+ Aleksandra Krajewska [AK]
+
+
+ 4
+ Fizyka
+ Stanisław Krupa [BS]
+
+
+ 5
+ Geografia
+ Aleksandra Wójtowicz [AW]
+
+
+ 6
+ Historia
+ Sara Wierzbicka [KB]
+
+
+ 7
+ Język angielski
+ Karolina Kowalska [AN], Mateusz Kowal [MK], Amelia Mazur [AM]
+
+
+ 8
+ Język niemiecki
+ Mateusz Kowal [MK], Barbara Markowska [BM]
+
+
+ 9
+ Język polski
+ Michał Mazur [MM]
+
+
+ 10
+ Matematyka
+ Szymon Wojciechowski [SW]
+
+
+ 11
+ Plastyka
+ Michał Mazur [MM]
+
+
+ 12
+ Religia
+ Maja Wiśniewska [M]
+
+
+ 13
+ Wiedza o społeczeństwie
+ Karolina Kowalska [AN]
+
+
+ 14
+ Wychowanie do życia w rodzinie
+ Zofia Czerwińska [NA]
+
+
+ 15
+ Wychowanie fizyczne
+ Karolina Kowalska [AN], Liliana Kowal [LK]
+
+
+ 16
+ Zajęcia techniczne
+ Bartek Dąbrowski [BD]
+
+
+ 17
+ Zajęcia z wychowawcą
+ Karolina Kowalska [AN]
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/timetable/PlanLekcji-full.html b/api/src/test/resources/io/github/wulkanowy/api/timetable/PlanLekcji-full.html
new file mode 100644
index 000000000..53eb04857
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/timetable/PlanLekcji-full.html
@@ -0,0 +1,466 @@
+
+
+
+
+
Witryna ucznia i rodzica – Plan lekcji
+
+
+
+ Plan lekcji
+
+
+
+
+ Lekcja
+ Pora lekcji
+ poniedziałek 19.06.2017
+ wtorek 20.06.2017
+ środa 21.06.2017
+ czwartek 22.06.2017
+ piątek 23.06.2017
+
+
+
+
+ 0
+ 07:10 07:55
+
+
+ Fizyka [zaw2]
+
+ Bączek Grzegorz
+ 19
+ (uczniowie zwolnieni do domu)
+
+
+
+
+ Metodologia programowania [zaw2]
+
+
+ 32
+
+
+
+
+ Religia
+ Cyranka Krystian
+ 3
+ Wychowanie do życia w rodzinie
+ Nowak Jadwiga
+ 3
+ (zastępstwo)
+
+
+
+
+ Język polski
+
+ 16
+ (oddział nieobecny)
+
+ Uwaga
+ egzamin
+
+
+
+ Uroczyste zakończenie roku szkolnego
+ Baran Małgorzata
+ 37
+
+
+
+
+ 1
+ 08:00 08:45
+
+
+ Język angielski [J1]
+
+ Kobczyk Iwona
+
+
+
+
+
+ Metodologia programowania [zaw2]
+
+ Baran Małgorzata
+ 36
+ (zmiana organizacji zajęć)
+
+
+ Wychowanie fizyczne [zaw2]
+
+
+ G3
+ (przeniesiona z lekcji 7, 01.12.2017)
+
+
+
+
+ Użytkowanie urządzeń peryferyjnych komputera [zaw2]
+
+ Bączek Robert
+
+
+
+
+
+ Wychowanie fizyczne [zaw1]
+
+ Jarocki Krzysztof
+ G4
+ Wychowanie fizyczne [zaw1]
+
+ Nowicka Irena
+ G4
+ (zastępstwo)
+
+
+
+
+
+ 2
+ 08:50 09:35
+
+
+ Język polski
+ Bocian Natalia
+
+
+
+
+
+ Język niemiecki [J1]
+
+ Rożeniec Honorata
+ 25
+ (okienko dla uczniów)
+
+
+ Język polski
+ Bocian Natalia
+
+ (przeniesiona z lekcji 7, 20.06.2017)
+
+
+ Język polski
+ Bocian Natalia
+
+
+
+
+
+ Urządzenia techniki komputerowej [zaw2]
+
+ Bocian Grzegorz
+
+
+
+
+
+ Matematyka
+ Baran Małgorzata
+
+
+
+
+
+
+ 3
+ 09:40 10:25
+
+
+ Język polski
+ Bocian Natalia
+
+
+
+
+
+ Fizyka
+ Bączek Grzegorz
+ 19
+ (okienko dla uczniów)
+
+
+ Wychowanie fizyczne [wf2]
+
+ Nowicka Irena
+
+ (przeniesiona z lekcji 4, 20.06.2017)
+
+
+ Wychowanie fizyczne [wf2]
+
+ Nowicka Irena
+
+
+
+
+
+ Metodologia programowania [zaw2]
+
+ Baran Małgorzata
+
+
+
+
+
+ Wychowanie fizyczne [wf2]
+
+ Nowicka Irena
+
+
+
+
+
+
+ 4
+ 10:40 11:25
+
+
+ Urządzenia techniki komputerowej [zaw2]
+
+ Bocian Grzegorz
+
+
+
+
+
+ Wychowanie fizyczne [wf2]
+
+ Nowicka Irena
+
+ (przeniesiona na lekcję 3, 20.06.2017)
+
+
+
+
+ Matematyka
+ Baran Małgorzata
+
+
+
+
+
+ Wychowanie fizyczne [wf2]
+
+ Nowicka Irena
+
+
+
+
+
+
+ 5
+ 11:30 12:15
+
+
+ Urządzenia techniki komputerowej [zaw2]
+
+ Bocian Grzegorz
+
+
+
+
+
+ Podstawy przedsiębiorczości
+ Bogatka Anna
+ W12
+ (okienko dla uczniów)
+
+
+
+
+ Religia
+ Cyranka Krystian
+
+
+
+
+
+ Sieci komputerowe i administrowanie sieciami [zaw2]
+
+ Rożeniec Piotr
+
+
+
+
+
+
+ 6
+ 12:20 13:05
+
+
+ Matematyka
+ Baran Małgorzata
+
+
+
+
+
+ Podstawy przedsiębiorczości
+ Bogatka Anna
+ W12
+ (okienko dla uczniów)
+
+
+
+
+ Język angielski [J1]
+
+ Brodziec Sylwia
+
+
+
+
+
+ Religia
+ Cyranka Krystian
+
+
+
+
+
+
+ 7
+ 13:10 13:55
+
+
+ Fizyka
+ Bączek Grzegorz
+ 33
+ (okienko dla uczniów)
+
+
+
+
+ Język polski
+ Bocian Natalia
+
+ (przeniesiona na lekcję 2, 20.06.2017)
+
+
+
+
+ Multimedia i grafika komputerowa [zaw2]
+
+ Bocian Konrad
+
+
+
+
+
+ Wiedza o kulturze
+ Bocian Natalia
+
+
+
+
+
+
+ 8
+ 14:00 14:45
+
+
+ Zajęcia z wychowawcą
+ Baran Małgorzata
+
+
+
+
+
+ Naprawa komputera [zaw2]
+
+ Kraska Maciej
+ 32
+ (okienko dla uczniów)
+
+
+
+
+ Systemy operacyjne [zaw2]
+
+ Kraska Maciej
+ 32
+
+
+
+
+
+
+ 9
+ 14:50 15:35
+
+
+
+ Język niemiecki [J1]
+
+ Rożeniec Honorata
+ 25
+ (uczniowie zwolnieni do domu)
+
+
+
+
+
+
+
+ 10
+ 15:40 16:25
+
+
+
+
+
+
+
+ 11
+ 16:35 17:20
+
+
+
+
+
+
+
+ 12
+ 17:25 18:10
+
+
+
+
+
+
+
+ 13
+ 18:15 19:00
+
+
+
+
+
+
+
+
+
+
+
+ Kursywa - planowane
+
+
+ Zwykła czcionka - zrealizowane
+
+
+ Przekreślone - odwołane lub przeniesione
+
+
+ Pogrubione - nowe lekcje, przeniesione z innego terminu, zastępstwa
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/timetable/PlanLekcji-holidays.html b/api/src/test/resources/io/github/wulkanowy/api/timetable/PlanLekcji-holidays.html
new file mode 100644
index 000000000..09555cf3f
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/timetable/PlanLekcji-holidays.html
@@ -0,0 +1,156 @@
+
+
+
+
+
Witryna ucznia i rodzica – Plan lekcji
+
+
+
+ Plan lekcji
+
+
+
+
+ Lekcja
+ Pora lekcji
+ poniedziałek 31.07.2017 Ferie letnie
+ wtorek 01.08.2017 Ferie letnie
+ środa 02.08.2017 Ferie letnie
+ czwartek 03.08.2017 Ferie letnie
+ piątek 04.08.2017 Ferie letnie
+
+
+
+
+ 0
+ 07:10 07:55
+
+
+
+
+
+
+
+ 1
+ 08:00 08:45
+
+
+
+
+
+
+
+ 2
+ 08:50 09:35
+
+
+
+
+
+
+
+ 3
+ 09:40 10:25
+
+
+
+
+
+
+
+ 4
+ 10:40 11:25
+
+
+
+
+
+
+
+ 5
+ 11:30 12:15
+
+
+
+
+
+
+
+ 6
+ 12:20 13:05
+
+
+
+
+
+
+
+ 7
+ 13:10 13:55
+
+
+
+
+
+
+
+ 8
+ 14:00 14:45
+
+
+
+
+
+
+
+ 9
+ 14:50 15:35
+
+
+
+
+
+
+
+ 10
+ 15:40 16:25
+
+
+
+
+
+
+
+ 11
+ 16:35 17:20
+
+
+
+
+
+
+
+ 12
+ 17:25 18:10
+
+
+
+
+
+
+
+ 13
+ 18:15 19:00
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/timetable/PlanLekcji-std.html b/api/src/test/resources/io/github/wulkanowy/api/timetable/PlanLekcji-std.html
new file mode 100644
index 000000000..8bcc9794e
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/timetable/PlanLekcji-std.html
@@ -0,0 +1,303 @@
+
+
+
+
+
Witryna ucznia i rodzica – Plan lekcji
+
+
+
+ Plan lekcji
+
+
+
+
+ Lekcja
+ Pora lekcji
+ poniedziałek 19.06.2017
+ wtorek 20.06.2017
+ środa 21.06.2017
+ czwartek 22.06.2017
+ piątek 23.06.2017
+
+
+
+
+ 1
+ 08:00 08:45
+
+
+ Edukacja dla bezpieczeństwa
+ Kobczyk Iwona
+
+
+
+
+
+
+ Język niemiecki [JNPW]
+
+ Dzwoniec Ewa
+
+
+
+
+
+ Wychowanie do życia w rodzinie
+ Baran Dominika
+
+
+
+
+
+ Język niemiecki [JNPW]
+
+ Dzwoniec Ewa
+
+
+
+
+
+ 2
+ 08:50 09:35
+
+
+ Historia
+ Bogatka Katarzyna
+
+
+
+
+
+ Wychowanie fizyczne [CH]
+
+ Brodziec Dominika
+
+
+
+
+
+ Fizyka
+ Bocian Łukasz
+
+
+
+
+
+ Biologia
+ Kowalska Anna
+
+
+
+
+
+ Religia
+ Kraska Maciej
+
+
+
+
+
+ 3
+ 09:40 10:25
+
+
+ Wychowanie fizyczne [CH]
+
+ Brodziec Dominika
+
+
+
+
+
+ Język polski
+ Rożeniec Paulina
+
+
+
+
+
+ Matematyka
+ Bączek Dominika
+
+
+
+
+
+ Plastyka
+ Rożeniec Paulina
+
+
+
+
+
+ Zajęcia z wychowawcą
+ Kowalska Anna
+
+
+
+
+
+ 4
+ 10:30 11:15
+
+
+ Geografia
+ Orłowski Konrad
+
+
+
+
+
+ Matematyka
+ Bączek Dominika
+
+
+
+
+
+ Język angielski [JAPN]
+
+ Biegus Kazimiera
+
+
+
+
+
+ Matematyka
+ Bączek Dominika
+
+
+
+
+
+ Historia
+ Bogatka Katarzyna
+
+
+
+
+
+ 5
+ 11:30 12:15
+
+
+ Matematyka
+ Bączek Dominika
+
+
+
+
+
+ Biologia
+ Kowalska Anna
+
+
+
+
+
+ Zajęcia techniczne
+ Chlebowski Stanisław
+
+
+
+
+
+ Język angielski [JAPN]
+
+ Biegus Kazimiera
+
+
+
+
+
+ Język polski
+ Rożeniec Paulina
+
+
+
+
+
+ 6
+ 12:30 13:15
+
+
+ Matematyka
+ Bączek Dominika
+
+
+
+
+
+ Fizyka
+ Bocian Łukasz
+
+
+
+
+
+ Język polski
+ Rożeniec Paulina
+
+
+
+
+
+ Wychowanie fizyczne [CH]
+
+ Brodziec Dominika
+
+
+
+
+
+ Język polski
+ Rożeniec Paulina
+
+
+
+
+
+ 7
+ 13:20 14:05
+
+
+ Język angielski [JAPN]
+
+ Biegus Kazimiera
+
+
+
+
+
+ Religia
+ Kraska Maciej
+
+
+
+
+
+ Wychowanie fizyczne [CH]
+
+ Brodziec Dominika
+
+
+
+
+
+
+
+ 8
+ 14:10 14:55
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/api/src/test/resources/io/github/wulkanowy/api/user/UczenDanePodstawowe.html b/api/src/test/resources/io/github/wulkanowy/api/user/UczenDanePodstawowe.html
new file mode 100644
index 000000000..c54dd8614
--- /dev/null
+++ b/api/src/test/resources/io/github/wulkanowy/api/user/UczenDanePodstawowe.html
@@ -0,0 +1,119 @@
+
+
+
+
+
Witryna ucznia i rodzica – Dane ucznia
+
+
+
+ Dane podstawowe
+ Dane osobowe
+
+
+ Imię (imiona) nazwisko:
+ Maria Aneta Kamińska
+
+
+ Data i miejsce urodzenia:
+ 01.01.1900, Warszawa
+
+
+ PESEL:
+ 12345678900
+
+
+ Płeć:
+ Kobieta
+
+
+ Obywatelstwo polskie:
+ Tak
+
+
+ Nazwisko rodowe:
+ Nowak
+
+
+ Imię matki i ojca:
+ Gabriela, Kamil
+
+
+ Dane adresowe
+
+
+ Adres zamieszkania:
+ ul. Sportowa 16, 00-123 Warszawa
+
+
+ Adres zameldowania:
+ ul. Sportowa 17, 00-123 Warszawa
+
+
+ Adres korespondencji:
+ ul. Sportowa 18, 00-123 Warszawa
+
+
+ Kontakt
+
+
+ Telefon:
+ 005554433
+
+
+ Telefon komórkowy:
+ 555444333
+
+
+ E-mail:
+ wulkanowy@example.null
+
+
+ Rodzina
+
+
+ Nazwisko i imię:
+ Marianna Pająk
+
+
+ Stopień pokrewieństwa:
+ matka
+
+
+ Adres:
+ ul. Sportowa 16, 00-123 Warszawa
+
+
+ Telefony:
+ 555111222
+
+
+ E-mail:
+ wulkanowy@example.null
+
+
+
+
+ Nazwisko i imię:
+ Dawid Świątek
+
+
+ Stopień pokrewieństwa:
+ ojciec
+
+
+ Adres:
+ ul. Sportowa 18, 00-123 Warszawa
+
+
+ Telefony:
+ 555222111
+
+
+ E-mail:
+ wulkanowy@example.null
+
+
+
+
+
+
diff --git a/app/build.gradle b/app/build.gradle
index 22af6e6bb..d930afc0d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,153 +1,109 @@
+buildscript {
+ repositories {
+ maven { url "https://plugins.gradle.org/m2/" }
+ maven { url 'https://maven.fabric.io/public' }
+ }
+
+ dependencies {
+ classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
+ classpath 'io.fabric.tools:gradle:1.25.1'
+ }
+}
+
+repositories {
+ maven { url 'https://maven.fabric.io/public' }
+}
+
apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-kapt'
-apply plugin: 'kotlin-android-extensions'
+apply plugin: 'org.greenrobot.greendao'
apply plugin: 'io.fabric'
-apply plugin: 'com.github.triplet.play'
-apply from: 'jacoco.gradle'
-apply from: 'sonarqube.gradle'
+apply from: '../jacoco.gradle'
+apply from: '../android-sonarqube.gradle'
android {
- compileSdkVersion 28
- buildToolsVersion '28.0.3'
-
+ compileSdkVersion 27
+ buildToolsVersion "27.0.3"
defaultConfig {
applicationId "io.github.wulkanowy"
testApplicationId "io.github.tests.wulkanowy"
minSdkVersion 15
- targetSdkVersion 28
- versionCode 30
- versionName "0.7.4"
- multiDexEnabled true
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ targetSdkVersion 27
+ versionCode 3
+ versionName "0.2.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [
- fabric_api_key: System.getenv("FABRIC_API_KEY") ?: "null",
- crashlytics_enabled: project.hasProperty("enableCrashlytics")
+ fabricApiKey: System.getenv("FABRIC_API_KEY") ?: "null"
]
- javaCompileOptions {
- annotationProcessorOptions {
- arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
- }
- }
- }
-
- sourceSets {
- androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
- }
-
- signingConfigs {
- release {
- storeFile file("upload-key.jks")
- storePassword System.getenv("PLAY_STORE_PASSWORD")
- keyAlias System.getenv("PLAY_KEY_ALIAS")
- keyPassword System.getenv("PLAY_KEY_PASSWORD")
- }
}
buildTypes {
release {
- buildConfigField "boolean", "CRASHLYTICS_ENABLED", "true"
- minifyEnabled true
- shrinkResources true
+ minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.release
}
debug {
- buildConfigField "boolean", "CRASHLYTICS_ENABLED", project.hasProperty("enableCrashlytics") ? "true" : "false"
applicationIdSuffix ".dev"
versionNameSuffix "-dev"
testCoverageEnabled = true
- ext.enableCrashlytics = project.hasProperty("enableCrashlytics")
- multiDexKeepProguard file('proguard-multidex-rules.pro')
+ ext.enableCrashlytics = false
}
}
- lintOptions {
- disable 'HardwareIds'
- }
-
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
+ testOptions {
+ unitTests.all {
+ testLogging {
+ events "passed", "skipped", "failed", "standardOut", "standardError"
+ outputs.upToDateWhen { false }
+ showStandardStreams = true
+ }
+ }
}
}
-androidExtensions {
- experimental = true
-}
-
-play {
- serviceAccountEmail = System.getenv("PLAY_SERVICE_ACCOUNT_EMAIL") ?: "jan@fakelog.cf"
- serviceAccountCredentials = file('key.p12')
- defaultToAppBundles = true
- track = 'alpha'
+greendao {
+ schemaVersion 22
+ generateTests = true
}
dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
- implementation('io.github.wulkanowy:api:0.7.4') { exclude module: "threetenbp" }
+ implementation project(':api')
+ implementation 'com.android.support:appcompat-v7:27.1.0'
+ implementation 'com.android.support:design:27.1.0'
+ implementation 'com.android.support:support-v4:27.1.0'
+ implementation 'com.android.support:recyclerview-v7:27.1.0'
+ implementation 'com.android.support:cardview-v7:27.1.0'
+ implementation 'com.android.support:customtabs:27.1.0'
+ implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
+ implementation 'org.apache.commons:commons-lang3:3.7'
+ implementation 'eu.davidea:flexible-adapter:5.0.0-rc4'
+ implementation 'eu.davidea:flexible-adapter-ui:1.0.0-b1'
+ implementation 'org.apache.commons:commons-collections4:4.1'
+ implementation 'org.greenrobot:greendao:3.2.2'
+ implementation 'com.github.yuweiguocn:GreenDaoUpgradeHelper:v2.0.2'
+ implementation 'com.jakewharton:butterknife:8.8.1'
+ implementation 'joda-time:joda-time:2.9.9'
+ implementation 'com.google.dagger:dagger-android:2.14.1'
+ implementation 'com.google.dagger:dagger-android-support:2.14.1'
+ implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
- implementation "androidx.legacy:legacy-support-v4:1.0.0"
- implementation "androidx.appcompat:appcompat:1.0.2"
- implementation "androidx.cardview:cardview:1.0.0"
- implementation "com.google.android.material:material:1.0.0"
- implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
- implementation 'androidx.multidex:multidex:2.0.1'
+ implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
+ transitive = true
+ }
+ implementation('com.crashlytics.sdk.android:answers:1.4.1@aar') {
+ transitive = true
+ }
- implementation "android.arch.work:work-runtime:1.0.0"
- implementation "android.arch.work:work-rxjava2:1.0.0"
+ annotationProcessor 'com.google.dagger:dagger-android-processor:2.14.1'
+ annotationProcessor 'com.google.dagger:dagger-compiler:2.14.1'
+ annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
- implementation "androidx.room:room-runtime:2.1.0-alpha06"
- implementation "androidx.room:room-rxjava2:2.1.0-alpha06"
- kapt "androidx.room:room-compiler:2.1.0-alpha06"
+ debugImplementation 'com.amitshekhar.android:debug-db:1.0.1'
+ debugImplementation 'net.zetetic:android-database-sqlcipher:3.5.9'
- implementation 'com.takisoft.preferencex:preferencex:1.0.0'
+ testImplementation 'junit:junit:4.12'
+ testImplementation 'org.mockito:mockito-core:2.13.0'
- implementation 'com.squareup.inject:assisted-inject-annotations-dagger2:0.3.3'
- kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.3.3'
-
- implementation "com.google.dagger:dagger-android-support:2.21"
- kapt "com.google.dagger:dagger-compiler:2.21"
- kapt "com.google.dagger:dagger-android-processor:2.21"
-
- implementation "eu.davidea:flexible-adapter:5.1.0"
- implementation "eu.davidea:flexible-adapter-ui:1.0.0"
- implementation "com.aurelhubert:ahbottomnavigation:2.3.4"
- implementation 'com.ncapdevi:frag-nav:3.2.0'
-
- implementation 'com.github.wulkanowy:MaterialChipsInput:b72fd0ee6f'
- implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
-
- implementation 'com.github.pwittchen:reactivenetwork-rx2:3.0.2'
- implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
- implementation "io.reactivex.rxjava2:rxjava:2.2.7"
-
- implementation "com.jakewharton.threetenabp:threetenabp:1.2.0"
- implementation "com.jakewharton.timber:timber:4.7.1"
- implementation "at.favre.lib:slf4j-timber:1.0.1"
- implementation "com.mikepenz:aboutlibraries:6.2.3"
-
- implementation 'com.google.firebase:firebase-core:16.0.8'
- implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
-
- releaseImplementation 'fr.o80.chucker:library-no-op:2.0.4'
-
- debugImplementation 'fr.o80.chucker:library:2.0.4'
- debugImplementation "com.amitshekhar.android:debug-db:1.0.6"
-
- testImplementation "junit:junit:4.12"
- testImplementation "io.mockk:mockk:1.9.2"
- testImplementation "org.mockito:mockito-inline:2.25.1"
- testImplementation 'org.threeten:threetenbp:1.3.8'
-
- androidTestImplementation 'androidx.test:core:1.1.0'
- androidTestImplementation 'androidx.test:runner:1.1.1'
- androidTestImplementation 'androidx.test.ext:junit:1.1.0'
- androidTestImplementation "io.mockk:mockk-android:1.9.2"
- androidTestImplementation 'org.mockito:mockito-android:2.25.1'
- androidTestImplementation "androidx.room:room-testing:2.1.0-alpha06"
- androidTestImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
+ androidTestImplementation 'com.android.support.test:runner:1.0.1'
+ androidTestImplementation 'org.mockito:mockito-android:2.13.0'
}
-
-apply plugin: 'com.google.gms.google-services'
diff --git a/app/jacoco.gradle b/app/jacoco.gradle
deleted file mode 100644
index f2b01b483..000000000
--- a/app/jacoco.gradle
+++ /dev/null
@@ -1,47 +0,0 @@
-apply plugin: "jacoco"
-
-jacoco {
- toolVersion "0.8.3"
- reportsDir = file("$buildDir/reports")
-}
-
-tasks.withType(Test) {
- jacoco.includeNoLocationClasses = true
-}
-
-task jacocoTestReport(type: JacocoReport) {
-
- group = "Reporting"
- description = "Generate Jacoco coverage reports"
-
- reports {
- xml.enabled = true
- html.enabled = true
- }
-
- def excludes = ['**/R.class',
- '**/R$*.class',
- '**/BuildConfig.*',
- '**/Manifest*.*',
- '**/*Test*.*',
- 'android/**/*.*',
- '**/*Module.*',
- '**/*Dagger*.*',
- '**/*MembersInjector*.*',
- '**/*_Provide*Factory*.*',
- '**/*_Factory.*']
-
- classDirectories = fileTree(
- dir: "$buildDir/intermediates/classes/debug",
- excludes: excludes
- ) + fileTree(
- dir: "$buildDir/tmp/kotlin-classes/debug",
- excludes: excludes
- )
-
- sourceDirectories = files("$project.projectDir/src/main/java")
- executionData = fileTree(
- dir: project.projectDir,
- includes: ["**/*.exec", "**/*.ec"]
- )
-}
diff --git a/app/key-encrypted.p12 b/app/key-encrypted.p12
deleted file mode 100644
index d9811213f..000000000
Binary files a/app/key-encrypted.p12 and /dev/null differ
diff --git a/app/key.p12.gpg b/app/key.p12.gpg
deleted file mode 100644
index e9b6d06eb..000000000
Binary files a/app/key.p12.gpg and /dev/null differ
diff --git a/app/proguard-multidex-rules.pro b/app/proguard-multidex-rules.pro
deleted file mode 100644
index 9ee1737f4..000000000
--- a/app/proguard-multidex-rules.pro
+++ /dev/null
@@ -1,3 +0,0 @@
--keep class android.support.test.internal** { *; }
--keep class org.junit.** { *; }
--keep public class io.github.wulkanowy** { *; }
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 15b628384..34ed4c38c 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,39 +1,25 @@
-# Optimizations
--optimizationpasses 5
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
--dontusemixedcaseclassnames
--dontskipnonpubliclibraryclasses
--dontskipnonpubliclibraryclassmembers
--dontpreverify
--dontobfuscate
--allowaccessmodification
--repackageclasses ''
--verbose
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\RicomenPL\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+# Add any project specific keep options here:
-#Config for anallitycs
--keepattributes *Annotation*
--keepattributes SourceFile,LineNumberTable
--keep class com.crashlytics.** {*;}
--keep public class * extends java.lang.Exception
--dontwarn com.crashlytics.**
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
-#Config for OkHttp
--keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
--dontwarn org.codehaus.mojo.animal_sniffer.*
--dontwarn okhttp3.internal.platform.ConscryptPlatform
--dontwarn javax.annotation.**
-
-
-#Config for ReactiveNetwork
--dontwarn com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
--dontwarn io.reactivex.functions.Function
--dontwarn rx.internal.util.**
--dontwarn sun.misc.Unsafe
-
-#Config for MPAndroidChart
--keep class com.github.mikephil.charting.** { *; }
-
-#Config for API
--keep class io.github.wulkanowy.api.** {*;}
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/11.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/11.json
deleted file mode 100644
index e42a4a719..000000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/11.json
+++ /dev/null
@@ -1,1325 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 11,
- "identityHash": "478af7daed6ac4563e71826fb70cc8c8",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `endpoint` TEXT NOT NULL, `loginType` TEXT NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_name` TEXT NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "endpoint",
- "columnName": "endpoint",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "loginType",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id"
- ],
- "createSql": "CREATE UNIQUE INDEX `index_Students_email_symbol_student_id_school_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` INTEGER NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predictedGrade` TEXT NOT NULL, `finalGrade` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predictedGrade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "finalGrade",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `grade` INTEGER NOT NULL, `amount` INTEGER NOT NULL, `is_semester` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "grade",
- "columnName": "grade",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "amount",
- "columnName": "amount",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semester",
- "columnName": "is_semester",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `content` TEXT, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `removed` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `category` TEXT NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "views": [],
- "setupQueries": [
- "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
- "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"478af7daed6ac4563e71826fb70cc8c8\")"
- ]
- }
-}
\ No newline at end of file
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/12.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/12.json
deleted file mode 100644
index 32f943554..000000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/12.json
+++ /dev/null
@@ -1,1332 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 12,
- "identityHash": "972ad26e6488d9a8239f6bd8597af61d",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `endpoint` TEXT NOT NULL, `loginType` TEXT NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_name` TEXT NOT NULL, `class_id` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "endpoint",
- "columnName": "endpoint",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "loginType",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id_class_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id",
- "class_id"
- ],
- "createSql": "CREATE UNIQUE INDEX `index_Students_email_symbol_student_id_school_id_class_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`, `class_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` INTEGER NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predictedGrade` TEXT NOT NULL, `finalGrade` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predictedGrade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "finalGrade",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `grade` INTEGER NOT NULL, `amount` INTEGER NOT NULL, `is_semester` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "grade",
- "columnName": "grade",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "amount",
- "columnName": "amount",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semester",
- "columnName": "is_semester",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `content` TEXT, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `removed` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `category` TEXT NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "views": [],
- "setupQueries": [
- "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
- "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"972ad26e6488d9a8239f6bd8597af61d\")"
- ]
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/AccountTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/AccountTest.java
new file mode 100644
index 000000000..e5330b621
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/AccountTest.java
@@ -0,0 +1,18 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.test.AbstractDaoTestLongPk;
+
+public class AccountTest extends AbstractDaoTestLongPk
{
+
+ public AccountTest() {
+ super(AccountDao.class);
+ }
+
+ @Override
+ protected Account createEntity(Long key) {
+ Account entity = new Account();
+ entity.setId(key);
+ return entity;
+ }
+
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/AttendanceLessonTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/AttendanceLessonTest.java
new file mode 100644
index 000000000..492d642d1
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/AttendanceLessonTest.java
@@ -0,0 +1,28 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.test.AbstractDaoTestLongPk;
+
+import io.github.wulkanowy.data.db.dao.entities.AttendanceLesson;
+import io.github.wulkanowy.data.db.dao.entities.AttendanceLessonDao;
+
+public class AttendanceLessonTest extends AbstractDaoTestLongPk {
+
+ public AttendanceLessonTest() {
+ super(AttendanceLessonDao.class);
+ }
+
+ @Override
+ protected AttendanceLesson createEntity(Long key) {
+ AttendanceLesson entity = new AttendanceLesson();
+ entity.setId(key);
+ entity.setIsPresence(false);
+ entity.setIsAbsenceUnexcused(false);
+ entity.setIsAbsenceExcused(false);
+ entity.setIsUnexcusedLateness(false);
+ entity.setIsAbsenceForSchoolReasons(false);
+ entity.setIsExcusedLateness(false);
+ entity.setIsExemption(false);
+ return entity;
+ }
+
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/DayTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/DayTest.java
new file mode 100644
index 000000000..34c4c4c5e
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/DayTest.java
@@ -0,0 +1,19 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.test.AbstractDaoTestLongPk;
+
+public class DayTest extends AbstractDaoTestLongPk {
+
+ public DayTest() {
+ super(DayDao.class);
+ }
+
+ @Override
+ protected Day createEntity(Long key) {
+ Day entity = new Day();
+ entity.setId(key);
+ entity.setIsFreeDay(false);
+ return entity;
+ }
+
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/GradeTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/GradeTest.java
new file mode 100644
index 000000000..ea0265591
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/GradeTest.java
@@ -0,0 +1,20 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.test.AbstractDaoTestLongPk;
+
+public class GradeTest extends AbstractDaoTestLongPk {
+
+ public GradeTest() {
+ super(GradeDao.class);
+ }
+
+ @Override
+ protected Grade createEntity(Long key) {
+ Grade entity = new Grade();
+ entity.setId(key);
+ entity.setIsNew(false);
+ entity.setRead(false);
+ return entity;
+ }
+
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/SubjectTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/SubjectTest.java
new file mode 100644
index 000000000..81a2e724f
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/SubjectTest.java
@@ -0,0 +1,18 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.test.AbstractDaoTestLongPk;
+
+public class SubjectTest extends AbstractDaoTestLongPk {
+
+ public SubjectTest() {
+ super(SubjectDao.class);
+ }
+
+ @Override
+ protected Subject createEntity(Long key) {
+ Subject entity = new Subject();
+ entity.setId(key);
+ return entity;
+ }
+
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/TimetableLessonTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/TimetableLessonTest.java
new file mode 100644
index 000000000..b215b6bef
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/TimetableLessonTest.java
@@ -0,0 +1,27 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.test.AbstractDaoTestLongPk;
+
+import io.github.wulkanowy.data.db.dao.entities.TimetableLesson;
+import io.github.wulkanowy.data.db.dao.entities.TimetableLessonDao;
+
+public class TimetableLessonTest extends AbstractDaoTestLongPk {
+
+ public TimetableLessonTest() {
+ super(TimetableLessonDao.class);
+ }
+
+ @Override
+ protected TimetableLesson createEntity(Long key) {
+ TimetableLesson entity = new TimetableLesson();
+ entity.setId(key);
+ entity.setIsEmpty(false);
+ entity.setIsDivisionIntoGroups(false);
+ entity.setIsPlanning(false);
+ entity.setIsRealized(false);
+ entity.setIsMovedOrCanceled(false);
+ entity.setIsNewMovedInOrChanged(false);
+ return entity;
+ }
+
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/WeekTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/WeekTest.java
new file mode 100644
index 000000000..86e7a8be5
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/WeekTest.java
@@ -0,0 +1,18 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.test.AbstractDaoTestLongPk;
+
+public class WeekTest extends AbstractDaoTestLongPk {
+
+ public WeekTest() {
+ super(WeekDao.class);
+ }
+
+ @Override
+ protected Week createEntity(Long key) {
+ Week entity = new Week();
+ entity.setId(key);
+ return entity;
+ }
+
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/Migration12Test.kt b/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/Migration12Test.kt
deleted file mode 100644
index c61e9305d..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/Migration12Test.kt
+++ /dev/null
@@ -1,159 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import android.content.ContentValues
-import android.database.sqlite.SQLiteDatabase.CONFLICT_FAIL
-import androidx.room.Room
-import androidx.room.testing.MigrationTestHelper
-import androidx.sqlite.db.SupportSQLiteDatabase
-import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.platform.app.InstrumentationRegistry
-import io.github.wulkanowy.data.db.AppDatabase
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class Migration12Test {
-
- private val dbName = "migration-test"
-
- @get:Rule
- val helper: MigrationTestHelper = MigrationTestHelper(
- InstrumentationRegistry.getInstrumentation(),
- AppDatabase::class.java.canonicalName,
- FrameworkSQLiteOpenHelperFactory()
- )
-
- @Test
- fun migrate11To12_twoNotRelatedStudents() {
- helper.createDatabase(dbName, 11).apply {
- // user 1
- createStudent(this, 1, true)
- createSemester(this, 1, false, 5, 1)
- createSemester(this, 1, true, 5, 2)
-
- // user 2
- createStudent(this, 2, true)
- createSemester(this, 2, false, 6, 1)
- createSemester(this, 2, true, 6, 2)
- close()
- }
-
- helper.runMigrationsAndValidate(dbName, 12, true, Migration12())
-
- val db = getMigratedRoomDatabase()
- val students = db.studentDao.loadAll().blockingGet()
-
- assertEquals(2, students.size)
-
- students[0].run {
- assertEquals(1, studentId)
- assertEquals(5, classId)
- }
-
- students[1].run {
- assertEquals(2, studentId)
- assertEquals(6, classId)
- }
- }
-
- @Test
- fun migrate11To12_removeStudentsWithoutClassId() {
- helper.createDatabase(dbName, 11).apply {
- // user 1
- createStudent(this, 1, true)
- createSemester(this, 1, false, 0, 2)
- createStudent(this, 2, true)
- createSemester(this, 2, true, 1, 2)
- close()
- }
-
- helper.runMigrationsAndValidate(dbName, 12, true, Migration12())
-
- val db = getMigratedRoomDatabase()
- val students = db.studentDao.loadAll().blockingGet()
-
- assertEquals(1, students.size)
-
- students[0].run {
- assertEquals(2, studentId)
- assertEquals(1, classId)
- }
- }
-
- @Test
- fun migrate11To12_ensureThereIsOnlyOneCurrentStudent() {
- helper.createDatabase(dbName, 11).apply {
- // user 1
- createStudent(this, 1, true)
- createSemester(this, 1, true, 5, 2)
- createStudent(this, 2, true)
- createSemester(this, 2, true, 6, 2)
- createStudent(this, 3, true)
- createSemester(this, 3, false, 7, 2)
- close()
- }
-
- helper.runMigrationsAndValidate(dbName, 12, true, Migration12())
-
- val db = getMigratedRoomDatabase()
- val students = db.studentDao.loadAll().blockingGet()
-
- assertEquals(3, students.size)
-
- students[0].run {
- assertEquals(studentId, 1)
- assertEquals(false, isCurrent)
- }
- students[1].run {
- assertEquals(studentId, 2)
- assertEquals(false, isCurrent)
- }
- students[2].run {
- assertEquals(studentId, 3)
- assertEquals(true, isCurrent)
- }
- }
-
- private fun createStudent(db: SupportSQLiteDatabase, studentId: Int, isCurrent: Boolean) {
- db.insert("Students", CONFLICT_FAIL, ContentValues().apply {
- put("endpoint", "https://fakelog.cf")
- put("loginType", "STANDARD")
- put("email", "jan@fakelog.cf")
- put("password", "******")
- put("symbol", "Default")
- put("student_id", studentId)
- put("student_name", "Jan Kowalski")
- put("school_id", "000123")
- put("school_name", "")
- put("is_current", isCurrent)
- put("registration_date", "0")
- })
- }
-
- private fun createSemester(db: SupportSQLiteDatabase, studentId: Int, isCurrent: Boolean, classId: Int, diaryId: Int) {
- db.insert("Semesters", CONFLICT_FAIL, ContentValues().apply {
- put("student_id", studentId)
- put("diary_id", diaryId)
- put("diary_name", "IA")
- put("semester_id", diaryId * 5)
- put("semester_name", "1")
- put("is_current", isCurrent)
- put("class_id", classId)
- put("unit_id", "99")
- })
- }
-
- private fun getMigratedRoomDatabase(): AppDatabase {
- val database = Room.databaseBuilder(ApplicationProvider.getApplicationContext(),
- AppDatabase::class.java, dbName)
- .addMigrations(Migration12())
- .build()
- // close the database and release any stream resources when the test finishes
- helper.closeWhenFinished(database)
- return database
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/TestInternetObservingStrategy.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/TestInternetObservingStrategy.kt
deleted file mode 100644
index 7dc93c4a4..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/TestInternetObservingStrategy.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingStrategy
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.error.ErrorHandler
-import io.reactivex.Observable
-import io.reactivex.Single
-
-class TestInternetObservingStrategy : InternetObservingStrategy {
-
- override fun checkInternetConnectivity(host: String?, port: Int, timeoutInMs: Int, httpResponse: Int, errorHandler: ErrorHandler?): Single {
- return Single.just(true)
- }
-
- override fun observeInternetConnectivity(initialIntervalInMs: Int, intervalInMs: Int, host: String?, port: Int, timeoutInMs: Int, httpResponse: Int, errorHandler: ErrorHandler?): Observable {
- return Observable.just(true)
- }
-
- override fun getDefaultPingHost() = "localhost"
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocalTest.kt
deleted file mode 100644
index ee65cf844..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocalTest.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.github.wulkanowy.data.repositories.attendance
-
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.data.db.entities.Semester
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDate
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class AttendanceLocalTest {
-
- private lateinit var attendanceLocal: AttendanceLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun createDb() {
- testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java).build()
- attendanceLocal = AttendanceLocal(testDb.attendanceDao)
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun saveAndReadTest() {
- attendanceLocal.saveAttendance(listOf(
- Attendance(1, 2, LocalDate.of(2018, 9, 10), 0, "", "", false, false, false, false, false, false),
- Attendance(1, 2, LocalDate.of(2018, 9, 14), 0, "", "", false, false, false, false, false, false),
- Attendance(1, 2, LocalDate.of(2018, 9, 17), 0, "", "", false, false, false, false, false, false)
- ))
-
- val attendance = attendanceLocal
- .getAttendance(Semester(1, 2, "", 1, 3, true, 1, 1),
- LocalDate.of(2018, 9, 10),
- LocalDate.of(2018, 9, 14)
- )
- .blockingGet()
- assertEquals(2, attendance.size)
- assertEquals(attendance[0].date, LocalDate.of(2018, 9, 10))
- assertEquals(attendance[1].date, LocalDate.of(2018, 9, 14))
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocalTest.kt
deleted file mode 100644
index 014f0b8bc..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocalTest.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-package io.github.wulkanowy.data.repositories.completedlessons
-
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.CompletedLesson
-import io.github.wulkanowy.data.db.entities.Semester
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDate
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class CompletedLessonsLocalTest {
-
- private lateinit var completedLessonsLocal: CompletedLessonsLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun createDb() {
- testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
- .build()
- completedLessonsLocal = CompletedLessonsLocal(testDb.completedLessonsDao)
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun saveAndReadTest() {
- completedLessonsLocal.saveCompletedLessons(listOf(
- getCompletedLesson(LocalDate.of(2018, 9, 10), 1),
- getCompletedLesson(LocalDate.of(2018, 9, 14), 2),
- getCompletedLesson(LocalDate.of(2018, 9, 17), 3)
- ))
-
- val completed = completedLessonsLocal
- .getCompletedLessons(Semester(1, 2, "", 1, 3, true, 1, 1),
- LocalDate.of(2018, 9, 10),
- LocalDate.of(2018, 9, 14)
- )
- .blockingGet()
- assertEquals(2, completed.size)
- assertEquals(completed[0].date, LocalDate.of(2018, 9, 10))
- assertEquals(completed[1].date, LocalDate.of(2018, 9, 14))
- }
-
- private fun getCompletedLesson(date: LocalDate, number: Int): CompletedLesson {
- return CompletedLesson(1, 2, date, number, "", "", "", "", "", "", "")
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/exam/ExamLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/exam/ExamLocalTest.kt
deleted file mode 100644
index dc66fa428..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/exam/ExamLocalTest.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.github.wulkanowy.data.repositories.exam
-
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.Exam
-import io.github.wulkanowy.data.db.entities.Semester
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDate
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class ExamLocalTest {
-
- private lateinit var examLocal: ExamLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun createDb() {
- testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java).build()
- examLocal = ExamLocal(testDb.examsDao)
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun saveAndReadTest() {
- examLocal.saveExams(listOf(
- Exam(1, 2, LocalDate.of(2018, 9, 10), LocalDate.now(), "", "", "", "", "", ""),
- Exam(1, 2, LocalDate.of(2018, 9, 14), LocalDate.now(), "", "", "", "", "", ""),
- Exam(1, 2, LocalDate.of(2018, 9, 17), LocalDate.now(), "", "", "", "", "", "")
- ))
-
- val exams = examLocal
- .getExams(Semester(1, 2, "", 1, 3, true, 1, 1),
- LocalDate.of(2018, 9, 10),
- LocalDate.of(2018, 9, 14)
- )
- .blockingGet()
- assertEquals(2, exams.size)
- assertEquals(exams[0].date, LocalDate.of(2018, 9, 10))
- assertEquals(exams[1].date, LocalDate.of(2018, 9, 14))
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeLocalTest.kt
deleted file mode 100644
index 36238f1b4..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeLocalTest.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package io.github.wulkanowy.data.repositories.grade
-
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.Semester
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDate
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class GradeLocalTest {
-
- private lateinit var gradeLocal: GradeLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun createDb() {
- testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
- .build()
- gradeLocal = GradeLocal(testDb.gradeDao)
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun saveAndReadTest() {
- gradeLocal.saveGrades(listOf(
- createGradeLocal(5, 3.0, LocalDate.of(2018, 9, 10), "", 1),
- createGradeLocal(4, 4.0, LocalDate.of(2019, 2, 27), "", 2),
- createGradeLocal(3, 5.0, LocalDate.of(2019, 2, 28), "", 2)
- ))
-
- val grades = gradeLocal
- .getGrades(Semester(1, 2, "", 2, 3, true, 1, 1))
- .blockingGet()
-
- assertEquals(2, grades.size)
- assertEquals(grades[0].date, LocalDate.of(2019, 2, 27))
- assertEquals(grades[1].date, LocalDate.of(2019, 2, 28))
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt
deleted file mode 100644
index 17e788fc0..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt
+++ /dev/null
@@ -1,112 +0,0 @@
-package io.github.wulkanowy.data.repositories.grade
-
-import android.os.Build.VERSION_CODES.P
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider.getApplicationContext
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.SdkSuppress
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.TestInternetObservingStrategy
-import io.mockk.MockKAnnotations
-import io.mockk.every
-import io.mockk.impl.annotations.MockK
-import io.mockk.impl.annotations.SpyK
-import io.reactivex.Single
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDate.of
-import org.threeten.bp.LocalDateTime
-import kotlin.test.assertFalse
-import kotlin.test.assertTrue
-import io.github.wulkanowy.api.grades.Grade as GradeApi
-
-@SdkSuppress(minSdkVersion = P)
-@RunWith(AndroidJUnit4::class)
-class GradeRepositoryTest {
-
- @SpyK
- private var mockApi = Api()
-
- private val settings = InternetObservingSettings.builder()
- .strategy(TestInternetObservingStrategy())
- .build()
-
- @MockK
- private lateinit var semesterMock: Semester
-
- @MockK
- private lateinit var studentMock: Student
-
- private lateinit var gradeRemote: GradeRemote
-
- private lateinit var gradeLocal: GradeLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun initApi() {
- MockKAnnotations.init(this)
- testDb = Room.inMemoryDatabaseBuilder(getApplicationContext(), AppDatabase::class.java).build()
- gradeLocal = GradeLocal(testDb.gradeDao)
- gradeRemote = GradeRemote(mockApi)
-
- every { mockApi.diaryId } returns 1
- every { studentMock.registrationDate } returns LocalDateTime.of(2019, 2, 27, 12, 0)
- every { semesterMock.studentId } returns 1
- every { semesterMock.semesterId } returns 1
- every { semesterMock.diaryId } returns 1
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun markOlderThanRegisterDateAsRead() {
- every { mockApi.getGrades(1) } returns Single.just(listOf(
- createGradeApi(5, 4.0, of(2019, 2, 25), "Ocena pojawiła się"),
- createGradeApi(5, 4.0, of(2019, 2, 26), "przed zalogowanie w aplikacji"),
- createGradeApi(5, 4.0, of(2019, 2, 27), "Ocena z dnia logowania"),
- createGradeApi(5, 4.0, of(2019, 2, 28), "Ocena jeszcze nowsza")
- ))
-
- val grades = GradeRepository(settings, gradeLocal, gradeRemote)
- .getGrades(studentMock, semesterMock, true).blockingGet().sortedByDescending { it.date }
-
- assertFalse { grades[0].isRead }
- assertFalse { grades[1].isRead }
- assertTrue { grades[2].isRead }
- assertTrue { grades[3].isRead }
- }
-
- @Test
- fun mitigateOldGradesNotifications() {
- gradeLocal.saveGrades(listOf(
- createGradeLocal(5, 3.0, of(2019, 2, 25), "Jedna ocena"),
- createGradeLocal(4, 4.0, of(2019, 2, 26), "Druga"),
- createGradeLocal(3, 5.0, of(2019, 2, 27), "Trzecia")
- ))
-
- every { mockApi.getGrades(1) } returns Single.just(listOf(
- createGradeApi(5, 2.0, of(2019, 2, 25), "Ocena ma datę, jest inna, ale nie zostanie powiadomiona"),
- createGradeApi(4, 3.0, of(2019, 2, 26), "starszą niż ostatnia lokalnie"),
- createGradeApi(3, 4.0, of(2019, 2, 27), "Ta jest z tego samego dnia co ostatnia lokalnie"),
- createGradeApi(2, 5.0, of(2019, 2, 28), "Ta jest już w ogóle nowa")
- ))
-
- val grades = GradeRepository(settings, gradeLocal, gradeRemote)
- .getGrades(studentMock, semesterMock, true).blockingGet().sortedByDescending { it.date }
-
- assertFalse { grades[0].isRead }
- assertFalse { grades[1].isRead }
- assertTrue { grades[2].isRead }
- assertTrue { grades[3].isRead }
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/TestGradeEntityCreator.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/TestGradeEntityCreator.kt
deleted file mode 100644
index e0fd05a82..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/TestGradeEntityCreator.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package io.github.wulkanowy.data.repositories.grade
-
-import io.github.wulkanowy.api.toDate
-import org.threeten.bp.LocalDate
-import io.github.wulkanowy.api.grades.Grade as GradeRemote
-import io.github.wulkanowy.data.db.entities.Grade as GradeLocal
-
-fun createGradeLocal(value: Int, weight: Double, date: LocalDate, desc: String, semesterId: Int = 1): GradeLocal {
- return GradeLocal(
- semesterId = semesterId,
- studentId = 1,
- modifier = .0,
- teacher = "",
- subject = "",
- date = date,
- color = "",
- comment = "",
- description = desc,
- entry = "",
- gradeSymbol = "",
- value = value,
- weight = "",
- weightValue = weight
- )
-}
-
-fun createGradeApi(value: Int, weight: Double, date: LocalDate, desc: String): GradeRemote {
- return GradeRemote().apply {
- this.value = value
- this.weightValue = weight
- this.date = date.toDate()
- this.description = desc
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsLocalTest.kt
deleted file mode 100644
index 5c0590e75..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsLocalTest.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-package io.github.wulkanowy.data.repositories.gradestatistics
-
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.GradeStatistics
-import io.github.wulkanowy.data.db.entities.Semester
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class GradeStatisticsLocalTest {
-
- private lateinit var gradeStatisticsLocal: GradeStatisticsLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun createDb() {
- testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
- .build()
- gradeStatisticsLocal = GradeStatisticsLocal(testDb.gradeStatistics)
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun saveAndRead_subject() {
- gradeStatisticsLocal.saveGradesStatistics(listOf(
- getGradeStatistics("Matematyka", 2, 1),
- getGradeStatistics("Fizyka", 1, 2)
- ))
-
- val stats = gradeStatisticsLocal.getGradesStatistics(
- Semester(2, 2, "", 1, 2, true, 1, 1), false,
- "Matematyka"
- ).blockingGet()
- assertEquals(1, stats.size)
- assertEquals(stats[0].subject, "Matematyka")
- }
-
- @Test
- fun saveAndRead_all() {
- gradeStatisticsLocal.saveGradesStatistics(listOf(
- getGradeStatistics("Matematyka", 2, 1),
- getGradeStatistics("Chemia", 2, 1),
- getGradeStatistics("Fizyka", 1, 2)
- ))
-
- val stats = gradeStatisticsLocal.getGradesStatistics(
- Semester(2, 2, "", 1, 2, true, 1, 1), false,
- "Wszystkie"
- ).blockingGet()
- assertEquals(1, stats.size)
- assertEquals(stats[0].subject, "Wszystkie")
- }
-
- private fun getGradeStatistics(subject: String, studentId: Int, semesterId: Int): GradeStatistics {
- return GradeStatistics(studentId, semesterId, subject, 5, 5, false)
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberLocalTest.kt
deleted file mode 100644
index a656ac058..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberLocalTest.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package io.github.wulkanowy.data.repositories.luckynumber
-
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.LuckyNumber
-import io.github.wulkanowy.data.db.entities.Semester
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDate
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class LuckyNumberLocalTest {
-
- private lateinit var luckyNumberLocal: LuckyNumberLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun createDb() {
- testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
- .build()
- luckyNumberLocal = LuckyNumberLocal(testDb.luckyNumberDao)
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun saveAndReadTest() {
- luckyNumberLocal.saveLuckyNumber(LuckyNumber(1, LocalDate.of(2019, 1, 20), 14))
-
- val luckyNumber = luckyNumberLocal.getLuckyNumber(Semester(1, 1, "", 1, 3, true, 1, 1),
- LocalDate.of(2019, 1, 20)
- ).blockingGet()
-
- assertEquals(1, luckyNumber.studentId)
- assertEquals(LocalDate.of(2019, 1, 20), luckyNumber.date)
- assertEquals(14, luckyNumber.luckyNumber)
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/recipient/RecipientLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/recipient/RecipientLocalTest.kt
deleted file mode 100644
index cc4dd9f31..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/recipient/RecipientLocalTest.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.github.wulkanowy.data.repositories.recipient
-
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.Recipient
-import io.github.wulkanowy.data.db.entities.ReportingUnit
-import io.github.wulkanowy.data.db.entities.Student
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDateTime
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class RecipientLocalTest {
-
- private lateinit var recipientLocal: RecipientLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun createDb() {
- testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
- .build()
- recipientLocal = RecipientLocal(testDb.recipientDao)
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun saveAndReadTest() {
- recipientLocal.saveRecipients(listOf(
- Recipient(1, "2rPracownik", "Kowalski Jan", "Kowalski Jan [KJ] - Pracownik (Fake123456)", 3, 4, 2, "hash"),
- Recipient(1, "3rPracownik", "Kowalska Karolina", "Kowalska Karolina [KK] - Pracownik (Fake123456)", 4, 4, 2, "hash"),
- Recipient(1, "4rPracownik", "Krupa Stanisław", "Krupa Stanisław [KS] - Uczeń (Fake123456)", 5, 4, 1, "hash")
- ))
-
- val recipients = recipientLocal.getRecipients(
- Student("fakelog.cf", "AUTO", "", "", "", 1, "", "", "", 1, true, LocalDateTime.now()),
- 2,
- ReportingUnit(1, 4, "", 0, "", emptyList())
- ).blockingGet()
-
- assertEquals(2, recipients.size)
- assertEquals(1, recipients[0].studentId)
- assertEquals("3rPracownik", recipients[1].realId)
- assertEquals("Kowalski Jan", recipients[0].name)
- assertEquals("Kowalska Karolina [KK] - Pracownik (Fake123456)", recipients[1].realName)
- assertEquals(3, recipients[0].loginId)
- assertEquals(4, recipients[1].unitId)
- assertEquals(2, recipients[0].role)
- assertEquals("hash", recipients[1].hash)
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt
deleted file mode 100644
index f61c63742..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.github.wulkanowy.data.repositories.student
-
-import android.content.Context
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.SharedPrefHelper
-import io.github.wulkanowy.data.db.entities.Student
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDateTime.now
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class StudentLocalTest {
-
- private lateinit var studentLocal: StudentLocal
-
- private lateinit var testDb: AppDatabase
-
- private lateinit var sharedHelper: SharedPrefHelper
-
- @Before
- fun createDb() {
- val context = ApplicationProvider.getApplicationContext()
- testDb = Room.inMemoryDatabaseBuilder(context, AppDatabase::class.java)
- .build()
- sharedHelper = SharedPrefHelper(context.getSharedPreferences("TEST", Context.MODE_PRIVATE))
- studentLocal = StudentLocal(testDb.studentDao, context)
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun saveAndReadTest() {
- studentLocal.saveStudent(Student(email = "test", password = "test123", schoolSymbol = "23", endpoint = "fakelog.cf", loginType = "AUTO", isCurrent = true, studentName = "", schoolName = "", studentId = 0, classId = 1, symbol = "", registrationDate = now()))
- .blockingGet()
-
- val student = studentLocal.getCurrentStudent(true).blockingGet()
- assertEquals("23", student.schoolSymbol)
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt
deleted file mode 100644
index 438e95f48..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.github.wulkanowy.data.repositories.timetable
-
-import io.github.wulkanowy.api.toDate
-import io.github.wulkanowy.utils.toDate
-import org.threeten.bp.LocalDateTime
-import org.threeten.bp.LocalDateTime.now
-import io.github.wulkanowy.api.timetable.Timetable as TimetableRemote
-import io.github.wulkanowy.data.db.entities.Timetable as TimetableLocal
-
-fun createTimetableLocal(number: Int, start: LocalDateTime, room: String = "", subject: String = ""): TimetableLocal {
- return TimetableLocal(
- studentId = 1,
- diaryId = 2,
- number = number,
- start = start,
- end = now(),
- date = start.toLocalDate(),
- subject = subject,
- subjectOld = "",
- group = "",
- room = room,
- roomOld = "",
- teacher = "",
- teacherOld = "",
- info = "",
- changes = false,
- canceled = false
- )
-}
-
-fun createTimetableRemote(number: Int, start: LocalDateTime, room: String, subject: String = ""): TimetableRemote {
- return TimetableRemote(
- number = number,
- start = start.toDate(),
- end = start.plusMinutes(45).toDate(),
- date = start.toLocalDate().toDate(),
- subject = subject,
- group = "",
- room = room,
- teacher = "",
- info = "",
- changes = false,
- canceled = false
- )
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableLocalTest.kt
deleted file mode 100644
index 0ecbcf92e..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableLocalTest.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package io.github.wulkanowy.data.repositories.timetable
-
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.Semester
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDate
-import org.threeten.bp.LocalDateTime.of
-import kotlin.test.assertEquals
-
-@RunWith(AndroidJUnit4::class)
-class TimetableLocalTest {
-
- private lateinit var timetableDb: TimetableLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun createDb() {
- testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
- .build()
- timetableDb = TimetableLocal(testDb.timetableDao)
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun saveAndReadTest() {
- timetableDb.saveTimetable(listOf(
- createTimetableLocal(1, of(2018, 9, 10, 0, 0, 0)),
- createTimetableLocal(1, of(2018, 9, 14, 0, 0, 0)),
- createTimetableLocal(1, of(2018, 9, 17, 0, 0, 0))
- ))
-
- val exams = timetableDb.getTimetable(
- Semester(1, 2, "", 1, 1, true, 1, 1),
- LocalDate.of(2018, 9, 10),
- LocalDate.of(2018, 9, 14)
- ).blockingGet()
-
- assertEquals(2, exams.size)
- assertEquals(exams[0].date, LocalDate.of(2018, 9, 10))
- assertEquals(exams[1].date, LocalDate.of(2018, 9, 14))
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt
deleted file mode 100644
index 1c0802637..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-package io.github.wulkanowy.data.repositories.timetable
-
-import android.os.Build.VERSION_CODES.P
-import androidx.room.Room
-import androidx.test.core.app.ApplicationProvider.getApplicationContext
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.SdkSuppress
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.repositories.TestInternetObservingStrategy
-import io.mockk.MockKAnnotations
-import io.mockk.every
-import io.mockk.impl.annotations.MockK
-import io.mockk.impl.annotations.SpyK
-import io.reactivex.Single
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.threeten.bp.LocalDate
-import org.threeten.bp.LocalDateTime.of
-import kotlin.test.assertEquals
-
-@SdkSuppress(minSdkVersion = P)
-@RunWith(AndroidJUnit4::class)
-class TimetableRepositoryTest {
-
- @SpyK
- private var mockApi = Api()
-
- private val settings = InternetObservingSettings.builder()
- .strategy(TestInternetObservingStrategy())
- .build()
-
- @MockK
- private lateinit var semesterMock: Semester
-
- private lateinit var timetableRemote: TimetableRemote
-
- private lateinit var timetableLocal: TimetableLocal
-
- private lateinit var testDb: AppDatabase
-
- @Before
- fun initApi() {
- MockKAnnotations.init(this)
- testDb = Room.inMemoryDatabaseBuilder(getApplicationContext(), AppDatabase::class.java).build()
- timetableLocal = TimetableLocal(testDb.timetableDao)
- timetableRemote = TimetableRemote(mockApi)
-
- every { semesterMock.studentId } returns 1
- every { semesterMock.diaryId } returns 2
- }
-
- @After
- fun closeDb() {
- testDb.close()
- }
-
- @Test
- fun copyDetailsToCompletedFromPrevious() {
- timetableLocal.saveTimetable(listOf(
- createTimetableLocal(1, of(2019, 3, 5, 8, 0), "123", "Przyroda"),
- createTimetableLocal(1, of(2019, 3, 5, 8, 50), "321", "Religia"),
- createTimetableLocal(1, of(2019, 3, 5, 9, 40), "213", "W-F")
- ))
-
- every { mockApi.getTimetable(any(), any()) } returns Single.just(listOf(
- createTimetableRemote(1, of(2019, 3, 5, 8, 0), "", "Przyroda"),
- createTimetableRemote(1, of(2019, 3, 5, 8, 50), "", "Religia"),
- createTimetableRemote(1, of(2019, 3, 5, 9, 40), "", "W-F")
- ))
-
- val lessons = TimetableRepository(settings, timetableLocal, timetableRemote)
- .getTimetable(semesterMock, LocalDate.of(2019, 3, 5), LocalDate.of(2019, 3, 5), true)
- .blockingGet()
-
- assertEquals(3, lessons.size)
- assertEquals("123", lessons[0].room)
- assertEquals("321", lessons[1].room)
- assertEquals("213", lessons[2].room)
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/utils/security/ScramblerTest.java b/app/src/androidTest/java/io/github/wulkanowy/utils/security/ScramblerTest.java
new file mode 100644
index 000000000..2fd1904ba
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/utils/security/ScramblerTest.java
@@ -0,0 +1,25 @@
+package io.github.wulkanowy.utils.security;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SdkSuppress;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class ScramblerTest {
+
+ @Test
+ @SdkSuppress(minSdkVersion = 18)
+ public void encryptDecryptTest() throws Exception {
+ Context targetContext = InstrumentationRegistry.getTargetContext();
+
+ Assert.assertEquals("PASS", Scrambler.decrypt("TEST",
+ Scrambler.encrypt("TEST", "PASS", targetContext)));
+ }
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/io/github/wulkanowy/utils/security/ScramblerTest.kt b/app/src/androidTest/java/io/github/wulkanowy/utils/security/ScramblerTest.kt
deleted file mode 100644
index 0c47e6bb6..000000000
--- a/app/src/androidTest/java/io/github/wulkanowy/utils/security/ScramblerTest.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package io.github.wulkanowy.utils.security
-
-import androidx.test.core.app.ApplicationProvider
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.SdkSuppress
-import androidx.test.filters.SmallTest
-import org.junit.Test
-import org.junit.runner.RunWith
-import java.security.KeyStore
-import kotlin.test.assertEquals
-import kotlin.test.assertFailsWith
-
-@SmallTest
-@RunWith(AndroidJUnit4::class)
-class ScramblerTest {
-
- @Test
- fun encryptDecryptTest() {
- assertEquals("TEST", decrypt(encrypt("TEST",
- ApplicationProvider.getApplicationContext())))
- }
-
- @Test
- fun emptyTextEncryptTest() {
- assertFailsWith {
- decrypt("")
- }
-
- assertFailsWith {
- encrypt("", ApplicationProvider.getApplicationContext())
- }
- }
-
- @Test
- @SdkSuppress(minSdkVersion = 18)
- fun emptyKeyStoreTest() {
- val text = encrypt("test", ApplicationProvider.getApplicationContext())
-
- val keyStore = KeyStore.getInstance("AndroidKeyStore")
- keyStore.load(null)
- keyStore.deleteEntry("wulkanowy_password")
-
- assertFailsWith {
- decrypt(text)
- }
- }
-}
diff --git a/app/src/debug/google-services.json b/app/src/debug/google-services.json
deleted file mode 100644
index e9303986b..000000000
--- a/app/src/debug/google-services.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "project_info": {
- "project_number": "",
- "firebase_url": "",
- "project_id": "",
- "storage_bucket": ""
- },
- "client": [
- {
- "client_info": {
- "mobilesdk_app_id": "1:1091101852179:android:b558a25f65d088b1",
- "android_client_info": {
- "package_name": "io.github.wulkanowy.dev"
- }
- },
- "oauth_client": [
- {
- "client_id": "",
- "client_type": 3
- }
- ],
- "api_key": [
- {
- "current_key": ""
- }
- ],
- "services": {
- "analytics_service": {
- "status": 1
- },
- "appinvite_service": {
- "status": 1,
- "other_platform_oauth_client": []
- },
- "ads_service": {
- "status": 2
- }
- }
- }
- ],
- "configuration_version": "1"
-}
diff --git a/app/src/debug/google-services.json.gpg b/app/src/debug/google-services.json.gpg
deleted file mode 100644
index 736f7906d..000000000
Binary files a/app/src/debug/google-services.json.gpg and /dev/null differ
diff --git a/app/src/debug/res/drawable/ic_launcher_foreground.xml b/app/src/debug/res/drawable/ic_launcher_foreground.xml
deleted file mode 100644
index 6be799094..000000000
--- a/app/src/debug/res/drawable/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100644
index 7353dbd1f..000000000
--- a/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index 7353dbd1f..000000000
--- a/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/debug/res/mipmap-hdpi/ic_launcher.png b/app/src/debug/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index 5b688d7cb..000000000
Binary files a/app/src/debug/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png
deleted file mode 100644
index 81e723ecc..000000000
Binary files a/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/src/debug/res/mipmap-mdpi/ic_launcher.png b/app/src/debug/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index 48b13240c..000000000
Binary files a/app/src/debug/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png
deleted file mode 100644
index 394b57076..000000000
Binary files a/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/src/debug/res/mipmap-xhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index ff8bfa3e9..000000000
Binary files a/app/src/debug/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png
deleted file mode 100644
index 365b4d663..000000000
Binary files a/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 96be1ed4f..000000000
Binary files a/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png
deleted file mode 100644
index 463c089b3..000000000
Binary files a/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index 57c7416f1..000000000
Binary files a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted file mode 100644
index 53d6f5bbd..000000000
Binary files a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/src/debug/res/values/ic_launcher_background.xml b/app/src/debug/res/values/ic_launcher_background.xml
deleted file mode 100644
index 9646c0b4e..000000000
--- a/app/src/debug/res/values/ic_launcher_background.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- #D32F2F
-
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0c6edab46..f1733681e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,78 +1,54 @@
-
+ android:installLocation="internalOnly">
-
+ android:supportsRtl="true"
+ android:theme="@style/WulkanowyTheme">
+ android:name=".ui.splash.SplashActivity"
+ android:configChanges="orientation|screenSize"
+ android:noHistory="true"
+ android:theme="@style/WulkanowyTheme.SplashTheme">
+
-
+ android:label="@string/activity_dashboard_text" />
-
-
+ android:name=".services.SyncJob"
+ android:exported="false">
-
+
-
-
-
-
+
-
+ android:value="${fabricApiKey}" />
+
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 000000000..7cad5c2f4
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/io/github/wulkanowy/WulkanowyApp.java b/app/src/main/java/io/github/wulkanowy/WulkanowyApp.java
new file mode 100644
index 000000000..4b8866ce2
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/WulkanowyApp.java
@@ -0,0 +1,59 @@
+package io.github.wulkanowy;
+
+import android.app.Application;
+
+import com.crashlytics.android.Crashlytics;
+import com.crashlytics.android.core.CrashlyticsCore;
+
+import org.greenrobot.greendao.query.QueryBuilder;
+
+import javax.inject.Inject;
+
+import eu.davidea.flexibleadapter.FlexibleAdapter;
+import eu.davidea.flexibleadapter.utils.Log;
+import io.fabric.sdk.android.Fabric;
+import io.github.wulkanowy.data.RepositoryContract;
+import io.github.wulkanowy.di.component.ApplicationComponent;
+import io.github.wulkanowy.di.component.DaggerApplicationComponent;
+import io.github.wulkanowy.di.modules.ApplicationModule;
+
+public class WulkanowyApp extends Application {
+
+ protected ApplicationComponent applicationComponent;
+
+ @Inject
+ RepositoryContract repository;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ applicationComponent = DaggerApplicationComponent
+ .builder()
+ .applicationModule(new ApplicationModule(this))
+ .build();
+ applicationComponent.inject(this);
+
+ if (BuildConfig.DEBUG) {
+ enableDebugLog();
+ }
+ initializeFabric();
+ }
+
+ private void enableDebugLog() {
+ QueryBuilder.LOG_VALUES = true;
+ FlexibleAdapter.enableLogs(Log.Level.DEBUG);
+ }
+
+ private void initializeFabric() {
+ Fabric.with(new Fabric.Builder(this)
+ .kits(new Crashlytics.Builder()
+ .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
+ .build())
+ .debuggable(BuildConfig.DEBUG)
+ .build());
+ }
+
+ public ApplicationComponent getApplicationComponent() {
+ return applicationComponent;
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/WulkanowyApp.kt b/app/src/main/java/io/github/wulkanowy/WulkanowyApp.kt
deleted file mode 100644
index e427647f6..000000000
--- a/app/src/main/java/io/github/wulkanowy/WulkanowyApp.kt
+++ /dev/null
@@ -1,73 +0,0 @@
-package io.github.wulkanowy
-
-import android.content.Context
-import androidx.appcompat.app.AppCompatDelegate
-import androidx.multidex.MultiDex
-import androidx.work.Configuration
-import androidx.work.WorkManager
-import com.crashlytics.android.Crashlytics
-import com.crashlytics.android.core.CrashlyticsCore
-import com.jakewharton.threetenabp.AndroidThreeTen
-import dagger.android.AndroidInjector
-import dagger.android.support.DaggerApplication
-import eu.davidea.flexibleadapter.FlexibleAdapter
-import eu.davidea.flexibleadapter.utils.Log
-import io.fabric.sdk.android.Fabric
-import io.github.wulkanowy.BuildConfig.DEBUG
-import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
-import io.github.wulkanowy.di.DaggerAppComponent
-import io.github.wulkanowy.services.sync.SyncWorkerFactory
-import io.github.wulkanowy.utils.CrashlyticsTree
-import io.github.wulkanowy.utils.DebugLogTree
-import io.reactivex.exceptions.UndeliverableException
-import io.reactivex.plugins.RxJavaPlugins
-import timber.log.Timber
-import java.io.IOException
-import java.lang.Exception
-import javax.inject.Inject
-
-class WulkanowyApp : DaggerApplication() {
-
- @Inject
- lateinit var prefRepository: PreferencesRepository
-
- @Inject
- lateinit var workerFactory: SyncWorkerFactory
-
- override fun attachBaseContext(base: Context?) {
- super.attachBaseContext(base)
- MultiDex.install(this)
- }
-
- override fun onCreate() {
- super.onCreate()
- AndroidThreeTen.init(this)
- initializeFabric()
- if (DEBUG) enableDebugLog()
- AppCompatDelegate.setDefaultNightMode(prefRepository.currentTheme)
- WorkManager.initialize(this, Configuration.Builder().setWorkerFactory(workerFactory).build())
- RxJavaPlugins.setErrorHandler(::onError)
- }
-
- private fun enableDebugLog() {
- Timber.plant(DebugLogTree())
- FlexibleAdapter.enableLogs(Log.Level.DEBUG)
- }
-
- private fun initializeFabric() {
- Fabric.with(Fabric.Builder(this).kits(
- Crashlytics.Builder().core(CrashlyticsCore.Builder().disabled(!BuildConfig.CRASHLYTICS_ENABLED).build()).build()
- ).debuggable(BuildConfig.DEBUG).build())
- Timber.plant(CrashlyticsTree())
- }
-
- private fun onError(t: Throwable) {
- if (t is UndeliverableException && t.cause is IOException || t.cause is InterruptedException) {
- Timber.e(t.cause, "An undeliverable error occurred")
- } else throw t
- }
-
- override fun applicationInjector(): AndroidInjector {
- return DaggerAppComponent.builder().create(this)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/ApiHelper.kt b/app/src/main/java/io/github/wulkanowy/data/ApiHelper.kt
deleted file mode 100644
index b6eee316b..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/ApiHelper.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package io.github.wulkanowy.data
-
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.entities.Student
-import java.net.URL
-import javax.inject.Inject
-
-class ApiHelper @Inject constructor(private val api: Api) {
-
- fun initApi(student: Student) {
- api.apply {
- email = student.email
- password = student.password
- symbol = student.symbol
- schoolSymbol = student.schoolSymbol
- studentId = student.studentId
- classId = student.classId
- host = URL(student.endpoint).run { host + ":$port".removeSuffix(":-1") }
- ssl = student.endpoint.startsWith("https")
- loginType = Api.LoginType.valueOf(student.loginType)
- useNewStudent = true
- }
- }
-
- fun initApi(email: String, password: String, symbol: String, endpoint: String) {
- api.apply {
- this.email = email
- this.password = password
- this.symbol = symbol
- host = URL(endpoint).run { host + ":$port".removeSuffix(":-1") }
- ssl = endpoint.startsWith("https")
- useNewStudent = true
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/Repository.java b/app/src/main/java/io/github/wulkanowy/data/Repository.java
new file mode 100644
index 000000000..d25be8b5e
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/Repository.java
@@ -0,0 +1,159 @@
+package io.github.wulkanowy.data;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import io.github.wulkanowy.api.VulcanException;
+import io.github.wulkanowy.data.db.dao.entities.Account;
+import io.github.wulkanowy.data.db.dao.entities.AttendanceLesson;
+import io.github.wulkanowy.data.db.dao.entities.DaoSession;
+import io.github.wulkanowy.data.db.dao.entities.Grade;
+import io.github.wulkanowy.data.db.dao.entities.GradeDao;
+import io.github.wulkanowy.data.db.dao.entities.Week;
+import io.github.wulkanowy.data.db.dao.entities.WeekDao;
+import io.github.wulkanowy.data.db.resources.ResourcesContract;
+import io.github.wulkanowy.data.db.shared.SharedPrefContract;
+import io.github.wulkanowy.data.sync.SyncContract;
+import io.github.wulkanowy.data.sync.account.AccountSyncContract;
+import io.github.wulkanowy.data.sync.attendance.AttendanceSyncContract;
+import io.github.wulkanowy.data.sync.timetable.TimetableSyncContract;
+import io.github.wulkanowy.di.annotations.SyncGrades;
+import io.github.wulkanowy.di.annotations.SyncSubjects;
+import io.github.wulkanowy.utils.security.CryptoException;
+
+@Singleton
+public class Repository implements RepositoryContract {
+
+ private final SharedPrefContract sharedPref;
+
+ private final ResourcesContract resources;
+
+ private final DaoSession daoSession;
+
+ private final AccountSyncContract accountSync;
+
+ private final AttendanceSyncContract attendanceSync;
+
+ private final TimetableSyncContract timetableSync;
+
+ private final SyncContract gradeSync;
+
+ private final SyncContract subjectSync;
+
+ @Inject
+ Repository(SharedPrefContract sharedPref,
+ ResourcesContract resources,
+ DaoSession daoSession,
+ AccountSyncContract accountSync,
+ AttendanceSyncContract attendanceSync,
+ TimetableSyncContract timetableSync,
+ @SyncGrades SyncContract gradeSync,
+ @SyncSubjects SyncContract subjectSync) {
+ this.sharedPref = sharedPref;
+ this.resources = resources;
+ this.daoSession = daoSession;
+ this.accountSync = accountSync;
+ this.attendanceSync = attendanceSync;
+ this.timetableSync = timetableSync;
+ this.gradeSync = gradeSync;
+ this.subjectSync = subjectSync;
+ }
+
+ @Override
+ public long getCurrentUserId() {
+ return sharedPref.getCurrentUserId();
+ }
+
+ @Override
+ public String[] getSymbolsKeysArray() {
+ return resources.getSymbolsKeysArray();
+ }
+
+ @Override
+ public String[] getSymbolsValuesArray() {
+ return resources.getSymbolsValuesArray();
+ }
+
+ @Override
+ public String getErrorLoginMessage(Exception e) {
+ return resources.getErrorLoginMessage(e);
+ }
+
+ @Override
+ public String getAttendanceLessonDescription(AttendanceLesson lesson) {
+ return resources.getAttendanceLessonDescription(lesson);
+ }
+
+ @Override
+ public void registerUser(String email, String password, String symbol) throws VulcanException,
+ IOException, CryptoException {
+ accountSync.registerUser(email, password, symbol);
+ }
+
+ @Override
+ public void initLastUser() throws VulcanException, IOException, CryptoException {
+ accountSync.initLastUser();
+ }
+
+ @Override
+ public void syncGrades() throws VulcanException, IOException, ParseException {
+ gradeSync.sync();
+ }
+
+ @Override
+ public void syncSubjects() throws VulcanException, IOException, ParseException {
+ subjectSync.sync();
+ }
+
+ @Override
+ public void syncAttendance() throws ParseException, IOException, VulcanException {
+ attendanceSync.syncAttendance();
+ }
+
+ @Override
+ public void syncAttendance(String date) throws ParseException, IOException, VulcanException {
+ attendanceSync.syncAttendance(date);
+ }
+
+ @Override
+ public void syncTimetable() throws VulcanException, IOException, ParseException {
+ timetableSync.syncTimetable();
+ }
+
+ @Override
+ public void syncTimetable(String date) throws VulcanException, IOException, ParseException {
+ timetableSync.syncTimetable(date);
+ }
+
+ @Override
+ public void syncAll() throws VulcanException, IOException, ParseException {
+ syncSubjects();
+ syncGrades();
+ syncAttendance();
+ syncTimetable();
+ }
+
+ @Override
+ public Account getCurrentUser() {
+ return daoSession.getAccountDao().load(sharedPref.getCurrentUserId());
+ }
+
+ @Override
+ public Week getWeek(String date) {
+ return daoSession.getWeekDao().queryBuilder()
+ .where(WeekDao.Properties.StartDayDate.eq(date),
+ WeekDao.Properties.UserId.eq(getCurrentUserId()))
+ .unique();
+ }
+
+ @Override
+ public List getNewGrades() {
+ return daoSession.getGradeDao().queryBuilder()
+ .where(GradeDao.Properties.IsNew.eq(1))
+ .list();
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/RepositoryContract.java b/app/src/main/java/io/github/wulkanowy/data/RepositoryContract.java
new file mode 100644
index 000000000..f06c47620
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/RepositoryContract.java
@@ -0,0 +1,35 @@
+package io.github.wulkanowy.data;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.List;
+
+import javax.inject.Singleton;
+
+import io.github.wulkanowy.api.VulcanException;
+import io.github.wulkanowy.data.db.dao.entities.Account;
+import io.github.wulkanowy.data.db.dao.entities.Grade;
+import io.github.wulkanowy.data.db.dao.entities.Week;
+import io.github.wulkanowy.data.db.resources.ResourcesContract;
+import io.github.wulkanowy.data.sync.account.AccountSyncContract;
+import io.github.wulkanowy.data.sync.attendance.AttendanceSyncContract;
+import io.github.wulkanowy.data.sync.timetable.TimetableSyncContract;
+
+@Singleton
+public interface RepositoryContract extends ResourcesContract, AccountSyncContract,
+ AttendanceSyncContract, TimetableSyncContract {
+
+ long getCurrentUserId();
+
+ void syncGrades() throws VulcanException, IOException, ParseException;
+
+ void syncSubjects() throws VulcanException, IOException, ParseException;
+
+ void syncAll() throws VulcanException, IOException, ParseException;
+
+ Account getCurrentUser();
+
+ Week getWeek(String date);
+
+ List getNewGrades();
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt b/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt
deleted file mode 100644
index c832368a5..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt
+++ /dev/null
@@ -1,135 +0,0 @@
-package io.github.wulkanowy.data
-
-import android.content.Context
-import android.content.SharedPreferences
-import android.content.res.Resources
-import androidx.preference.PreferenceManager
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy
-import com.readystatesoftware.chuck.api.ChuckCollector
-import com.readystatesoftware.chuck.api.ChuckInterceptor
-import com.readystatesoftware.chuck.api.RetentionManager
-import dagger.Module
-import dagger.Provides
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.AppDatabase
-import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
-import okhttp3.logging.HttpLoggingInterceptor
-import okhttp3.logging.HttpLoggingInterceptor.Level.BASIC
-import okhttp3.logging.HttpLoggingInterceptor.Level.NONE
-import timber.log.Timber
-import javax.inject.Singleton
-
-@Module
-internal class RepositoryModule {
-
- @Singleton
- @Provides
- fun provideInternetObservingSettings(): InternetObservingSettings {
- return InternetObservingSettings.builder()
- .strategy(WalledGardenInternetObservingStrategy())
- .build()
- }
-
- @Singleton
- @Provides
- fun provideApi(chuckCollector: ChuckCollector, context: Context): Api {
- return Api().apply {
- logLevel = NONE
- androidVersion = android.os.Build.VERSION.RELEASE
- buildTag = android.os.Build.MODEL
- setInterceptor(HttpLoggingInterceptor(HttpLoggingInterceptor.Logger { Timber.d(it) }).setLevel(BASIC))
-
- // for debug only
- setInterceptor(ChuckInterceptor(context, chuckCollector).maxContentLength(250000L), true, 0)
- }
- }
-
- @Singleton
- @Provides
- fun provideChuckCollector(context: Context, prefRepository: PreferencesRepository): ChuckCollector {
- return ChuckCollector(context)
- .showNotification(prefRepository.isDebugNotificationEnable)
- .retentionManager(RetentionManager(context, ChuckCollector.Period.ONE_HOUR))
- }
-
- @Singleton
- @Provides
- fun provideDatabase(context: Context) = AppDatabase.newInstance(context)
-
- @Singleton
- @Provides
- fun provideResources(context: Context): Resources = context.resources
-
- @Singleton
- @Provides
- fun provideSharedPref(context: Context): SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
-
- @Singleton
- @Provides
- fun provideStudentDao(database: AppDatabase) = database.studentDao
-
- @Singleton
- @Provides
- fun provideSemesterDao(database: AppDatabase) = database.semesterDao
-
- @Singleton
- @Provides
- fun provideGradeDao(database: AppDatabase) = database.gradeDao
-
- @Singleton
- @Provides
- fun provideGradeSummaryDao(database: AppDatabase) = database.gradeSummaryDao
-
- @Singleton
- @Provides
- fun provideGradeStatisticsDao(database: AppDatabase) = database.gradeStatistics
-
- @Singleton
- @Provides
- fun provideMessagesDao(database: AppDatabase) = database.messagesDao
-
- @Singleton
- @Provides
- fun provideExamDao(database: AppDatabase) = database.examsDao
-
- @Singleton
- @Provides
- fun provideAttendanceDao(database: AppDatabase) = database.attendanceDao
-
- @Singleton
- @Provides
- fun provideAttendanceSummaryDao(database: AppDatabase) = database.attendanceSummaryDao
-
- @Singleton
- @Provides
- fun provideTimetableDao(database: AppDatabase) = database.timetableDao
-
- @Singleton
- @Provides
- fun provideNoteDao(database: AppDatabase) = database.noteDao
-
- @Singleton
- @Provides
- fun provideHomeworkDao(database: AppDatabase) = database.homeworkDao
-
- @Singleton
- @Provides
- fun provideSubjectDao(database: AppDatabase) = database.subjectDao
-
- @Singleton
- @Provides
- fun provideLuckyNumberDao(database: AppDatabase) = database.luckyNumberDao
-
- @Singleton
- @Provides
- fun provideCompletedLessonsDao(database: AppDatabase) = database.completedLessonsDao
-
- @Singleton
- @Provides
- fun provideReportingUnitDao(database: AppDatabase) = database.reportingUnitDao
-
- @Singleton
- @Provides
- fun provideRecipientDao(database: AppDatabase) = database.recipientDao
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/AppDatabase.kt b/app/src/main/java/io/github/wulkanowy/data/db/AppDatabase.kt
deleted file mode 100644
index 9ce62b187..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/AppDatabase.kt
+++ /dev/null
@@ -1,141 +0,0 @@
-package io.github.wulkanowy.data.db
-
-import android.content.Context
-import androidx.room.Database
-import androidx.room.Room
-import androidx.room.RoomDatabase
-import androidx.room.RoomDatabase.JournalMode.TRUNCATE
-import androidx.room.TypeConverters
-import io.github.wulkanowy.data.db.dao.AttendanceDao
-import io.github.wulkanowy.data.db.dao.AttendanceSummaryDao
-import io.github.wulkanowy.data.db.dao.CompletedLessonsDao
-import io.github.wulkanowy.data.db.dao.ExamDao
-import io.github.wulkanowy.data.db.dao.GradeDao
-import io.github.wulkanowy.data.db.dao.GradeStatisticsDao
-import io.github.wulkanowy.data.db.dao.GradeSummaryDao
-import io.github.wulkanowy.data.db.dao.HomeworkDao
-import io.github.wulkanowy.data.db.dao.LuckyNumberDao
-import io.github.wulkanowy.data.db.dao.MessagesDao
-import io.github.wulkanowy.data.db.dao.NoteDao
-import io.github.wulkanowy.data.db.dao.RecipientDao
-import io.github.wulkanowy.data.db.dao.ReportingUnitDao
-import io.github.wulkanowy.data.db.dao.SemesterDao
-import io.github.wulkanowy.data.db.dao.StudentDao
-import io.github.wulkanowy.data.db.dao.SubjectDao
-import io.github.wulkanowy.data.db.dao.TimetableDao
-import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.data.db.entities.AttendanceSummary
-import io.github.wulkanowy.data.db.entities.CompletedLesson
-import io.github.wulkanowy.data.db.entities.Exam
-import io.github.wulkanowy.data.db.entities.Grade
-import io.github.wulkanowy.data.db.entities.GradeStatistics
-import io.github.wulkanowy.data.db.entities.GradeSummary
-import io.github.wulkanowy.data.db.entities.Homework
-import io.github.wulkanowy.data.db.entities.LuckyNumber
-import io.github.wulkanowy.data.db.entities.Message
-import io.github.wulkanowy.data.db.entities.Note
-import io.github.wulkanowy.data.db.entities.Recipient
-import io.github.wulkanowy.data.db.entities.ReportingUnit
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.db.entities.Subject
-import io.github.wulkanowy.data.db.entities.Timetable
-import io.github.wulkanowy.data.db.migrations.Migration10
-import io.github.wulkanowy.data.db.migrations.Migration11
-import io.github.wulkanowy.data.db.migrations.Migration12
-import io.github.wulkanowy.data.db.migrations.Migration2
-import io.github.wulkanowy.data.db.migrations.Migration3
-import io.github.wulkanowy.data.db.migrations.Migration4
-import io.github.wulkanowy.data.db.migrations.Migration5
-import io.github.wulkanowy.data.db.migrations.Migration6
-import io.github.wulkanowy.data.db.migrations.Migration7
-import io.github.wulkanowy.data.db.migrations.Migration8
-import io.github.wulkanowy.data.db.migrations.Migration9
-import javax.inject.Singleton
-
-@Singleton
-@Database(
- entities = [
- Student::class,
- Semester::class,
- Exam::class,
- Timetable::class,
- Attendance::class,
- AttendanceSummary::class,
- Grade::class,
- GradeSummary::class,
- GradeStatistics::class,
- Message::class,
- Note::class,
- Homework::class,
- Subject::class,
- LuckyNumber::class,
- CompletedLesson::class,
- ReportingUnit::class,
- Recipient::class
- ],
- version = AppDatabase.VERSION_SCHEMA,
- exportSchema = true
-)
-@TypeConverters(Converters::class)
-abstract class AppDatabase : RoomDatabase() {
-
- companion object {
- const val VERSION_SCHEMA = 12
-
- fun newInstance(context: Context): AppDatabase {
- return Room.databaseBuilder(context, AppDatabase::class.java, "wulkanowy_database")
- .setJournalMode(TRUNCATE)
- .fallbackToDestructiveMigrationFrom(VERSION_SCHEMA + 1)
- .fallbackToDestructiveMigrationOnDowngrade()
- .addMigrations(
- Migration2(),
- Migration3(),
- Migration4(),
- Migration5(),
- Migration6(),
- Migration7(),
- Migration8(),
- Migration9(),
- Migration10(),
- Migration11(),
- Migration12()
- )
- .build()
- }
- }
-
- abstract val studentDao: StudentDao
-
- abstract val semesterDao: SemesterDao
-
- abstract val examsDao: ExamDao
-
- abstract val timetableDao: TimetableDao
-
- abstract val attendanceDao: AttendanceDao
-
- abstract val attendanceSummaryDao: AttendanceSummaryDao
-
- abstract val gradeDao: GradeDao
-
- abstract val gradeSummaryDao: GradeSummaryDao
-
- abstract val gradeStatistics: GradeStatisticsDao
-
- abstract val messagesDao: MessagesDao
-
- abstract val noteDao: NoteDao
-
- abstract val homeworkDao: HomeworkDao
-
- abstract val subjectDao: SubjectDao
-
- abstract val luckyNumberDao: LuckyNumberDao
-
- abstract val completedLessonsDao: CompletedLessonsDao
-
- abstract val reportingUnitDao: ReportingUnitDao
-
- abstract val recipientDao: RecipientDao
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/Converters.kt b/app/src/main/java/io/github/wulkanowy/data/db/Converters.kt
deleted file mode 100644
index 73a04d236..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/Converters.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-package io.github.wulkanowy.data.db
-
-import androidx.room.TypeConverter
-import com.google.gson.Gson
-import com.google.gson.reflect.TypeToken
-import org.threeten.bp.DateTimeUtils
-import org.threeten.bp.Instant
-import org.threeten.bp.LocalDate
-import org.threeten.bp.LocalDateTime
-import org.threeten.bp.Month
-import org.threeten.bp.ZoneOffset
-import java.util.Date
-
-class Converters {
-
- @TypeConverter
- fun timestampToDate(value: Long?): LocalDate? = value?.run {
- DateTimeUtils.toInstant(Date(value)).atZone(ZoneOffset.UTC).toLocalDate()
- }
-
- @TypeConverter
- fun dateToTimestamp(date: LocalDate?): Long? {
- return date?.atStartOfDay()?.toInstant(ZoneOffset.UTC)?.toEpochMilli()
- }
-
- @TypeConverter
- fun timestampToTime(value: Long?): LocalDateTime? = value?.let {
- LocalDateTime.ofInstant(Instant.ofEpochMilli(value), ZoneOffset.UTC)
- }
-
- @TypeConverter
- fun timeToTimestamp(date: LocalDateTime?): Long? {
- return date?.atZone(ZoneOffset.UTC)?.toInstant()?.toEpochMilli()
- }
-
- @TypeConverter
- fun monthToInt(month: Month?) = month?.value
-
- @TypeConverter
- fun intToMonth(value: Int?) = value?.let { Month.of(it) }
-
- @TypeConverter
- fun intListToGson(list: List): String {
- return Gson().toJson(list)
- }
-
- @TypeConverter
- fun gsonToIntList(value: String): List {
- return Gson().fromJson(value, object : TypeToken>() {}.type)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefHelper.kt b/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefHelper.kt
deleted file mode 100644
index b3b6f5e3e..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefHelper.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.wulkanowy.data.db
-
-import android.annotation.SuppressLint
-import android.content.SharedPreferences
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class SharedPrefHelper @Inject constructor(private val sharedPref: SharedPreferences) {
-
- @SuppressLint("ApplySharedPref")
- fun putLong(key: String, value: Long, sync: Boolean = false) {
- sharedPref.edit().putLong(key, value).apply {
- if (sync) commit() else apply()
- }
- }
-
- fun getLong(key: String, defaultValue: Long): Long {
- return sharedPref.getLong(key, defaultValue)
- }
-
- fun delete(key: String) {
- sharedPref.edit().remove(key).apply()
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceDao.kt
deleted file mode 100644
index d3c4f146f..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceDao.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.Attendance
-import io.reactivex.Maybe
-import org.threeten.bp.LocalDate
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface AttendanceDao {
-
- @Insert
- fun insertAll(exams: List): List
-
- @Delete
- fun deleteAll(exams: List)
-
- @Query("SELECT * FROM Attendance WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
- fun loadAll(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceSummaryDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceSummaryDao.kt
deleted file mode 100644
index a7413de56..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/AttendanceSummaryDao.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.AttendanceSummary
-import io.reactivex.Maybe
-
-@Dao
-interface AttendanceSummaryDao {
-
- @Insert
- fun insertAll(exams: List): List
-
- @Delete
- fun deleteAll(exams: List)
-
- @Query("SELECT * FROM AttendanceSummary WHERE diary_id = :diaryId AND student_id = :studentId AND subject_id = :subjectId")
- fun loadAll(diaryId: Int, studentId: Int, subjectId: Int): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/CompletedLessonsDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/CompletedLessonsDao.kt
deleted file mode 100644
index 6816ceaaf..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/CompletedLessonsDao.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.CompletedLesson
-import io.reactivex.Maybe
-import org.threeten.bp.LocalDate
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface CompletedLessonsDao {
-
- @Insert
- fun insertAll(exams: List)
-
- @Delete
- fun deleteAll(exams: List)
-
- @Query("SELECT * FROM CompletedLesson WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
- fun loadAll(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/DbHelper.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/DbHelper.java
new file mode 100644
index 000000000..a67e9b7f5
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/DbHelper.java
@@ -0,0 +1,61 @@
+package io.github.wulkanowy.data.db.dao;
+
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+
+import com.github.yuweiguocn.library.greendao.MigrationHelper;
+
+import org.greenrobot.greendao.database.Database;
+import org.greenrobot.greendao.database.StandardDatabase;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import io.github.wulkanowy.BuildConfig;
+import io.github.wulkanowy.data.db.dao.entities.AccountDao;
+import io.github.wulkanowy.data.db.dao.entities.DaoMaster;
+import io.github.wulkanowy.data.db.dao.entities.GradeDao;
+import io.github.wulkanowy.data.db.dao.entities.SubjectDao;
+import io.github.wulkanowy.data.db.shared.SharedPrefContract;
+import io.github.wulkanowy.di.annotations.ApplicationContext;
+import io.github.wulkanowy.di.annotations.DatabaseInfo;
+import io.github.wulkanowy.utils.LogUtils;
+
+@Singleton
+public class DbHelper extends DaoMaster.OpenHelper {
+
+ private SharedPrefContract sharedPref;
+
+ @Inject
+ DbHelper(@ApplicationContext Context context, @DatabaseInfo String dbName,
+ SharedPrefContract sharedPref) {
+ super(context, dbName);
+ this.sharedPref = sharedPref;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void onUpgrade(Database db, int oldVersion, int newVersion) {
+ MigrationHelper.DEBUG = BuildConfig.DEBUG;
+ MigrationHelper.migrate(db, new MigrationHelper.ReCreateAllTableListener() {
+ @Override
+ public void onCreateAllTables(Database db, boolean ifNotExists) {
+ DaoMaster.createAllTables(db, ifNotExists);
+ }
+ @Override
+ public void onDropAllTables(Database db, boolean ifExists) {
+ DaoMaster.dropAllTables(db, ifExists);
+ }
+ }, AccountDao.class, SubjectDao.class, GradeDao.class);
+ }
+
+ @Override
+ public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ Database database = new StandardDatabase(db);
+ DaoMaster.dropAllTables(database, true);
+ onCreate(database);
+ sharedPref.setCurrentUserId(0);
+
+ LogUtils.info("Cleaning user data oldVersion=" + oldVersion + " newVersion=" + newVersion);
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/ExamDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/ExamDao.kt
deleted file mode 100644
index 06cd56135..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/ExamDao.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.Exam
-import io.reactivex.Maybe
-import org.threeten.bp.LocalDate
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface ExamDao {
-
- @Insert
- fun insertAll(exams: List): List
-
- @Delete
- fun deleteAll(exams: List)
-
- @Query("SELECT * FROM Exams WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
- fun loadAll(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeDao.kt
deleted file mode 100644
index 0bd210b02..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeDao.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import androidx.room.Update
-import io.github.wulkanowy.data.db.entities.Grade
-import io.reactivex.Maybe
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface GradeDao {
-
- @Insert
- fun insertAll(grades: List)
-
- @Update
- fun updateAll(grade: List)
-
- @Delete
- fun deleteAll(grades: List)
-
- @Query("SELECT * FROM Grades WHERE semester_id = :semesterId AND student_id = :studentId")
- fun loadAll(semesterId: Int, studentId: Int): Maybe>
-
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeStatisticsDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeStatisticsDao.kt
deleted file mode 100644
index 338c369fa..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeStatisticsDao.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.GradeStatistics
-import io.reactivex.Maybe
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface GradeStatisticsDao {
-
- @Insert
- fun insertAll(gradesStatistics: List)
-
- @Delete
- fun deleteAll(gradesStatistics: List)
-
- @Query("SELECT * FROM GradesStatistics WHERE student_id = :studentId AND semester_id = :semesterId AND subject = :subjectName AND is_semester = :isSemester")
- fun loadSubject(semesterId: Int, studentId: Int, subjectName: String, isSemester: Boolean): Maybe>
-
- @Query("SELECT * FROM GradesStatistics WHERE student_id = :studentId AND semester_id = :semesterId AND is_semester = :isSemester")
- fun loadAll(semesterId: Int, studentId: Int, isSemester: Boolean): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeSummaryDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeSummaryDao.kt
deleted file mode 100644
index 3f2e87bd0..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeSummaryDao.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.GradeSummary
-import io.reactivex.Maybe
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface GradeSummaryDao {
-
- @Insert
- fun insertAll(gradesSummary: List)
-
- @Delete
- fun deleteAll(gradesSummary: List)
-
- @Query("SELECT * FROM GradesSummary WHERE student_id = :studentId AND semester_id = :semesterId")
- fun loadAll(semesterId: Int, studentId: Int): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/HomeworkDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/HomeworkDao.kt
deleted file mode 100644
index 253bdb11f..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/HomeworkDao.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.Homework
-import io.reactivex.Maybe
-import org.threeten.bp.LocalDate
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface HomeworkDao {
-
- @Insert
- fun insertAll(homework: List)
-
- @Delete
- fun deleteAll(homework: List)
-
- @Query("SELECT * FROM Homework WHERE semester_id = :semesterId AND student_id = :studentId AND date >= :from AND date <= :end")
- fun loadAll(semesterId: Int, studentId: Int, from: LocalDate, end: LocalDate): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/LuckyNumberDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/LuckyNumberDao.kt
deleted file mode 100644
index afd7905c0..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/LuckyNumberDao.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import androidx.room.Update
-import io.github.wulkanowy.data.db.entities.LuckyNumber
-import io.reactivex.Maybe
-import org.threeten.bp.LocalDate
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface LuckyNumberDao {
-
- @Insert
- fun insert(luckyNumber: LuckyNumber)
-
- @Update
- fun update(luckyNumber: LuckyNumber)
-
- @Delete
- fun delete(luckyNumber: LuckyNumber)
-
- @Query("SELECT * FROM LuckyNumbers WHERE student_id = :studentId AND date = :date")
- fun load(studentId: Int, date: LocalDate): Maybe
-
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/MessagesDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/MessagesDao.kt
deleted file mode 100644
index 3ef5d6905..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/MessagesDao.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import androidx.room.Update
-import io.github.wulkanowy.data.db.entities.Message
-import io.reactivex.Maybe
-
-@Dao
-interface MessagesDao {
-
- @Insert
- fun insertAll(messages: List)
-
- @Delete
- fun deleteAll(messages: List)
-
- @Update
- fun updateAll(messages: List)
-
- @Query("SELECT * FROM Messages WHERE student_id = :studentId AND folder_id = :folder AND removed = 0 ORDER BY date DESC")
- fun loadAll(studentId: Int, folder: Int): Maybe>
-
- @Query("SELECT * FROM Messages WHERE student_id = :studentId AND real_id = :id")
- fun load(studentId: Int, id: Int): Maybe
-
- @Query("SELECT * FROM Messages WHERE student_id = :studentId AND removed = 1 ORDER BY date DESC")
- fun loadDeleted(studentId: Int): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/NoteDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/NoteDao.kt
deleted file mode 100644
index 867e06a25..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/NoteDao.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import androidx.room.Update
-import io.github.wulkanowy.data.db.entities.Note
-import io.reactivex.Maybe
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface NoteDao {
-
- @Insert
- fun insertAll(notes: List)
-
- @Update
- fun updateAll(notes: List)
-
- @Delete
- fun deleteAll(notes: List)
-
- @Query("SELECT * FROM Notes WHERE student_id = :studentId")
- fun loadAll(studentId: Int): Maybe>
-
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/RecipientDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/RecipientDao.kt
deleted file mode 100644
index 7c5fd6ca6..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/RecipientDao.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.Recipient
-import io.reactivex.Maybe
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface RecipientDao {
-
- @Insert
- fun insertAll(messages: List)
-
- @Delete
- fun deleteAll(messages: List)
-
- @Query("SELECT * FROM Recipients WHERE student_id = :studentId AND role = :role AND unit_id = :unitId")
- fun load(studentId: Int, role: Int, unitId: Int): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/ReportingUnitDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/ReportingUnitDao.kt
deleted file mode 100644
index 1898390a9..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/ReportingUnitDao.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.ReportingUnit
-import io.reactivex.Maybe
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface ReportingUnitDao {
-
- @Insert
- fun insertAll(reportingUnits: List)
-
- @Delete
- fun deleteAll(reportingUnits: List)
-
- @Query("SELECT * FROM ReportingUnits WHERE student_id = :studentId")
- fun load(studentId: Int): Maybe>
-
- @Query("SELECT * FROM ReportingUnits WHERE student_id = :studentId AND real_id = :unitId")
- fun loadOne(studentId: Int, unitId: Int): Maybe
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt
deleted file mode 100644
index 01841fb67..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Maybe
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface SemesterDao {
-
- @Insert
- fun insertAll(semester: List)
-
- @Delete
- fun deleteAll(semester: List)
-
- @Query("SELECT * FROM Semesters WHERE student_id = :studentId AND class_id = :classId")
- fun loadAll(studentId: Int, classId: Int): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt
deleted file mode 100644
index 8110bb696..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.OnConflictStrategy.ABORT
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.Student
-import io.reactivex.Maybe
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface StudentDao {
-
- @Insert(onConflict = ABORT)
- fun insert(student: Student): Long
-
- @Delete
- fun delete(student: Student)
-
- @Query("SELECT * FROM Students WHERE is_current = 1")
- fun loadCurrent(): Maybe
-
- @Query("SELECT * FROM Students")
- fun loadAll(): Maybe>
-
- @Query("UPDATE Students SET is_current = 1 WHERE id = :id")
- fun updateCurrent(id: Long)
-
- @Query("UPDATE Students SET is_current = 0")
- fun resetCurrent()
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/SubjectDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/SubjectDao.kt
deleted file mode 100644
index 725a371ab..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/SubjectDao.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.Subject
-import io.reactivex.Maybe
-
-@Dao
-interface SubjectDao {
-
- @Insert
- fun insertAll(subjects: List): List
-
- @Delete
- fun deleteAll(subjects: List)
-
- @Query("SELECT * FROM Subjects WHERE diary_id = :diaryId AND student_id = :studentId")
- fun loadAll(diaryId: Int, studentId: Int): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/TimetableDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/TimetableDao.kt
deleted file mode 100644
index abe213618..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/TimetableDao.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.Timetable
-import io.reactivex.Maybe
-import org.threeten.bp.LocalDate
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface TimetableDao {
-
- @Insert
- fun insertAll(exams: List): List
-
- @Delete
- fun deleteAll(exams: List)
-
- @Query("SELECT * FROM Timetable WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
- fun loadAll(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Account.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Account.java
new file mode 100644
index 000000000..20a47ac26
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Account.java
@@ -0,0 +1,258 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.DaoException;
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Generated;
+import org.greenrobot.greendao.annotation.Id;
+import org.greenrobot.greendao.annotation.Property;
+import org.greenrobot.greendao.annotation.ToMany;
+
+import java.util.List;
+
+@Entity(
+ nameInDb = "Accounts",
+ active = true
+)
+public class Account {
+
+ @Id(autoincrement = true)
+ private Long id;
+
+ @Property(nameInDb = "NAME")
+ private String name;
+
+ @Property(nameInDb = "E-MAIL")
+ private String email;
+
+ @Property(nameInDb = "PASSWORD")
+ private String password;
+
+ @Property(nameInDb = "SYMBOL")
+ private String symbol;
+
+ @Property(nameInDb = "SNPID")
+ private String snpId;
+
+ @ToMany(referencedJoinProperty = "userId")
+ private List subjectList;
+
+ @ToMany(referencedJoinProperty = "userId")
+ private List gradeList;
+
+ @ToMany(referencedJoinProperty = "userId")
+ private List dayList;
+
+ /**
+ * Used to resolve relations
+ */
+ @Generated(hash = 2040040024)
+ private transient DaoSession daoSession;
+
+ /**
+ * Used for active entity operations.
+ */
+ @Generated(hash = 335469827)
+ private transient AccountDao myDao;
+
+ @Generated(hash = 735765217)
+ public Account(Long id, String name, String email, String password, String symbol,
+ String snpId) {
+ this.id = id;
+ this.name = name;
+ this.email = email;
+ this.password = password;
+ this.symbol = symbol;
+ this.snpId = snpId;
+ }
+
+ @Generated(hash = 882125521)
+ public Account() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Account setId(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Account setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public Account setEmail(String email) {
+ this.email = email;
+ return this;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public Account setPassword(String password) {
+ this.password = password;
+ return this;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public Account setSymbol(String symbol) {
+ this.symbol = symbol;
+ return this;
+ }
+
+ public String getSnpId() {
+ return this.snpId;
+ }
+
+ public Account setSnpId(String snpId) {
+ this.snpId = snpId;
+ return this;
+ }
+
+ /**
+ * To-many relationship, resolved on first access (and after reset).
+ * Changes to to-many relations are not persisted, make changes to the target entity.
+ */
+ @Generated(hash = 1800750450)
+ public List getSubjectList() {
+ if (subjectList == null) {
+ final DaoSession daoSession = this.daoSession;
+ if (daoSession == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ SubjectDao targetDao = daoSession.getSubjectDao();
+ List subjectListNew = targetDao._queryAccount_SubjectList(id);
+ synchronized (this) {
+ if (subjectList == null) {
+ subjectList = subjectListNew;
+ }
+ }
+ }
+ return subjectList;
+ }
+
+ /**
+ * Resets a to-many relationship, making the next get call to query for a fresh result.
+ */
+ @Generated(hash = 594294258)
+ public synchronized void resetSubjectList() {
+ subjectList = null;
+ }
+
+ /**
+ * To-many relationship, resolved on first access (and after reset).
+ * Changes to to-many relations are not persisted, make changes to the target entity.
+ */
+ @Generated(hash = 1040074549)
+ public List getGradeList() {
+ if (gradeList == null) {
+ final DaoSession daoSession = this.daoSession;
+ if (daoSession == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ GradeDao targetDao = daoSession.getGradeDao();
+ List gradeListNew = targetDao._queryAccount_GradeList(id);
+ synchronized (this) {
+ if (gradeList == null) {
+ gradeList = gradeListNew;
+ }
+ }
+ }
+ return gradeList;
+ }
+
+ /**
+ * Resets a to-many relationship, making the next get call to query for a fresh result.
+ */
+ @Generated(hash = 1939990047)
+ public synchronized void resetGradeList() {
+ gradeList = null;
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 128553479)
+ public void delete() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.delete(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 1942392019)
+ public void refresh() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.refresh(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 713229351)
+ public void update() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.update(this);
+ }
+
+ /**
+ * To-many relationship, resolved on first access (and after reset).
+ * Changes to to-many relations are not persisted, make changes to the target entity.
+ */
+ @Generated(hash = 300459794)
+ public List getDayList() {
+ if (dayList == null) {
+ final DaoSession daoSession = this.daoSession;
+ if (daoSession == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ DayDao targetDao = daoSession.getDayDao();
+ List dayListNew = targetDao._queryAccount_DayList(id);
+ synchronized (this) {
+ if (dayList == null) {
+ dayList = dayListNew;
+ }
+ }
+ }
+ return dayList;
+ }
+
+ /**
+ * Resets a to-many relationship, making the next get call to query for a fresh result.
+ */
+ @Generated(hash = 1010399236)
+ public synchronized void resetDayList() {
+ dayList = null;
+ }
+
+ /** called by internal mechanisms, do not call yourself. */
+ @Generated(hash = 1812283172)
+ public void __setDaoSession(DaoSession daoSession) {
+ this.daoSession = daoSession;
+ myDao = daoSession != null ? daoSession.getAccountDao() : null;
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/AttendanceLesson.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/AttendanceLesson.java
new file mode 100644
index 000000000..9250518af
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/AttendanceLesson.java
@@ -0,0 +1,254 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.DaoException;
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Generated;
+import org.greenrobot.greendao.annotation.Id;
+import org.greenrobot.greendao.annotation.Index;
+import org.greenrobot.greendao.annotation.Property;
+import org.greenrobot.greendao.annotation.Transient;
+
+import java.io.Serializable;
+
+@Entity(
+ nameInDb = "AttendanceLessons",
+ active = true,
+ indexes = {@Index(value = "dayId,date,number", unique = true)}
+)
+public class AttendanceLesson implements Serializable {
+
+ @Id(autoincrement = true)
+ private Long id;
+
+ @Property(nameInDb = "DAY_ID")
+ private Long dayId;
+
+ @Property(nameInDb = "DATE")
+ private String date = "";
+
+ @Property(nameInDb = "NUMBER_OF_LESSON")
+ private int number = 0;
+
+ @Property(nameInDb = "SUBJECT_NAME")
+ private String subject = "";
+
+ @Property(nameInDb = "IS_PRESENCE")
+ private boolean isPresence = false;
+
+ @Property(nameInDb = "IS_ABSENCE_UNEXCUSED")
+ private boolean isAbsenceUnexcused = false;
+
+ @Property(nameInDb = "IS_ABSENCE_EXCUSED")
+ private boolean isAbsenceExcused = false;
+
+ @Property(nameInDb = "IS_UNEXCUSED_LATENESS")
+ private boolean isUnexcusedLateness = false;
+
+ @Property(nameInDb = "IS_ABSENCE_FOR_SCHOOL_REASONS")
+ private boolean isAbsenceForSchoolReasons = false;
+
+ @Property(nameInDb = "IS_EXCUSED_LATENESS")
+ private boolean isExcusedLateness = false;
+
+ @Property(nameInDb = "IS_EXEMPTION")
+ private boolean isExemption = false;
+
+ @Transient
+ private String description = "";
+
+ private static final long serialVersionUID = 42L;
+
+ /**
+ * Used to resolve relations
+ */
+ @Generated(hash = 2040040024)
+ private transient DaoSession daoSession;
+
+ /**
+ * Used for active entity operations.
+ */
+ @Generated(hash = 1936953859)
+ private transient AttendanceLessonDao myDao;
+
+ @Generated(hash = 1428129046)
+ public AttendanceLesson(Long id, Long dayId, String date, int number,
+ String subject, boolean isPresence, boolean isAbsenceUnexcused,
+ boolean isAbsenceExcused, boolean isUnexcusedLateness,
+ boolean isAbsenceForSchoolReasons, boolean isExcusedLateness,
+ boolean isExemption) {
+ this.id = id;
+ this.dayId = dayId;
+ this.date = date;
+ this.number = number;
+ this.subject = subject;
+ this.isPresence = isPresence;
+ this.isAbsenceUnexcused = isAbsenceUnexcused;
+ this.isAbsenceExcused = isAbsenceExcused;
+ this.isUnexcusedLateness = isUnexcusedLateness;
+ this.isAbsenceForSchoolReasons = isAbsenceForSchoolReasons;
+ this.isExcusedLateness = isExcusedLateness;
+ this.isExemption = isExemption;
+ }
+
+ @Generated(hash = 921806575)
+ public AttendanceLesson() {
+ }
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getDayId() {
+ return this.dayId;
+ }
+
+ public void setDayId(Long dayId) {
+ this.dayId = dayId;
+ }
+
+ public String getDate() {
+ return this.date;
+ }
+
+ public AttendanceLesson setDate(String date) {
+ this.date = date;
+ return this;
+ }
+
+ public int getNumber() {
+ return this.number;
+ }
+
+ public AttendanceLesson setNumber(int number) {
+ this.number = number;
+ return this;
+ }
+
+ public String getSubject() {
+ return this.subject;
+ }
+
+ public AttendanceLesson setSubject(String subject) {
+ this.subject = subject;
+ return this;
+ }
+
+ public boolean getIsPresence() {
+ return this.isPresence;
+ }
+
+ public AttendanceLesson setIsPresence(boolean isPresence) {
+ this.isPresence = isPresence;
+ return this;
+ }
+
+ public boolean getIsAbsenceUnexcused() {
+ return this.isAbsenceUnexcused;
+ }
+
+ public AttendanceLesson setIsAbsenceUnexcused(boolean isAbsenceUnexcused) {
+ this.isAbsenceUnexcused = isAbsenceUnexcused;
+ return this;
+ }
+
+ public boolean getIsAbsenceExcused() {
+ return this.isAbsenceExcused;
+ }
+
+ public AttendanceLesson setIsAbsenceExcused(boolean isAbsenceExcused) {
+ this.isAbsenceExcused = isAbsenceExcused;
+ return this;
+ }
+
+ public boolean getIsUnexcusedLateness() {
+ return this.isUnexcusedLateness;
+ }
+
+ public AttendanceLesson setIsUnexcusedLateness(boolean isUnexcusedLateness) {
+ this.isUnexcusedLateness = isUnexcusedLateness;
+ return this;
+ }
+
+ public boolean getIsAbsenceForSchoolReasons() {
+ return this.isAbsenceForSchoolReasons;
+ }
+
+ public AttendanceLesson setIsAbsenceForSchoolReasons(boolean isAbsenceForSchoolReasons) {
+ this.isAbsenceForSchoolReasons = isAbsenceForSchoolReasons;
+ return this;
+ }
+
+ public boolean getIsExcusedLateness() {
+ return this.isExcusedLateness;
+ }
+
+ public AttendanceLesson setIsExcusedLateness(boolean isExcusedLateness) {
+ this.isExcusedLateness = isExcusedLateness;
+ return this;
+ }
+
+ public boolean getIsExemption() {
+ return this.isExemption;
+ }
+
+ public AttendanceLesson setIsExemption(boolean isExemption) {
+ this.isExemption = isExemption;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public AttendanceLesson setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 128553479)
+ public void delete() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.delete(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 1942392019)
+ public void refresh() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.refresh(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 713229351)
+ public void update() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.update(this);
+ }
+
+ /** called by internal mechanisms, do not call yourself. */
+ @Generated(hash = 1157101112)
+ public void __setDaoSession(DaoSession daoSession) {
+ this.daoSession = daoSession;
+ myDao = daoSession != null ? daoSession.getAttendanceLessonDao() : null;
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Day.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Day.java
new file mode 100644
index 000000000..fb3ce4143
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Day.java
@@ -0,0 +1,239 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.DaoException;
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Generated;
+import org.greenrobot.greendao.annotation.Id;
+import org.greenrobot.greendao.annotation.Index;
+import org.greenrobot.greendao.annotation.OrderBy;
+import org.greenrobot.greendao.annotation.Property;
+import org.greenrobot.greendao.annotation.ToMany;
+
+import java.util.List;
+
+@Entity(
+ nameInDb = "Days",
+ active = true,
+ indexes = {@Index(value = "userId,weekId,date", unique = true)}
+)
+public class Day {
+
+ @Id(autoincrement = true)
+ private Long id;
+
+ @Property(nameInDb = "USER_ID")
+ private Long userId;
+
+ @Property(nameInDb = "WEEK_ID")
+ private Long weekId;
+
+ @Property(nameInDb = "DATE")
+ private String date = "";
+
+ @Property(nameInDb = "DAY_NAME")
+ private String dayName = "";
+
+ @Property(nameInDb = "IS_FREE_DAY")
+ private boolean isFreeDay = false;
+
+ @Property(nameInDb = "FREE_DAY_NAME")
+ private String freeDayName = "";
+
+ @ToMany(referencedJoinProperty = "dayId")
+ private List timetableLessons;
+
+ @ToMany(referencedJoinProperty = "dayId")
+ @OrderBy("number ASC")
+ private List attendanceLessons;
+
+ /**
+ * Used to resolve relations
+ */
+ @Generated(hash = 2040040024)
+ private transient DaoSession daoSession;
+
+ /**
+ * Used for active entity operations.
+ */
+ @Generated(hash = 312167767)
+ private transient DayDao myDao;
+
+ @Generated(hash = 723729681)
+ public Day(Long id, Long userId, Long weekId, String date, String dayName,
+ boolean isFreeDay, String freeDayName) {
+ this.id = id;
+ this.userId = userId;
+ this.weekId = weekId;
+ this.date = date;
+ this.dayName = dayName;
+ this.isFreeDay = isFreeDay;
+ this.freeDayName = freeDayName;
+ }
+
+ @Generated(hash = 866989762)
+ public Day() {
+ }
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public Long getWeekId() {
+ return weekId;
+ }
+
+ public Day setWeekId(Long weekId) {
+ this.weekId = weekId;
+ return this;
+ }
+
+ public Day setUserId(Long userId) {
+ this.userId = userId;
+ return this;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public Day setDate(String date) {
+ this.date = date;
+ return this;
+ }
+
+ public String getDayName() {
+ return dayName;
+ }
+
+ public Day setDayName(String dayName) {
+ this.dayName = dayName;
+ return this;
+ }
+
+ public boolean getIsFreeDay() {
+ return this.isFreeDay;
+ }
+
+ public Day setIsFreeDay(boolean isFreeDay) {
+ this.isFreeDay = isFreeDay;
+ return this;
+ }
+
+ public String getFreeDayName() {
+ return freeDayName;
+ }
+
+ public Day setFreeDayName(String freeDayName) {
+ this.freeDayName = freeDayName;
+ return this;
+ }
+
+ /**
+ * To-many relationship, resolved on first access (and after reset).
+ * Changes to to-many relations are not persisted, make changes to the target entity.
+ */
+ @Generated(hash = 218588195)
+ public List getTimetableLessons() {
+ if (timetableLessons == null) {
+ final DaoSession daoSession = this.daoSession;
+ if (daoSession == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ TimetableLessonDao targetDao = daoSession.getTimetableLessonDao();
+ List timetableLessonsNew = targetDao
+ ._queryDay_TimetableLessons(id);
+ synchronized (this) {
+ if (timetableLessons == null) {
+ timetableLessons = timetableLessonsNew;
+ }
+ }
+ }
+ return timetableLessons;
+ }
+
+ /** Resets a to-many relationship, making the next get call to query for a fresh result. */
+ @Generated(hash = 1687683740)
+ public synchronized void resetTimetableLessons() {
+ timetableLessons = null;
+ }
+
+ /**
+ * To-many relationship, resolved on first access (and after reset).
+ * Changes to to-many relations are not persisted, make changes to the target entity.
+ */
+ @Generated(hash = 1166820581)
+ public List getAttendanceLessons() {
+ if (attendanceLessons == null) {
+ final DaoSession daoSession = this.daoSession;
+ if (daoSession == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ AttendanceLessonDao targetDao = daoSession.getAttendanceLessonDao();
+ List attendanceLessonsNew = targetDao
+ ._queryDay_AttendanceLessons(id);
+ synchronized (this) {
+ if (attendanceLessons == null) {
+ attendanceLessons = attendanceLessonsNew;
+ }
+ }
+ }
+ return attendanceLessons;
+ }
+
+ /** Resets a to-many relationship, making the next get call to query for a fresh result. */
+ @Generated(hash = 1343075564)
+ public synchronized void resetAttendanceLessons() {
+ attendanceLessons = null;
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 128553479)
+ public void delete() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.delete(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 1942392019)
+ public void refresh() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.refresh(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 713229351)
+ public void update() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.update(this);
+ }
+
+ /** called by internal mechanisms, do not call yourself. */
+ @Generated(hash = 1409317752)
+ public void __setDaoSession(DaoSession daoSession) {
+ this.daoSession = daoSession;
+ myDao = daoSession != null ? daoSession.getDayDao() : null;
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Grade.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Grade.java
new file mode 100644
index 000000000..632f9bcc7
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Grade.java
@@ -0,0 +1,331 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.greenrobot.greendao.DaoException;
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Generated;
+import org.greenrobot.greendao.annotation.Id;
+import org.greenrobot.greendao.annotation.Property;
+
+import java.io.Serializable;
+
+import io.github.wulkanowy.R;
+
+@Entity(
+ nameInDb = "Grades",
+ active = true
+)
+public class Grade implements Serializable {
+
+ @Id(autoincrement = true)
+ protected Long id;
+
+ @Property(nameInDb = "SUBJECT_ID")
+ private Long subjectId;
+
+ @Property(nameInDb = "USER_ID")
+ private Long userId;
+
+ @Property(nameInDb = "SUBJECT")
+ private String subject = "";
+
+ @Property(nameInDb = "VALUE")
+ protected String value = "";
+
+ @Property(nameInDb = "COLOR")
+ private String color = "";
+
+ @Property(nameInDb = "SYMBOL")
+ private String symbol = "";
+
+ @Property(nameInDb = "DESCRIPTION")
+ private String description = "";
+
+ @Property(nameInDb = "WEIGHT")
+ private String weight = "";
+
+ @Property(nameInDb = "DATE")
+ private String date = "";
+
+ @Property(nameInDb = "TEACHER")
+ private String teacher = "";
+
+ @Property(nameInDb = "SEMESTER")
+ private String semester = "";
+
+ @Property(nameInDb = "IS_NEW")
+ private boolean isNew = false;
+
+ @Property(nameInDb = "READ")
+ private boolean read = true;
+
+ private static final long serialVersionUID = 42L;
+
+ @Generated(hash = 568899968)
+ public Grade(Long id, Long subjectId, Long userId, String subject, String value,
+ String color, String symbol, String description, String weight,
+ String date, String teacher, String semester, boolean isNew,
+ boolean read) {
+ this.id = id;
+ this.subjectId = subjectId;
+ this.userId = userId;
+ this.subject = subject;
+ this.value = value;
+ this.color = color;
+ this.symbol = symbol;
+ this.description = description;
+ this.weight = weight;
+ this.date = date;
+ this.teacher = teacher;
+ this.semester = semester;
+ this.isNew = isNew;
+ this.read = read;
+ }
+
+ @Generated(hash = 2042976393)
+ public Grade() {
+ }
+
+ /**
+ * Used to resolve relations
+ */
+ @Generated(hash = 2040040024)
+ private transient DaoSession daoSession;
+
+ /**
+ * Used for active entity operations.
+ */
+ @Generated(hash = 681281562)
+ private transient GradeDao myDao;
+
+ public int getValueColor() {
+
+ String replacedString = value.replaceAll("[^0-9]", "");
+
+ if (!"".equals(replacedString)) {
+ switch (Integer.parseInt(replacedString)) {
+ case 6:
+ return R.color.six_grade;
+ case 5:
+ return R.color.five_grade;
+ case 4:
+ return R.color.four_grade;
+ case 3:
+ return R.color.three_grade;
+ case 2:
+ return R.color.two_grade;
+ case 1:
+ return R.color.one_grade;
+ default:
+ return R.color.default_grade;
+ }
+ }
+ return R.color.default_grade;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Grade grade = (Grade) o;
+
+ return new EqualsBuilder()
+ .append(subject, grade.subject)
+ .append(value, grade.value)
+ .append(color, grade.color)
+ .append(symbol, grade.symbol)
+ .append(description, grade.description)
+ .append(weight, grade.weight)
+ .append(date, grade.date)
+ .append(teacher, grade.teacher)
+ .append(semester, grade.semester)
+ .isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(17, 37)
+ .append(subject)
+ .append(value)
+ .append(color)
+ .append(symbol)
+ .append(description)
+ .append(weight)
+ .append(date)
+ .append(teacher)
+ .append(semester)
+ .toHashCode();
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Grade setId(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ public Long getSubjectId() {
+ return subjectId;
+ }
+
+ public Grade setSubjectId(Long subjectId) {
+ this.subjectId = subjectId;
+ return this;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public Grade setUserId(Long userId) {
+ this.userId = userId;
+ return this;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public Grade setSubject(String subject) {
+ this.subject = subject;
+ return this;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public Grade setValue(String value) {
+ this.value = value;
+ return this;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public Grade setColor(String color) {
+ this.color = color;
+ return this;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public Grade setSymbol(String symbol) {
+ this.symbol = symbol;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Grade setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public String getWeight() {
+ return weight;
+ }
+
+ public Grade setWeight(String weight) {
+ this.weight = weight;
+ return this;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public Grade setDate(String date) {
+ this.date = date;
+ return this;
+ }
+
+ public String getTeacher() {
+ return teacher;
+ }
+
+ public Grade setTeacher(String teacher) {
+ this.teacher = teacher;
+ return this;
+ }
+
+ public String getSemester() {
+ return semester;
+ }
+
+ public Grade setSemester(String semester) {
+ this.semester = semester;
+ return this;
+ }
+
+ public boolean getIsNew() {
+ return this.isNew;
+ }
+
+ public Grade setIsNew(boolean isNew) {
+ this.isNew = isNew;
+ return this;
+ }
+
+ public boolean getRead() {
+ return this.read;
+ }
+
+ public Grade setRead(boolean read) {
+ this.read = read;
+ return this;
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 128553479)
+ public void delete() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.delete(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 1942392019)
+ public void refresh() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.refresh(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 713229351)
+ public void update() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.update(this);
+ }
+
+ /** called by internal mechanisms, do not call yourself. */
+ @Generated(hash = 1187286414)
+ public void __setDaoSession(DaoSession daoSession) {
+ this.daoSession = daoSession;
+ myDao = daoSession != null ? daoSession.getGradeDao() : null;
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Subject.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Subject.java
new file mode 100644
index 000000000..6bcce6229
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Subject.java
@@ -0,0 +1,192 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.DaoException;
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Generated;
+import org.greenrobot.greendao.annotation.Id;
+import org.greenrobot.greendao.annotation.Property;
+import org.greenrobot.greendao.annotation.ToMany;
+
+import java.util.List;
+
+@Entity(
+ nameInDb = "Subjects",
+ active = true
+)
+public class Subject {
+
+ @Id(autoincrement = true)
+ private Long id;
+
+ @Property(nameInDb = "USER_ID")
+ private Long userId;
+
+ @Property(nameInDb = "NAME")
+ private String name;
+
+ @Property(nameInDb = "PREDICTED_RATING")
+ private String predictedRating;
+
+ @Property(nameInDb = "FINAL_RATING")
+ private String finalRating;
+
+ @Property(nameInDb = "SEMESTER")
+ private String semester;
+
+ @ToMany(referencedJoinProperty = "subjectId")
+ private List gradeList;
+
+ /**
+ * Used to resolve relations
+ */
+ @Generated(hash = 2040040024)
+ private transient DaoSession daoSession;
+
+ /**
+ * Used for active entity operations.
+ */
+ @Generated(hash = 1644932788)
+ private transient SubjectDao myDao;
+
+ @Generated(hash = 396325764)
+ public Subject(Long id, Long userId, String name, String predictedRating,
+ String finalRating, String semester) {
+ this.id = id;
+ this.userId = userId;
+ this.name = name;
+ this.predictedRating = predictedRating;
+ this.finalRating = finalRating;
+ this.semester = semester;
+ }
+
+ @Generated(hash = 1617906264)
+ public Subject() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Subject setId(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public Subject setUserId(Long userId) {
+ this.userId = userId;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Subject setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getPredictedRating() {
+ return predictedRating;
+ }
+
+ public Subject setPredictedRating(String predictedRating) {
+ this.predictedRating = predictedRating;
+ return this;
+ }
+
+ public String getFinalRating() {
+ return finalRating;
+ }
+
+ public Subject setFinalRating(String finalRating) {
+ this.finalRating = finalRating;
+ return this;
+ }
+
+ public String getSemester() {
+ return semester;
+ }
+
+ public Subject setSemester(String semester) {
+ this.semester = semester;
+ return this;
+ }
+
+ /**
+ * To-many relationship, resolved on first access (and after reset).
+ * Changes to to-many relations are not persisted, make changes to the target entity.
+ */
+ @Generated(hash = 1358847893)
+ public List getGradeList() {
+ if (gradeList == null) {
+ final DaoSession daoSession = this.daoSession;
+ if (daoSession == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ GradeDao targetDao = daoSession.getGradeDao();
+ List gradeListNew = targetDao._querySubject_GradeList(id);
+ synchronized (this) {
+ if (gradeList == null) {
+ gradeList = gradeListNew;
+ }
+ }
+ }
+ return gradeList;
+ }
+
+ /**
+ * Resets a to-many relationship, making the next get call to query for a fresh result.
+ */
+ @Generated(hash = 1939990047)
+ public synchronized void resetGradeList() {
+ gradeList = null;
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 128553479)
+ public void delete() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.delete(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 1942392019)
+ public void refresh() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.refresh(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 713229351)
+ public void update() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.update(this);
+ }
+
+ /** called by internal mechanisms, do not call yourself. */
+ @Generated(hash = 937984622)
+ public void __setDaoSession(DaoSession daoSession) {
+ this.daoSession = daoSession;
+ myDao = daoSession != null ? daoSession.getSubjectDao() : null;
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/TimetableLesson.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/TimetableLesson.java
new file mode 100644
index 000000000..390f679ef
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/TimetableLesson.java
@@ -0,0 +1,330 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.DaoException;
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Generated;
+import org.greenrobot.greendao.annotation.Id;
+import org.greenrobot.greendao.annotation.Index;
+import org.greenrobot.greendao.annotation.Property;
+
+import java.io.Serializable;
+
+@Entity(
+ nameInDb = "TimetableLessons",
+ active = true,
+ indexes = {@Index(value = "dayId,date,startTime,endTime", unique = true)}
+)
+public class TimetableLesson implements Serializable {
+
+ @Id(autoincrement = true)
+ private Long id;
+
+ @Property(nameInDb = "DAY_ID")
+ private Long dayId;
+
+ @Property(nameInDb = "NUMBER_OF_LESSON")
+ private String number;
+
+ @Property(nameInDb = "SUBJECT_NAME")
+ private String subject = "";
+
+ @Property(nameInDb = "TEACHER")
+ private String teacher = "";
+
+ @Property(nameInDb = "ROOM")
+ private String room = "";
+
+ @Property(nameInDb = "DESCRIPTION")
+ private String description = "";
+
+ @Property(nameInDb = "GROUP_NAME")
+ private String groupName = "";
+
+ @Property(nameInDb = "START_TIME")
+ private String startTime = "";
+
+ @Property(nameInDb = "END_TIME")
+ private String endTime = "";
+
+ @Property(nameInDb = "DATE")
+ private String date = "";
+
+ @Property(nameInDb = "IS_EMPTY")
+ private boolean isEmpty = false;
+
+ @Property(nameInDb = "IS_DIVISION_INTO_GROUP")
+ private boolean isDivisionIntoGroups = false;
+
+ @Property(nameInDb = "IS_PLANNING")
+ private boolean isPlanning = false;
+
+ @Property(nameInDb = "IS_REALIZED")
+ private boolean isRealized = false;
+
+ @Property(nameInDb = "IS_MOVED_CANCELED")
+ private boolean isMovedOrCanceled = false;
+
+ @Property(nameInDb = "IS_NEW_MOVED_IN_CANCELED")
+ private boolean isNewMovedInOrChanged = false;
+
+ private static final long serialVersionUID = 42L;
+
+ /**
+ * Used to resolve relations
+ */
+ @Generated(hash = 2040040024)
+ private transient DaoSession daoSession;
+
+ /**
+ * Used for active entity operations.
+ */
+ @Generated(hash = 1119360138)
+ private transient TimetableLessonDao myDao;
+
+ @Generated(hash = 627457324)
+ public TimetableLesson(Long id, Long dayId, String number, String subject,
+ String teacher, String room, String description, String groupName,
+ String startTime, String endTime, String date, boolean isEmpty,
+ boolean isDivisionIntoGroups, boolean isPlanning, boolean isRealized,
+ boolean isMovedOrCanceled, boolean isNewMovedInOrChanged) {
+ this.id = id;
+ this.dayId = dayId;
+ this.number = number;
+ this.subject = subject;
+ this.teacher = teacher;
+ this.room = room;
+ this.description = description;
+ this.groupName = groupName;
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.date = date;
+ this.isEmpty = isEmpty;
+ this.isDivisionIntoGroups = isDivisionIntoGroups;
+ this.isPlanning = isPlanning;
+ this.isRealized = isRealized;
+ this.isMovedOrCanceled = isMovedOrCanceled;
+ this.isNewMovedInOrChanged = isNewMovedInOrChanged;
+ }
+
+ @Generated(hash = 1878030142)
+ public TimetableLesson() {
+ }
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getDayId() {
+ return this.dayId;
+ }
+
+ public void setDayId(Long dayId) {
+ this.dayId = dayId;
+ }
+
+ public String getNumber() {
+ return this.number;
+ }
+
+ public TimetableLesson setNumber(String number) {
+ this.number = number;
+ return this;
+ }
+
+ public String getSubject() {
+ return this.subject;
+ }
+
+ public TimetableLesson setSubject(String subject) {
+ this.subject = subject;
+ return this;
+ }
+
+ public String getTeacher() {
+ return this.teacher;
+ }
+
+ public TimetableLesson setTeacher(String teacher) {
+ this.teacher = teacher;
+ return this;
+ }
+
+ public String getRoom() {
+ return this.room;
+ }
+
+ public TimetableLesson setRoom(String room) {
+ this.room = room;
+ return this;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public TimetableLesson setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public String getGroupName() {
+ return this.groupName;
+ }
+
+ public TimetableLesson setGroupName(String groupName) {
+ this.groupName = groupName;
+ return this;
+ }
+
+ public String getStartTime() {
+ return this.startTime;
+ }
+
+ public TimetableLesson setStartTime(String startTime) {
+ this.startTime = startTime;
+ return this;
+ }
+
+ public String getEndTime() {
+ return this.endTime;
+ }
+
+ public TimetableLesson setEndTime(String endTime) {
+ this.endTime = endTime;
+ return this;
+ }
+
+ public String getDate() {
+ return this.date;
+ }
+
+ public TimetableLesson setDate(String date) {
+ this.date = date;
+ return this;
+ }
+
+ public boolean getIsEmpty() {
+ return this.isEmpty;
+ }
+
+ public TimetableLesson setEmpty(boolean isEmpty) {
+ this.isEmpty = isEmpty;
+ return this;
+ }
+
+ public boolean getIsDivisionIntoGroups() {
+ return this.isDivisionIntoGroups;
+ }
+
+ public TimetableLesson setDivisionIntoGroups(boolean isDivisionIntoGroups) {
+ this.isDivisionIntoGroups = isDivisionIntoGroups;
+ return this;
+ }
+
+ public boolean getIsPlanning() {
+ return this.isPlanning;
+ }
+
+ public TimetableLesson setPlanning(boolean isPlanning) {
+ this.isPlanning = isPlanning;
+ return this;
+ }
+
+ public boolean getIsRealized() {
+ return this.isRealized;
+ }
+
+ public TimetableLesson setRealized(boolean isRealized) {
+ this.isRealized = isRealized;
+ return this;
+ }
+
+ public boolean getIsMovedOrCanceled() {
+ return this.isMovedOrCanceled;
+ }
+
+ public TimetableLesson setMovedOrCanceled(boolean isMovedOrCanceled) {
+ this.isMovedOrCanceled = isMovedOrCanceled;
+ return this;
+ }
+
+ public boolean getIsNewMovedInOrChanged() {
+ return this.isNewMovedInOrChanged;
+ }
+
+ public TimetableLesson setNewMovedInOrChanged(boolean isNewMovedInOrChanged) {
+ this.isNewMovedInOrChanged = isNewMovedInOrChanged;
+ return this;
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 128553479)
+ public void delete() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.delete(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 1942392019)
+ public void refresh() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.refresh(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 713229351)
+ public void update() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.update(this);
+ }
+
+ public void setIsEmpty(boolean isEmpty) {
+ this.isEmpty = isEmpty;
+ }
+
+ public void setIsDivisionIntoGroups(boolean isDivisionIntoGroups) {
+ this.isDivisionIntoGroups = isDivisionIntoGroups;
+ }
+
+ public void setIsPlanning(boolean isPlanning) {
+ this.isPlanning = isPlanning;
+ }
+
+ public void setIsRealized(boolean isRealized) {
+ this.isRealized = isRealized;
+ }
+
+ public void setIsMovedOrCanceled(boolean isMovedOrCanceled) {
+ this.isMovedOrCanceled = isMovedOrCanceled;
+ }
+
+ public void setIsNewMovedInOrChanged(boolean isNewMovedInOrChanged) {
+ this.isNewMovedInOrChanged = isNewMovedInOrChanged;
+ }
+
+ /** called by internal mechanisms, do not call yourself. */
+ @Generated(hash = 1885258429)
+ public void __setDaoSession(DaoSession daoSession) {
+ this.daoSession = daoSession;
+ myDao = daoSession != null ? daoSession.getTimetableLessonDao() : null;
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Week.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Week.java
new file mode 100644
index 000000000..778f6ca3c
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Week.java
@@ -0,0 +1,173 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.DaoException;
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Generated;
+import org.greenrobot.greendao.annotation.Id;
+import org.greenrobot.greendao.annotation.Index;
+import org.greenrobot.greendao.annotation.Property;
+import org.greenrobot.greendao.annotation.ToMany;
+
+import java.util.List;
+
+@Entity(
+ nameInDb = "Weeks",
+ active = true,
+ indexes ={@Index(value = "userId,startDayDate", unique = true)}
+)
+public class Week {
+
+ @Id(autoincrement = true)
+ private Long id;
+
+ @Property(nameInDb = "USER_ID")
+ private Long userId;
+
+ @Property(nameInDb = "START_DATE")
+ private String startDayDate = "";
+
+ @Property(nameInDb = "IS_ATTENDANCE_SYNCED")
+ private boolean isAttendanceSynced = false;
+
+ @Property(nameInDb = "IS_TIMETABLE_SYNCED")
+ private boolean isTimetableSynced = false;
+
+ @ToMany(referencedJoinProperty = "weekId")
+ private List dayList;
+
+ /** Used to resolve relations */
+ @Generated(hash = 2040040024)
+ private transient DaoSession daoSession;
+
+ /** Used for active entity operations. */
+ @Generated(hash = 1019310398)
+ private transient WeekDao myDao;
+
+ @Generated(hash = 1745118398)
+ public Week(Long id, Long userId, String startDayDate, boolean isAttendanceSynced,
+ boolean isTimetableSynced) {
+ this.id = id;
+ this.userId = userId;
+ this.startDayDate = startDayDate;
+ this.isAttendanceSynced = isAttendanceSynced;
+ this.isTimetableSynced = isTimetableSynced;
+ }
+
+ @Generated(hash = 2135529658)
+ public Week() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Week setId(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public Week setUserId(Long userId) {
+ this.userId = userId;
+ return this;
+ }
+
+ public String getStartDayDate() {
+ return startDayDate;
+ }
+
+ public Week setStartDayDate(String startDayDate) {
+ this.startDayDate = startDayDate;
+ return this;
+ }
+
+ public boolean getIsAttendanceSynced() {
+ return this.isAttendanceSynced;
+ }
+
+ public void setIsAttendanceSynced(boolean isAttendanceSynced) {
+ this.isAttendanceSynced = isAttendanceSynced;
+ }
+
+ public boolean getIsTimetableSynced() {
+ return this.isTimetableSynced;
+ }
+
+ public void setIsTimetableSynced(boolean isTimetableSynced) {
+ this.isTimetableSynced = isTimetableSynced;
+ }
+
+ /**
+ * To-many relationship, resolved on first access (and after reset).
+ * Changes to to-many relations are not persisted, make changes to the target entity.
+ */
+ @Generated(hash = 1562119145)
+ public List getDayList() {
+ if (dayList == null) {
+ final DaoSession daoSession = this.daoSession;
+ if (daoSession == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ DayDao targetDao = daoSession.getDayDao();
+ List dayListNew = targetDao._queryWeek_DayList(id);
+ synchronized (this) {
+ if (dayList == null) {
+ dayList = dayListNew;
+ }
+ }
+ }
+ return dayList;
+ }
+
+ /** Resets a to-many relationship, making the next get call to query for a fresh result. */
+ @Generated(hash = 1010399236)
+ public synchronized void resetDayList() {
+ dayList = null;
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 128553479)
+ public void delete() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.delete(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 1942392019)
+ public void refresh() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.refresh(this);
+ }
+
+ /**
+ * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
+ * Entity must attached to an entity context.
+ */
+ @Generated(hash = 713229351)
+ public void update() {
+ if (myDao == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ myDao.update(this);
+ }
+
+ /** called by internal mechanisms, do not call yourself. */
+ @Generated(hash = 665278367)
+ public void __setDaoSession(DaoSession daoSession) {
+ this.daoSession = daoSession;
+ myDao = daoSession != null ? daoSession.getWeekDao() : null;
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Attendance.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Attendance.kt
deleted file mode 100644
index 3c58971ae..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Attendance.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDate
-import java.io.Serializable
-
-@Entity(tableName = "Attendance")
-data class Attendance(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- val diaryId: Int,
-
- val date: LocalDate,
-
- val number: Int,
-
- val subject: String,
-
- val name: String,
-
- val presence: Boolean,
-
- val absence: Boolean,
-
- val exemption: Boolean,
-
- val lateness: Boolean,
-
- val excused: Boolean,
-
- val deleted: Boolean
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/AttendanceSummary.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/AttendanceSummary.kt
deleted file mode 100644
index d2e1f174e..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/AttendanceSummary.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.Month
-import java.io.Serializable
-
-@Entity(tableName = "AttendanceSummary")
-data class AttendanceSummary(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- val diaryId: Int,
-
- @ColumnInfo(name = "subject_id")
- val subjectId: Int,
-
- val month: Month,
-
- val presence: Int,
-
- val absence: Int,
-
- @ColumnInfo(name = "absence_excused")
- val absenceExcused: Int,
-
- @ColumnInfo(name = "absence_for_school_reasons")
- val absenceForSchoolReasons: Int,
-
- val lateness: Int,
-
- @ColumnInfo(name = "lateness_excused")
- val latenessExcused: Int,
-
- val exemption: Int
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/CompletedLesson.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/CompletedLesson.kt
deleted file mode 100644
index 775f3f558..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/CompletedLesson.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDate
-import java.io.Serializable
-
-@Entity(tableName = "CompletedLesson")
-data class CompletedLesson(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- val diaryId: Int,
-
- val date: LocalDate,
-
- val number: Int,
-
- val subject: String,
-
- val topic: String,
-
- val teacher: String,
-
- @ColumnInfo(name = "teacher_symbol")
- val teacherSymbol: String,
-
- val substitution: String,
-
- val absence: String,
-
- val resources: String
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Exam.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Exam.kt
deleted file mode 100644
index 9ae795e71..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Exam.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDate
-import java.io.Serializable
-
-@Entity(tableName = "Exams")
-data class Exam(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- val diaryId: Int,
-
- val date: LocalDate,
-
- @ColumnInfo(name = "entry_date")
- val entryDate: LocalDate,
-
- val subject: String,
-
- val group: String,
-
- val type: String,
-
- val description: String,
-
- val teacher: String,
-
- @ColumnInfo(name = "teacher_symbol")
- val teacherSymbol: String
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Grade.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Grade.kt
deleted file mode 100644
index 1221a7aab..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Grade.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDate
-import java.io.Serializable
-
-@Entity(tableName = "Grades")
-data class Grade(
-
- @ColumnInfo(name = "semester_id")
- val semesterId: Int,
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- val subject: String,
-
- val entry: String,
-
- val value: Int,
-
- val modifier: Double,
-
- val comment: String,
-
- val color: String,
-
- @ColumnInfo(name = "grade_symbol")
- val gradeSymbol: String,
-
- val description: String,
-
- val weight: String,
-
- val weightValue: Double,
-
- val date: LocalDate,
-
- val teacher: String
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-
- @ColumnInfo(name = "is_read")
- var isRead: Boolean = true
-
- @ColumnInfo(name = "is_notified")
- var isNotified: Boolean = true
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeStatistics.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeStatistics.kt
deleted file mode 100644
index 8ad8b8b8d..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeStatistics.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-
-@Entity(tableName = "GradesStatistics")
-data class GradeStatistics(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "semester_id")
- val semesterId: Int,
-
- val subject: String,
-
- val grade: Int,
-
- val amount: Int,
-
- @ColumnInfo(name = "is_semester")
- val semester: Boolean
-) {
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSummary.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSummary.kt
deleted file mode 100644
index e6ac4926d..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSummary.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-
-@Entity(tableName = "GradesSummary")
-data class GradeSummary(
-
- @ColumnInfo(name = "semester_id")
- val semesterId: Int,
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- val subject: String,
-
- val predictedGrade: String,
-
- val finalGrade: String
-) {
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Homework.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Homework.kt
deleted file mode 100644
index a22df0961..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Homework.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDate
-import java.io.Serializable
-
-@Entity(tableName = "Homework")
-data class Homework(
-
- @ColumnInfo(name = "semester_id")
- val semesterId: Int,
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- val date: LocalDate,
-
- @ColumnInfo(name = "entry_date")
- val entryDate: LocalDate,
-
- val subject: String,
-
- val content: String,
-
- val teacher: String,
-
- @ColumnInfo(name = "teacher_symbol")
- val teacherSymbol: String
-
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/LuckyNumber.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/LuckyNumber.kt
deleted file mode 100644
index 5b9130f5d..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/LuckyNumber.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDate
-import java.io.Serializable
-
-@Entity(tableName = "LuckyNumbers")
-data class LuckyNumber (
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- val date: LocalDate,
-
- @ColumnInfo(name = "lucky_number")
- val luckyNumber: Int
-
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-
- @ColumnInfo(name = "is_notified")
- var isNotified: Boolean = true
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Message.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Message.kt
deleted file mode 100644
index 48b4fd022..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Message.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDateTime
-import java.io.Serializable
-
-@Entity(tableName = "Messages")
-data class Message(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "real_id")
- val realId: Int,
-
- @ColumnInfo(name = "message_id")
- val messageId: Int,
-
- @ColumnInfo(name = "sender_name")
- val sender: String,
-
- @ColumnInfo(name = "sender_id")
- val senderId: Int,
-
- @ColumnInfo(name = "recipient_name")
- val recipient: String,
-
- val subject: String,
-
- val date: LocalDateTime,
-
- @ColumnInfo(name = "folder_id")
- val folderId: Int,
-
- var unread: Boolean,
-
- @ColumnInfo(name = "unread_by")
- val unreadBy: Int,
-
- @ColumnInfo(name = "read_by")
- val readBy: Int,
-
- val removed: Boolean
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-
- @ColumnInfo(name = "is_notified")
- var isNotified: Boolean = true
-
- var content: String? = null
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Note.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Note.kt
deleted file mode 100644
index 5f3a92ab6..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Note.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDate
-import java.io.Serializable
-
-@Entity(tableName = "Notes")
-data class Note(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- val date: LocalDate,
-
- val teacher: String,
-
- val category: String,
-
- val content: String
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-
- @ColumnInfo(name = "is_read")
- var isRead: Boolean = true
-
- @ColumnInfo(name = "is_notified")
- var isNotified: Boolean = true
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Recipient.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Recipient.kt
deleted file mode 100644
index 3021da72d..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Recipient.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import java.io.Serializable
-
-@Entity(tableName = "Recipients")
-data class Recipient(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "real_id")
- val realId: String,
-
- val name: String,
-
- @ColumnInfo(name = "real_name")
- val realName: String,
-
- @ColumnInfo(name = "login_id")
- val loginId: Int,
-
- @ColumnInfo(name = "unit_id")
- val unitId: Int,
-
- val role: Int,
-
- val hash: String
-
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-
- override fun toString() = name
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/ReportingUnit.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/ReportingUnit.kt
deleted file mode 100644
index 601d8aac7..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/ReportingUnit.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import java.io.Serializable
-
-@Entity(tableName = "ReportingUnits")
-data class ReportingUnit(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "real_id")
- val realId: Int,
-
- @ColumnInfo(name = "short")
- val shortName: String,
-
- @ColumnInfo(name = "sender_id")
- val senderId: Int,
-
- @ColumnInfo(name = "sender_name")
- val senderName: String,
-
- val roles: List
-
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Semester.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Semester.kt
deleted file mode 100644
index 0f44fa2d9..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Semester.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.Index
-import androidx.room.PrimaryKey
-
-@Entity(tableName = "Semesters", indices = [Index(value = ["student_id", "diary_id", "semester_id"], unique = true)])
-data class Semester(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- val diaryId: Int,
-
- @ColumnInfo(name = "diary_name")
- val diaryName: String,
-
- @ColumnInfo(name = "semester_id")
- val semesterId: Int,
-
- @ColumnInfo(name = "semester_name")
- val semesterName: Int,
-
- @ColumnInfo(name = "is_current")
- val isCurrent: Boolean,
-
- @ColumnInfo(name = "class_id")
- val classId: Int,
-
- @ColumnInfo(name = "unit_id")
- val unitId: Int
-) {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Student.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Student.kt
deleted file mode 100644
index 9cacf8358..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Student.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.Index
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDateTime
-import java.io.Serializable
-
-@Entity(tableName = "Students", indices = [Index(value = ["email", "symbol", "student_id", "school_id", "class_id"], unique = true)])
-data class Student(
-
- val endpoint: String,
-
- val loginType: String,
-
- val email: String,
-
- var password: String,
-
- val symbol: String,
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "student_name")
- val studentName: String,
-
- @ColumnInfo(name = "school_id")
- val schoolSymbol: String,
-
- @ColumnInfo(name = "school_name")
- val schoolName: String,
-
- @ColumnInfo(name = "class_id")
- val classId: Int,
-
- @ColumnInfo(name = "is_current")
- val isCurrent: Boolean,
-
- @ColumnInfo(name = "registration_date")
- val registrationDate: LocalDateTime
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Subject.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Subject.kt
deleted file mode 100644
index dbaa6f4ed..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Subject.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import java.io.Serializable
-
-@Entity(tableName = "Subjects")
-data class Subject(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- val diaryId: Int,
-
- @ColumnInfo(name = "real_id")
- val realId: Int,
-
- val name: String
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Timetable.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Timetable.kt
deleted file mode 100644
index 9bc3d2140..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Timetable.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDate
-import org.threeten.bp.LocalDateTime
-import java.io.Serializable
-
-@Entity(tableName = "Timetable")
-data class Timetable(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- val diaryId: Int,
-
- val number: Int,
-
- val start: LocalDateTime,
-
- val end: LocalDateTime,
-
- val date: LocalDate,
-
- val subject: String,
-
- val subjectOld: String,
-
- val group: String,
-
- val room: String,
-
- val roomOld: String,
-
- val teacher: String,
-
- val teacherOld: String,
-
- val info: String,
-
- val changes: Boolean,
-
- val canceled: Boolean
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration10.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration10.kt
deleted file mode 100644
index c26a02d1f..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration10.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration10 : Migration(9, 10) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("ALTER TABLE Grades_Summary RENAME TO GradesSummary")
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration11.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration11.kt
deleted file mode 100644
index cb437c0ee..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration11.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration11 : Migration(10, 11) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS Grades_temp (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- is_read INTEGER NOT NULL,
- is_notified INTEGER NOT NULL,
- semester_id INTEGER NOT NULL,
- student_id INTEGER NOT NULL,
- subject TEXT NOT NULL,
- entry TEXT NOT NULL,
- value INTEGER NOT NULL,
- modifier REAL NOT NULL,
- comment TEXT NOT NULL,
- color TEXT NOT NULL,
- grade_symbol TEXT NOT NULL,
- description TEXT NOT NULL,
- weight TEXT NOT NULL,
- weightValue REAL NOT NULL,
- date INTEGER NOT NULL,
- teacher TEXT NOT NULL
- )
- """)
- database.execSQL("INSERT INTO Grades_temp SELECT * FROM Grades")
- database.execSQL("DROP TABLE Grades")
- database.execSQL("ALTER TABLE Grades_temp RENAME TO Grades")
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration12.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration12.kt
deleted file mode 100644
index 1dc38e14c..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration12.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration12 : Migration(11, 12) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- createTempStudentsTable(database)
- replaceStudentTable(database)
- updateStudentsWithClassId(database, getStudentsIds(database))
- removeStudentsWithNoClassId(database)
- ensureThereIsOnlyOneCurrentStudent(database)
- }
-
- private fun createTempStudentsTable(database: SupportSQLiteDatabase) {
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS Students_tmp (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- endpoint TEXT NOT NULL,
- loginType TEXT NOT NULL,
- email TEXT NOT NULL,
- password TEXT NOT NULL,
- symbol TEXT NOT NULL,
- student_id INTEGER NOT NULL,
- student_name TEXT NOT NULL,
- school_id TEXT NOT NULL,
- school_name TEXT NOT NULL,
- is_current INTEGER NOT NULL,
- registration_date INTEGER NOT NULL,
- class_id INTEGER NOT NULL
- )
- """)
- database.execSQL("CREATE UNIQUE INDEX index_Students_email_symbol_student_id_school_id_class_id ON Students_tmp (email, symbol, student_id, school_id, class_id)")
- }
-
- private fun replaceStudentTable(database: SupportSQLiteDatabase) {
- database.execSQL("ALTER TABLE Students ADD COLUMN class_id INTEGER DEFAULT 0 NOT NULL")
- database.execSQL("INSERT INTO Students_tmp SELECT * FROM Students")
- database.execSQL("DROP TABLE Students")
- database.execSQL("ALTER TABLE Students_tmp RENAME TO Students")
- }
-
- private fun getStudentsIds(database: SupportSQLiteDatabase): List {
- val students = mutableListOf()
- val studentsCursor = database.query("SELECT student_id FROM Students")
- if (studentsCursor.moveToFirst()) {
- do {
- students.add(studentsCursor.getInt(0))
- } while (studentsCursor.moveToNext())
- }
- return students
- }
-
- private fun updateStudentsWithClassId(database: SupportSQLiteDatabase, students: List) {
- students.forEach {
- database.execSQL("UPDATE Students SET class_id = IFNULL((SELECT class_id FROM Semesters WHERE student_id = $it), 0) WHERE student_id = $it")
- }
- }
-
- private fun removeStudentsWithNoClassId(database: SupportSQLiteDatabase) {
- database.execSQL("DELETE FROM Students WHERE class_id = 0")
- }
-
- private fun ensureThereIsOnlyOneCurrentStudent(database: SupportSQLiteDatabase) {
- database.execSQL("UPDATE Students SET is_current = 0")
- database.execSQL("UPDATE Students SET is_current = 1 WHERE id = (SELECT MAX(id) FROM Students)")
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration2.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration2.kt
deleted file mode 100644
index c5a30991a..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration2.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration2 : Migration(1, 2) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS LuckyNumbers (
- id INTEGER PRIMARY KEY NOT NULL,
- is_notified INTEGER NOT NULL,
- student_id INTEGER NOT NULL,
- date INTEGER NOT NULL,
- lucky_number INTEGER NOT NULL)
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration3.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration3.kt
deleted file mode 100644
index d9699c0f4..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration3.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration3 : Migration(2, 3) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS CompletedLesson (
- id INTEGER PRIMARY KEY NOT NULL,
- student_id INTEGER NOT NULL,
- diary_id INTEGER NOT NULL,
- date INTEGER NOT NULL,
- number INTEGER NOT NULL,
- subject TEXT NOT NULL,
- topic TEXT NOT NULL,
- teacher TEXT NOT NULL,
- teacher_symbol TEXT NOT NULL,
- substitution TEXT NOT NULL,
- absence TEXT NOT NULL,
- resources TEXT NOT NULL)
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration4.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration4.kt
deleted file mode 100644
index 0ae89bdd6..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration4.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration4 : Migration(3, 4) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("DROP TABLE IF EXISTS Messages")
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS Messages (
- id INTEGER PRIMARY KEY NOT NULL,
- is_notified INTEGER NOT NULL,
- content TEXT,
- student_id INTEGER NOT NULL,
- real_id INTEGER NOT NULL,
- message_id INTEGER NOT NULL,
- sender_name TEXT NOT NULL,
- sender_id INTEGER NOT NULL,
- recipient_id INTEGER NOT NULL,
- recipient_name TEXT NOT NULL,
- subject TEXT NOT NULL,
- date INTEGER NOT NULL,
- folder_id INTEGER NOT NULL,
- unread INTEGER NOT NULL,
- unreadBy INTEGER NOT NULL,
- readBy INTEGER NOT NULL,
- removed INTEGER NOT NULL)
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration5.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration5.kt
deleted file mode 100644
index fe0dec48f..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration5.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-import org.threeten.bp.LocalDateTime.now
-import org.threeten.bp.ZoneOffset
-
-class Migration5 : Migration(4, 5) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("ALTER TABLE Students ADD COLUMN registration_date INTEGER DEFAULT 0 NOT NULL")
- database.execSQL("UPDATE Students SET registration_date = '${now().atZone(ZoneOffset.UTC).toInstant().toEpochMilli()}'")
- database.execSQL("DROP TABLE IF EXISTS Notes")
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS Notes (
- id INTEGER PRIMARY KEY NOT NULL,
- is_read INTEGER NOT NULL,
- is_notified INTEGER NOT NULL,
- student_id INTEGER NOT NULL,
- date INTEGER NOT NULL,
- teacher TEXT NOT NULL,
- category TEXT NOT NULL,
- content TEXT NOT NULL)
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration6.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration6.kt
deleted file mode 100644
index fa9436187..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration6.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration6 : Migration(5, 6) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS ReportingUnits (
- id INTEGER PRIMARY KEY NOT NULL,
- student_id INTEGER NOT NULL,
- real_id INTEGER NOT NULL,
- short TEXT NOT NULL,
- sender_id INTEGER NOT NULL,
- sender_name TEXT NOT NULL,
- roles TEXT NOT NULL)
- """)
-
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS Recipients (
- id INTEGER PRIMARY KEY NOT NULL,
- student_id INTEGER NOT NULL,
- real_id TEXT NOT NULL,
- name TEXT NOT NULL,
- real_name TEXT NOT NULL,
- login_id INTEGER NOT NULL,
- unit_id INTEGER NOT NULL,
- role INTEGER NOT NULL,
- hash TEXT NOT NULL)
- """)
-
- database.execSQL("DELETE FROM Semesters WHERE 1")
- database.execSQL("ALTER TABLE Semesters ADD COLUMN class_id INTEGER DEFAULT 0 NOT NULL")
- database.execSQL("ALTER TABLE Semesters ADD COLUMN unit_id INTEGER DEFAULT 0 NOT NULL")
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration7.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration7.kt
deleted file mode 100644
index 120716c81..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration7.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration7 : Migration(6, 7) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS GradesStatistics (
- id INTEGER PRIMARY KEY NOT NULL,
- student_id INTEGER NOT NULL,
- semester_id INTEGER NOT NULL,
- subject TEXT NOT NULL,
- grade INTEGER NOT NULL,
- amount INTEGER NOT NULL,
- is_semester INTEGER NOT NULL)
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration8.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration8.kt
deleted file mode 100644
index 7009ee129..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration8.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration8 : Migration(7, 8) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("ALTER TABLE Timetable ADD COLUMN subjectOld TEXT DEFAULT \"\" NOT NULL")
- database.execSQL("ALTER TABLE Timetable ADD COLUMN roomOld TEXT DEFAULT \"\" NOT NULL")
- database.execSQL("ALTER TABLE Timetable ADD COLUMN teacherOld TEXT DEFAULT \"\" NOT NULL")
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration9.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration9.kt
deleted file mode 100644
index d79a57062..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration9.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration9 : Migration(8, 9) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("DROP TABLE IF EXISTS Messages")
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS Messages (
- id INTEGER PRIMARY KEY NOT NULL,
- student_id INTEGER NOT NULL,
- real_id INTEGER NOT NULL,
- message_id INTEGER NOT NULL,
- sender_name TEXT NOT NULL,
- sender_id INTEGER NOT NULL,
- recipient_name TEXT NOT NULL,
- subject TEXT NOT NULL,
- date INTEGER NOT NULL,
- folder_id INTEGER NOT NULL,
- unread INTEGER NOT NULL,
- unread_by INTEGER NOT NULL,
- read_by INTEGER NOT NULL,
- removed INTEGER NOT NULL,
- is_notified INTEGER NOT NULL,
- content TEXT)
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/resources/AppResources.java b/app/src/main/java/io/github/wulkanowy/data/db/resources/AppResources.java
new file mode 100644
index 000000000..349ac177e
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/resources/AppResources.java
@@ -0,0 +1,91 @@
+package io.github.wulkanowy.data.db.resources;
+
+import android.content.Context;
+import android.content.res.Resources;
+
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+import java.net.UnknownHostException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import io.github.wulkanowy.R;
+import io.github.wulkanowy.api.NotLoggedInErrorException;
+import io.github.wulkanowy.api.VulcanOfflineException;
+import io.github.wulkanowy.data.db.dao.entities.AttendanceLesson;
+import io.github.wulkanowy.di.annotations.ApplicationContext;
+import io.github.wulkanowy.utils.AppConstant;
+import io.github.wulkanowy.utils.LogUtils;
+import io.github.wulkanowy.utils.security.CryptoException;
+
+@Singleton
+public class AppResources implements ResourcesContract {
+
+ private Resources resources;
+
+ @Inject
+ AppResources(@ApplicationContext Context context) {
+ resources = context.getResources();
+ }
+
+ @Override
+ public String[] getSymbolsKeysArray() {
+ return resources.getStringArray(R.array.symbols);
+ }
+
+ @Override
+ public String[] getSymbolsValuesArray() {
+ return resources.getStringArray(R.array.symbols_values);
+ }
+
+ @Override
+ public String getErrorLoginMessage(Exception exception) {
+ LogUtils.error(AppConstant.APP_NAME + " encountered a error", exception);
+
+ if (exception instanceof CryptoException) {
+ return resources.getString(R.string.encrypt_failed_text);
+ } else if (exception instanceof UnknownHostException) {
+ return resources.getString(R.string.noInternet_text);
+ } else if (exception instanceof SocketTimeoutException) {
+ return resources.getString(R.string.generic_timeout_error);
+ } else if (exception instanceof NotLoggedInErrorException || exception instanceof IOException) {
+ return resources.getString(R.string.login_denied_text);
+ } else if (exception instanceof VulcanOfflineException) {
+ return resources.getString(R.string.error_host_offline);
+ } else {
+ return exception.getMessage();
+ }
+ }
+
+ @Override
+ public String getAttendanceLessonDescription(AttendanceLesson lesson) {
+ int id = R.string.attendance_present;
+
+ if (lesson.getIsAbsenceForSchoolReasons()) {
+ id = R.string.attendance_absence_for_school_reasons;
+ }
+
+ if (lesson.getIsAbsenceExcused()) {
+ id = R.string.attendance_absence_excused;
+ }
+
+ if (lesson.getIsAbsenceUnexcused()) {
+ id = R.string.attendance_absence_unexcused;
+ }
+
+ if (lesson.getIsExemption()) {
+ id = R.string.attendance_exemption;
+ }
+
+ if (lesson.getIsExcusedLateness()) {
+ id = R.string.attendance_excused_lateness;
+ }
+
+ if (lesson.getIsUnexcusedLateness()) {
+ id = R.string.attendance_unexcused_lateness;
+ }
+
+ return resources.getString(id);
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/resources/ResourcesContract.java b/app/src/main/java/io/github/wulkanowy/data/db/resources/ResourcesContract.java
new file mode 100644
index 000000000..0ef45a76d
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/resources/ResourcesContract.java
@@ -0,0 +1,14 @@
+package io.github.wulkanowy.data.db.resources;
+
+import io.github.wulkanowy.data.db.dao.entities.AttendanceLesson;
+
+public interface ResourcesContract {
+
+ String[] getSymbolsKeysArray();
+
+ String[] getSymbolsValuesArray();
+
+ String getErrorLoginMessage(Exception e);
+
+ String getAttendanceLessonDescription(AttendanceLesson lesson);
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPref.java b/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPref.java
new file mode 100644
index 000000000..ba437f882
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPref.java
@@ -0,0 +1,33 @@
+package io.github.wulkanowy.data.db.shared;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import io.github.wulkanowy.di.annotations.ApplicationContext;
+import io.github.wulkanowy.di.annotations.SharedPreferencesInfo;
+
+@Singleton
+public class SharedPref implements SharedPrefContract {
+
+ private static final String SHARED_KEY_USER_ID = "USER_ID";
+
+ private final SharedPreferences sharedPreferences;
+
+ @Inject
+ SharedPref(@ApplicationContext Context context, @SharedPreferencesInfo String sharedName) {
+ sharedPreferences = context.getSharedPreferences(sharedName, Context.MODE_PRIVATE);
+ }
+
+ @Override
+ public long getCurrentUserId() {
+ return sharedPreferences.getLong(SHARED_KEY_USER_ID, 0);
+ }
+
+ @Override
+ public void setCurrentUserId(long userId) {
+ sharedPreferences.edit().putLong(SHARED_KEY_USER_ID, userId).apply();
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefContract.java b/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefContract.java
new file mode 100644
index 000000000..7f540acfd
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefContract.java
@@ -0,0 +1,8 @@
+package io.github.wulkanowy.data.db.shared;
+
+public interface SharedPrefContract {
+
+ long getCurrentUserId();
+
+ void setCurrentUserId(long userId);
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/exceptions/NoCurrentStudent.kt b/app/src/main/java/io/github/wulkanowy/data/exceptions/NoCurrentStudent.kt
deleted file mode 100644
index 58a2396e2..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/exceptions/NoCurrentStudent.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package io.github.wulkanowy.data.exceptions
-
-class NoCurrentStudentException : Exception("There no set current student in database")
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocal.kt
deleted file mode 100644
index 0f5873766..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocal.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.wulkanowy.data.repositories.attendance
-
-import io.github.wulkanowy.data.db.dao.AttendanceDao
-import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Maybe
-import org.threeten.bp.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class AttendanceLocal @Inject constructor(private val attendanceDb: AttendanceDao) {
-
- fun saveAttendance(attendance: List) {
- attendanceDb.insertAll(attendance)
- }
-
- fun deleteAttendance(attendance: List) {
- attendanceDb.deleteAll(attendance)
- }
-
- fun getAttendance(semester: Semester, startDate: LocalDate, endDate: LocalDate): Maybe> {
- return attendanceDb.loadAll(semester.diaryId, semester.studentId, startDate, endDate).filter { it.isNotEmpty() }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRemote.kt
deleted file mode 100644
index b3544c3f5..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRemote.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package io.github.wulkanowy.data.repositories.attendance
-
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.utils.toLocalDate
-import io.reactivex.Single
-import org.threeten.bp.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class AttendanceRemote @Inject constructor(private val api: Api) {
-
- fun getAttendance(semester: Semester, startDate: LocalDate, endDate: LocalDate): Single> {
- return Single.just(api.apply { diaryId = semester.diaryId })
- .flatMap { it.getAttendance(startDate, endDate) }.map { attendance ->
- attendance.map {
- Attendance(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- date = it.date.toLocalDate(),
- number = it.number,
- subject = it.subject,
- name = it.name,
- presence = it.presence,
- absence = it.absence,
- exemption = it.exemption,
- lateness = it.lateness,
- excused = it.excused,
- deleted = it.deleted
- )
- }
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
deleted file mode 100644
index f6eb07dae..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.wulkanowy.data.repositories.attendance
-
-import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.utils.friday
-import io.github.wulkanowy.utils.monday
-import io.reactivex.Single
-import org.threeten.bp.LocalDate
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class AttendanceRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: AttendanceLocal,
- private val remote: AttendanceRemote
-) {
-
- fun getAttendance(semester: Semester, startDate: LocalDate, endDate: LocalDate, forceRefresh: Boolean)
- : Single> {
- return Single.fromCallable { startDate.monday to endDate.friday }
- .flatMap { dates ->
- local.getAttendance(semester, dates.first, dates.second).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings).flatMap {
- if (it) remote.getAttendance(semester, dates.first, dates.second)
- else Single.error(UnknownHostException())
- }.flatMap { newAttendance ->
- local.getAttendance(semester, dates.first, dates.second)
- .toSingle(emptyList())
- .doOnSuccess { oldAttendance ->
- local.deleteAttendance(oldAttendance - newAttendance)
- local.saveAttendance(newAttendance - oldAttendance)
- }
- }.flatMap {
- local.getAttendance(semester, dates.first, dates.second)
- .toSingle(emptyList())
- }).map { list -> list.filter { it.date in startDate..endDate } }
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryLocal.kt
deleted file mode 100644
index 2e9a10067..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryLocal.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.github.wulkanowy.data.repositories.attendancesummary
-
-import io.github.wulkanowy.data.db.dao.AttendanceSummaryDao
-import io.github.wulkanowy.data.db.entities.AttendanceSummary
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Maybe
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class AttendanceSummaryLocal @Inject constructor(private val attendanceDb: AttendanceSummaryDao) {
-
- fun saveAttendanceSummary(attendance: List) {
- attendanceDb.insertAll(attendance)
- }
-
- fun deleteAttendanceSummary(attendance: List) {
- attendanceDb.deleteAll(attendance)
- }
-
- fun getAttendanceSummary(semester: Semester, subjectId: Int): Maybe> {
- return attendanceDb.loadAll(semester.diaryId, semester.studentId, subjectId).filter { it.isNotEmpty() }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRemote.kt
deleted file mode 100644
index d38dd3a4b..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRemote.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.github.wulkanowy.data.repositories.attendancesummary
-
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.entities.AttendanceSummary
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Single
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class AttendanceSummaryRemote @Inject constructor(private val api: Api) {
-
- fun getAttendanceSummary(semester: Semester, subjectId: Int): Single> {
- return Single.just(api.apply { diaryId = semester.diaryId })
- .flatMap { api.getAttendanceSummary(subjectId) }.map { attendance ->
- attendance.map {
- AttendanceSummary(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- subjectId = subjectId,
- month = it.month,
- presence = it.presence,
- absence = it.absence,
- absenceExcused = it.absenceExcused,
- absenceForSchoolReasons = it.absenceForSchoolReasons,
- lateness = it.lateness,
- latenessExcused = it.latenessExcused,
- exemption = it.exemption
- )
- }
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt
deleted file mode 100644
index 90d39aab2..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.github.wulkanowy.data.repositories.attendancesummary
-
-import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.data.db.entities.AttendanceSummary
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Single
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class AttendanceSummaryRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: AttendanceSummaryLocal,
- private val remote: AttendanceSummaryRemote
-) {
-
- fun getAttendanceSummary(semester: Semester, subjectId: Int, forceRefresh: Boolean = false): Single> {
- return local.getAttendanceSummary(semester, subjectId).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getAttendanceSummary(semester, subjectId)
- else Single.error(UnknownHostException())
- }.flatMap { new ->
- local.getAttendanceSummary(semester, subjectId).toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteAttendanceSummary(old - new)
- local.saveAttendanceSummary(new - old)
- }
- }.flatMap { local.getAttendanceSummary(semester, subjectId).toSingle(emptyList()) })
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocal.kt
deleted file mode 100644
index 9b275908e..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocal.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.wulkanowy.data.repositories.completedlessons
-
-import io.github.wulkanowy.data.db.dao.CompletedLessonsDao
-import io.github.wulkanowy.data.db.entities.CompletedLesson
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Maybe
-import org.threeten.bp.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class CompletedLessonsLocal @Inject constructor(private val completedLessonsDb: CompletedLessonsDao) {
-
- fun saveCompletedLessons(completedLessons: List) {
- completedLessonsDb.insertAll(completedLessons)
- }
-
- fun deleteCompleteLessons(completedLessons: List) {
- completedLessonsDb.deleteAll(completedLessons)
- }
-
- fun getCompletedLessons(semester: Semester, start: LocalDate, end: LocalDate): Maybe> {
- return completedLessonsDb.loadAll(semester.diaryId, semester.studentId, start, end).filter { it.isNotEmpty() }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRemote.kt
deleted file mode 100644
index 58dd5a9d1..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRemote.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package io.github.wulkanowy.data.repositories.completedlessons
-
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.api.toLocalDate
-import io.github.wulkanowy.data.db.entities.CompletedLesson
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Single
-import org.threeten.bp.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class CompletedLessonsRemote @Inject constructor(private val api: Api) {
-
- fun getCompletedLessons(semester: Semester, startDate: LocalDate, endDate: LocalDate): Single> {
- return Single.just(api.apply { diaryId = semester.diaryId })
- .flatMap { it.getCompletedLessons(startDate, endDate) }
- .map { lessons ->
- lessons.map {
- it.absence
- CompletedLesson(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- date = it.date.toLocalDate(),
- number = it.number,
- subject = it.subject,
- topic = it.topic,
- teacher = it.teacher,
- teacherSymbol = it.teacherSymbol,
- substitution = it.substitution,
- absence = it.absence,
- resources = it.resources
- )
- }
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
deleted file mode 100644
index 5b5941076..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.wulkanowy.data.repositories.completedlessons
-
-import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.data.db.entities.CompletedLesson
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.utils.friday
-import io.github.wulkanowy.utils.monday
-import io.reactivex.Single
-import org.threeten.bp.LocalDate
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class CompletedLessonsRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: CompletedLessonsLocal,
- private val remote: CompletedLessonsRemote
-) {
-
- fun getCompletedLessons(semester: Semester, startDate: LocalDate, endDate: LocalDate, forceRefresh: Boolean = false): Single> {
- return Single.fromCallable { startDate.monday to endDate.friday }
- .flatMap { dates ->
- local.getCompletedLessons(semester, dates.first, dates.second).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getCompletedLessons(semester, dates.first, dates.second)
- else Single.error(UnknownHostException())
- }.flatMap { new ->
- local.getCompletedLessons(semester, dates.first, dates.second)
- .toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteCompleteLessons(old - new)
- local.saveCompletedLessons(new - old)
- }
- }.flatMap {
- local.getCompletedLessons(semester, dates.first, dates.second)
- .toSingle(emptyList())
- }).map { list -> list.filter { it.date in startDate..endDate } }
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamLocal.kt
deleted file mode 100644
index 0f484d323..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamLocal.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.github.wulkanowy.data.repositories.exam
-
-import io.github.wulkanowy.data.db.dao.ExamDao
-import io.github.wulkanowy.data.db.entities.Exam
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Maybe
-import org.threeten.bp.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class ExamLocal @Inject constructor(private val examDb: ExamDao) {
-
- fun getExams(semester: Semester, startDate: LocalDate, endDate: LocalDate): Maybe> {
- return examDb.loadAll(semester.diaryId, semester.studentId, startDate, endDate)
- .filter { !it.isEmpty() }
- }
-
- fun saveExams(exams: List) {
- examDb.insertAll(exams)
- }
-
- fun deleteExams(exams: List) {
- examDb.deleteAll(exams)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRemote.kt
deleted file mode 100644
index f6d653a61..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRemote.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package io.github.wulkanowy.data.repositories.exam
-
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.entities.Exam
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.utils.toLocalDate
-import io.reactivex.Single
-import org.threeten.bp.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class ExamRemote @Inject constructor(private val api: Api) {
-
- fun getExams(semester: Semester, startDate: LocalDate, endDate: LocalDate): Single> {
- return Single.just(api.apply { diaryId = semester.diaryId })
- .flatMap { it.getExams(startDate, endDate) }.map { exams ->
- exams.map {
- Exam(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- date = it.date.toLocalDate(),
- entryDate = it.entryDate.toLocalDate(),
- subject = it.subject,
- group = it.group,
- type = it.type,
- description = it.description,
- teacher = it.teacher,
- teacherSymbol = it.teacherSymbol
- )
- }
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
deleted file mode 100644
index a0cb5ba11..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.wulkanowy.data.repositories.exam
-
-import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.data.db.entities.Exam
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.utils.friday
-import io.github.wulkanowy.utils.monday
-import io.reactivex.Single
-import org.threeten.bp.LocalDate
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class ExamRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: ExamLocal,
- private val remote: ExamRemote
-) {
-
- fun getExams(semester: Semester, startDate: LocalDate, endDate: LocalDate, forceRefresh: Boolean = false): Single> {
- return Single.fromCallable { startDate.monday to endDate.friday }
- .flatMap { dates ->
- local.getExams(semester, dates.first, dates.second).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getExams(semester, dates.first, dates.second)
- else Single.error(UnknownHostException())
- }.flatMap { newExams ->
- local.getExams(semester, dates.first, dates.second)
- .toSingle(emptyList())
- .doOnSuccess { oldExams ->
- local.deleteExams(oldExams - newExams)
- local.saveExams(newExams - oldExams)
- }
- }.flatMap {
- local.getExams(semester, dates.first, dates.second)
- .toSingle(emptyList())
- }).map { list -> list.filter { it.date in startDate..endDate } }
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeLocal.kt
deleted file mode 100644
index 4983a4740..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeLocal.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package io.github.wulkanowy.data.repositories.grade
-
-import io.github.wulkanowy.data.db.dao.GradeDao
-import io.github.wulkanowy.data.db.entities.Grade
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Maybe
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class GradeLocal @Inject constructor(private val gradeDb: GradeDao) {
-
- fun saveGrades(grades: List) {
- gradeDb.insertAll(grades)
- }
-
- fun deleteGrades(grades: List) {
- gradeDb.deleteAll(grades)
- }
-
- fun updateGrades(grades: List) {
- gradeDb.updateAll(grades)
- }
-
- fun getGrades(semester: Semester): Maybe> {
- return gradeDb.loadAll(semester.semesterId, semester.studentId).filter { it.isNotEmpty() }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRemote.kt
deleted file mode 100644
index 570ab7a77..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRemote.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.github.wulkanowy.data.repositories.grade
-
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.entities.Grade
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.utils.toLocalDate
-import io.reactivex.Single
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class GradeRemote @Inject constructor(private val api: Api) {
-
- fun getGrades(semester: Semester): Single> {
- return Single.just(api.apply { diaryId = semester.diaryId })
- .flatMap { it.getGrades(semester.semesterId) }
- .map { grades ->
- grades.map {
- Grade(
- semesterId = semester.semesterId,
- studentId = semester.studentId,
- subject = it.subject,
- entry = it.entry,
- value = it.value,
- modifier = it.modifier,
- comment = it.comment,
- color = it.color,
- gradeSymbol = it.symbol.orEmpty(),
- description = it.description.orEmpty(),
- weight = it.weight,
- weightValue = it.weightValue,
- date = it.date.toLocalDate(),
- teacher = it.teacher
- )
- }
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt
deleted file mode 100644
index 3dd456bff..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-package io.github.wulkanowy.data.repositories.grade
-
-import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.data.db.entities.Grade
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.reactivex.Completable
-import io.reactivex.Single
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class GradeRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: GradeLocal,
- private val remote: GradeRemote
-) {
-
- fun getGrades(student: Student, semester: Semester, forceRefresh: Boolean = false, notify: Boolean = false): Single> {
- return local.getGrades(semester).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getGrades(semester)
- else Single.error(UnknownHostException())
- }.flatMap { newGrades ->
- local.getGrades(semester).toSingle(emptyList())
- .doOnSuccess { oldGrades ->
- val notifyBreakDate = oldGrades.maxBy { it.date }?.date
- ?: student.registrationDate.toLocalDate()
- local.deleteGrades(oldGrades - newGrades)
- local.saveGrades((newGrades - oldGrades)
- .onEach {
- if (it.date >= notifyBreakDate) it.apply {
- isRead = false
- if (notify) isNotified = false
- }
- })
- }
- }.flatMap { local.getGrades(semester).toSingle(emptyList()) })
- }
-
- fun getUnreadGrades(semester: Semester): Single> {
- return local.getGrades(semester).map { it.filter { grade -> !grade.isRead } }.toSingle(emptyList())
- }
-
- fun getNotNotifiedGrades(semester: Semester): Single> {
- return local.getGrades(semester).map { it.filter { grade -> !grade.isNotified } }.toSingle(emptyList())
- }
-
- fun updateGrade(grade: Grade): Completable {
- return Completable.fromCallable { local.updateGrades(listOf(grade)) }
- }
-
- fun updateGrades(grades: List