+
+ 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 00000000..40e69161
--- /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 00000000..5eaf50df
--- /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 00000000..aa995305
--- /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 00000000..ecc48cf1
--- /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 00000000..a229d1d5
--- /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 00000000..023b5405
--- /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 00000000..0f6da414
--- /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 00000000..2911f1d2
--- /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 00000000..a8496cd1
--- /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 00000000..08713188
--- /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-success.html b/api/src/test/resources/io/github/wulkanowy/api/login/Logowanie-success.html
new file mode 100644
index 00000000..23c27a3f
--- /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 00000000..062f9b60
--- /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 00000000..549b2d42
--- /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 00000000..1ba54a32
--- /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 00000000..326390ed
--- /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 00000000..36f89aa1
--- /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 00000000..ae976af1
--- /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 00000000..c8d55a96
--- /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 00000000..b15bb6e7
--- /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 00000000..50e74058
--- /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 00000000..05a698a0
--- /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 00000000..53eb0485
--- /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 00000000..09555cf3
--- /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 00000000..8bcc9794
--- /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 00000000..c54dd861
--- /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 6382469d..1887df3a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,136 +1,106 @@
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-kapt'
-apply plugin: 'kotlin-android-extensions'
-apply plugin: 'io.fabric'
-apply plugin: 'com.github.triplet.play'
-apply from: 'jacoco.gradle'
-apply from: 'sonarqube.gradle'
-
-android {
- compileSdkVersion 28
- buildToolsVersion '28.0.3'
-
- playAccountConfigs {
- defaultAccountConfig {
- serviceAccountEmail = System.getenv("PLAY_SERVICE_ACCOUNT_EMAIL")
- pk12File = file('key.p12')
- }
+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: 'org.greenrobot.greendao'
+apply plugin: 'io.fabric'
+apply from: '../jacoco.gradle'
+apply from: '../android-sonarqube.gradle'
+
+android {
+ compileSdkVersion 27
+ buildToolsVersion "27.0.3"
defaultConfig {
applicationId "io.github.wulkanowy"
testApplicationId "io.github.tests.wulkanowy"
minSdkVersion 15
- targetSdkVersion 28
- versionCode 19
- versionName "0.6.0"
- multiDexEnabled true
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ targetSdkVersion 27
+ versionCode 2
+ versionName "0.1.1"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
- playAccountConfig = playAccountConfigs.defaultAccountConfig
- manifestPlaceholders = [crashlytics_enabled: project.hasProperty("enableCrashlytics")]
- }
-
- 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")
- }
+ manifestPlaceholders = [
+ fabricApiKey: System.getenv("FABRIC_API_KEY") ?: "null"
+ ]
}
buildTypes {
release {
- buildConfigField "boolean", "CRASHLYTICS_ENABLED", "true"
- minifyEnabled true
- useProguard false
- 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'
+ testOptions {
+ unitTests.all {
+ testLogging {
+ events "passed", "skipped", "failed", "standardOut", "standardError"
+ outputs.upToDateWhen { false }
+ showStandardStreams = true
+ }
+ }
}
}
-androidExtensions {
- experimental = true
-}
-
-play {
- track = 'alpha'
- uploadImages = true
-}
-
-configurations.all {
- resolutionStrategy.force "com.squareup.okhttp3:okhttp-urlconnection:3.11.0"
+greendao {
+ schemaVersion 20
+ generateTests = true
}
dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
- implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
- implementation('io.github.wulkanowy:api:0.6.0') { 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.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.multidex:multidex:2.0.0'
+ 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 'com.takisoft.preferencex:preferencex:1.0.0'
- implementation "com.mikepenz:aboutlibraries:6.2.0"
- implementation "com.firebase:firebase-jobdispatcher:0.8.5"
+ 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 "com.google.dagger:dagger-android-support:2.19"
- kapt "com.google.dagger:dagger-compiler:2.19"
- kapt "com.google.dagger:dagger-android-processor:2.19"
+ debugImplementation 'com.amitshekhar.android:debug-db:1.0.1'
+ debugImplementation 'net.zetetic:android-database-sqlcipher:3.5.9'
- implementation "androidx.room:room-runtime:2.1.0-alpha03"
- implementation "androidx.room:room-rxjava2:2.1.0-alpha03"
- kapt "androidx.room:room-compiler:2.1.0-alpha03"
+ testImplementation 'junit:junit:4.12'
+ testImplementation 'org.mockito:mockito-core:2.13.0'
- implementation "eu.davidea:flexible-adapter:5.1.0"
- implementation "eu.davidea:flexible-adapter-ui:1.0.0"
-
- implementation "com.aurelhubert:ahbottomnavigation:2.2.0"
- implementation 'com.ncapdevi:frag-nav:3.0.0'
-
- implementation 'com.github.pwittchen:reactivenetwork-rx2:3.0.1'
- implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
- implementation "io.reactivex.rxjava2:rxjava:2.2.4"
-
- implementation "com.jakewharton.threetenabp:threetenabp:1.1.0"
-
- implementation "com.jakewharton.timber:timber:4.7.1"
- implementation "at.favre.lib:slf4j-timber:1.0.1"
-
- implementation 'com.google.firebase:firebase-core:16.0.6'
- implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
-
- debugImplementation "com.amitshekhar.android:debug-db:1.0.4"
-
- testImplementation "junit:junit:4.12"
- testImplementation "io.mockk:mockk:1.8.13.kotlin13"
- testImplementation "org.mockito:mockito-inline:2.23.4"
- 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 'org.mockito:mockito-android:2.23.4'
- 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 4f94ef19..00000000
--- a/app/jacoco.gradle
+++ /dev/null
@@ -1,47 +0,0 @@
-apply plugin: "jacoco"
-
-jacoco {
- toolVersion "0.8.2"
- 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 d9811213..00000000
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 e9b6d06e..00000000
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 9ee1737f..00000000
--- 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 cebd3d94..34ed4c38 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,36 +1,25 @@
-# Optimizations
--optimizationpasses 5
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
--dontusemixedcaseclassnames
--dontskipnonpubliclibraryclasses
--dontskipnonpubliclibraryclassmembers
--dontpreverify
--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
--renamesourcefileattribute SourceFile
--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 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/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 00000000..e5330b62
--- /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/DayTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/DayTest.java
new file mode 100644
index 00000000..34c4c4c5
--- /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 00000000..ea026559
--- /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/LessonTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/LessonTest.java
new file mode 100644
index 00000000..c8690ff9
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/LessonTest.java
@@ -0,0 +1,24 @@
+package io.github.wulkanowy.data.db.dao.entities;
+
+import org.greenrobot.greendao.test.AbstractDaoTestLongPk;
+
+public class LessonTest extends AbstractDaoTestLongPk {
+
+ public LessonTest() {
+ super(LessonDao.class);
+ }
+
+ @Override
+ protected Lesson createEntity(Long key) {
+ Lesson entity = new Lesson();
+ 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/SubjectTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/SubjectTest.java
new file mode 100644
index 00000000..81a2e724
--- /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/WeekTest.java b/app/src/androidTest/java/io/github/wulkanowy/data/db/dao/entities/WeekTest.java
new file mode 100644
index 00000000..86e7a8be
--- /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/repositories/local/AttendanceLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/local/AttendanceLocalTest.kt
deleted file mode 100644
index 8cbd13cd..00000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/local/AttendanceLocalTest.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-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, "", ""),
- Attendance(1, 2, LocalDate.of(2018, 9, 14), 0, "", ""),
- Attendance(1, 2, LocalDate.of(2018, 9, 17), 0, "", "")
- ))
-
- val attendance = attendanceLocal
- .getAttendance(Semester(1, 1, 2, "", 3, 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/local/ExamLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/local/ExamLocalTest.kt
deleted file mode 100644
index c60348e3..00000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/local/ExamLocalTest.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-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, 1, 2, "", 3, 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/local/StudentLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/local/StudentLocalTest.kt
deleted file mode 100644
index 732dc5bc..00000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/local/StudentLocalTest.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-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 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, sharedHelper, 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))
- .blockingGet()
- assert(studentLocal.isStudentSaved)
-
- val student = studentLocal.getCurrentStudent(true).blockingGet()
- assertEquals("23", student.schoolSymbol)
- }
-}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/local/TimetableLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/local/TimetableLocalTest.kt
deleted file mode 100644
index df0a7994..00000000
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/local/TimetableLocalTest.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-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 io.github.wulkanowy.data.db.entities.Timetable
-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
-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(
- Timetable(1, 2, 1, LocalDateTime.now(), LocalDateTime.now(),
- LocalDate.of(2018, 9, 10), "", "", "", "", ""),
- Timetable(1, 2, 1, LocalDateTime.now(), LocalDateTime.now(),
- LocalDate.of(2018, 9, 14), "", "", "", "", ""),
- Timetable(1, 2, 1, LocalDateTime.now(), LocalDateTime.now(),
- LocalDate.of(2018, 9, 17), "", "", "", "", "")
- ))
-
- val exams = timetableDb.getTimetable(
- Semester(0, 1, 2, "3", 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/utils/security/ScramblerTest.java b/app/src/androidTest/java/io/github/wulkanowy/utils/security/ScramblerTest.java
new file mode 100644
index 00000000..2fd1904b
--- /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 0c47e6bb..00000000
--- 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 e9303986..00000000
--- 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 736f7906..00000000
Binary files a/app/src/debug/google-services.json.gpg and /dev/null differ
diff --git a/app/src/debug/res/values-pl/strings.xml b/app/src/debug/res/values-pl/strings.xml
deleted file mode 100644
index c90641dd..00000000
--- a/app/src/debug/res/values-pl/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Wulkanowy DEV
-
diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml
deleted file mode 100644
index c90641dd..00000000
--- a/app/src/debug/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Wulkanowy DEV
-
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 643fd292..f1733681 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,28 +1,27 @@
-
+ android:supportsRtl="true"
+ android:theme="@style/WulkanowyTheme">
+ android:name=".ui.splash.SplashActivity"
+ android:configChanges="orientation|screenSize"
+ android:noHistory="true"
+ android:theme="@style/WulkanowyTheme.SplashTheme">
@@ -30,40 +29,26 @@
+ android:label="@string/activity_dashboard_text" />
-
-
-
-
-
-
-
-
+ android:name="io.fabric.ApiKey"
+ android:value="${fabricApiKey}" />
+
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
index de216d36..7cad5c2f 100644
Binary files a/app/src/main/ic_launcher-web.png 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 00000000..4b8866ce
--- /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 628d6ce6..00000000
--- a/app/src/main/java/io/github/wulkanowy/WulkanowyApp.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package io.github.wulkanowy
-
-import android.content.Context
-import androidx.appcompat.app.AppCompatDelegate
-import androidx.multidex.MultiDex
-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.PreferencesRepository
-import io.github.wulkanowy.di.DaggerAppComponent
-import io.github.wulkanowy.utils.CrashlyticsTree
-import io.github.wulkanowy.utils.DebugLogTree
-import timber.log.Timber
-import javax.inject.Inject
-
-class WulkanowyApp : DaggerApplication() {
-
- @Inject
- lateinit var prefRepository: PreferencesRepository
-
- 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)
- }
-
- 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())
- }
-
- 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 5b7b1072..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/ApiHelper.kt
+++ /dev/null
@@ -1,27 +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
- useNewStudent = false
- host = URL(student.endpoint).run { host + ":$port".removeSuffix(":-1") }
- ssl = student.endpoint.startsWith("https")
- loginType = Api.LoginType.valueOf(student.loginType)
- }
- }
-
- fun initApi(email: String, password: String, symbol: String, endpoint: String) {
- initApi(Student(email = email, password = password, symbol = symbol, endpoint = endpoint, loginType = "AUTO"))
- }
-}
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 00000000..04460a07
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/Repository.java
@@ -0,0 +1,143 @@
+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.login.AccountPermissionException;
+import io.github.wulkanowy.api.login.BadCredentialsException;
+import io.github.wulkanowy.api.login.NotLoggedInErrorException;
+import io.github.wulkanowy.api.login.VulcanOfflineException;
+import io.github.wulkanowy.data.db.dao.entities.Account;
+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.login.LoginSyncContract;
+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 LoginSyncContract loginSync;
+
+ private final TimetableSyncContract timetableSync;
+
+ private final SyncContract gradeSync;
+
+ private final SyncContract subjectSync;
+
+ @Inject
+ Repository(SharedPrefContract sharedPref,
+ ResourcesContract resources,
+ DaoSession daoSession,
+ LoginSyncContract loginSync,
+ TimetableSyncContract timetableSync,
+ @SyncGrades SyncContract gradeSync,
+ @SyncSubjects SyncContract subjectSync) {
+ this.sharedPref = sharedPref;
+ this.resources = resources;
+ this.daoSession = daoSession;
+ this.loginSync = loginSync;
+ 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 void loginUser(String email, String password, String symbol)
+ throws NotLoggedInErrorException, AccountPermissionException, IOException,
+ CryptoException, VulcanOfflineException, BadCredentialsException {
+ loginSync.loginUser(email, password, symbol);
+ }
+
+ @Override
+ public void loginCurrentUser() throws NotLoggedInErrorException, AccountPermissionException,
+ IOException, CryptoException, VulcanOfflineException, BadCredentialsException {
+ loginSync.loginCurrentUser();
+ }
+
+ @Override
+ public void syncGrades() throws NotLoggedInErrorException, IOException, ParseException {
+ gradeSync.sync();
+ }
+
+ @Override
+ public void syncSubjects() throws NotLoggedInErrorException, IOException, ParseException {
+ subjectSync.sync();
+ }
+
+ @Override
+ public void syncTimetable() throws NotLoggedInErrorException, IOException, ParseException {
+ timetableSync.syncTimetable();
+ }
+
+ @Override
+ public void syncTimetable(String date) throws NotLoggedInErrorException, IOException, ParseException {
+ timetableSync.syncTimetable(date);
+ }
+
+ @Override
+ public void syncAll() throws NotLoggedInErrorException, IOException, ParseException {
+ syncSubjects();
+ syncGrades();
+ 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 00000000..fcdf29ed
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/RepositoryContract.java
@@ -0,0 +1,34 @@
+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.login.NotLoggedInErrorException;
+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.login.LoginSyncContract;
+import io.github.wulkanowy.data.sync.timetable.TimetableSyncContract;
+
+@Singleton
+public interface RepositoryContract extends ResourcesContract, LoginSyncContract,
+ TimetableSyncContract {
+
+ long getCurrentUserId();
+
+ void syncGrades() throws NotLoggedInErrorException, IOException, ParseException;
+
+ void syncSubjects() throws NotLoggedInErrorException, IOException, ParseException;
+
+ void syncAll() throws NotLoggedInErrorException, 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 3c58ea4b..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt
+++ /dev/null
@@ -1,101 +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.SocketInternetObservingStrategy
-import dagger.Module
-import dagger.Provides
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.AppDatabase
-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(SocketInternetObservingStrategy())
- .host("www.google.com")
- .build()
- }
-
- @Singleton
- @Provides
- fun provideApi(): 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))
- }
- }
-
- @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 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
-}
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 30c957b4..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/AppDatabase.kt
+++ /dev/null
@@ -1,88 +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.ExamDao
-import io.github.wulkanowy.data.db.dao.GradeDao
-import io.github.wulkanowy.data.db.dao.GradeSummaryDao
-import io.github.wulkanowy.data.db.dao.MessagesDao
-import io.github.wulkanowy.data.db.dao.HomeworkDao
-import io.github.wulkanowy.data.db.dao.NoteDao
-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.Exam
-import io.github.wulkanowy.data.db.entities.Grade
-import io.github.wulkanowy.data.db.entities.GradeSummary
-import io.github.wulkanowy.data.db.entities.Message
-import io.github.wulkanowy.data.db.entities.Homework
-import io.github.wulkanowy.data.db.entities.Note
-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 javax.inject.Singleton
-
-@Singleton
-@Database(
- entities = [
- Student::class,
- Semester::class,
- Exam::class,
- Timetable::class,
- Attendance::class,
- AttendanceSummary::class,
- Grade::class,
- GradeSummary::class,
- Message::class,
- Note::class,
- Homework::class,
- Subject::class
- ],
- version = 1,
- exportSchema = false
-)
-@TypeConverters(Converters::class)
-abstract class AppDatabase : RoomDatabase() {
-
- companion object {
- fun newInstance(context: Context): AppDatabase {
- return Room.databaseBuilder(context, AppDatabase::class.java, "wulkanowy_database")
- .setJournalMode(TRUNCATE)
- .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 messagesDao: MessagesDao
-
- abstract val noteDao: NoteDao
-
- abstract val homeworkDao: HomeworkDao
-
- abstract val subjectDao: SubjectDao
-}
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 a550df89..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/Converters.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-package io.github.wulkanowy.data.db
-
-import androidx.room.TypeConverter
-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) }
-}
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 656b39d4..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefHelper.kt
+++ /dev/null
@@ -1,33 +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 putBoolean(key: String, value: Boolean) {
- sharedPref.edit().putBoolean(key, value).apply()
- }
-
- fun getBoolean(key: String, defaultValue: Boolean): Boolean {
- return sharedPref.getBoolean(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 d3c4f146..00000000
--- 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 a7413de5..00000000
--- 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/DbHelper.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/DbHelper.java
new file mode 100644
index 00000000..199a6c8b
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/DbHelper.java
@@ -0,0 +1,19 @@
+package io.github.wulkanowy.data.db.dao;
+
+import android.content.Context;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import io.github.wulkanowy.data.db.dao.entities.DaoMaster;
+import io.github.wulkanowy.di.annotations.ApplicationContext;
+import io.github.wulkanowy.di.annotations.DatabaseInfo;
+
+@Singleton
+public class DbHelper extends DaoMaster.DevOpenHelper {
+
+ @Inject
+ DbHelper(@ApplicationContext Context context, @DatabaseInfo String dbName) {
+ super(context, dbName);
+ }
+}
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 06cd5613..00000000
--- 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 629f201d..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeDao.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.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 update(grade: Grade)
-
- @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>
-
- @Query("SELECT * FROM Grades WHERE is_read = 0 AND semester_id = :semesterId AND student_id = :studentId")
- fun loadAllNew(semesterId: Int, studentId: Int): 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 3530118c..00000000
--- 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 grades_summary 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 4127460f..00000000
--- 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 = :date")
- fun loadAll(semesterId: Int, 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 5018b690..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/MessagesDao.kt
+++ /dev/null
@@ -1,37 +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): List
-
- @Delete
- fun deleteAll(messages: List)
-
- @Update
- fun update(message: Message)
-
- @Update
- fun updateAll(messages: List)
-
- @Query("SELECT * FROM Messages WHERE student_id = :studentId AND real_id = :id")
- fun loadOne(studentId: Int, id: Int): Maybe
-
- @Query("SELECT * FROM Messages WHERE student_id = :studentId AND folder_id = :folder ORDER BY date DESC")
- fun load(studentId: Int, folder: Int): Maybe>
-
- @Query("SELECT * FROM Messages WHERE student_id = :studentId AND removed = 1 ORDER BY date DESC")
- fun loadDeleted(studentId: Int): Maybe>
-
- @Query("SELECT * FROM Messages WHERE unread = 1 AND student_id = :studentId")
- fun loadNewMessages(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 2c182860..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/NoteDao.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.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 update(note: Note)
-
- @Update
- fun updateAll(notes: List)
-
- @Delete
- fun deleteAll(notes: List)
-
- @Query("SELECT * FROM Notes WHERE semester_id = :semesterId AND student_id = :studentId")
- fun loadAll(semesterId: Int, studentId: Int): Maybe>
-
- @Query("SELECT * FROM Notes WHERE is_read = 0 AND semester_id = :semesterId AND student_id = :studentId")
- fun loadNew(semesterId: Int, studentId: 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 44de31d8..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Insert
-import androidx.room.OnConflictStrategy.IGNORE
-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(onConflict = IGNORE)
- fun insertAll(semester: List)
-
- @Query("SELECT * FROM Semesters WHERE student_id = :studentId")
- fun loadAll(studentId: Int): Maybe>
-
- @Query("UPDATE Semesters SET is_current = 1 WHERE semester_id = :semesterId AND diary_id = :diaryId")
- fun updateCurrent(semesterId: Int, diaryId: Int)
-
- @Query("UPDATE Semesters SET is_current = 0 WHERE student_id = :studentId")
- fun resetCurrent(studentId: Int)
-}
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 76e29539..00000000
--- 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.FAIL
-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 = FAIL)
- 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 student_id = :studentId")
- fun updateCurrent(studentId: Int)
-
- @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 725a371a..00000000
--- 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 abe21361..00000000
--- 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 00000000..20a47ac2
--- /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/Day.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Day.java
new file mode 100644
index 00000000..15a06309
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Day.java
@@ -0,0 +1,214 @@
+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 = "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 lessons;
+
+ /**
+ * 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 isFreeDay() {
+ return isFreeDay;
+ }
+
+ public Day setFreeDay(boolean freeDay) {
+ isFreeDay = freeDay;
+ return this;
+ }
+
+ public String getFreeDayName() {
+ return freeDayName;
+ }
+
+ public Day setFreeDayName(String freeDayName) {
+ this.freeDayName = freeDayName;
+ return this;
+ }
+
+ public boolean getIsFreeDay() {
+ return this.isFreeDay;
+ }
+
+ public void setIsFreeDay(boolean isFreeDay) {
+ this.isFreeDay = isFreeDay;
+ }
+
+ /**
+ * 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 = 1552857303)
+ public List getLessons() {
+ if (lessons == null) {
+ final DaoSession daoSession = this.daoSession;
+ if (daoSession == null) {
+ throw new DaoException("Entity is detached from DAO context");
+ }
+ LessonDao targetDao = daoSession.getLessonDao();
+ List lessonsNew = targetDao._queryDay_Lessons(id);
+ synchronized (this) {
+ if (lessons == null) {
+ lessons = lessonsNew;
+ }
+ }
+ }
+ return lessons;
+ }
+
+ /**
+ * Resets a to-many relationship, making the next get call to query for a fresh result.
+ */
+ @Generated(hash = 1769801440)
+ public synchronized void resetLessons() {
+ lessons = 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 00000000..632f9bcc
--- /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/Lesson.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Lesson.java
new file mode 100644
index 00000000..db9be944
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Lesson.java
@@ -0,0 +1,353 @@
+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 = "Lessons",
+ active = true,
+ indexes = {@Index(value = "dayId,date,startTime,endTime", unique = true)}
+)
+public class Lesson 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 = 610143130)
+ private transient LessonDao myDao;
+
+ @Generated(hash = 140778287)
+ public Lesson(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 = 1669664117)
+ public Lesson() {
+ }
+
+ 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 number;
+ }
+
+ public Lesson setNumber(String number) {
+ this.number = number;
+ return this;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public Lesson setSubject(String subject) {
+ this.subject = subject;
+ return this;
+ }
+
+ public String getTeacher() {
+ return teacher;
+ }
+
+ public Lesson setTeacher(String teacher) {
+ this.teacher = teacher;
+ return this;
+ }
+
+ public String getRoom() {
+ return room;
+ }
+
+ public Lesson setRoom(String room) {
+ this.room = room;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Lesson setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public Lesson setGroupName(String groupName) {
+ this.groupName = groupName;
+ return this;
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public Lesson setStartTime(String startTime) {
+ this.startTime = startTime;
+ return this;
+ }
+
+ public String getEndTime() {
+ return endTime;
+ }
+
+ public Lesson setEndTime(String endTime) {
+ this.endTime = endTime;
+ return this;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public Lesson setDate(String date) {
+ this.date = date;
+ return this;
+ }
+
+ public boolean isEmpty() {
+ return isEmpty;
+ }
+
+ public Lesson setEmpty(boolean empty) {
+ isEmpty = empty;
+ return this;
+ }
+
+ public boolean isDivisionIntoGroups() {
+ return isDivisionIntoGroups;
+ }
+
+ public Lesson setDivisionIntoGroups(boolean divisionIntoGroups) {
+ isDivisionIntoGroups = divisionIntoGroups;
+ return this;
+ }
+
+ public boolean isPlanning() {
+ return isPlanning;
+ }
+
+ public Lesson setPlanning(boolean planning) {
+ isPlanning = planning;
+ return this;
+ }
+
+ public boolean isRealized() {
+ return isRealized;
+ }
+
+ public Lesson setRealized(boolean realized) {
+ isRealized = realized;
+ return this;
+ }
+
+ public boolean isMovedOrCanceled() {
+ return isMovedOrCanceled;
+ }
+
+ public Lesson setMovedOrCanceled(boolean movedOrCanceled) {
+ isMovedOrCanceled = movedOrCanceled;
+ return this;
+ }
+
+ public boolean isNewMovedInOrChanged() {
+ return isNewMovedInOrChanged;
+ }
+
+ public Lesson setNewMovedInOrChanged(boolean newMovedInOrChanged) {
+ isNewMovedInOrChanged = newMovedInOrChanged;
+ return this;
+ }
+
+ public boolean getIsEmpty() {
+ return this.isEmpty;
+ }
+
+ public void setIsEmpty(boolean isEmpty) {
+ this.isEmpty = isEmpty;
+ }
+
+ public boolean getIsDivisionIntoGroups() {
+ return this.isDivisionIntoGroups;
+ }
+
+ public void setIsDivisionIntoGroups(boolean isDivisionIntoGroups) {
+ this.isDivisionIntoGroups = isDivisionIntoGroups;
+ }
+
+ public boolean getIsPlanning() {
+ return this.isPlanning;
+ }
+
+ public void setIsPlanning(boolean isPlanning) {
+ this.isPlanning = isPlanning;
+ }
+
+ public boolean getIsRealized() {
+ return this.isRealized;
+ }
+
+ public void setIsRealized(boolean isRealized) {
+ this.isRealized = isRealized;
+ }
+
+ public boolean getIsMovedOrCanceled() {
+ return this.isMovedOrCanceled;
+ }
+
+ public void setIsMovedOrCanceled(boolean isMovedOrCanceled) {
+ this.isMovedOrCanceled = isMovedOrCanceled;
+ }
+
+ public boolean getIsNewMovedInOrChanged() {
+ return this.isNewMovedInOrChanged;
+ }
+
+ public void setIsNewMovedInOrChanged(boolean isNewMovedInOrChanged) {
+ this.isNewMovedInOrChanged = isNewMovedInOrChanged;
+ }
+
+ /**
+ * 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 = 2078826279)
+ public void __setDaoSession(DaoSession daoSession) {
+ this.daoSession = daoSession;
+ myDao = daoSession != null ? daoSession.getLessonDao() : 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 00000000..6bcce622
--- /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/Week.java b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Week.java
new file mode 100644
index 00000000..c82f3277
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/entities/Week.java
@@ -0,0 +1,148 @@
+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 = "";
+
+ @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 = 36829814)
+ public Week(Long id, Long userId, String startDayDate) {
+ this.id = id;
+ this.userId = userId;
+ this.startDayDate = startDayDate;
+ }
+
+ @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;
+ }
+
+ /**
+ * 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 7588201b..00000000
--- 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")
- var studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- var diaryId: Int,
-
- var date: LocalDate,
-
- var number: Int,
-
- var subject: String,
-
- var name: String,
-
- var presence: Boolean = false,
-
- var absence: Boolean = false,
-
- var exemption: Boolean = false,
-
- var lateness: Boolean = false,
-
- var excused: Boolean = false,
-
- var deleted: Boolean = false
-) : 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 de2de98f..00000000
--- 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")
- var studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- var diaryId: Int,
-
- @ColumnInfo(name = "subject_id")
- var subjectId: Int = 0,
-
- 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/Exam.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Exam.kt
deleted file mode 100644
index daa886d5..00000000
--- 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")
- var studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- var diaryId: Int,
-
- var date: LocalDate,
-
- @ColumnInfo(name = "entry_date")
- var entryDate: LocalDate = LocalDate.now(),
-
- var subject: String,
-
- var group: String,
-
- var type: String,
-
- var description: String,
-
- var teacher: String,
-
- @ColumnInfo(name = "teacher_symbol")
- var 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 d665f9d2..00000000
--- 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")
- var semesterId: Int,
-
- @ColumnInfo(name = "student_id")
- var studentId: Int,
-
- var subject: String,
-
- var entry: String,
-
- var value: Int,
-
- var modifier: Double,
-
- var comment: String,
-
- var color: String,
-
- @ColumnInfo(name = "grade_symbol")
- var gradeSymbol: String,
-
- var description: String,
-
- var weight: String,
-
- var weightValue: Int,
-
- var date: LocalDate,
-
- var 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/GradeSummary.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSummary.kt
deleted file mode 100644
index 74d709bb..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSummary.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
-
-@Entity(tableName = "Grades_Summary")
-data class GradeSummary(
-
- @ColumnInfo(name = "semester_id")
- var semesterId: Int,
-
- @ColumnInfo(name = "student_id")
- var studentId: Int,
-
- var subject: String,
-
- var predictedGrade: String,
-
- var 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 705d1d63..00000000
--- 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")
- var semesterId: Int,
-
- @ColumnInfo(name = "student_id")
- var studentId: Int,
-
- var date: LocalDate,
-
- @ColumnInfo(name = "entry_date")
- var entryDate: LocalDate,
-
- var subject: String,
-
- var content: String,
-
- var teacher: String,
-
- @ColumnInfo(name = "teacher_symbol")
- var teacherSymbol: String
-
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
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 320e9322..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Message.kt
+++ /dev/null
@@ -1,56 +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")
- var studentId: Int? = null,
-
- @ColumnInfo(name = "real_id")
- val realId: Int? = null,
-
- @ColumnInfo(name = "message_id")
- val messageId: Int? = null,
-
- @ColumnInfo(name = "sender_name")
- val sender: String? = null,
-
- @ColumnInfo(name = "sender_id")
- val senderId: Int? = null,
-
- @ColumnInfo(name = "recipient_id")
- val recipientId: Int? = null,
-
- @ColumnInfo(name = "recipient_name")
- val recipient: String? = "",
-
- val subject: String = "",
-
- val date: LocalDateTime? = null,
-
- @ColumnInfo(name = "folder_id")
- val folderId: Int = 0,
-
- var unread: Boolean? = false,
-
- val unreadBy: Int? = 0,
-
- val readBy: Int? = 0,
-
- val removed: Boolean = false
-) : 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 1f61f087..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Note.kt
+++ /dev/null
@@ -1,35 +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 = "semester_id")
- var semesterId: Int,
-
- @ColumnInfo(name = "student_id")
- var studentId: Int,
-
- var date: LocalDate,
-
- var teacher: String,
-
- var category: String,
-
- var content: String
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-
- @ColumnInfo(name = "is_read")
- var isRead: Boolean = false
-
- @ColumnInfo(name = "is_notified")
- var isNotified: Boolean = true
-}
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 509a692e..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Semester.kt
+++ /dev/null
@@ -1,31 +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(
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0,
-
- @ColumnInfo(name = "student_id")
- var studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- var diaryId: Int,
-
- @ColumnInfo(name = "diary_name")
- var diaryName: String,
-
- @ColumnInfo(name = "semester_id")
- var semesterId: Int,
-
- @ColumnInfo(name = "semester_name")
- var semesterName: Int,
-
- @ColumnInfo(name = "is_current")
- var isCurrent: Boolean = false
-)
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 1fe4cf8d..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Student.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 = "Students", indices = [Index(value = ["email", "symbol", "student_id", "school_id"], unique = true)])
-data class Student(
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0,
-
- var endpoint: String,
-
- var loginType: String,
-
- var email: String,
-
- var password: String,
-
- var symbol: String = "",
-
- @ColumnInfo(name = "student_id")
- var studentId: Int = 0,
-
- @ColumnInfo(name = "student_name")
- var studentName: String = "",
-
- @ColumnInfo(name = "school_id")
- var schoolSymbol: String = "",
-
- @ColumnInfo(name = "school_name")
- var schoolName: String = "",
-
- @ColumnInfo(name = "is_current")
- var isCurrent: Boolean = false
-)
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 45306be3..00000000
--- 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")
- var studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- var diaryId: Int,
-
- @ColumnInfo(name = "real_id")
- var realId: Int,
-
- var 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 2aa1eafa..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Timetable.kt
+++ /dev/null
@@ -1,44 +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")
- var studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- var diaryId: Int,
-
- val number: Int = 0,
-
- val start: LocalDateTime = LocalDateTime.now(),
-
- val end: LocalDateTime = LocalDateTime.now(),
-
- val date: LocalDate,
-
- val subject: String,
-
- val group: String,
-
- val room: String,
-
- val teacher: String,
-
- val info: String,
-
- val changes: Boolean = false,
-
- val canceled: Boolean = false
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
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 00000000..8e7227d3
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/resources/AppResources.java
@@ -0,0 +1,59 @@
+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.login.NotLoggedInErrorException;
+import io.github.wulkanowy.api.login.VulcanOfflineException;
+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();
+ }
+ }
+}
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 00000000..3768ad2c
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/resources/ResourcesContract.java
@@ -0,0 +1,10 @@
+package io.github.wulkanowy.data.db.resources;
+
+public interface ResourcesContract {
+
+ String[] getSymbolsKeysArray();
+
+ String[] getSymbolsValuesArray();
+
+ String getErrorLoginMessage(Exception e);
+}
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 00000000..ba437f88
--- /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 00000000..7f540acf
--- /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/repositories/AttendanceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceRepository.kt
deleted file mode 100644
index eb7230ae..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceRepository.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.data.repositories.local.AttendanceLocal
-import io.github.wulkanowy.data.repositories.remote.AttendanceRemote
-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/AttendanceSummaryRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceSummaryRepository.kt
deleted file mode 100644
index 8e21b12c..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceSummaryRepository.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.github.wulkanowy.data.repositories.local.AttendanceSummaryLocal
-import io.github.wulkanowy.data.repositories.remote.AttendanceSummaryRemote
-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/ExamRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/ExamRepository.kt
deleted file mode 100644
index cb78df53..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/ExamRepository.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.data.repositories.local.ExamLocal
-import io.github.wulkanowy.data.repositories.remote.ExamRemote
-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/GradeRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/GradeRepository.kt
deleted file mode 100644
index 42266955..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/GradeRepository.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.repositories.local.GradeLocal
-import io.github.wulkanowy.data.repositories.remote.GradeRemote
-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(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 ->
- local.deleteGrades(oldGrades - newGrades)
- local.saveGrades((newGrades - oldGrades)
- .onEach {
- if (oldGrades.isNotEmpty()) it.isRead = false
- if (notify) it.isNotified = false
- })
- }
- }.flatMap { local.getGrades(semester).toSingle(emptyList()) })
- }
-
- fun getNewGrades(semester: Semester): Single> {
- return local.getNewGrades(semester).toSingle(emptyList())
- }
-
- fun updateGrade(grade: Grade): Completable {
- return local.updateGrade(grade)
- }
-
- fun updateGrades(grades: List): Completable {
- return local.updateGrades(grades)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/GradeSummaryRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/GradeSummaryRepository.kt
deleted file mode 100644
index a59a2cd5..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/GradeSummaryRepository.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.GradeSummary
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.repositories.local.GradeSummaryLocal
-import io.github.wulkanowy.data.repositories.remote.GradeSummaryRemote
-import io.reactivex.Single
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class GradeSummaryRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: GradeSummaryLocal,
- private val remote: GradeSummaryRemote
-) {
-
- fun getGradesSummary(semester: Semester, forceRefresh: Boolean = false): Single> {
- return local.getGradesSummary(semester).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getGradeSummary(semester)
- else Single.error(UnknownHostException())
- }.flatMap { newGradesSummary ->
- local.getGradesSummary(semester).toSingle(emptyList())
- .doOnSuccess { oldGradesSummary ->
- local.deleteGradesSummary(oldGradesSummary - newGradesSummary)
- local.saveGradesSummary(newGradesSummary - oldGradesSummary)
- }
- }.flatMap { local.getGradesSummary(semester).toSingle(emptyList()) })
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/HomeworkRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/HomeworkRepository.kt
deleted file mode 100644
index a2a477b5..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/HomeworkRepository.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.Homework
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.repositories.local.HomeworkLocal
-import io.github.wulkanowy.data.repositories.remote.HomeworkRemote
-import io.reactivex.Single
-import org.threeten.bp.LocalDate
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class HomeworkRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: HomeworkLocal,
- private val remote: HomeworkRemote
-) {
-
- fun getHomework(semester: Semester, date: LocalDate, forceRefresh: Boolean = false): Single> {
- return local.getHomework(semester, date).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getHomework(semester, date)
- else Single.error(UnknownHostException())
- }.flatMap { newGrades ->
- local.getHomework(semester, date).toSingle(emptyList())
- .doOnSuccess { oldGrades ->
- local.deleteHomework(oldGrades - newGrades)
- local.saveHomework(newGrades - oldGrades)
- }
- }.flatMap { local.getHomework(semester, date).toSingle(emptyList()) })
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/MessagesRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/MessagesRepository.kt
deleted file mode 100644
index 06a0f6f9..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/MessagesRepository.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.Message
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.local.MessagesLocal
-import io.github.wulkanowy.data.repositories.remote.MessagesRemote
-import io.reactivex.Completable
-import io.reactivex.Single
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MessagesRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: MessagesLocal,
- private val remote: MessagesRemote
-) {
-
- enum class MessageFolder(val id: Int = 1) {
- RECEIVED(1),
- SENT(2),
- TRASHED(3)
- }
-
- fun getMessages(studentId: Int, folder: MessageFolder, forceRefresh: Boolean = false, notify: Boolean = false): Single> {
- return local.getMessages(studentId, folder).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getMessages(studentId, folder)
- else Single.error(UnknownHostException())
- }.flatMap { new ->
- local.getMessages(studentId, folder).toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteMessages(old - new)
- local.saveMessages((new - old)
- .onEach {
- it.isNotified = !notify
- })
- }
- }.flatMap { local.getMessages(studentId, folder).toSingle(emptyList()) }
- )
- }
-
- fun getMessage(studentId: Int, messageId: Int, markAsRead: Boolean = false): Single {
- return local.getMessage(studentId, messageId)
- .filter { !it.content.isNullOrEmpty() }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) local.getMessage(studentId, messageId).toSingle()
- else Single.error(UnknownHostException())
- }
- .flatMap { dbMessage ->
- remote.getMessagesContent(dbMessage, markAsRead).doOnSuccess {
- local.updateMessage(dbMessage.copy(unread = false).apply {
- id = dbMessage.id
- content = it
- })
- }
- }.flatMap {
- local.getMessage(studentId, messageId).toSingle()
- }
- )
- }
-
- fun getNewMessages(student: Student): Single> {
- return local.getNewMessages(student).toSingle(emptyList())
- }
-
- fun updateMessage(message: Message): Completable {
- return Completable.fromCallable { local.updateMessage(message) }
- }
-
- fun updateMessages(messages: List): Completable {
- return Completable.fromCallable { local.updateMessages(messages) }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt
deleted file mode 100644
index 2836894f..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.Note
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.repositories.local.NoteLocal
-import io.github.wulkanowy.data.repositories.remote.NoteRemote
-import io.reactivex.Completable
-import io.reactivex.Single
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class NoteRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: NoteLocal,
- private val remote: NoteRemote
-) {
-
- fun getNotes(semester: Semester, forceRefresh: Boolean = false, notify: Boolean = false): Single> {
- return local.getNotes(semester).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getNotes(semester)
- else Single.error(UnknownHostException())
- }.flatMap { new ->
- local.getNotes(semester).toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteNotes(old - new)
- local.saveNotes((new - old)
- .onEach {
- if (notify) it.isNotified = false
- })
- }
- }.flatMap { local.getNotes(semester).toSingle(emptyList()) }
- )
- }
-
- fun getNewNotes(semester: Semester): Single> {
- return local.getNewNotes(semester).toSingle(emptyList())
- }
-
- fun updateNote(note: Note): Completable {
- return local.updateNote(note)
- }
-
- fun updateNotes(notes: List): Completable {
- return local.updateNotes(notes)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt
deleted file mode 100644
index 205baa3a..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import android.content.Context
-import android.content.SharedPreferences
-import io.github.wulkanowy.R
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class PreferencesRepository @Inject constructor(
- private val sharedPref: SharedPreferences,
- val context: Context
-) {
- val startMenuIndex: Int
- get() = sharedPref.getString(context.getString(R.string.pref_key_start_menu), "0")?.toInt() ?: 0
-
- val isShowPresent: Boolean
- get() = sharedPref.getBoolean(context.getString(R.string.pref_key_attendance_present), true)
-
- val isGradeExpandable: Boolean
- get() = !sharedPref.getBoolean(context.getString(R.string.pref_key_expand_grade), false)
-
- val currentThemeKey: String = context.getString(R.string.pref_key_theme)
- val currentTheme: Int
- get() = sharedPref.getString(currentThemeKey, "1")?.toInt() ?: 1
-
- val gradePlusModifier: Double
- get() = sharedPref.getString(context.getString(R.string.pref_key_grade_modifier_plus), "0.0")?.toDouble() ?: 0.0
-
- val gradeMinusModifier: Double
- get() = sharedPref.getString(context.getString(R.string.pref_key_grade_modifier_minus), "0.0")?.toDouble() ?: 0.0
-
- val serviceEnablesKey: String = context.getString(R.string.pref_key_services_enable)
- val isServiceEnabled: Boolean
- get() = sharedPref.getBoolean(serviceEnablesKey, true)
-
- val servicesIntervalKey: String = context.getString(R.string.pref_key_services_interval)
- val servicesInterval: Int
- get() = sharedPref.getString(servicesIntervalKey, "60")?.toInt() ?: 60
-
- val servicesOnlyWifiKey: String = context.getString(R.string.pref_key_services_wifi_only)
- val isServicesOnlyWifi: Boolean
- get() = sharedPref.getBoolean(servicesOnlyWifiKey, true)
-
- val isNotificationsEnable: Boolean
- get() = sharedPref.getBoolean(context.getString(R.string.pref_key_notifications_enable), true)
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt
deleted file mode 100644
index b7902106..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.data.ApiHelper
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.local.SemesterLocal
-import io.github.wulkanowy.data.repositories.remote.SemesterRemote
-import io.reactivex.Maybe
-import io.reactivex.Single
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class SemesterRepository @Inject constructor(
- private val remote: SemesterRemote,
- private val local: SemesterLocal,
- private val settings: InternetObservingSettings,
- private val apiHelper: ApiHelper
-) {
-
- fun getSemesters(student: Student, forceRefresh: Boolean = false): Single> {
- return Maybe.just(apiHelper.initApi(student))
- .flatMap { local.getSemesters(student).filter { !forceRefresh } }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getSemesters(student) else Single.error(UnknownHostException())
- }.map { newSemesters ->
- local.apply {
- saveSemesters(newSemesters)
- setCurrentSemester(newSemesters.single { it.isCurrent })
- }
- }.flatMap { local.getSemesters(student).toSingle(emptyList()) })
- }
-
- fun getCurrentSemester(student: Student, forceRefresh: Boolean = false): Single {
- return getSemesters(student, forceRefresh).map { item -> item.single { it.isCurrent } }
- }
-}
-
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt
deleted file mode 100644
index 97210da0..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.data.ApiHelper
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.local.StudentLocal
-import io.github.wulkanowy.data.repositories.remote.StudentRemote
-import io.reactivex.Completable
-import io.reactivex.Single
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class StudentRepository @Inject constructor(
- private val local: StudentLocal,
- private val remote: StudentRemote,
- private val settings: InternetObservingSettings,
- private val apiHelper: ApiHelper
-) {
-
- val isStudentSaved
- get() = local.isStudentSaved
-
- lateinit var cachedStudents: Single>
- private set
-
- fun getStudents(email: String, password: String, symbol: String, endpoint: String): Single> {
- cachedStudents = ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- apiHelper.initApi(email, password, symbol, endpoint)
- if (it) remote.getStudents(email, password, endpoint)
- else Single.error(UnknownHostException("No internet connection"))
- }.doOnSuccess { cachedStudents = Single.just(it) }
- return cachedStudents
- }
-
- fun getSavedStudents(decryptPass: Boolean = true): Single> {
- return local.getStudents(decryptPass).toSingle(emptyList())
- }
-
- fun getCurrentStudent(decryptPass: Boolean = true): Single {
- return local.getCurrentStudent(decryptPass).toSingle()
- }
-
- fun saveStudent(student: Student): Single {
- return local.saveStudent(student)
- }
-
- fun switchStudent(student: Student): Completable {
- return local.setCurrentStudent(student)
- }
-
- fun logoutStudent(student: Student): Completable {
- return local.logoutStudent(student)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/SubjectRepostory.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/SubjectRepostory.kt
deleted file mode 100644
index e3e8a2a7..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/SubjectRepostory.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.Semester
-import io.github.wulkanowy.data.db.entities.Subject
-import io.github.wulkanowy.data.repositories.local.SubjectLocal
-import io.github.wulkanowy.data.repositories.remote.SubjectRemote
-import io.reactivex.Single
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class SubjectRepostory @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: SubjectLocal,
- private val remote: SubjectRemote
-) {
-
- fun getSubjects(semester: Semester, forceRefresh: Boolean = false): Single> {
- return local.getSubjects(semester).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getSubjects(semester)
- else Single.error(UnknownHostException())
- }.flatMap { new ->
- local.getSubjects(semester)
- .toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteSubjects(old - new)
- local.saveSubjects(new - old)
- }
- }.flatMap {
- local.getSubjects(semester).toSingle(emptyList())
- })
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/TimetableRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/TimetableRepository.kt
deleted file mode 100644
index 6cc6a043..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/TimetableRepository.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-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.Semester
-import io.github.wulkanowy.data.db.entities.Timetable
-import io.github.wulkanowy.data.repositories.local.TimetableLocal
-import io.github.wulkanowy.data.repositories.remote.TimetableRemote
-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 TimetableRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: TimetableLocal,
- private val remote: TimetableRemote
-) {
-
- fun getTimetable(semester: Semester, startDate: LocalDate, endDate: LocalDate, forceRefresh: Boolean = false)
- : Single> {
- return Single.fromCallable { startDate.monday to endDate.friday }
- .flatMap { dates ->
- local.getTimetable(semester, dates.first, dates.second).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getTimetable(semester, dates.first, dates.second)
- else Single.error(UnknownHostException())
- }.flatMap { newTimetable ->
- local.getTimetable(semester, dates.first, dates.second)
- .toSingle(emptyList())
- .doOnSuccess { oldTimetable ->
- local.deleteTimetable(oldTimetable - newTimetable)
- local.saveTimetable(newTimetable - oldTimetable)
- }
- }.flatMap {
- local.getTimetable(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/local/AttendanceLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/local/AttendanceLocal.kt
deleted file mode 100644
index 9a318dba..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/local/AttendanceLocal.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-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
-
-class AttendanceLocal @Inject constructor(private val attendanceDb: AttendanceDao) {
-
- fun getAttendance(semester: Semester, startDate: LocalDate, endDate: LocalDate): Maybe> {
- return attendanceDb.loadAll(semester.diaryId, semester.studentId, startDate, endDate)
- .filter { !it.isEmpty() }
- }
-
- fun saveAttendance(attendance: List) {
- attendanceDb.insertAll(attendance)
- }
-
- fun deleteAttendance(attendance: List) {
- attendanceDb.deleteAll(attendance)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/local/AttendanceSummaryLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/local/AttendanceSummaryLocal.kt
deleted file mode 100644
index 2bb9f122..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/local/AttendanceSummaryLocal.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-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
-
-class AttendanceSummaryLocal @Inject constructor(private val attendanceDb: AttendanceSummaryDao) {
-
- fun getAttendanceSummary(semester: Semester, subjectId: Int): Maybe> {
- return attendanceDb.loadAll(semester.diaryId, semester.studentId, subjectId).filter { !it.isEmpty() }
- }
-
- fun saveAttendanceSummary(attendance: List) {
- attendanceDb.insertAll(attendance)
- }
-
- fun deleteAttendanceSummary(attendance: List) {
- attendanceDb.deleteAll(attendance)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/local/ExamLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/local/ExamLocal.kt
deleted file mode 100644
index 3e32a635..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/local/ExamLocal.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-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
-
-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/local/GradeLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/local/GradeLocal.kt
deleted file mode 100644
index d6d46340..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/local/GradeLocal.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-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.Completable
-import io.reactivex.Maybe
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class GradeLocal @Inject constructor(private val gradeDb: GradeDao) {
-
- fun getGrades(semester: Semester): Maybe> {
- return gradeDb.loadAll(semester.semesterId, semester.studentId).filter { !it.isEmpty() }
- }
-
- fun getNewGrades(semester: Semester): Maybe> {
- return gradeDb.loadAllNew(semester.semesterId, semester.studentId)
- }
-
- fun saveGrades(grades: List) {
- gradeDb.insertAll(grades)
- }
-
- fun updateGrade(grade: Grade): Completable {
- return Completable.fromCallable { gradeDb.update(grade) }
- }
-
- fun updateGrades(grades: List): Completable {
- return Completable.fromCallable { gradeDb.updateAll(grades) }
- }
-
- fun deleteGrades(grades: List) {
- gradeDb.deleteAll(grades)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/local/GradeSummaryLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/local/GradeSummaryLocal.kt
deleted file mode 100644
index 6a72416d..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/local/GradeSummaryLocal.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-import io.github.wulkanowy.data.db.dao.GradeSummaryDao
-import io.github.wulkanowy.data.db.entities.GradeSummary
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Maybe
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class GradeSummaryLocal @Inject constructor(private val gradeSummaryDb: GradeSummaryDao) {
-
- fun getGradesSummary(semester: Semester): Maybe> {
- return gradeSummaryDb.loadAll(semester.semesterId, semester.studentId)
- .filter { !it.isEmpty() }
- }
-
- fun saveGradesSummary(gradesSummary: List) {
- gradeSummaryDb.insertAll(gradesSummary)
- }
-
- fun deleteGradesSummary(gradesSummary: List) {
- gradeSummaryDb.deleteAll(gradesSummary)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/local/HomeworkLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/local/HomeworkLocal.kt
deleted file mode 100644
index ea18d814..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/local/HomeworkLocal.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-import io.github.wulkanowy.data.db.dao.HomeworkDao
-import io.github.wulkanowy.data.db.entities.Homework
-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 HomeworkLocal @Inject constructor(private val homeworkDb: HomeworkDao) {
-
- fun getHomework(semester: Semester, date: LocalDate): Maybe> {
- return homeworkDb.loadAll(semester.semesterId, semester.studentId, date).filter { !it.isEmpty() }
- }
-
- fun saveHomework(homework: List) {
- homeworkDb.insertAll(homework)
- }
-
- fun deleteHomework(homework: List) {
- homeworkDb.deleteAll(homework)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/local/MessagesLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/local/MessagesLocal.kt
deleted file mode 100644
index 531cd8b0..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/local/MessagesLocal.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-import io.github.wulkanowy.data.db.dao.MessagesDao
-import io.github.wulkanowy.data.db.entities.Message
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.MessagesRepository
-import io.reactivex.Maybe
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MessagesLocal @Inject constructor(private val messagesDb: MessagesDao) {
-
- fun getMessage(studentId: Int, id: Int): Maybe {
- return messagesDb.loadOne(studentId, id)
- }
-
- fun getMessages(studentId: Int, folder: MessagesRepository.MessageFolder): Maybe> {
- return when (folder) {
- MessagesRepository.MessageFolder.TRASHED -> messagesDb.loadDeleted(studentId)
- else -> messagesDb.load(studentId, folder.id)
- }.filter { !it.isEmpty() }
- }
-
- fun getNewMessages(student: Student): Maybe> {
- return messagesDb.loadNewMessages(student.studentId)
- }
-
- fun saveMessages(messages: List): List {
- return messagesDb.insertAll(messages)
- }
-
- fun updateMessage(message: Message) {
- return messagesDb.update(message)
- }
-
- fun updateMessages(messages: List) {
- return messagesDb.updateAll(messages)
- }
-
- fun deleteMessages(messages: List) {
- messagesDb.deleteAll(messages)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/local/NoteLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/local/NoteLocal.kt
deleted file mode 100644
index 543eab9b..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/local/NoteLocal.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package io.github.wulkanowy.data.repositories.local
-
-import io.github.wulkanowy.data.db.dao.NoteDao
-import io.github.wulkanowy.data.db.entities.Note
-import io.github.wulkanowy.data.db.entities.Semester
-import io.reactivex.Completable
-import io.reactivex.Maybe
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class NoteLocal @Inject constructor(private val noteDb: NoteDao) {
-
- fun getNotes(semester: Semester): Maybe