forked from github/szkolny
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 enableTextGrades = false;
|
||||
private boolean enableBehaviourGrades = true;
|
||||
private long unitId = -1;
|
||||
private int startPointsSemester1 = 0;
|
||||
private int startPointsSemester2 = 0;
|
||||
|
||||
@ -346,6 +347,7 @@ public class Librus implements EdziennikInterface {
|
||||
targetEndpoints.add("Events");
|
||||
targetEndpoints.add("CustomTypes");
|
||||
targetEndpoints.add("PtMeetings");
|
||||
targetEndpoints.add("SchoolFreeDays");
|
||||
break;
|
||||
case FEATURE_GRADES:
|
||||
targetEndpoints.add("SavedGradeCategories");
|
||||
@ -534,6 +536,9 @@ public class Librus implements EdziennikInterface {
|
||||
case "TeacherFreeDays":
|
||||
getTeacherFreeDays();
|
||||
break;
|
||||
case "SchoolFreeDays":
|
||||
getSchoolFreeDays();
|
||||
break;
|
||||
case "MessagesLogin":
|
||||
getMessagesLogin();
|
||||
break;
|
||||
@ -1403,7 +1408,8 @@ public class Librus implements EdziennikInterface {
|
||||
}
|
||||
JsonElement unit = myClass.get("Unit");
|
||||
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");
|
||||
}
|
||||
@ -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() {
|
||||
if (synergiaPassword == null) {
|
||||
// skip messages
|
||||
@ -3668,4 +3694,4 @@ public class Librus implements EdziennikInterface {
|
||||
public MessagesComposeInfo getComposeInfo(@NonNull ProfileFull profile) {
|
||||
return new MessagesComposeInfo(0, 0, 150, 20000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -908,4 +908,5 @@
|
||||
<string name="settings_about_discord_text">Serwer Discord</string>
|
||||
<string name="settings_about_discord_subtext">Dołącz do naszego serwera Discord!</string>
|
||||
<string name="menu_debug">Debugowanie</string>
|
||||
<string name="sync_action_syncing_school_free_days">Pobieranie dni wolnych szkoły</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user