Merge branch 'hotfix-3.0.3'

This commit is contained in:
Kuba Szczodrzyński 2019-09-26 22:36:28 +02:00
commit 3a6087e421
4 changed files with 68 additions and 15 deletions

View File

@ -31,6 +31,14 @@
</head>
<body>
<h3>Wersja 3.0.3, 2019-09-26</h3>
<ul>
<li>Librus: poprawka kilku błędów synchronizacji.</li>
<li>Vulcan: prawidłowe oznaczanie wiadomości jako przeczytana.</li>
<li>Vulcan: poprawiona synchronizacja wiadomości i frekwencji.</li>
<li>Vulcan: poprawka błędów logowania.</li>
</ul>
<h3>Wersja 3.0.2, 2019-09-24</h3>
<ul>
<li>Librus: pobieranie Bieżących ocen opisowych.</li>

View File

@ -435,6 +435,10 @@ public class Librus implements EdziennikInterface {
callback.onProgress(PROGRESS_STEP);
index++;
}
if (index > targetEndpoints.size()) {
finish();
return;
}
d(TAG, "Called r("+type+", "+endpoint+"). Getting "+targetEndpoints.get(index));
switch (targetEndpoints.get(index)) {
case "Me":
@ -1667,11 +1671,32 @@ public class Librus implements EdziennikInterface {
continue;
}
Time startTime = null;
Time endTime = null;
try {
startTime = Time.fromH_m(lesson.get(substitution && !cancelled ? "OrgHourFrom" : "HourFrom").getAsString());
endTime = Time.fromH_m(lesson.get(substitution && !cancelled ? "OrgHourTo" : "HourTo").getAsString());
}
catch (Exception ignore) {
try {
JsonElement lessonNo;
if (!((lessonNo = lesson.get("LessonNo")) instanceof JsonNull)) {
Pair<Time, Time> timePair = lessonRanges.get(strToInt(lessonNo.getAsString()));
if (timePair != null) {
startTime = timePair.first;
endTime = timePair.second;
}
}
}
catch (Exception ignore2) { }
}
Lesson lessonObject = new Lesson(
profileId,
lesson.get("DayNo").getAsInt() - 1,
Time.fromH_m(lesson.get(substitution && !cancelled ? "OrgHourFrom" : "HourFrom").getAsString()),
Time.fromH_m(lesson.get(substitution && !cancelled ? "OrgHourTo" : "HourTo").getAsString())
startTime,
endTime
);
JsonElement subject;
@ -1716,7 +1741,7 @@ public class Librus implements EdziennikInterface {
r("finish", "Substitutions");
return;
}
JsonArray substitutions = data.get("Substitutions").getAsJsonArray();
try {
List<Long> ignoreList = new ArrayList<>();
@ -2409,7 +2434,15 @@ public class Librus implements EdziennikInterface {
long teacherId = grade.get("AddedBy").getAsJsonObject().get("Id").getAsLong();
int semester = grade.get("Semester").getAsInt();
long subjectId = grade.get("Subject").getAsJsonObject().get("Id").getAsLong();
String description = grade.get("Map").getAsString();
JsonElement map = grade.get("Map");
JsonElement realGrade = grade.get("RealGradeValue");
String description = "";
if (map != null) {
description = map.getAsString();
}
else if (realGrade != null) {
description = realGrade.getAsString();
}
long categoryId = -1;
JsonElement skillEl = grade.get("Skill");

View File

@ -113,6 +113,7 @@ public class Vulcan implements EdziennikInterface {
private static final String ENDPOINT_ATTENDANCES = "mobile-api/Uczen.v3.Uczen/Frekwencje";
private static final String ENDPOINT_MESSAGES_RECEIVED = "mobile-api/Uczen.v3.Uczen/WiadomosciOdebrane";
private static final String ENDPOINT_MESSAGES_SENT = "mobile-api/Uczen.v3.Uczen/WiadomosciWyslane";
private static final String ENDPOINT_MESSAGES_CHANGE_STATUS = "mobile-api/Uczen.v3.Uczen/ZmienStatusWiadomosci";
private static final String ENDPOINT_PUSH = "mobile-api/Uczen.v3.Uczen/UstawPushToken";
private static final String userAgent = "MobileUserAgent";
@ -427,8 +428,10 @@ public class Vulcan implements EdziennikInterface {
app.db.noticeDao().clearForSemester(profileId, studentSemesterNumber);
app.db.noticeDao().addAll(noticeList);
}
if (attendanceList.size() > 0)
if (attendanceList.size() > 0) {
app.db.attendanceDao().clearAfterDate(profileId, getCurrentSemesterStartDate());
app.db.attendanceDao().addAll(attendanceList);
}
if (messageList.size() > 0)
app.db.messageDao().addAllIgnore(messageList);
if (messageRecipientList.size() > 0)
@ -742,7 +745,7 @@ public class Vulcan implements EdziennikInterface {
studentLoginId = account.get("UzytkownikLoginId").getAsInt();
studentClassId = account.get("IdOddzial").getAsInt();
studentSemesterId = account.get("IdOkresKlasyfikacyjny").getAsInt();
String studentClassName = account.get("OddzialKod").getAsString();
String studentClassName = account.get("OkresPoziom").getAsInt()+account.get("OddzialSymbol").getAsString();
targetProfile.putStudentData("userName", account.get("UzytkownikNazwa").getAsString());
targetProfile.putStudentData("schoolName", schoolName);
targetProfile.putStudentData("schoolSymbol", schoolSymbol);
@ -1240,9 +1243,9 @@ public class Vulcan implements EdziennikInterface {
Grade gradeObject = new Grade(
profileId,
id,
finalDescription,
color,
category,
color,
finalDescription,
finalName,
finalValue,
weight,
@ -1459,7 +1462,7 @@ public class Vulcan implements EdziennikInterface {
private void getAttendances() {
callback.onActionStarted(R.string.sync_action_syncing_attendances);
JsonObject json = new JsonObject();
json.addProperty("DataPoczatkowa", profile.getEmpty() ? getCurrentSemesterStartDate().getStringY_m_d() : oneMonthBack.getStringY_m_d());
json.addProperty("DataPoczatkowa", true ? getCurrentSemesterStartDate().getStringY_m_d() : oneMonthBack.getStringY_m_d());
json.addProperty("DataKoncowa", getCurrentSemesterEndDate().getStringY_m_d());
json.addProperty("IdOddzial", studentClassId);
json.addProperty("IdUczen", studentId);
@ -1506,8 +1509,8 @@ public class Vulcan implements EdziennikInterface {
private void getMessagesInbox() {
callback.onActionStarted(R.string.sync_action_syncing_messages_inbox);
JsonObject json = new JsonObject();
json.addProperty("DataPoczatkowa", profile.getEmpty() ? getCurrentSemesterStartDate().getInUnix() : oneMonthBack.getInUnix());
json.addProperty("DataKoncowa", Date.getToday().getInUnix());
json.addProperty("DataPoczatkowa", true ? getCurrentSemesterStartDate().getInUnix() : oneMonthBack.getInUnix());
json.addProperty("DataKoncowa", getCurrentSemesterEndDate().getInUnix());
json.addProperty("LoginId", studentLoginId);
json.addProperty("IdUczen", studentId);
apiRequest(schoolSymbol+"/"+ENDPOINT_MESSAGES_RECEIVED, json, result -> {
@ -1557,8 +1560,8 @@ public class Vulcan implements EdziennikInterface {
}
callback.onActionStarted(R.string.sync_action_syncing_messages_outbox);
JsonObject json = new JsonObject();
json.addProperty("DataPoczatkowa", profile.getEmpty() ? getCurrentSemesterStartDate().getInUnix() : oneMonthBack.getInUnix());
json.addProperty("DataKoncowa", Date.getToday().getInUnix());
json.addProperty("DataPoczatkowa", true ? getCurrentSemesterStartDate().getInUnix() : oneMonthBack.getInUnix());
json.addProperty("DataKoncowa", getCurrentSemesterEndDate().getInUnix());
json.addProperty("LoginId", studentLoginId);
json.addProperty("IdUczen", studentId);
apiRequest(schoolSymbol+"/"+ENDPOINT_MESSAGES_SENT, json, result -> {
@ -1632,6 +1635,15 @@ public class Vulcan implements EdziennikInterface {
recipient.fullName = profile.getStudentNameLong();
}
if (!message.seen) {
studentId = profile.getStudentData("studentId", -1);
studentLoginId = profile.getStudentData("studentLoginId", -1);
JsonObject json = new JsonObject();
json.addProperty("WiadomoscId", message.id);
json.addProperty("FolderWiadomosci", "Odebrane");
json.addProperty("Status", "Widoczna");
json.addProperty("LoginId", studentLoginId);
json.addProperty("IdUczen", studentId);
apiRequest(schoolSymbol+"/"+ENDPOINT_MESSAGES_CHANGE_STATUS, json, result -> { });
app.db.metadataDao().setSeen(profile.getId(), message, true);
if (message.type != TYPE_SENT) {
app.db.messageRecipientDao().add(new MessageRecipient(profile.getId(), -1, -1, System.currentTimeMillis(), message.id));

View File

@ -5,8 +5,8 @@ buildscript {
kotlin_version = '1.3.50'
release = [
versionName: "3.0.2",
versionCode: 3000299
versionName: "3.0.3",
versionCode: 3000399
]
setup = [