mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-18 12:56:45 -06:00
commit
ce0f2f74df
@ -29,22 +29,22 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".messages.MessagesComposeActivity"
|
||||
android:name="pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/messages_compose_title"
|
||||
android:theme="@style/AppTheme.Black" />
|
||||
<activity
|
||||
android:name=".activities.FeedbackActivity"
|
||||
android:name=".ui.modules.base.FeedbackActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" />
|
||||
<activity
|
||||
android:name=".login.LoginActivity"
|
||||
android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/AppTheme.Light" />
|
||||
<activity
|
||||
android:name=".intro.ChangelogIntroActivity"
|
||||
android:name=".ui.modules.intro.ChangelogIntroActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Intro" />
|
||||
@ -57,7 +57,7 @@
|
||||
|_| |_|_| \___|_.__/ \__,_|___/\___/
|
||||
-->
|
||||
<activity
|
||||
android:name=".activities.CrashActivity"
|
||||
android:name=".ui.modules.base.CrashActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:process=":error_activity"
|
||||
android:theme="@style/DeadTheme" />
|
||||
@ -72,7 +72,7 @@
|
||||
|___/
|
||||
-->
|
||||
<activity
|
||||
android:name=".activities.CrashGtfoActivity"
|
||||
android:name=".ui.modules.base.CrashGtfoActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:theme="@style/DeadTheme" />
|
||||
<activity
|
||||
@ -103,7 +103,7 @@
|
||||
android:theme="@style/AppTheme.NoDisplay" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.SettingsLicenseActivity"
|
||||
android:name=".ui.modules.settings.SettingsLicenseActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
@ -113,14 +113,14 @@
|
||||
android:theme="@style/Base.Theme.AppCompat" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.WebPushConfigActivity"
|
||||
android:name=".ui.modules.webpush.WebPushConfigActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:theme="@style/AppTheme.Dark" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.CounterActivity"
|
||||
android:name=".ui.modules.home.CounterActivity"
|
||||
android:theme="@style/AppTheme.Black" />
|
||||
<activity android:name=".activities.QrScannerActivity" />
|
||||
<activity android:name=".ui.modules.webpush.QrScannerActivity" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
@ -231,4 +231,4 @@
|
||||
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
@ -63,18 +63,18 @@ import me.leolin.shortcutbadger.ShortcutBadger;
|
||||
import okhttp3.ConnectionSpec;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.TlsVersion;
|
||||
import pl.szczodrzynski.edziennik.activities.CrashActivity;
|
||||
import pl.szczodrzynski.edziennik.api.Edziennik;
|
||||
import pl.szczodrzynski.edziennik.api.Iuczniowie;
|
||||
import pl.szczodrzynski.edziennik.api.Librus;
|
||||
import pl.szczodrzynski.edziennik.api.Mobidziennik;
|
||||
import pl.szczodrzynski.edziennik.api.Vulcan;
|
||||
import pl.szczodrzynski.edziennik.datamodels.AppDb;
|
||||
import pl.szczodrzynski.edziennik.datamodels.DebugLog;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile;
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.models.AppConfig;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.base.CrashActivity;
|
||||
import pl.szczodrzynski.edziennik.data.api.Edziennik;
|
||||
import pl.szczodrzynski.edziennik.data.api.Iuczniowie;
|
||||
import pl.szczodrzynski.edziennik.data.api.Librus;
|
||||
import pl.szczodrzynski.edziennik.data.api.Mobidziennik;
|
||||
import pl.szczodrzynski.edziennik.data.api.Vulcan;
|
||||
import pl.szczodrzynski.edziennik.data.db.AppDb;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.debuglog.DebugLog;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.utils.models.AppConfig;
|
||||
import pl.szczodrzynski.edziennik.network.NetworkUtils;
|
||||
import pl.szczodrzynski.edziennik.network.TLSSocketFactory;
|
||||
import pl.szczodrzynski.edziennik.receivers.JobsCreator;
|
||||
@ -83,8 +83,8 @@ import pl.szczodrzynski.edziennik.utils.PermissionChecker;
|
||||
import pl.szczodrzynski.edziennik.utils.Themes;
|
||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_VULCAN;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_VULCAN;
|
||||
|
||||
public class App extends androidx.multidex.MultiDexApplication {
|
||||
private static final String TAG = "App";
|
||||
|
@ -9,8 +9,8 @@ import android.os.Bundle
|
||||
import androidx.core.app.ActivityCompat
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonObject
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile
|
||||
import pl.szczodrzynski.edziennik.datamodels.Teacher
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher
|
||||
import pl.szczodrzynski.navlib.R
|
||||
import pl.szczodrzynski.navlib.crc16
|
||||
import pl.szczodrzynski.navlib.getColorFromRes
|
||||
|
@ -19,7 +19,7 @@ import com.mikepenz.iconics.typeface.library.community.material.CommunityMateria
|
||||
import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont
|
||||
import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
|
||||
import pl.szczodrzynski.edziennik.datamodels.Metadata.*
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.*
|
||||
import pl.szczodrzynski.edziennik.utils.Themes
|
||||
import pl.szczodrzynski.navlib.NavView
|
||||
import pl.szczodrzynski.navlib.SystemBarsUtil
|
||||
@ -41,22 +41,35 @@ import com.mikepenz.materialdrawer.model.ProfileDrawerItem
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IProfile
|
||||
import pl.droidsonroids.gif.GifDrawable
|
||||
import pl.szczodrzynski.edziennik.App.APP_URL
|
||||
import pl.szczodrzynski.edziennik.api.AppError
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.*
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.*
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback
|
||||
import pl.szczodrzynski.edziennik.databinding.ActivitySzkolnyBinding
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull
|
||||
import pl.szczodrzynski.edziennik.dialogs.ChangelogDialog
|
||||
import pl.szczodrzynski.edziennik.fragments.*
|
||||
import pl.szczodrzynski.edziennik.homework.HomeworkFragment
|
||||
import pl.szczodrzynski.edziennik.login.LoginActivity
|
||||
import pl.szczodrzynski.edziennik.messages.MessagesDetailsFragment
|
||||
import pl.szczodrzynski.edziennik.messages.MessagesFragment
|
||||
import pl.szczodrzynski.edziennik.models.NavTarget
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.changelog.ChangelogDialog
|
||||
import pl.szczodrzynski.edziennik.ui.modules.homework.HomeworkFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity
|
||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesDetailsFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesFragment
|
||||
import pl.szczodrzynski.edziennik.utils.models.NavTarget
|
||||
import pl.szczodrzynski.edziennik.network.ServerRequest
|
||||
import pl.szczodrzynski.edziennik.sync.SyncJob
|
||||
import pl.szczodrzynski.edziennik.ui.modules.agenda.AgendaDefaultFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.announcements.AnnouncementsFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.base.DebugFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.base.FeedbackFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.base.HelpFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.grades.editor.GradesEditorFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.grades.GradesFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.behaviour.BehaviourFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.notifications.NotificationsFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.settings.ProfileManagerFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsNewFragment
|
||||
import pl.szczodrzynski.edziennik.ui.modules.timetable.TimetableFragment
|
||||
import pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoTouch
|
||||
import pl.szczodrzynski.edziennik.utils.Utils
|
||||
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
|
||||
@ -85,8 +98,8 @@ class MainActivity : AppCompatActivity() {
|
||||
const val DRAWER_ITEM_GRADES = 13
|
||||
const val DRAWER_ITEM_MESSAGES = 17
|
||||
const val DRAWER_ITEM_HOMEWORK = 14
|
||||
const val DRAWER_ITEM_NOTICES = 15
|
||||
const val DRAWER_ITEM_ATTENDANCES = 16
|
||||
const val DRAWER_ITEM_BEHAVIOUR = 15
|
||||
const val DRAWER_ITEM_ATTENDANCE = 16
|
||||
const val DRAWER_ITEM_ANNOUNCEMENTS = 18
|
||||
const val DRAWER_ITEM_NOTIFICATIONS = 20
|
||||
const val DRAWER_ITEM_SETTINGS = 101
|
||||
@ -110,17 +123,17 @@ class MainActivity : AppCompatActivity() {
|
||||
.isStatic(true)
|
||||
.withPopToHome(false)
|
||||
|
||||
list += NavTarget(DRAWER_ITEM_TIMETABLE, R.string.menu_timetable, RegisterTimetableFragment::class)
|
||||
list += NavTarget(DRAWER_ITEM_TIMETABLE, R.string.menu_timetable, TimetableFragment::class)
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_timetable)
|
||||
.withBadgeTypeId(TYPE_LESSON_CHANGE)
|
||||
.isInDrawer(true)
|
||||
|
||||
list += NavTarget(DRAWER_ITEM_AGENDA, R.string.menu_agenda, RegisterAgendaDefaultFragment::class)
|
||||
list += NavTarget(DRAWER_ITEM_AGENDA, R.string.menu_agenda, AgendaDefaultFragment::class)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_calendar)
|
||||
.withBadgeTypeId(TYPE_EVENT)
|
||||
.isInDrawer(true)
|
||||
|
||||
list += NavTarget(DRAWER_ITEM_GRADES, R.string.menu_grades, RegisterGradesFragment::class)
|
||||
list += NavTarget(DRAWER_ITEM_GRADES, R.string.menu_grades, GradesFragment::class)
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_numeric_5_box)
|
||||
.withBadgeTypeId(TYPE_GRADE)
|
||||
.isInDrawer(true)
|
||||
@ -135,24 +148,24 @@ class MainActivity : AppCompatActivity() {
|
||||
.withBadgeTypeId(TYPE_HOMEWORK)
|
||||
.isInDrawer(true)
|
||||
|
||||
list += NavTarget(DRAWER_ITEM_NOTICES, R.string.menu_notices, RegisterNoticesFragment::class)
|
||||
list += NavTarget(DRAWER_ITEM_BEHAVIOUR, R.string.menu_notices, BehaviourFragment::class)
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_message_alert)
|
||||
.withBadgeTypeId(TYPE_NOTICE)
|
||||
.isInDrawer(true)
|
||||
|
||||
list += NavTarget(DRAWER_ITEM_ATTENDANCES, R.string.menu_attendances, RegisterAttendancesFragment::class)
|
||||
list += NavTarget(DRAWER_ITEM_ATTENDANCE, R.string.menu_attendance, AttendanceFragment::class)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_calendar_remove)
|
||||
.withBadgeTypeId(TYPE_ATTENDANCE)
|
||||
.isInDrawer(true)
|
||||
|
||||
list += NavTarget(DRAWER_ITEM_ANNOUNCEMENTS, R.string.menu_announcements, RegisterAnnouncementsFragment::class)
|
||||
list += NavTarget(DRAWER_ITEM_ANNOUNCEMENTS, R.string.menu_announcements, AnnouncementsFragment::class)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_bulletin_board)
|
||||
.withBadgeTypeId(TYPE_ANNOUNCEMENT)
|
||||
.isInDrawer(true)
|
||||
|
||||
|
||||
// static drawer items
|
||||
list += NavTarget(DRAWER_ITEM_NOTIFICATIONS, R.string.menu_notifications, RegisterNotificationsFragment::class)
|
||||
list += NavTarget(DRAWER_ITEM_NOTIFICATIONS, R.string.menu_notifications, NotificationsFragment::class)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_bell_ring)
|
||||
.isInDrawer(true)
|
||||
.isStatic(true)
|
||||
@ -524,8 +537,8 @@ class MainActivity : AppCompatActivity() {
|
||||
DRAWER_ITEM_AGENDA -> FEATURE_AGENDA
|
||||
DRAWER_ITEM_GRADES -> FEATURE_GRADES
|
||||
DRAWER_ITEM_HOMEWORK -> FEATURE_HOMEWORK
|
||||
DRAWER_ITEM_NOTICES -> FEATURE_NOTICES
|
||||
DRAWER_ITEM_ATTENDANCES -> FEATURE_ATTENDANCES
|
||||
DRAWER_ITEM_BEHAVIOUR -> FEATURE_NOTICES
|
||||
DRAWER_ITEM_ATTENDANCE -> FEATURE_ATTENDANCE
|
||||
DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) {
|
||||
1 -> FEATURE_MESSAGES_OUTBOX
|
||||
else -> FEATURE_MESSAGES_INBOX
|
||||
@ -540,8 +553,8 @@ class MainActivity : AppCompatActivity() {
|
||||
DRAWER_ITEM_AGENDA -> R.string.sync_feature_agenda
|
||||
DRAWER_ITEM_GRADES -> R.string.sync_feature_grades
|
||||
DRAWER_ITEM_HOMEWORK -> R.string.sync_feature_homework
|
||||
DRAWER_ITEM_NOTICES -> R.string.sync_feature_notices
|
||||
DRAWER_ITEM_ATTENDANCES -> R.string.sync_feature_attendances
|
||||
DRAWER_ITEM_BEHAVIOUR -> R.string.sync_feature_notices
|
||||
DRAWER_ITEM_ATTENDANCE -> R.string.sync_feature_attendance
|
||||
DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) {
|
||||
1 -> R.string.sync_feature_messages_outbox
|
||||
else -> R.string.sync_feature_messages_inbox
|
||||
|
@ -16,9 +16,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
import pl.szczodrzynski.edziennik.receivers.BootReceiver;
|
||||
import pl.szczodrzynski.edziennik.sync.SyncJob;
|
||||
import pl.szczodrzynski.edziennik.sync.SyncService;
|
||||
@ -221,7 +221,7 @@ public class Notifier {
|
||||
| . ` |/ _ \| __| | _| |/ __/ _` | __| |/ _ \| '_ \
|
||||
| |\ | (_) | |_| | | | | (_| (_| | |_| | (_) | | | |
|
||||
|_| \_|\___/ \__|_|_| |_|\___\__,_|\__|_|\___/|_| |*/
|
||||
public void add(pl.szczodrzynski.edziennik.models.Notification notification) {
|
||||
public void add(pl.szczodrzynski.edziennik.utils.models.Notification notification) {
|
||||
app.appConfig.notifications.add(notification);
|
||||
}
|
||||
|
||||
@ -235,8 +235,8 @@ public class Notifier {
|
||||
}
|
||||
|
||||
int unreadCount = 0;
|
||||
List<pl.szczodrzynski.edziennik.models.Notification> notificationList = new ArrayList<>();
|
||||
for (pl.szczodrzynski.edziennik.models.Notification notification: app.appConfig.notifications) {
|
||||
List<pl.szczodrzynski.edziennik.utils.models.Notification> notificationList = new ArrayList<>();
|
||||
for (pl.szczodrzynski.edziennik.utils.models.Notification notification: app.appConfig.notifications) {
|
||||
if (!notification.notified) {
|
||||
notification.seen = false;
|
||||
notification.notified = true;
|
||||
@ -250,7 +250,7 @@ public class Notifier {
|
||||
}
|
||||
}
|
||||
|
||||
for (pl.szczodrzynski.edziennik.models.Notification notification: notificationList) {
|
||||
for (pl.szczodrzynski.edziennik.utils.models.Notification notification: notificationList) {
|
||||
Intent intent = new Intent(app, MainActivity.class);
|
||||
notification.fillIntent(intent);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(app, notification.id, intent, 0);
|
||||
@ -258,9 +258,9 @@ public class Notifier {
|
||||
// title, text, type, date
|
||||
.setContentTitle(notification.title)
|
||||
.setContentText(notification.text)
|
||||
.setSubText(pl.szczodrzynski.edziennik.models.Notification.stringType(app, notification.type))
|
||||
.setSubText(pl.szczodrzynski.edziennik.utils.models.Notification.stringType(app, notification.type))
|
||||
.setWhen(notification.addedDate)
|
||||
.setTicker(app.getString(R.string.notification_ticker_format, pl.szczodrzynski.edziennik.models.Notification.stringType(app, notification.type)))
|
||||
.setTicker(app.getString(R.string.notification_ticker_format, pl.szczodrzynski.edziennik.utils.models.Notification.stringType(app, notification.type)))
|
||||
// icon, color, lights, priority
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setColor(notificationColor)
|
||||
@ -349,7 +349,7 @@ public class Notifier {
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
for (pl.szczodrzynski.edziennik.models.Notification notification: app.appConfig.notifications) {
|
||||
for (pl.szczodrzynski.edziennik.utils.models.Notification notification: app.appConfig.notifications) {
|
||||
Log.d(TAG, "Profile"+notification.profileId+" Notification from "+ Date.fromMillis(notification.addedDate).getFormattedString()+" "+ Time.fromMillis(notification.addedDate).getStringHMS()+" - "+notification.text);
|
||||
}
|
||||
}
|
||||
|
@ -28,22 +28,22 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.datamodels.EventFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LessonFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile;
|
||||
import pl.szczodrzynski.edziennik.fragments.HomeFragment;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.ItemWidgetTimetableModel;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.models.Week;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.ItemWidgetTimetableModel;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Week;
|
||||
import pl.szczodrzynski.edziennik.widgets.WidgetConfig;
|
||||
import pl.szczodrzynski.edziennik.sync.SyncJob;
|
||||
import pl.szczodrzynski.edziennik.widgets.timetable.LessonDetailsActivity;
|
||||
import pl.szczodrzynski.edziennik.widgets.timetable.WidgetTimetableService;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.ExtensionsKt.filterOutArchived;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
||||
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
package pl.szczodrzynski.edziennik.api.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
|
||||
|
||||
public interface MessageListCallback {
|
||||
void onSuccess(List<MessageFull> messageList);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package pl.szczodrzynski.edziennik.api.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.datamodels.Teacher;
|
||||
|
||||
public interface RecipientListGetCallback {
|
||||
void onSuccess(List<Teacher> teacherList);
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2
|
||||
|
||||
import pl.szczodrzynski.edziennik.api.AppError
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
|
||||
data class ApiLoginResult(val loginStore: LoginStore, val error: AppError?)
|
@ -1,6 +0,0 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2
|
||||
|
||||
import pl.szczodrzynski.edziennik.api.AppError
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile
|
||||
|
||||
data class FirstLoginResult(val profileList: ArrayList<Profile>, val error: AppError?)
|
@ -1,10 +0,0 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.librus.data
|
||||
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile
|
||||
|
||||
class DataLibrus(val app: App, val profile: Profile, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) {
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.librus.firstlogin
|
||||
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile
|
||||
|
||||
class FirstLoginLibrus(val app: App, val loginStore: LoginStore, val progressCallback: ProgressCallback, val onSuccess: (profileList: List<Profile>) -> Unit) {
|
||||
init {
|
||||
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.librus.firstlogin
|
||||
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile
|
||||
|
||||
class FirstLoginSynergia(val app: App, val loginStore: LoginStore, val progressCallback: ProgressCallback, val onSuccess: (profileList: List<Profile>) -> Unit) {
|
||||
init {
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api;
|
||||
package pl.szczodrzynski.edziennik.data.api;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api;
|
||||
package pl.szczodrzynski.edziennik.data.api;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
@ -43,27 +43,27 @@ import pl.szczodrzynski.edziennik.BuildConfig;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.MainActivity;
|
||||
import pl.szczodrzynski.edziennik.WidgetTimetable;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.datamodels.AnnouncementFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Attendance;
|
||||
import pl.szczodrzynski.edziennik.datamodels.AttendanceFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Event;
|
||||
import pl.szczodrzynski.edziennik.datamodels.EventFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.EventType;
|
||||
import pl.szczodrzynski.edziennik.datamodels.GradeFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LessonFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Message;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Metadata;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Notice;
|
||||
import pl.szczodrzynski.edziennik.datamodels.NoticeFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile;
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Team;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Notification;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.announcements.AnnouncementFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.AttendanceFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventType;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.NoticeFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Notification;
|
||||
import pl.szczodrzynski.edziennik.network.ServerRequest;
|
||||
import pl.szczodrzynski.edziennik.sync.SyncJob;
|
||||
import pl.szczodrzynski.edziennik.utils.Themes;
|
||||
@ -75,34 +75,34 @@ import static com.mikepenz.iconics.utils.IconicsConvertersKt.colorInt;
|
||||
import static com.mikepenz.iconics.utils.IconicsConvertersKt.sizeDp;
|
||||
import static pl.szczodrzynski.edziennik.App.APP_URL;
|
||||
import static pl.szczodrzynski.edziennik.MainActivity.DRAWER_ITEM_HOME;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OK;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_PROFILE_ARCHIVED;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_PROFILE_NOT_FOUND;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.stringErrorCode;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.stringErrorType;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_AGENDA;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ALL;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ANNOUNCEMENTS;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ATTENDANCES;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_GRADES;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_INBOX;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_OUTBOX;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_NOTICES;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_TIMETABLE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_IUCZNIOWIE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_LIBRUS;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_VULCAN;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Profile.REGISTRATION_ENABLED;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OK;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_PROFILE_ARCHIVED;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_PROFILE_NOT_FOUND;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.stringErrorCode;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.stringErrorType;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_AGENDA;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ALL;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ANNOUNCEMENTS;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ATTENDANCE;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_GRADES;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_INBOX;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_OUTBOX;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_NOTICES;
|
||||
import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_TIMETABLE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_IUCZNIOWIE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_LIBRUS;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_VULCAN;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile.REGISTRATION_ENABLED;
|
||||
import static pl.szczodrzynski.edziennik.sync.SyncService.PROFILE_MAX_PROGRESS;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.d;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.ns;
|
||||
@ -354,7 +354,7 @@ public class Edziennik {
|
||||
app.notifier.add(new Notification(app.getContext(), text)
|
||||
.withProfileData(profile.getId(), profile.getName())
|
||||
.withType(Notification.TYPE_NEW_NOTICE)
|
||||
.withFragmentRedirect(MainActivity.DRAWER_ITEM_NOTICES)
|
||||
.withFragmentRedirect(MainActivity.DRAWER_ITEM_BEHAVIOUR)
|
||||
.withLongExtra("noticeId", notice.id)
|
||||
.withAddedDate(notice.addedDate)
|
||||
);
|
||||
@ -382,7 +382,7 @@ public class Edziennik {
|
||||
app.notifier.add(new Notification(app.getContext(), text)
|
||||
.withProfileData(profile.getId(), profile.getName())
|
||||
.withType(Notification.TYPE_NEW_ATTENDANCE)
|
||||
.withFragmentRedirect(MainActivity.DRAWER_ITEM_ATTENDANCES)
|
||||
.withFragmentRedirect(MainActivity.DRAWER_ITEM_ATTENDANCE)
|
||||
.withLongExtra("attendanceId", attendance.id)
|
||||
.withAddedDate(attendance.addedDate)
|
||||
);
|
||||
@ -849,7 +849,7 @@ public class Edziennik {
|
||||
app.getString(R.string.menu_grades),
|
||||
app.getString(R.string.menu_homework),
|
||||
app.getString(R.string.menu_notices),
|
||||
app.getString(R.string.menu_attendances),
|
||||
app.getString(R.string.menu_attendance),
|
||||
app.getString(R.string.title_messages_inbox_single),
|
||||
app.getString(R.string.title_messages_sent_single),
|
||||
app.getString(R.string.menu_announcements)
|
||||
@ -860,7 +860,7 @@ public class Edziennik {
|
||||
FEATURE_GRADES,
|
||||
FEATURE_HOMEWORK,
|
||||
FEATURE_NOTICES,
|
||||
FEATURE_ATTENDANCES,
|
||||
FEATURE_ATTENDANCE,
|
||||
FEATURE_MESSAGES_INBOX,
|
||||
FEATURE_MESSAGES_OUTBOX,
|
||||
FEATURE_ANNOUNCEMENTS
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api;
|
||||
package pl.szczodrzynski.edziennik.data.api;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
@ -34,58 +34,58 @@ import okhttp3.HttpUrl;
|
||||
import pl.szczodrzynski.edziennik.App;
|
||||
import pl.szczodrzynski.edziennik.BuildConfig;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.AttachmentGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.LoginCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.MessageGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.RecipientListGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Announcement;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Attendance;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Event;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Grade;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Lesson;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LuckyNumber;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Message;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageRecipient;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageRecipientFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Metadata;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Notice;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile;
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Subject;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Teacher;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Team;
|
||||
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Endpoint;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.models.Week;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.AttachmentGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.LoginCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.MessageGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.RecipientListGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumber;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Endpoint;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Week;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_INVALID_LOGIN;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_INVALID_SCHOOL_NAME;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_MAINTENANCE;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_RELEASED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CANCELLED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_DELETED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEGATIVE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEUTRAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_POSITIVE;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_INVALID_LOGIN;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_INVALID_SCHOOL_NAME;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_MAINTENANCE;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_DELETED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEGATIVE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEUTRAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_POSITIVE;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.crc16;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.crc32;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.d;
|
||||
@ -200,7 +200,7 @@ public class Iuczniowie implements EdziennikInterface {
|
||||
targetEndpoints.add("Exams");
|
||||
targetEndpoints.add("Notices");
|
||||
targetEndpoints.add("Announcements");
|
||||
targetEndpoints.add("Attendances");
|
||||
targetEndpoints.add("Attendance");
|
||||
targetEndpoints.add("MessagesInbox");
|
||||
targetEndpoints.add("MessagesOutbox");
|
||||
targetEndpoints.add("Finish");
|
||||
@ -241,8 +241,8 @@ public class Iuczniowie implements EdziennikInterface {
|
||||
case FEATURE_NOTICES:
|
||||
targetEndpoints.add("Notices");
|
||||
break;
|
||||
case FEATURE_ATTENDANCES:
|
||||
targetEndpoints.add("Attendances");
|
||||
case FEATURE_ATTENDANCE:
|
||||
targetEndpoints.add("Attendance");
|
||||
break;
|
||||
case FEATURE_MESSAGES_INBOX:
|
||||
targetEndpoints.add("MessagesInbox");
|
||||
@ -300,9 +300,9 @@ public class Iuczniowie implements EdziennikInterface {
|
||||
}
|
||||
}
|
||||
|
||||
this.attendancesMonth = today.month;
|
||||
this.attendancesYear = today.year;
|
||||
this.attendancesPrevMonthChecked = false;
|
||||
this.attendanceMonth = today.month;
|
||||
this.attendanceYear = today.year;
|
||||
this.attendancePrevMonthChecked = false;
|
||||
this.examsMonth = today.month;
|
||||
this.examsYear = today.year;
|
||||
this.examsMonthsChecked = 0;
|
||||
@ -352,8 +352,8 @@ public class Iuczniowie implements EdziennikInterface {
|
||||
case "Announcements":
|
||||
getAnnouncements();
|
||||
break;
|
||||
case "Attendances":
|
||||
getAttendances();
|
||||
case "Attendance":
|
||||
getAttendance();
|
||||
break;
|
||||
case "MessagesInbox":
|
||||
getMessagesInbox();
|
||||
@ -1196,17 +1196,17 @@ public class Iuczniowie implements EdziennikInterface {
|
||||
});
|
||||
}
|
||||
|
||||
private int attendancesYear;
|
||||
private int attendancesMonth;
|
||||
private boolean attendancesPrevMonthChecked = false;
|
||||
private void getAttendances() {
|
||||
callback.onActionStarted(R.string.sync_action_syncing_attendances);
|
||||
private int attendanceYear;
|
||||
private int attendanceMonth;
|
||||
private boolean attendancePrevMonthChecked = false;
|
||||
private void getAttendance() {
|
||||
callback.onActionStarted(R.string.sync_action_syncing_attendance);
|
||||
apiRequest(Request.builder()
|
||||
.url(IDZIENNIK_URL +"/mod_panelRodzica/obecnosci/WS_obecnosciUcznia.asmx/pobierzObecnosciUcznia")
|
||||
.userAgent(userAgent)
|
||||
.addParameter("idPozDziennika", loginRegisterId)
|
||||
.addParameter("mc", attendancesMonth)
|
||||
.addParameter("rok", attendancesYear)
|
||||
.addParameter("mc", attendanceMonth)
|
||||
.addParameter("rok", attendanceYear)
|
||||
.addParameter("dataTygodnia", "")
|
||||
.postJson(), (result, response) -> {
|
||||
JsonObject data = result.getAsJsonObject("d");
|
||||
@ -1281,25 +1281,25 @@ public class Iuczniowie implements EdziennikInterface {
|
||||
}
|
||||
}
|
||||
|
||||
int attendancesDateValue = attendancesYear*10000 + attendancesMonth*100;
|
||||
if (profile.getEmpty() && attendancesDateValue > profile.getSemesterStart(1).getValue()) {
|
||||
attendancesPrevMonthChecked = true; // do not need to check prev month later
|
||||
attendancesMonth--;
|
||||
if (attendancesMonth < 1) {
|
||||
attendancesMonth = 12;
|
||||
attendancesYear--;
|
||||
int attendanceDateValue = attendanceYear *10000 + attendanceMonth *100;
|
||||
if (profile.getEmpty() && attendanceDateValue > profile.getSemesterStart(1).getValue()) {
|
||||
attendancePrevMonthChecked = true; // do not need to check prev month later
|
||||
attendanceMonth--;
|
||||
if (attendanceMonth < 1) {
|
||||
attendanceMonth = 12;
|
||||
attendanceYear--;
|
||||
}
|
||||
r("get", "Attendances");
|
||||
} else if (!attendancesPrevMonthChecked /* get also the previous month */) {
|
||||
attendancesMonth--;
|
||||
if (attendancesMonth < 1) {
|
||||
attendancesMonth = 12;
|
||||
attendancesYear--;
|
||||
r("get", "Attendance");
|
||||
} else if (!attendancePrevMonthChecked /* get also the previous month */) {
|
||||
attendanceMonth--;
|
||||
if (attendanceMonth < 1) {
|
||||
attendanceMonth = 12;
|
||||
attendanceYear--;
|
||||
}
|
||||
attendancesPrevMonthChecked = true;
|
||||
r("get", "Attendances");
|
||||
attendancePrevMonthChecked = true;
|
||||
r("get", "Attendance");
|
||||
} else {
|
||||
r("finish", "Attendances");
|
||||
r("finish", "Attendance");
|
||||
}
|
||||
});
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api;
|
||||
package pl.szczodrzynski.edziennik.data.api;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
@ -45,39 +45,39 @@ import im.wangchao.mhttp.callback.TextCallbackHandler;
|
||||
import pl.szczodrzynski.edziennik.App;
|
||||
import pl.szczodrzynski.edziennik.BuildConfig;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.AttachmentGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.LoginCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.MessageGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.RecipientListGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.api.v2.models.DataStore;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Announcement;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Attendance;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Event;
|
||||
import pl.szczodrzynski.edziennik.datamodels.EventType;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Grade;
|
||||
import pl.szczodrzynski.edziennik.datamodels.GradeCategory;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Lesson;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LuckyNumber;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Message;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageRecipient;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageRecipientFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Metadata;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Notice;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile;
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Subject;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Teacher;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Team;
|
||||
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Endpoint;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.models.Week;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.AttachmentGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.LoginCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.MessageGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.RecipientListGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.models.DataStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventType;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumber;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Endpoint;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Week;
|
||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||
|
||||
import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
|
||||
@ -86,44 +86,44 @@ import static java.net.HttpURLConnection.HTTP_GONE;
|
||||
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
|
||||
import static java.net.HttpURLConnection.HTTP_OK;
|
||||
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_INVALID_LOGIN;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_LIBRUS_DISCONNECTED;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_LIBRUS_NOT_ACTIVATED;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_MAINTENANCE;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_PROFILE_NOT_FOUND;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_SYNERGIA_NOT_ACTIVATED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_RELEASED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_PT_MEETING;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_TEACHER_ABSENCE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_NORMAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CANCELLED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEGATIVE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEUTRAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_POSITIVE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_EDUCATOR;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_LIBRARIAN;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_PARENTS_COUNCIL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_PEDAGOGUE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_SCHOOL_ADMIN;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_SCHOOL_PARENTS_COUNCIL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_SECRETARIAT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_SUPER_ADMIN;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_TEACHER;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_INVALID_LOGIN;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_LIBRUS_DISCONNECTED;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_LIBRUS_NOT_ACTIVATED;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_MAINTENANCE;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_PROFILE_NOT_FOUND;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_SYNERGIA_NOT_ACTIVATED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_PT_MEETING;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_TEACHER_ABSENCE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_NORMAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEGATIVE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEUTRAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_POSITIVE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_EDUCATOR;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_LIBRARIAN;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_PARENTS_COUNCIL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_PEDAGOGUE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_SCHOOL_ADMIN;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_SCHOOL_PARENTS_COUNCIL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_SECRETARIAT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_SUPER_ADMIN;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_TEACHER;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.c;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.contains;
|
||||
@ -297,8 +297,8 @@ public class Librus implements EdziennikInterface {
|
||||
targetEndpoints.add("Homework");
|
||||
targetEndpoints.add("LuckyNumbers");
|
||||
targetEndpoints.add("Notices");
|
||||
targetEndpoints.add("AttendancesTypes");
|
||||
targetEndpoints.add("Attendances");
|
||||
targetEndpoints.add("AttendanceTypes");
|
||||
targetEndpoints.add("Attendance");
|
||||
targetEndpoints.add("Announcements");
|
||||
targetEndpoints.add("PtMeetings");
|
||||
|
||||
@ -371,9 +371,9 @@ public class Librus implements EdziennikInterface {
|
||||
case FEATURE_NOTICES:
|
||||
targetEndpoints.add("Notices");
|
||||
break;
|
||||
case FEATURE_ATTENDANCES:
|
||||
targetEndpoints.add("AttendancesTypes");
|
||||
targetEndpoints.add("Attendances");
|
||||
case FEATURE_ATTENDANCE:
|
||||
targetEndpoints.add("AttendanceTypes");
|
||||
targetEndpoints.add("Attendance");
|
||||
break;
|
||||
case FEATURE_MESSAGES_INBOX:
|
||||
if (!hasMessagesLogin) {
|
||||
@ -527,11 +527,11 @@ public class Librus implements EdziennikInterface {
|
||||
case "Notices":
|
||||
getNotices();
|
||||
break;
|
||||
case "AttendancesTypes":
|
||||
getAttendancesTypes();
|
||||
case "AttendanceTypes":
|
||||
getAttendanceTypes();
|
||||
break;
|
||||
case "Attendances":
|
||||
getAttendances();
|
||||
case "Attendance":
|
||||
getAttendance();
|
||||
break;
|
||||
case "Announcements":
|
||||
getAnnouncements();
|
||||
@ -2888,11 +2888,11 @@ public class Librus implements EdziennikInterface {
|
||||
}
|
||||
|
||||
private SparseArray<Pair<Integer, String>> attendanceTypes = new SparseArray<>();
|
||||
private void getAttendancesTypes() {
|
||||
private void getAttendanceTypes() {
|
||||
callback.onActionStarted(R.string.sync_action_syncing_attendance_types);
|
||||
apiRequest("Attendances/Types", data -> {
|
||||
if (data == null) {
|
||||
r("finish", "AttendancesTypes");
|
||||
r("finish", "AttendanceTypes");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@ -2907,7 +2907,7 @@ public class Librus implements EdziennikInterface {
|
||||
)
|
||||
);
|
||||
}
|
||||
r("finish", "AttendancesTypes");
|
||||
r("finish", "AttendanceTypes");
|
||||
}
|
||||
catch (Exception e) {
|
||||
finishWithError(new AppError(TAG, 2782, CODE_OTHER, e, data));
|
||||
@ -2915,18 +2915,18 @@ public class Librus implements EdziennikInterface {
|
||||
});
|
||||
}
|
||||
|
||||
private void getAttendances() {
|
||||
callback.onActionStarted(R.string.sync_action_syncing_attendances);
|
||||
private void getAttendance() {
|
||||
callback.onActionStarted(R.string.sync_action_syncing_attendance);
|
||||
apiRequest("Attendances"+(fullSync ? "" : "?dateFrom="+ Date.getToday().stepForward(0, -1, 0).getStringY_m_d()), data -> {
|
||||
if (data == null) {
|
||||
r("finish", "Attendances");
|
||||
r("finish", "Attendance");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
JsonArray jAttendances = data.get("Attendances").getAsJsonArray();
|
||||
JsonArray jAttendance = data.get("Attendances").getAsJsonArray();
|
||||
|
||||
for (JsonElement attendanceEl : jAttendances) {
|
||||
for (JsonElement attendanceEl : jAttendance) {
|
||||
JsonObject attendance = attendanceEl.getAsJsonObject();
|
||||
|
||||
int type = attendance.getAsJsonObject("Type").get("Id").getAsInt();
|
||||
@ -2992,7 +2992,7 @@ public class Librus implements EdziennikInterface {
|
||||
metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), addedDate));
|
||||
}
|
||||
}
|
||||
r("finish", "Attendances");
|
||||
r("finish", "Attendance");
|
||||
}
|
||||
catch (Exception e) {
|
||||
finishWithError(new AppError(TAG, 2872, CODE_OTHER, e, data));
|
||||
@ -3380,7 +3380,7 @@ public class Librus implements EdziennikInterface {
|
||||
configurableEndpoints.put("Homework", new Endpoint("Homework",true, false, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("LuckyNumbers", new Endpoint("LuckyNumbers",true, false, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("Notices", new Endpoint("Notices",true, false, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("Attendances", new Endpoint("Attendances",true, false, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("Attendance", new Endpoint("Attendance",true, false, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("Announcements", new Endpoint("Announcements",true, true, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("PtMeetings", new Endpoint("PtMeetings",true, true, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("TeacherFreeDays", new Endpoint("TeacherFreeDays",false, false, profile.getChangedEndpoints()));
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api;
|
||||
package pl.szczodrzynski.edziennik.data.api;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
@ -40,59 +40,59 @@ import im.wangchao.mhttp.callback.TextCallbackHandler;
|
||||
import pl.szczodrzynski.edziennik.App;
|
||||
import pl.szczodrzynski.edziennik.BuildConfig;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.AttachmentGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.LoginCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.MessageGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.RecipientListGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Attendance;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Event;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Grade;
|
||||
import pl.szczodrzynski.edziennik.datamodels.GradeCategory;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Lesson;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LuckyNumber;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Message;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageRecipient;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageRecipientFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Metadata;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Notice;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile;
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Subject;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Teacher;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Team;
|
||||
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Endpoint;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.models.Week;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.AttachmentGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.LoginCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.MessageGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.RecipientListGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumber;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Endpoint;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Week;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_INVALID_LOGIN;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_MAINTENANCE;
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_CUSTOM;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_RELEASED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_DEFAULT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_EXAM;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_SHORT_QUIZ;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_DELETED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_INVALID_LOGIN;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_MAINTENANCE;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_CUSTOM;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_DEFAULT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_EXAM;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_SHORT_QUIZ;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_DELETED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.crc16;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.d;
|
||||
@ -150,7 +150,7 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
private String loginPassword = null;
|
||||
private int studentId = -1;
|
||||
|
||||
private long attendancesLastSync = 0;
|
||||
private long attendanceLastSync = 0;
|
||||
|
||||
private boolean prepare(@NonNull Context activityContext, @NonNull SyncCallback callback, int profileId, @Nullable Profile profile, @NonNull LoginStore loginStore) {
|
||||
this.activityContext = activityContext;
|
||||
@ -171,7 +171,7 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
return false;
|
||||
}
|
||||
this.studentId = profile == null ? -1 : profile.getStudentData("studentId", -1);
|
||||
this.attendancesLastSync = profile == null ? 0 : profile.getStudentData("attendancesLastSync", (long)0);
|
||||
this.attendanceLastSync = profile == null ? 0 : profile.getStudentData("attendanceLastSync", (long)0);
|
||||
fakeLogin = BuildConfig.DEBUG && loginUsername.toLowerCase().startsWith("fake");
|
||||
|
||||
teamList = profileId == -1 ? new ArrayList<>() : app.db.teamDao().getAllNow(profileId);
|
||||
@ -204,7 +204,7 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
targetEndpoints = new ArrayList<>();
|
||||
targetEndpoints.add("GetData");
|
||||
targetEndpoints.add("ProcessData");
|
||||
targetEndpoints.add("Attendances");
|
||||
targetEndpoints.add("Attendance");
|
||||
targetEndpoints.add("ClassCalendar");
|
||||
targetEndpoints.add("GradeDetails");
|
||||
targetEndpoints.add("NoticeDetails");
|
||||
@ -256,8 +256,8 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
case FEATURE_NOTICES:
|
||||
targetEndpoints.add("NoticeDetails");
|
||||
break;
|
||||
case FEATURE_ATTENDANCES:
|
||||
targetEndpoints.add("Attendances");
|
||||
case FEATURE_ATTENDANCE:
|
||||
targetEndpoints.add("Attendance");
|
||||
break;
|
||||
case FEATURE_MESSAGES_INBOX:
|
||||
targetEndpoints.add("MessagesInbox");
|
||||
@ -314,8 +314,8 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
case "NoticeDetails":
|
||||
getNoticeDetails();
|
||||
break;
|
||||
case "Attendances":
|
||||
getAttendances();
|
||||
case "Attendance":
|
||||
getAttendance();
|
||||
break;
|
||||
case "Messages":
|
||||
getAllMessages();
|
||||
@ -597,7 +597,7 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
processLessons(table);
|
||||
}
|
||||
if (i == 16) {
|
||||
processAttendances(table);
|
||||
processAttendance(table);
|
||||
}
|
||||
if (i == 17) {
|
||||
processNotices(table);
|
||||
@ -1051,20 +1051,20 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
this.lessonId = lessonId;
|
||||
}
|
||||
}
|
||||
private Date attendancesCheckDate = Week.getWeekStart();
|
||||
private void getAttendances() {
|
||||
r("finish", "Attendances");
|
||||
// TODO: 2019-09-10 please download attendances from /dziennik/frekwencja. /mobile does not work above v13.0
|
||||
private Date attendanceCheckDate = Week.getWeekStart();
|
||||
private void getAttendance() {
|
||||
r("finish", "Attendance");
|
||||
// TODO: 2019-09-10 please download attendance from /dziennik/frekwencja. /mobile does not work above v13.0
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
callback.onActionStarted(R.string.sync_action_syncing_attendances);
|
||||
d(TAG, "Get attendances for week "+attendancesCheckDate.getStringY_m_d());
|
||||
callback.onActionStarted(R.string.sync_action_syncing_attendance);
|
||||
d(TAG, "Get attendance for week "+ attendanceCheckDate.getStringY_m_d());
|
||||
Request.builder()
|
||||
.url(fakeLogin ? "https://szkolny.eu/mobimobi/mobi_mod_frekwencja.php" : "https://" + loginServerName + ".mobidziennik.pl/mobile/frekwencja")
|
||||
.userAgent(System.getProperty("http.agent"))
|
||||
.addParameter("uczen", studentId)
|
||||
.addParameter("data_poniedzialek", attendancesCheckDate.getStringY_m_d())
|
||||
.addParameter("data_poniedzialek", attendanceCheckDate.getStringY_m_d())
|
||||
.post()
|
||||
.callback(new TextCallbackHandler() {
|
||||
@Override
|
||||
@ -1076,11 +1076,11 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
public void onSuccess(String data, Response response) {
|
||||
// just skip any failures here
|
||||
if (data == null || data.equals("")) {
|
||||
r("finish", "Attendances");
|
||||
r("finish", "Attendance");
|
||||
return;
|
||||
}
|
||||
if (data.contains("nie-pamietam-hasla")) {
|
||||
r("finish", "Attendances");
|
||||
r("finish", "Attendance");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1135,7 +1135,7 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
continue;
|
||||
AttendanceLessonRange range = ranges.get(currentIndex);
|
||||
|
||||
Date date = attendancesCheckDate.clone().stepForward(0, 0, range.weekDay);
|
||||
Date date = attendanceCheckDate.clone().stepForward(0, 0, range.weekDay);
|
||||
long addedDate = date.combineWith(range.startTime);
|
||||
|
||||
int markerIndex = 0;
|
||||
@ -1201,7 +1201,7 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
markerIndex++;
|
||||
attendanceList.add(attendanceObject);
|
||||
if (attendanceObject.type != TYPE_PRESENT) {
|
||||
boolean markAsRead = onlyFeature == FEATURE_ATTENDANCES && attendancesLastSync == 0;
|
||||
boolean markAsRead = onlyFeature == FEATURE_ATTENDANCE && attendanceLastSync == 0;
|
||||
metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty() || markAsRead, profile.getEmpty() || markAsRead, addedDate));
|
||||
}
|
||||
}
|
||||
@ -1209,40 +1209,40 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
} catch (Exception e) {
|
||||
Crashlytics.logException(e);
|
||||
e.printStackTrace();
|
||||
if (onlyFeature == FEATURE_ATTENDANCES)
|
||||
if (onlyFeature == FEATURE_ATTENDANCE)
|
||||
finishWithError(new AppError(TAG, 955, CODE_OTHER, response, e, data));
|
||||
else
|
||||
r("finish", "Attendances");
|
||||
r("finish", "Attendance");
|
||||
return;
|
||||
}
|
||||
|
||||
if (onlyFeature == FEATURE_ATTENDANCES) {
|
||||
// syncing attendances exclusively
|
||||
if (attendancesLastSync == 0) {
|
||||
// first sync - get attendances until it's start of the school year
|
||||
attendancesLastSync = profile.getSemesterStart(1).getInMillis();
|
||||
if (onlyFeature == FEATURE_ATTENDANCE) {
|
||||
// syncing attendance exclusively
|
||||
if (attendanceLastSync == 0) {
|
||||
// first sync - get attendance until it's start of the school year
|
||||
attendanceLastSync = profile.getSemesterStart(1).getInMillis();
|
||||
}
|
||||
Date lastSyncDate = Date.fromMillis(attendancesLastSync);
|
||||
Date lastSyncDate = Date.fromMillis(attendanceLastSync);
|
||||
lastSyncDate.stepForward(0, 0, -7);
|
||||
if (lastSyncDate.getValue() < attendancesCheckDate.getValue()) {
|
||||
attendancesCheckDate.stepForward(0, 0, -7);
|
||||
r("get", "Attendances");
|
||||
if (lastSyncDate.getValue() < attendanceCheckDate.getValue()) {
|
||||
attendanceCheckDate.stepForward(0, 0, -7);
|
||||
r("get", "Attendance");
|
||||
}
|
||||
else {
|
||||
profile.putStudentData("attendancesLastSync", System.currentTimeMillis());
|
||||
r("finish", "Attendances");
|
||||
profile.putStudentData("attendanceLastSync", System.currentTimeMillis());
|
||||
r("finish", "Attendance");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (attendancesLastSync != 0) {
|
||||
if (attendanceLastSync != 0) {
|
||||
// not a first sync
|
||||
Date lastSyncDate = Date.fromMillis(attendancesLastSync);
|
||||
Date lastSyncDate = Date.fromMillis(attendanceLastSync);
|
||||
lastSyncDate.stepForward(0, 0, 2);
|
||||
if (lastSyncDate.getValue() >= attendancesCheckDate.getValue()) {
|
||||
profile.putStudentData("attendancesLastSync", System.currentTimeMillis());
|
||||
if (lastSyncDate.getValue() >= attendanceCheckDate.getValue()) {
|
||||
profile.putStudentData("attendanceLastSync", System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
r("finish", "Attendances");
|
||||
r("finish", "Attendance");
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1675,12 +1675,12 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
}
|
||||
}
|
||||
|
||||
private void processAttendances(String table)
|
||||
private void processAttendance(String table)
|
||||
{
|
||||
if (true)
|
||||
return;
|
||||
String[] attendances = table.split("\n");
|
||||
for (String attendanceStr: attendances)
|
||||
String[] attendanceList = table.split("\n");
|
||||
for (String attendanceStr: attendanceList)
|
||||
{
|
||||
if (attendanceStr.isEmpty()) {
|
||||
continue;
|
||||
@ -1718,7 +1718,7 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
mobiLesson.date,
|
||||
mobiLesson.startTime,
|
||||
type);
|
||||
attendanceList.add(attendanceObject);
|
||||
this.attendanceList.add(attendanceObject);
|
||||
metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), System.currentTimeMillis()));
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api;
|
||||
package pl.szczodrzynski.edziennik.data.api;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
@ -35,57 +35,57 @@ import okhttp3.OkHttpClient;
|
||||
import okio.Buffer;
|
||||
import pl.szczodrzynski.edziennik.App;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.AttachmentGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.LoginCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.MessageGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.RecipientListGetCallback;
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Attendance;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Event;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Grade;
|
||||
import pl.szczodrzynski.edziennik.datamodels.GradeCategory;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Lesson;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Message;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageRecipient;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageRecipientFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Metadata;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Notice;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile;
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Subject;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Teacher;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Team;
|
||||
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Endpoint;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.models.Week;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.AttachmentGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.LoginCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.MessageGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.RecipientListGetCallback;
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Endpoint;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Week;
|
||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_RELEASED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_EXAM;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_SHORT_QUIZ;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CANCELLED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_VULCAN;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_MESSAGE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEUTRAL;
|
||||
import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED_EXCUSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_EXAM;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_SHORT_QUIZ;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_PROPOSED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_VULCAN;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_MESSAGE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEUTRAL;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.c;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.crc16;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.d;
|
||||
@ -110,7 +110,7 @@ public class Vulcan implements EdziennikInterface {
|
||||
private static final String ENDPOINT_EVENTS = "mobile-api/Uczen.v3.Uczen/Sprawdziany";
|
||||
private static final String ENDPOINT_HOMEWORK = "mobile-api/Uczen.v3.Uczen/ZadaniaDomowe";
|
||||
private static final String ENDPOINT_NOTICES = "mobile-api/Uczen.v3.Uczen/UwagiUcznia";
|
||||
private static final String ENDPOINT_ATTENDANCES = "mobile-api/Uczen.v3.Uczen/Frekwencje";
|
||||
private static final String ENDPOINT_ATTENDANCE = "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";
|
||||
@ -261,7 +261,7 @@ public class Vulcan implements EdziennikInterface {
|
||||
targetEndpoints.add("Events");
|
||||
targetEndpoints.add("Homework");
|
||||
targetEndpoints.add("Notices");
|
||||
targetEndpoints.add("Attendances");
|
||||
targetEndpoints.add("Attendance");
|
||||
targetEndpoints.add("MessagesInbox");
|
||||
targetEndpoints.add("MessagesOutbox");
|
||||
targetEndpoints.add("Finish");
|
||||
@ -303,8 +303,8 @@ public class Vulcan implements EdziennikInterface {
|
||||
case FEATURE_NOTICES:
|
||||
targetEndpoints.add("Notices");
|
||||
break;
|
||||
case FEATURE_ATTENDANCES:
|
||||
targetEndpoints.add("Attendances");
|
||||
case FEATURE_ATTENDANCE:
|
||||
targetEndpoints.add("Attendance");
|
||||
break;
|
||||
case FEATURE_MESSAGES_INBOX:
|
||||
targetEndpoints.add("MessagesInbox");
|
||||
@ -386,8 +386,8 @@ public class Vulcan implements EdziennikInterface {
|
||||
case "Notices":
|
||||
getNotices();
|
||||
break;
|
||||
case "Attendances":
|
||||
getAttendances();
|
||||
case "Attendance":
|
||||
getAttendance();
|
||||
break;
|
||||
case "MessagesInbox":
|
||||
getMessagesInbox();
|
||||
@ -1459,18 +1459,18 @@ public class Vulcan implements EdziennikInterface {
|
||||
});
|
||||
}
|
||||
|
||||
private void getAttendances() {
|
||||
callback.onActionStarted(R.string.sync_action_syncing_attendances);
|
||||
private void getAttendance() {
|
||||
callback.onActionStarted(R.string.sync_action_syncing_attendance);
|
||||
JsonObject json = new JsonObject();
|
||||
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);
|
||||
json.addProperty("IdOkresKlasyfikacyjny", studentSemesterId);
|
||||
apiRequest(schoolSymbol+"/"+ENDPOINT_ATTENDANCES, json, result -> {
|
||||
JsonArray attendances = result.getAsJsonObject("Data").getAsJsonArray("Frekwencje");
|
||||
apiRequest(schoolSymbol+"/"+ ENDPOINT_ATTENDANCE, json, result -> {
|
||||
JsonArray attendanceList = result.getAsJsonObject("Data").getAsJsonArray("Frekwencje");
|
||||
|
||||
for (JsonElement attendanceEl: attendances) {
|
||||
for (JsonElement attendanceEl: attendanceList) {
|
||||
JsonObject attendance = attendanceEl.getAsJsonObject();
|
||||
|
||||
Pair<Integer, String> attendanceCategory = attendanceCategories.get(attendance.get("IdKategoria").getAsInt());
|
||||
@ -1497,12 +1497,12 @@ public class Vulcan implements EdziennikInterface {
|
||||
lessonRanges.get(attendance.get("IdPoraLekcji").getAsInt()).first,
|
||||
type);
|
||||
|
||||
attendanceList.add(attendanceObject);
|
||||
this.attendanceList.add(attendanceObject);
|
||||
if (attendanceObject.type != TYPE_PRESENT) {
|
||||
metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), attendanceObject.lessonDate.combineWith(attendanceObject.startTime)));
|
||||
}
|
||||
}
|
||||
r("finish", "Attendances");
|
||||
r("finish", "Attendance");
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api.interfaces;
|
||||
package pl.szczodrzynski.edziennik.data.api.interfaces;
|
||||
|
||||
import im.wangchao.mhttp.Request;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api.interfaces;
|
||||
package pl.szczodrzynski.edziennik.data.api.interfaces;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
@ -6,13 +6,13 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Message;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile;
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.models.Endpoint;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Endpoint;
|
||||
|
||||
public interface EdziennikInterface {
|
||||
|
||||
@ -36,7 +36,7 @@ public interface EdziennikInterface {
|
||||
int FEATURE_GRADES = 3;
|
||||
int FEATURE_HOMEWORK = 4;
|
||||
int FEATURE_NOTICES = 5;
|
||||
int FEATURE_ATTENDANCES = 6;
|
||||
int FEATURE_ATTENDANCE = 6;
|
||||
int FEATURE_MESSAGES_INBOX = 7;
|
||||
int FEATURE_MESSAGES_OUTBOX = 8;
|
||||
int FEATURE_ANNOUNCEMENTS = 9;
|
||||
@ -60,7 +60,7 @@ public interface EdziennikInterface {
|
||||
*
|
||||
* Updates a database-saved {@code teacherList} with {@code loginId}s.
|
||||
*
|
||||
* A {@link pl.szczodrzynski.edziennik.datamodels.Teacher} is considered as a recipient when its {@code loginId} is not null.
|
||||
* A {@link Teacher} is considered as a recipient when its {@code loginId} is not null.
|
||||
*
|
||||
* May be executed on any thread.
|
||||
*
|
@ -1,10 +1,10 @@
|
||||
package pl.szczodrzynski.edziennik.api.interfaces;
|
||||
package pl.szczodrzynski.edziennik.data.api.interfaces;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import pl.szczodrzynski.edziennik.api.AppError;
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError;
|
||||
|
||||
public interface ErrorCallback {
|
||||
void onError(Context activityContext, @NonNull AppError error);
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api.interfaces;
|
||||
package pl.szczodrzynski.edziennik.data.api.interfaces;
|
||||
|
||||
public interface LoginCallback {
|
||||
void onSuccess();
|
@ -1,7 +1,6 @@
|
||||
package pl.szczodrzynski.edziennik.api.interfaces;
|
||||
package pl.szczodrzynski.edziennik.data.api.interfaces;
|
||||
|
||||
import pl.szczodrzynski.edziennik.datamodels.Message;
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
|
||||
|
||||
/**
|
||||
* Callback containing a {@link MessageFull} which already has its {@code body} and {@code recipients}.
|
@ -0,0 +1,9 @@
|
||||
package pl.szczodrzynski.edziennik.data.api.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
|
||||
|
||||
public interface MessageListCallback {
|
||||
void onSuccess(List<MessageFull> messageList);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api.interfaces;
|
||||
package pl.szczodrzynski.edziennik.data.api.interfaces;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
@ -0,0 +1,9 @@
|
||||
package pl.szczodrzynski.edziennik.data.api.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
|
||||
|
||||
public interface RecipientListGetCallback {
|
||||
void onSuccess(List<Teacher> teacherList);
|
||||
}
|
@ -1,15 +1,12 @@
|
||||
package pl.szczodrzynski.edziennik.api.interfaces;
|
||||
package pl.szczodrzynski.edziennik.data.api.interfaces;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import pl.szczodrzynski.edziennik.api.AppError;
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile;
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
|
||||
/**
|
||||
* A callback used for error reporting, progress information.
|
@ -0,0 +1,6 @@
|
||||
package pl.szczodrzynski.edziennik.data.api.v2
|
||||
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
|
||||
data class ApiLoginResult(val loginStore: LoginStore, val error: AppError?)
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2
|
||||
package pl.szczodrzynski.edziennik.data.api.v2
|
||||
|
||||
const val FEATURE_ALL = 0
|
||||
const val FEATURE_TIMETABLE = 1
|
||||
@ -6,7 +6,7 @@ const val FEATURE_AGENDA = 2
|
||||
const val FEATURE_GRADES = 3
|
||||
const val FEATURE_HOMEWORK = 4
|
||||
const val FEATURE_NOTICES = 5
|
||||
const val FEATURE_ATTENDANCES = 6
|
||||
const val FEATURE_ATTENDANCE = 6
|
||||
const val FEATURE_MESSAGES_INBOX = 7
|
||||
const val FEATURE_MESSAGES_OUTBOX = 8
|
||||
const val FEATURE_ANNOUNCEMENTS = 9
|
@ -0,0 +1,6 @@
|
||||
package pl.szczodrzynski.edziennik.data.api.v2
|
||||
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
|
||||
|
||||
data class FirstLoginResult(val profileList: ArrayList<Profile>, val error: AppError?)
|
@ -1,26 +1,26 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.librus
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.librus
|
||||
|
||||
import android.content.Context
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.api.AppError
|
||||
import pl.szczodrzynski.edziennik.api.AppError.*
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.*
|
||||
import pl.szczodrzynski.edziennik.api.v2.LOGIN_MODE_LIBRUS_EMAIL
|
||||
import pl.szczodrzynski.edziennik.api.v2.LOGIN_MODE_LIBRUS_JST
|
||||
import pl.szczodrzynski.edziennik.api.v2.LOGIN_MODE_LIBRUS_SYNERGIA
|
||||
import pl.szczodrzynski.edziennik.api.v2.librus.firstlogin.FirstLoginLibrus
|
||||
import pl.szczodrzynski.edziennik.api.v2.librus.firstlogin.FirstLoginSynergia
|
||||
import pl.szczodrzynski.edziennik.api.v2.librus.login.LoginJst
|
||||
import pl.szczodrzynski.edziennik.api.v2.librus.login.LoginLibrus
|
||||
import pl.szczodrzynski.edziennik.api.v2.librus.login.LoginSynergia
|
||||
import pl.szczodrzynski.edziennik.api.v2.librus.login.SynergiaTokenExtractor
|
||||
import pl.szczodrzynski.edziennik.api.v2.models.DataStore
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
import pl.szczodrzynski.edziennik.datamodels.MessageFull
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull
|
||||
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo
|
||||
import pl.szczodrzynski.edziennik.models.Endpoint
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError.*
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.*
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.LOGIN_MODE_LIBRUS_EMAIL
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.LOGIN_MODE_LIBRUS_JST
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.LOGIN_MODE_LIBRUS_SYNERGIA
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.librus.firstlogin.FirstLoginLibrus
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.librus.firstlogin.FirstLoginSynergia
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.librus.login.LoginJst
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.librus.login.LoginLibrus
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.librus.login.LoginSynergia
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.librus.login.SynergiaTokenExtractor
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.models.DataStore
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull
|
||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo
|
||||
import pl.szczodrzynski.edziennik.utils.models.Endpoint
|
||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||
import java.lang.Exception
|
||||
|
||||
@ -198,4 +198,4 @@ class Librus(val app: App, val profile: Profile?, val loginStore: LoginStore) :
|
||||
override fun isEndpointEnabled(profile: Profile?, defaultActive: Boolean, name: String?): Boolean {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.librus.data
|
||||
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
|
||||
|
||||
class DataLibrus(val app: App, val profile: Profile, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) {
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.librus.firstlogin
|
||||
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
|
||||
|
||||
class FirstLoginLibrus(val app: App, val loginStore: LoginStore, val progressCallback: ProgressCallback, val onSuccess: (profileList: List<Profile>) -> Unit) {
|
||||
init {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.librus.firstlogin
|
||||
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
|
||||
|
||||
class FirstLoginSynergia(val app: App, val loginStore: LoginStore, val progressCallback: ProgressCallback, val onSuccess: (profileList: List<Profile>) -> Unit) {
|
||||
init {
|
||||
|
||||
}
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.librus.login
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.librus.login
|
||||
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.api.v2.ApiLoginResult
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
|
||||
class LoginJst(val app: App, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) {
|
||||
companion object {
|
||||
private const val TAG = "librus.LoginJst"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.librus.login
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.librus.login
|
||||
|
||||
import android.util.Pair
|
||||
import com.google.gson.JsonObject
|
||||
@ -9,11 +9,11 @@ import im.wangchao.mhttp.callback.JsonCallbackHandler
|
||||
import im.wangchao.mhttp.callback.TextCallbackHandler
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.R
|
||||
import pl.szczodrzynski.edziennik.api.AppError
|
||||
import pl.szczodrzynski.edziennik.api.AppError.*
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.api.v2.*
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError.*
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.*
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
import pl.szczodrzynski.edziennik.getInt
|
||||
import pl.szczodrzynski.edziennik.getString
|
||||
import pl.szczodrzynski.edziennik.utils.Utils.c
|
||||
@ -180,4 +180,4 @@ class LoginLibrus(val app: App, val loginStore: LoginStore, val callback: Progre
|
||||
.build()
|
||||
.enqueue()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.librus.login
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.librus.login
|
||||
|
||||
import pl.szczodrzynski.edziennik.App
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
|
||||
class LoginSynergia(val app: App, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) {
|
||||
companion object {
|
||||
private const val TAG = "librus.LoginSynergia"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.librus.login
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.librus.login
|
||||
|
||||
import com.google.gson.JsonNull
|
||||
import com.google.gson.JsonObject
|
||||
@ -6,13 +6,13 @@ import im.wangchao.mhttp.Request
|
||||
import im.wangchao.mhttp.Response
|
||||
import im.wangchao.mhttp.callback.JsonCallbackHandler
|
||||
import pl.szczodrzynski.edziennik.*
|
||||
import pl.szczodrzynski.edziennik.api.AppError
|
||||
import pl.szczodrzynski.edziennik.api.AppError.*
|
||||
import pl.szczodrzynski.edziennik.api.v2.LIBRUS_USER_AGENT
|
||||
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.api.v2.LIBRUS_ACCOUNT_URL
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore
|
||||
import pl.szczodrzynski.edziennik.datamodels.Profile
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError
|
||||
import pl.szczodrzynski.edziennik.data.api.AppError.*
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.LIBRUS_USER_AGENT
|
||||
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.LIBRUS_ACCOUNT_URL
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
|
||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||
import java.net.HttpURLConnection.*
|
||||
|
||||
@ -107,4 +107,4 @@ class SynergiaTokenExtractor(val app: App, val profile: Profile, val loginStore:
|
||||
.enqueue()
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,25 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.models
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.models
|
||||
|
||||
import android.util.LongSparseArray
|
||||
import androidx.core.util.forEach
|
||||
import androidx.core.util.isNotEmpty
|
||||
import pl.szczodrzynski.edziennik.datamodels.*
|
||||
import pl.szczodrzynski.edziennik.models.Date
|
||||
import pl.szczodrzynski.edziennik.data.db.AppDb
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventType
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teams.Team
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||
|
||||
data class DataStore(private val appDb: AppDb, val profileId: Int) {
|
||||
val teacherList: LongSparseArray<Teacher> = LongSparseArray()
|
||||
@ -115,4 +130,4 @@ data class DataStore(private val appDb: AppDb, val profileId: Int) {
|
||||
if (messageMetadataList.isNotEmpty())
|
||||
appDb.metadataDao().setSeen(messageMetadataList)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.models
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.models
|
||||
|
||||
|
||||
data class Feature(val featureId: Int, val loginOptions: Map<Int, List<Int>>) {
|
||||
@ -7,4 +7,4 @@ data class Feature(val featureId: Int, val loginOptions: Map<Int, List<Int>>) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package pl.szczodrzynski.edziennik.api.v2.models
|
||||
package pl.szczodrzynski.edziennik.data.api.v2.models
|
||||
|
||||
import pl.szczodrzynski.edziennik.api.v2.*
|
||||
import pl.szczodrzynski.edziennik.data.api.v2.*
|
||||
|
||||
val Features = listOf(
|
||||
Feature(FEATURE_TIMETABLE, mapOf(
|
||||
@ -10,4 +10,4 @@ val Features = listOf(
|
||||
LOGIN_MODE_LIBRUS_JST
|
||||
)
|
||||
))
|
||||
)
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db;
|
||||
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
import androidx.room.Database;
|
||||
@ -6,7 +6,53 @@ import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
import androidx.room.TypeConverters;
|
||||
import androidx.room.migration.Migration;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.announcements.AnnouncementDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.AttendanceDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.converters.ConverterDate;
|
||||
import pl.szczodrzynski.edziennik.data.db.converters.ConverterJsonObject;
|
||||
import pl.szczodrzynski.edziennik.data.db.converters.ConverterListLong;
|
||||
import pl.szczodrzynski.edziennik.data.db.converters.ConverterListString;
|
||||
import pl.szczodrzynski.edziennik.data.db.converters.ConverterTime;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.debuglog.DebugLog;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.debuglog.DebugLogDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventType;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventTypeDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.feedback.FeedbackMessage;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.feedback.FeedbackMessageDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategoryDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChangeDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStoreDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumber;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumberDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.MetadataDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.NoticeDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.subjects.SubjectDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.TeacherDao;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teams.TeamDao;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.converters;
|
||||
|
||||
import androidx.room.TypeConverter;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
|
||||
public class ConverterDate {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.converters;
|
||||
|
||||
import androidx.room.TypeConverter;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.converters;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.converters;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
@ -1,8 +1,8 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.converters;
|
||||
|
||||
import androidx.room.TypeConverter;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
|
||||
public class ConverterTime {
|
||||
|
@ -1,11 +1,11 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.announcements;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Ignore;
|
||||
import androidx.room.Index;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
|
||||
@Entity(tableName = "announcements",
|
||||
primaryKeys = {"profileId", "announcementId"},
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.announcements;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -11,7 +11,9 @@ import androidx.room.RawQuery;
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
import androidx.sqlite.db.SupportSQLiteQuery;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_ANNOUNCEMENT;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ANNOUNCEMENT;
|
||||
|
||||
@Dao
|
||||
public abstract class AnnouncementDao {
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.announcements;
|
||||
|
||||
public class AnnouncementFull extends Announcement {
|
||||
public String teacherFullName = "";
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.attendance;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
@ -6,8 +6,8 @@ import androidx.room.Entity;
|
||||
import androidx.room.Ignore;
|
||||
import androidx.room.Index;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
|
||||
@Entity(tableName = "attendances",
|
||||
primaryKeys = {"profileId", "attendanceId", "attendanceLessonDate", "attendanceStartTime"},
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.attendance;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
@ -8,12 +8,11 @@ import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.RawQuery;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_ATTENDANCE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ATTENDANCE;
|
||||
|
||||
@Dao
|
||||
public abstract class AttendanceDao {
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.attendance;
|
||||
|
||||
public class AttendanceFull extends Attendance {
|
||||
public String teacherFullName = "";
|
@ -1,7 +1,6 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.debuglog;
|
||||
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Index;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.d;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.debuglog;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
@ -1,11 +1,11 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.events;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Ignore;
|
||||
import androidx.room.Index;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
|
||||
@Entity(tableName = "events",
|
||||
primaryKeys = {"profileId", "eventId"},
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.events;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
@ -14,12 +14,12 @@ import android.util.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_EVENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_LESSON_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_EVENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_LESSON_CHANGE;
|
||||
|
||||
@Dao
|
||||
public abstract class EventDao {
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.events;
|
||||
|
||||
public class EventFull extends Event {
|
||||
public String typeName = "";
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.events;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
@ -28,4 +28,4 @@ public class EventType {
|
||||
public EventType(int profileId, int id, String name, String color) {
|
||||
this(profileId, id, name, Color.parseColor(color));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.events;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.feedback;
|
||||
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Ignore;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.feedback;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.feedback;
|
||||
|
||||
public class FeedbackMessageWithCount extends FeedbackMessage {
|
||||
public int messageCount = 0;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.grades;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.grades;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.grades;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.grades;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
@ -14,7 +14,7 @@ import android.util.SparseIntArray;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_GRADE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_GRADE;
|
||||
|
||||
@Dao
|
||||
public abstract class GradeDao {
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.grades;
|
||||
|
||||
public class GradeFull extends Grade {
|
||||
//public String category = "";
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.lessons;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -8,8 +8,8 @@ import androidx.room.Ignore;
|
||||
import androidx.room.Index;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.models.Week;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Week;
|
||||
|
||||
@Entity(tableName = "lessons",
|
||||
primaryKeys = {"profileId", "lessonWeekDay", "lessonStartTime", "lessonEndTime"},
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.lessons;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
@ -7,8 +7,8 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
|
||||
@Entity(tableName = "lessonChanges",
|
||||
primaryKeys = {"profileId", "lessonChangeDate", "lessonChangeStartTime", "lessonChangeEndTime"},
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.lessons;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
@ -11,10 +11,10 @@ import androidx.room.RawQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.db.LessonChangeCounter;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.db.LessonChangeCounter;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_LESSON_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_LESSON_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.d;
|
||||
|
||||
@Dao
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.lessons;
|
||||
|
||||
public class LessonChangeFull extends LessonChange {
|
||||
/*public String changeTeacherFullName = "";
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.lessons;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
@ -9,12 +9,11 @@ import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.RawQuery;
|
||||
import androidx.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.models.Time;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
|
||||
@Dao
|
||||
public abstract class LessonDao {
|
@ -1,15 +1,15 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.lessons;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import android.content.Context;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_ADDED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CANCELLED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_ADDED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
||||
|
||||
public class LessonFull extends Lesson {
|
@ -1,16 +1,17 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.login;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.Ignore;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
|
||||
@Entity(tableName = "loginStores",
|
||||
primaryKeys = {"loginStoreId"})
|
||||
public class LoginStore {
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.login;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
@ -8,6 +8,8 @@ import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
|
||||
@Dao
|
||||
public abstract class LoginStoreDao {
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@ -1,10 +1,10 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.luckynumber;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
|
||||
@Entity(tableName = "luckyNumbers",
|
||||
primaryKeys = {"profileId", "luckyNumberDate"})
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.luckynumber;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
@ -8,7 +8,7 @@ import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
|
||||
@Dao
|
||||
public interface LuckyNumberDao {
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.messages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.messages;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -11,10 +11,12 @@ import androidx.room.RawQuery;
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
import androidx.sqlite.db.SupportSQLiteQuery;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_DELETED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_MESSAGE;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_DELETED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_MESSAGE;
|
||||
|
||||
@Dao
|
||||
public abstract class MessageDao {
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.messages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.messages;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
@ -1,8 +1,7 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.messages;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
@ -11,8 +10,6 @@ import androidx.room.RawQuery;
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
import androidx.sqlite.db.SupportSQLiteQuery;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_MESSAGE;
|
||||
|
||||
@Dao
|
||||
public abstract class MessageRecipientDao {
|
||||
@Query("DELETE FROM messageRecipients WHERE profileId = :profileId")
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.messages;
|
||||
|
||||
public class MessageRecipientFull extends MessageRecipient {
|
||||
public String fullName = null;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.metadata;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.metadata;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
@ -9,16 +9,24 @@ import androidx.room.Transaction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.db.UnreadCounter;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
|
||||
import pl.szczodrzynski.edziennik.utils.models.db.UnreadCounter;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_ANNOUNCEMENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_ATTENDANCE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_EVENT;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_GRADE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_LESSON_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_MESSAGE;
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_NOTICE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ANNOUNCEMENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ATTENDANCE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_EVENT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_GRADE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_LESSON_CHANGE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_MESSAGE;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_NOTICE;
|
||||
|
||||
@Dao
|
||||
public abstract class MetadataDao {
|
||||
@ -196,7 +204,7 @@ public abstract class MetadataDao {
|
||||
public abstract void deleteUnusedNotices(int profileId);
|
||||
|
||||
@Query("DELETE FROM metadata WHERE profileId = :profileId AND thingType = "+TYPE_ATTENDANCE+" AND thingId NOT IN (SELECT attendanceId FROM attendances WHERE profileId = :profileId);")
|
||||
public abstract void deleteUnusedAttendances(int profileId);
|
||||
public abstract void deleteUnusedAttendance(int profileId);
|
||||
|
||||
@Query("DELETE FROM metadata WHERE profileId = :profileId AND thingType = "+TYPE_EVENT+" AND thingId NOT IN (SELECT eventId FROM events WHERE profileId = :profileId AND eventType != -1);")
|
||||
public abstract void deleteUnusedEvents(int profileId);
|
||||
@ -217,7 +225,7 @@ public abstract class MetadataDao {
|
||||
public void deleteUnused(int profileId) {
|
||||
deleteUnusedGrades(profileId);
|
||||
deleteUnusedNotices(profileId);
|
||||
deleteUnusedAttendances(profileId);
|
||||
deleteUnusedAttendance(profileId);
|
||||
deleteUnusedEvents(profileId);
|
||||
deleteUnusedHomework(profileId);
|
||||
deleteUnusedLessonChanges(profileId);
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.notices;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.notices;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||
@ -11,7 +11,9 @@ import androidx.room.RawQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_NOTICE;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_NOTICE;
|
||||
|
||||
@Dao
|
||||
public abstract class NoticeDao {
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.notices;
|
||||
|
||||
public class NoticeFull extends Notice {
|
||||
public String teacherFullName = "";
|
@ -1,27 +1,22 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.profiles
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.media.ThumbnailUtils
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.NetworkInfo
|
||||
import android.widget.ImageView
|
||||
import androidx.core.graphics.drawable.RoundedBitmapDrawable
|
||||
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory
|
||||
|
||||
import com.google.gson.JsonElement
|
||||
import com.google.gson.JsonObject
|
||||
|
||||
import androidx.room.Ignore
|
||||
import pl.droidsonroids.gif.GifDrawable
|
||||
import pl.szczodrzynski.edziennik.colorFromName
|
||||
|
||||
import pl.szczodrzynski.edziennik.models.Date
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||
import pl.szczodrzynski.navlib.ImageHolder
|
||||
import pl.szczodrzynski.navlib.R
|
||||
import pl.szczodrzynski.navlib.drawer.IDrawerProfile
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.profiles;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
@ -8,7 +8,7 @@ import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Profile.REGISTRATION_ENABLED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile.REGISTRATION_ENABLED;
|
||||
|
||||
@Dao
|
||||
public interface ProfileDao {
|
@ -1,17 +1,18 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.profiles
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.ColumnInfo
|
||||
import com.google.gson.JsonObject
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_AGENDA
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ANNOUNCEMENTS
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ATTENDANCES
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ATTENDANCE
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_GRADES
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_HOMEWORK
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_NOTICES
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_BEHAVIOUR
|
||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_TIMETABLE
|
||||
import pl.szczodrzynski.edziennik.datamodels.LoginStore.*
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.*
|
||||
import java.util.*
|
||||
|
||||
class ProfileFull : Profile {
|
||||
@ -51,8 +52,8 @@ class ProfileFull : Profile {
|
||||
fragmentIds.add(DRAWER_ITEM_GRADES)
|
||||
fragmentIds.add(DRAWER_ITEM_MESSAGES)
|
||||
fragmentIds.add(DRAWER_ITEM_HOMEWORK)
|
||||
fragmentIds.add(DRAWER_ITEM_NOTICES)
|
||||
fragmentIds.add(DRAWER_ITEM_ATTENDANCES)
|
||||
fragmentIds.add(DRAWER_ITEM_BEHAVIOUR)
|
||||
fragmentIds.add(DRAWER_ITEM_ATTENDANCE)
|
||||
return fragmentIds
|
||||
}
|
||||
LOGIN_TYPE_LIBRUS -> {
|
||||
@ -62,8 +63,8 @@ class ProfileFull : Profile {
|
||||
fragmentIds.add(DRAWER_ITEM_GRADES)
|
||||
fragmentIds.add(DRAWER_ITEM_MESSAGES)
|
||||
fragmentIds.add(DRAWER_ITEM_HOMEWORK)
|
||||
fragmentIds.add(DRAWER_ITEM_NOTICES)
|
||||
fragmentIds.add(DRAWER_ITEM_ATTENDANCES)
|
||||
fragmentIds.add(DRAWER_ITEM_BEHAVIOUR)
|
||||
fragmentIds.add(DRAWER_ITEM_ATTENDANCE)
|
||||
fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS)
|
||||
return fragmentIds
|
||||
}
|
||||
@ -73,8 +74,8 @@ class ProfileFull : Profile {
|
||||
fragmentIds.add(DRAWER_ITEM_AGENDA)
|
||||
fragmentIds.add(DRAWER_ITEM_GRADES)
|
||||
fragmentIds.add(DRAWER_ITEM_MESSAGES)
|
||||
fragmentIds.add(DRAWER_ITEM_NOTICES)
|
||||
fragmentIds.add(DRAWER_ITEM_ATTENDANCES)
|
||||
fragmentIds.add(DRAWER_ITEM_BEHAVIOUR)
|
||||
fragmentIds.add(DRAWER_ITEM_ATTENDANCE)
|
||||
fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS)
|
||||
return fragmentIds
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.subjects;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.subjects;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.teachers;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@ -6,7 +6,6 @@ import android.graphics.Bitmap;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Ignore;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.teachers;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.teams;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
@ -1,4 +1,4 @@
|
||||
package pl.szczodrzynski.edziennik.datamodels;
|
||||
package pl.szczodrzynski.edziennik.data.db.modules.teams;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
@ -16,10 +16,10 @@ import im.wangchao.mhttp.ThreadMode;
|
||||
import im.wangchao.mhttp.callback.JsonCallbackHandler;
|
||||
import pl.szczodrzynski.edziennik.App;
|
||||
import pl.szczodrzynski.edziennik.BuildConfig;
|
||||
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.datamodels.Profile.REGISTRATION_ENABLED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile.REGISTRATION_ENABLED;
|
||||
|
||||
public class ServerRequest {
|
||||
private App app;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user