diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java index 99ab1a4b..328aaa95 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java @@ -676,7 +676,7 @@ public class Edziennik { } }; AsyncTask.execute(() -> { - ProfileFull profile = app.db.profileDao().getByIdNow(profileId); + ProfileFull profile = app.db.profileDao().getFullByIdNow(profileId); if (profile != null) { if (profile.getArchived()) { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java index ff04e59e..cba9b250 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java @@ -51,7 +51,6 @@ 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; @@ -216,8 +215,6 @@ public class Librus implements EdziennikInterface { this.fullSync = profile == null || profile.getEmpty() || profile.shouldFullSync(activityContext); this.today = Date.getToday(); - DataStore ds = new DataStore(app.db, profileId); - this.librusEmail = loginStore.getLoginData("email", ""); this.librusPassword = loginStore.getLoginData("password", ""); if (profile == null) { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.java index 24df37d0..bcf3a440 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/HomeFragment.java @@ -34,6 +34,8 @@ import com.mikepenz.iconics.IconicsDrawable; import com.mikepenz.iconics.IconicsSize; import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial; +import org.greenrobot.eventbus.EventBus; + import java.util.ArrayList; import java.util.List; @@ -41,6 +43,8 @@ import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.BuildConfig; import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.MainActivity; +import pl.szczodrzynski.edziennik.api.v2.events.requests.SyncProfileRequest; +import pl.szczodrzynski.edziennik.api.v2.events.requests.SyncViewRequest; import pl.szczodrzynski.edziennik.databinding.CardLuckyNumberBinding; import pl.szczodrzynski.edziennik.databinding.CardUpdateBinding; import pl.szczodrzynski.edziennik.databinding.FragmentHomeBinding; @@ -60,6 +64,8 @@ import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem; import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem; import static pl.szczodrzynski.edziennik.App.UPDATES_ON_PLAY_STORE; +import static pl.szczodrzynski.edziennik.MainActivity.DRAWER_ITEM_GRADES; +import static pl.szczodrzynski.edziennik.api.v2.FeaturesKt.FEATURE_STUDENT_INFO; 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; @@ -113,9 +119,27 @@ public class HomeFragment extends Fragment { startActivity(new Intent(activity, MessagesComposeActivity.class)); })); + b.test2.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE); + b.test2.setOnClickListener((v -> { + List list = new ArrayList<>(); + list.add(FEATURE_STUDENT_INFO); + EventBus.getDefault().post(new SyncProfileRequest(16, list)); + })); + + b.test3.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE); + b.test3.setOnClickListener((v -> { + EventBus.getDefault().post(new SyncProfileRequest(16, null)); + })); + + b.test4.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE); + b.test4.setOnClickListener((v -> { + EventBus.getDefault().post(new SyncViewRequest(16, DRAWER_ITEM_GRADES)); + })); + //((TextView)v.findViewById(R.id.nextSync)).setText(getString(R.string.next_sync_format,Time.fromMillis(app.appJobs.syncJobTime).getStringHMS())); + LayoutInflater layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); ViewGroup insertPoint = b.cardInsertPoint; assert layoutInflater != null; @@ -544,7 +568,7 @@ public class HomeFragment extends Fragment { Button cardGradesButton = root.findViewById(R.id.cardGradesButton); buttonAddDrawable(c, cardGradesButton, CommunityMaterial.Icon.cmd_arrow_right); cardGradesButton.setOnClickListener((v1 -> new Handler().postDelayed(() -> a.runOnUiThread(() -> { - activity.loadTarget(MainActivity.DRAWER_ITEM_GRADES, null); + activity.loadTarget(DRAWER_ITEM_GRADES, null); }), 100))); //new Handler().postDelayed(() -> a.runOnUiThread(() -> updateCardGrades(c, a, root)), newRefreshInterval);