mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
Add basic getting school free days in API
This commit is contained in:
parent
a4db208dfd
commit
e344be0fa1
@ -199,6 +199,7 @@ public class Librus implements EdziennikInterface {
|
|||||||
private boolean enableDescriptiveGrades = false;
|
private boolean enableDescriptiveGrades = false;
|
||||||
private boolean enableTextGrades = false;
|
private boolean enableTextGrades = false;
|
||||||
private boolean enableBehaviourGrades = true;
|
private boolean enableBehaviourGrades = true;
|
||||||
|
private long unitId = -1;
|
||||||
private int startPointsSemester1 = 0;
|
private int startPointsSemester1 = 0;
|
||||||
private int startPointsSemester2 = 0;
|
private int startPointsSemester2 = 0;
|
||||||
|
|
||||||
@ -346,6 +347,7 @@ public class Librus implements EdziennikInterface {
|
|||||||
targetEndpoints.add("Events");
|
targetEndpoints.add("Events");
|
||||||
targetEndpoints.add("CustomTypes");
|
targetEndpoints.add("CustomTypes");
|
||||||
targetEndpoints.add("PtMeetings");
|
targetEndpoints.add("PtMeetings");
|
||||||
|
targetEndpoints.add("SchoolFreeDays");
|
||||||
break;
|
break;
|
||||||
case FEATURE_GRADES:
|
case FEATURE_GRADES:
|
||||||
targetEndpoints.add("SavedGradeCategories");
|
targetEndpoints.add("SavedGradeCategories");
|
||||||
@ -534,6 +536,9 @@ public class Librus implements EdziennikInterface {
|
|||||||
case "TeacherFreeDays":
|
case "TeacherFreeDays":
|
||||||
getTeacherFreeDays();
|
getTeacherFreeDays();
|
||||||
break;
|
break;
|
||||||
|
case "SchoolFreeDays":
|
||||||
|
getSchoolFreeDays();
|
||||||
|
break;
|
||||||
case "MessagesLogin":
|
case "MessagesLogin":
|
||||||
getMessagesLogin();
|
getMessagesLogin();
|
||||||
break;
|
break;
|
||||||
@ -1403,7 +1408,8 @@ public class Librus implements EdziennikInterface {
|
|||||||
}
|
}
|
||||||
JsonElement unit = myClass.get("Unit");
|
JsonElement unit = myClass.get("Unit");
|
||||||
if (unit != null && !(unit instanceof JsonNull)) {
|
if (unit != null && !(unit instanceof JsonNull)) {
|
||||||
profile.putStudentData("unitId", unit.getAsJsonObject().get("Id").getAsLong());
|
unitId = unit.getAsJsonObject().get("Id").getAsLong();
|
||||||
|
profile.putStudentData("unitId", unitId);
|
||||||
}
|
}
|
||||||
r("finish", "Classes");
|
r("finish", "Classes");
|
||||||
}
|
}
|
||||||
@ -3071,6 +3077,26 @@ public class Librus implements EdziennikInterface {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getSchoolFreeDays() {
|
||||||
|
callback.onActionStarted(R.string.sync_action_syncing_school_free_days);
|
||||||
|
apiRequest("SchoolFreeDays" + (unitId != -1 ? "?unit=" + unitId : ""), data -> {
|
||||||
|
if (data == null) {
|
||||||
|
r("finish", "SchoolFreeDays");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
JsonArray jFreeDays = data.get("SchoolFreeDays").getAsJsonArray();
|
||||||
|
|
||||||
|
for (JsonElement freeDayEl: jFreeDays) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
r("finish", "SchoolFreeDays");
|
||||||
|
} catch (Exception e) {
|
||||||
|
finishWithError(new AppError(TAG, 3069, CODE_OTHER, e, data));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void getMessagesLogin() {
|
private void getMessagesLogin() {
|
||||||
if (synergiaPassword == null) {
|
if (synergiaPassword == null) {
|
||||||
// skip messages
|
// skip messages
|
||||||
|
@ -908,4 +908,5 @@
|
|||||||
<string name="settings_about_discord_text">Serwer Discord</string>
|
<string name="settings_about_discord_text">Serwer Discord</string>
|
||||||
<string name="settings_about_discord_subtext">Dołącz do naszego serwera Discord!</string>
|
<string name="settings_about_discord_subtext">Dołącz do naszego serwera Discord!</string>
|
||||||
<string name="menu_debug">Debugowanie</string>
|
<string name="menu_debug">Debugowanie</string>
|
||||||
|
<string name="sync_action_syncing_school_free_days">Pobieranie dni wolnych szkoły</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user