diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 7dbda6e8..cebd3d94 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -32,5 +32,5 @@ -dontwarn rx.internal.util.** -dontwarn sun.misc.Unsafe -#Confi for API +#Config for API -keep class io.github.wulkanowy.api.** {*;} diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/remote/StudentRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/remote/StudentRemote.kt index 1db18b26..6c6e26a9 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/remote/StudentRemote.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/remote/StudentRemote.kt @@ -19,7 +19,7 @@ class StudentRemote @Inject constructor(private val api: Api) { studentId = pupil.studentId, studentName = pupil.studentName, schoolSymbol = pupil.schoolSymbol, - schoolName = pupil.schoolName, + schoolName = pupil.description, endpoint = endpoint, loginType = pupil.loginType.name ) diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt index 5606a51f..c5a31958 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt @@ -1,6 +1,5 @@ package io.github.wulkanowy.ui.base -import io.github.wulkanowy.data.ErrorHandler import io.reactivex.disposables.CompositeDisposable open class BasePresenter(private val errorHandler: ErrorHandler) { diff --git a/app/src/main/java/io/github/wulkanowy/data/ErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt similarity index 97% rename from app/src/main/java/io/github/wulkanowy/data/ErrorHandler.kt rename to app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt index f167a199..e0e32e2c 100644 --- a/app/src/main/java/io/github/wulkanowy/data/ErrorHandler.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt @@ -1,4 +1,4 @@ -package io.github.wulkanowy.data +package io.github.wulkanowy.ui.base import android.content.res.Resources import io.github.wulkanowy.R diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionFragment.kt new file mode 100644 index 00000000..42622b50 --- /dev/null +++ b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionFragment.kt @@ -0,0 +1,11 @@ +package io.github.wulkanowy.ui.base.session + +import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.modules.main.MainActivity + +open class BaseSessionFragment : BaseFragment(), BaseSessionView { + + override fun showExpiredDialog() { + (activity as? MainActivity)?.showExpiredDialog() + } +} diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionPresenter.kt new file mode 100644 index 00000000..17ed6537 --- /dev/null +++ b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionPresenter.kt @@ -0,0 +1,12 @@ +package io.github.wulkanowy.ui.base.session + +import io.github.wulkanowy.ui.base.BasePresenter + +open class BaseSessionPresenter(private val errorHandler: SessionErrorHandler) : + BasePresenter(errorHandler) { + + override fun onAttachView(view: T) { + super.onAttachView(view) + errorHandler.onDecryptionFail = { view.showExpiredDialog() } + } +} diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionView.kt b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionView.kt new file mode 100644 index 00000000..81ce4d8f --- /dev/null +++ b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionView.kt @@ -0,0 +1,8 @@ +package io.github.wulkanowy.ui.base.session + +import io.github.wulkanowy.ui.base.BaseView + +interface BaseSessionView : BaseView { + + fun showExpiredDialog() +} diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/base/session/SessionErrorHandler.kt similarity index 64% rename from app/src/main/java/io/github/wulkanowy/ui/modules/main/MainErrorHandler.kt rename to app/src/main/java/io/github/wulkanowy/ui/base/session/SessionErrorHandler.kt index ed111ac6..89654732 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainErrorHandler.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/base/session/SessionErrorHandler.kt @@ -1,13 +1,11 @@ -package io.github.wulkanowy.ui.modules.main +package io.github.wulkanowy.ui.base.session import android.content.res.Resources -import io.github.wulkanowy.data.ErrorHandler -import io.github.wulkanowy.di.scopes.PerActivity +import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.utils.security.ScramblerException import javax.inject.Inject -@PerActivity -class MainErrorHandler @Inject constructor(resources: Resources) : ErrorHandler(resources) { +class SessionErrorHandler @Inject constructor(resources: Resources) : ErrorHandler(resources) { var onDecryptionFail: () -> Unit = {} diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt index 7a1f665c..9a512f70 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt @@ -4,8 +4,8 @@ import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL1 import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL2 import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL3 -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import timber.log.Timber import javax.inject.Inject diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt index 76f24619..e1459fe7 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt @@ -3,13 +3,13 @@ package io.github.wulkanowy.ui.modules.account import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.ui.base.BasePresenter -import io.github.wulkanowy.ui.modules.main.MainErrorHandler +import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.utils.SchedulersProvider import io.reactivex.Single import javax.inject.Inject class AccountPresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: ErrorHandler, private val studentRepository: StudentRepository, private val schedulers: SchedulersProvider ) : BasePresenter(errorHandler) { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt index 765c0ee6..3b60d8cb 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt @@ -12,7 +12,7 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Attendance -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.attendance.summary.AttendanceSummaryFragment import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainView @@ -20,7 +20,7 @@ import io.github.wulkanowy.utils.setOnItemClickListener import kotlinx.android.synthetic.main.fragment_attendance.* import javax.inject.Inject -class AttendanceFragment : BaseFragment(), AttendanceView, MainView.MainChildView, MainView.TitledView { +class AttendanceFragment : BaseSessionFragment(), AttendanceView, MainView.MainChildView, MainView.TitledView { @Inject lateinit var presenter: AttendancePresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt index 4a03600e..9be87b44 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt @@ -6,8 +6,8 @@ import io.github.wulkanowy.data.repositories.AttendanceRepository import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository -import io.github.wulkanowy.ui.base.BasePresenter -import io.github.wulkanowy.ui.modules.main.MainErrorHandler +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.isHolidays @@ -22,14 +22,14 @@ import java.util.concurrent.TimeUnit.MILLISECONDS import javax.inject.Inject class AttendancePresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: SessionErrorHandler, private val schedulers: SchedulersProvider, private val attendanceRepository: AttendanceRepository, private val studentRepository: StudentRepository, private val semesterRepository: SemesterRepository, private val prefRepository: PreferencesRepository, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { lateinit var currentDate: LocalDate private set diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt index b4ea981a..f839e89a 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt @@ -1,9 +1,9 @@ package io.github.wulkanowy.ui.modules.attendance import io.github.wulkanowy.data.db.entities.Attendance -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface AttendanceView : BaseView { +interface AttendanceView : BaseSessionView { val isViewEmpty: Boolean diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt index eee9e834..1a3fc16f 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt @@ -12,13 +12,13 @@ import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.R -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.main.MainView import io.github.wulkanowy.utils.setOnItemSelectedListener import kotlinx.android.synthetic.main.fragment_attendance_summary.* import javax.inject.Inject -class AttendanceSummaryFragment : BaseFragment(), AttendanceSummaryView, MainView.TitledView { +class AttendanceSummaryFragment : BaseSessionFragment(), AttendanceSummaryView, MainView.TitledView { @Inject lateinit var presenter: AttendanceSummaryPresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt index 2fcd88f2..5086e80c 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt @@ -1,13 +1,13 @@ package io.github.wulkanowy.ui.modules.attendance.summary -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.data.db.entities.AttendanceSummary import io.github.wulkanowy.data.db.entities.Subject import io.github.wulkanowy.data.repositories.AttendanceSummaryRepository import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.data.repositories.SubjectRepostory -import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.calculatePercentage @@ -18,14 +18,14 @@ import java.util.concurrent.TimeUnit.MILLISECONDS import javax.inject.Inject class AttendanceSummaryPresenter @Inject constructor( - private val errorHandler: ErrorHandler, + private val errorHandler: SessionErrorHandler, private val attendanceSummaryRepository: AttendanceSummaryRepository, private val subjectRepository: SubjectRepostory, private val studentRepository: StudentRepository, private val semesterRepository: SemesterRepository, private val schedulers: SchedulersProvider, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { private var subjects = emptyList() diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt index 03419a63..af62a2de 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt @@ -1,8 +1,8 @@ package io.github.wulkanowy.ui.modules.attendance.summary -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface AttendanceSummaryView : BaseView { +interface AttendanceSummaryView : BaseSessionView { val isViewEmpty: Boolean diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamFragment.kt index c23ad22b..d39688d4 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamFragment.kt @@ -12,13 +12,13 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Exam -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.main.MainView import io.github.wulkanowy.utils.setOnItemClickListener import kotlinx.android.synthetic.main.fragment_exam.* import javax.inject.Inject -class ExamFragment : BaseFragment(), ExamView, MainView.MainChildView, MainView.TitledView { +class ExamFragment : BaseSessionFragment(), ExamView, MainView.MainChildView, MainView.TitledView { @Inject lateinit var presenter: ExamPresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt index a9e8d241..88a0eaa5 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt @@ -6,8 +6,8 @@ import io.github.wulkanowy.data.db.entities.Exam import io.github.wulkanowy.data.repositories.ExamRepository import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository -import io.github.wulkanowy.ui.base.BasePresenter -import io.github.wulkanowy.ui.modules.main.MainErrorHandler +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.friday @@ -22,13 +22,13 @@ import java.util.concurrent.TimeUnit.MILLISECONDS import javax.inject.Inject class ExamPresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: SessionErrorHandler, private val schedulers: SchedulersProvider, private val examRepository: ExamRepository, private val studentRepository: StudentRepository, private val semesterRepository: SemesterRepository, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { lateinit var currentDate: LocalDate private set diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamView.kt index 5ee81e8b..b6a926f3 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamView.kt @@ -1,9 +1,9 @@ package io.github.wulkanowy.ui.modules.exam import io.github.wulkanowy.data.db.entities.Exam -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface ExamView : BaseView { +interface ExamView : BaseSessionView { val isViewEmpty: Boolean diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeFragment.kt index fcf8c3ff..a4d948a9 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeFragment.kt @@ -11,8 +11,8 @@ import android.view.View.VISIBLE import android.view.ViewGroup import androidx.appcompat.app.AlertDialog import io.github.wulkanowy.R -import io.github.wulkanowy.ui.base.BaseFragment import io.github.wulkanowy.ui.base.BasePagerAdapter +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.grade.details.GradeDetailsFragment import io.github.wulkanowy.ui.modules.grade.summary.GradeSummaryFragment import io.github.wulkanowy.ui.modules.main.MainView @@ -20,7 +20,7 @@ import io.github.wulkanowy.utils.setOnSelectPageListener import kotlinx.android.synthetic.main.fragment_grade.* import javax.inject.Inject -class GradeFragment : BaseFragment(), GradeView, MainView.MainChildView, MainView.TitledView { +class GradeFragment : BaseSessionFragment(), GradeView, MainView.MainChildView, MainView.TitledView { @Inject lateinit var presenter: GradePresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt index 4920a8d6..d2dd8031 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt @@ -3,8 +3,8 @@ package io.github.wulkanowy.ui.modules.grade import io.github.wulkanowy.data.db.entities.Semester import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository -import io.github.wulkanowy.ui.base.BasePresenter -import io.github.wulkanowy.ui.modules.main.MainErrorHandler +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.reactivex.Completable @@ -12,12 +12,12 @@ import java.util.concurrent.TimeUnit.MILLISECONDS import javax.inject.Inject class GradePresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: SessionErrorHandler, private val schedulers: SchedulersProvider, private val studentRepository: StudentRepository, private val semesterRepository: SemesterRepository, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { var selectedIndex = 0 private set diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeView.kt index f396aca3..3f1a197c 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeView.kt @@ -1,8 +1,8 @@ package io.github.wulkanowy.ui.modules.grade -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface GradeView : BaseView { +interface GradeView : BaseSessionView { val currentPageIndex: Int diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsFragment.kt index 81aac0eb..a9ee9ce2 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsFragment.kt @@ -17,14 +17,14 @@ import eu.davidea.flexibleadapter.items.IExpandable import eu.davidea.flexibleadapter.items.IFlexible import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Grade -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.grade.GradeFragment import io.github.wulkanowy.ui.modules.grade.GradeView import io.github.wulkanowy.utils.setOnItemClickListener import kotlinx.android.synthetic.main.fragment_grade_details.* import javax.inject.Inject -class GradeDetailsFragment : BaseFragment(), GradeDetailsView, GradeView.GradeChildView { +class GradeDetailsFragment : BaseSessionFragment(), GradeDetailsView, GradeView.GradeChildView { @Inject lateinit var presenter: GradeDetailsPresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt index 8034deea..b80a7108 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt @@ -6,8 +6,8 @@ import io.github.wulkanowy.data.repositories.GradeRepository import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository -import io.github.wulkanowy.ui.base.BasePresenter -import io.github.wulkanowy.ui.modules.main.MainErrorHandler +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.calcAverage @@ -17,14 +17,14 @@ import timber.log.Timber import javax.inject.Inject class GradeDetailsPresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: SessionErrorHandler, private val schedulers: SchedulersProvider, private val gradeRepository: GradeRepository, private val studentRepository: StudentRepository, private val semesterRepository: SemesterRepository, private val preferencesRepository: PreferencesRepository, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { private var currentSemesterId = 0 diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsView.kt index 9a9ee83b..24254260 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsView.kt @@ -4,9 +4,9 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.IExpandable import eu.davidea.flexibleadapter.items.IFlexible import io.github.wulkanowy.data.db.entities.Grade -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface GradeDetailsView : BaseView { +interface GradeDetailsView : BaseSessionView { val isViewEmpty: Boolean diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryFragment.kt index b2993bd3..13833b74 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryFragment.kt @@ -11,13 +11,13 @@ import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.R -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.grade.GradeFragment import io.github.wulkanowy.ui.modules.grade.GradeView import kotlinx.android.synthetic.main.fragment_grade_summary.* import javax.inject.Inject -class GradeSummaryFragment : BaseFragment(), GradeSummaryView, GradeView.GradeChildView { +class GradeSummaryFragment : BaseSessionFragment(), GradeSummaryView, GradeView.GradeChildView { @Inject lateinit var presenter: GradeSummaryPresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt index 3ae1cd24..a67ad894 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt @@ -6,8 +6,8 @@ import io.github.wulkanowy.data.repositories.GradeSummaryRepository import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository -import io.github.wulkanowy.ui.base.BasePresenter -import io.github.wulkanowy.ui.modules.main.MainErrorHandler +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.calcAverage @@ -17,7 +17,7 @@ import java.util.Locale.FRANCE import javax.inject.Inject class GradeSummaryPresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: SessionErrorHandler, private val gradeSummaryRepository: GradeSummaryRepository, private val gradeRepository: GradeRepository, private val studentRepository: StudentRepository, @@ -25,7 +25,7 @@ class GradeSummaryPresenter @Inject constructor( private val preferencesRepository: PreferencesRepository, private val schedulers: SchedulersProvider, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { override fun onAttachView(view: GradeSummaryView) { super.onAttachView(view) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryView.kt index 7aa609f4..2602ec99 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryView.kt @@ -1,8 +1,8 @@ package io.github.wulkanowy.ui.modules.grade.summary -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface GradeSummaryView : BaseView { +interface GradeSummaryView : BaseSessionView { val isViewEmpty: Boolean diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkFragment.kt index ac1f397f..135098fb 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkFragment.kt @@ -9,13 +9,13 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Homework -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.main.MainView import io.github.wulkanowy.utils.setOnItemClickListener import kotlinx.android.synthetic.main.fragment_homework.* import javax.inject.Inject -class HomeworkFragment : BaseFragment(), HomeworkView, MainView.TitledView { +class HomeworkFragment : BaseSessionFragment(), HomeworkView, MainView.TitledView { @Inject lateinit var presenter: HomeworkPresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt index 9e621e05..e4d42745 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt @@ -5,8 +5,8 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.data.repositories.HomeworkRepository import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository -import io.github.wulkanowy.ui.base.BasePresenter -import io.github.wulkanowy.ui.modules.main.MainErrorHandler +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.isHolidays @@ -19,13 +19,13 @@ import java.util.concurrent.TimeUnit import javax.inject.Inject class HomeworkPresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: SessionErrorHandler, private val schedulers: SchedulersProvider, private val homeworkRepository: HomeworkRepository, private val studentRepository: StudentRepository, private val semesterRepository: SemesterRepository, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { lateinit var currentDate: LocalDate private set diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkView.kt index f2da72e3..521020e6 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkView.kt @@ -1,9 +1,9 @@ package io.github.wulkanowy.ui.modules.homework import io.github.wulkanowy.data.db.entities.Homework -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface HomeworkView : BaseView { +interface HomeworkView : BaseSessionView { fun initView() diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginErrorHandler.kt index 7df2d05d..40f1d711 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginErrorHandler.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginErrorHandler.kt @@ -4,7 +4,7 @@ import android.content.res.Resources import android.database.sqlite.SQLiteConstraintException import io.github.wulkanowy.R import io.github.wulkanowy.api.login.BadCredentialsException -import io.github.wulkanowy.data.ErrorHandler +import io.github.wulkanowy.ui.base.ErrorHandler import javax.inject.Inject class LoginErrorHandler @Inject constructor(resources: Resources) : ErrorHandler(resources) { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginPresenter.kt index c2695215..0687e2f2 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginPresenter.kt @@ -1,7 +1,7 @@ package io.github.wulkanowy.ui.modules.login -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.ErrorHandler import javax.inject.Inject class LoginPresenter @Inject constructor(errorHandler: ErrorHandler) : BasePresenter(errorHandler) { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt index f2ad1f90..58c2f7c9 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt @@ -134,7 +134,7 @@ class MainActivity : BaseActivity(), MainView { navController.showDialogFragment(AccountDialog.newInstance()) } - override fun showExpiredDialog() { + fun showExpiredDialog() { AlertDialog.Builder(this) .setTitle(R.string.main_session_expired) .setMessage(R.string.main_session_relogin) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt index 34e762b2..f18bd9eb 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt @@ -6,13 +6,14 @@ import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.services.job.ServiceHelper import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.reactivex.Completable import javax.inject.Inject class MainPresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: ErrorHandler, private val studentRepository: StudentRepository, private val prefRepository: PreferencesRepository, private val schedulers: SchedulersProvider, @@ -24,7 +25,6 @@ class MainPresenter @Inject constructor( super.onAttachView(view) view.run { cancelNotifications() - errorHandler.onDecryptionFail = { showExpiredDialog() } startMenuIndex = if (initMenuIndex != -1) initMenuIndex else prefRepository.startMenuIndex initView() } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt index 2feef660..112f3f4e 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt @@ -20,8 +20,6 @@ interface MainView : BaseView { fun showAccountPicker() - fun showExpiredDialog() - fun notifyMenuViewReselected() fun setViewTitle(title: String) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/MessagePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/MessagePresenter.kt index 5a52cbed..360b9bfc 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/MessagePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/MessagePresenter.kt @@ -1,7 +1,7 @@ package io.github.wulkanowy.ui.modules.message -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.utils.SchedulersProvider import io.reactivex.Completable import java.util.concurrent.TimeUnit.MILLISECONDS diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewFragment.kt index 7130a925..f104d87a 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewFragment.kt @@ -5,12 +5,12 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import io.github.wulkanowy.R -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.main.MainView import kotlinx.android.synthetic.main.fragment_message_preview.* import javax.inject.Inject -class MessagePreviewFragment : BaseFragment(), MessagePreviewView, MainView.TitledView { +class MessagePreviewFragment : BaseSessionFragment(), MessagePreviewView, MainView.TitledView { @Inject lateinit var presenter: MessagePreviewPresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt index 3d8f81d8..3197e991 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt @@ -1,22 +1,22 @@ package io.github.wulkanowy.ui.modules.message.preview import com.google.firebase.analytics.FirebaseAnalytics.Param.START_DATE -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.data.repositories.MessagesRepository import io.github.wulkanowy.data.repositories.StudentRepository -import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.toFormattedString import javax.inject.Inject class MessagePreviewPresenter @Inject constructor( - private val errorHandler: ErrorHandler, + private val errorHandler: SessionErrorHandler, private val schedulers: SchedulersProvider, private val messagesRepository: MessagesRepository, private val studentRepository: StudentRepository, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { var messageId: Int = 0 diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewView.kt index 4f236533..d8dd8965 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewView.kt @@ -1,8 +1,8 @@ package io.github.wulkanowy.ui.modules.message.preview -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface MessagePreviewView : BaseView { +interface MessagePreviewView : BaseSessionView { val noSubjectString: String diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabFragment.kt index 07f10fc0..d3e2f471 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabFragment.kt @@ -12,7 +12,7 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.R import io.github.wulkanowy.data.repositories.MessagesRepository -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.message.MessageFragment import io.github.wulkanowy.ui.modules.message.MessageItem @@ -22,7 +22,7 @@ import io.github.wulkanowy.utils.setOnItemClickListener import kotlinx.android.synthetic.main.fragment_message_tab.* import javax.inject.Inject -class MessageTabFragment : BaseFragment(), MessageTabView, MessageView.MessageChildView { +class MessageTabFragment : BaseSessionFragment(), MessageTabView, MessageView.MessageChildView { @Inject lateinit var presenter: MessageTabPresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt index 417900f0..0e1a9d84 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt @@ -1,11 +1,11 @@ package io.github.wulkanowy.ui.modules.message.tab import eu.davidea.flexibleadapter.items.AbstractFlexibleItem -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.data.db.entities.Message import io.github.wulkanowy.data.repositories.MessagesRepository import io.github.wulkanowy.data.repositories.StudentRepository -import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.ui.modules.message.MessageItem import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider @@ -13,12 +13,12 @@ import timber.log.Timber import javax.inject.Inject class MessageTabPresenter @Inject constructor( - private val errorHandler: ErrorHandler, + private val errorHandler: SessionErrorHandler, private val schedulers: SchedulersProvider, private val messagesRepository: MessagesRepository, private val studentRepository: StudentRepository, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { lateinit var folder: MessagesRepository.MessageFolder diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabView.kt index 1bacd352..309e2766 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabView.kt @@ -1,10 +1,10 @@ package io.github.wulkanowy.ui.modules.message.tab import eu.davidea.flexibleadapter.items.AbstractFlexibleItem -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView import io.github.wulkanowy.ui.modules.message.MessageItem -interface MessageTabView : BaseView { +interface MessageTabView : BaseSessionView { val noSubjectString: String diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt index 6890f2e0..61b187f1 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt @@ -1,8 +1,8 @@ package io.github.wulkanowy.ui.modules.more import eu.davidea.flexibleadapter.items.AbstractFlexibleItem -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.ErrorHandler import javax.inject.Inject class MorePresenter @Inject constructor(errorHandler: ErrorHandler) : BasePresenter(errorHandler) { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteFragment.kt index a5b198dc..243f2575 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteFragment.kt @@ -11,13 +11,13 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Note -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.main.MainView import io.github.wulkanowy.utils.setOnItemClickListener import kotlinx.android.synthetic.main.fragment_note.* import javax.inject.Inject -class NoteFragment : BaseFragment(), NoteView, MainView.TitledView { +class NoteFragment : BaseSessionFragment(), NoteView, MainView.TitledView { @Inject lateinit var presenter: NotePresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt index 6a283c4f..c388a3f7 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt @@ -5,21 +5,21 @@ import io.github.wulkanowy.data.db.entities.Note import io.github.wulkanowy.data.repositories.NoteRepository import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository -import io.github.wulkanowy.ui.base.BasePresenter -import io.github.wulkanowy.ui.modules.main.MainErrorHandler +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import timber.log.Timber import javax.inject.Inject class NotePresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: SessionErrorHandler, private val schedulers: SchedulersProvider, private val studentRepository: StudentRepository, private val noteRepository: NoteRepository, private val semesterRepository: SemesterRepository, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { override fun onAttachView(view: NoteView) { super.onAttachView(view) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteView.kt index 63b615fe..c060c8ed 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteView.kt @@ -2,9 +2,9 @@ package io.github.wulkanowy.ui.modules.note import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.data.db.entities.Note -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface NoteView : BaseView { +interface NoteView : BaseSessionView { val isViewEmpty: Boolean diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt index 647a0b35..40368913 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt @@ -1,9 +1,9 @@ package io.github.wulkanowy.ui.modules.settings -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.services.job.ServiceHelper import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.isHolidays import org.threeten.bp.LocalDate.now diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/splash/SplashPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/splash/SplashPresenter.kt index 81823bf4..5f8ba16e 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/splash/SplashPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/splash/SplashPresenter.kt @@ -1,8 +1,8 @@ package io.github.wulkanowy.ui.modules.splash -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.ui.base.BasePresenter +import io.github.wulkanowy.ui.base.ErrorHandler import javax.inject.Inject class SplashPresenter @Inject constructor( diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt index cfa110e9..faf17665 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt @@ -9,13 +9,13 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Timetable -import io.github.wulkanowy.ui.base.BaseFragment +import io.github.wulkanowy.ui.base.session.BaseSessionFragment import io.github.wulkanowy.ui.modules.main.MainView import io.github.wulkanowy.utils.setOnItemClickListener import kotlinx.android.synthetic.main.fragment_timetable.* import javax.inject.Inject -class TimetableFragment : BaseFragment(), TimetableView, MainView.MainChildView, MainView.TitledView { +class TimetableFragment : BaseSessionFragment(), TimetableView, MainView.MainChildView, MainView.TitledView { @Inject lateinit var presenter: TimetablePresenter diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt index 2d56ed49..27a9db99 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt @@ -5,8 +5,8 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.data.repositories.TimetableRepository -import io.github.wulkanowy.ui.base.BasePresenter -import io.github.wulkanowy.ui.modules.main.MainErrorHandler +import io.github.wulkanowy.ui.base.session.BaseSessionPresenter +import io.github.wulkanowy.ui.base.session.SessionErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.isHolidays @@ -21,13 +21,13 @@ import java.util.concurrent.TimeUnit.MILLISECONDS import javax.inject.Inject class TimetablePresenter @Inject constructor( - private val errorHandler: MainErrorHandler, + private val errorHandler: SessionErrorHandler, private val schedulers: SchedulersProvider, private val timetableRepository: TimetableRepository, private val studentRepository: StudentRepository, private val semesterRepository: SemesterRepository, private val analytics: FirebaseAnalyticsHelper -) : BasePresenter(errorHandler) { +) : BaseSessionPresenter(errorHandler) { lateinit var currentDate: LocalDate private set diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt index 1411599a..0ad0eaeb 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt @@ -1,9 +1,9 @@ package io.github.wulkanowy.ui.modules.timetable import io.github.wulkanowy.data.db.entities.Timetable -import io.github.wulkanowy.ui.base.BaseView +import io.github.wulkanowy.ui.base.session.BaseSessionView -interface TimetableView : BaseView { +interface TimetableView : BaseSessionView { val roomString: String diff --git a/app/src/test/java/io/github/wulkanowy/ui/modules/main/MainPresenterTest.kt b/app/src/test/java/io/github/wulkanowy/ui/modules/main/MainPresenterTest.kt index 15d80ee4..203ce304 100644 --- a/app/src/test/java/io/github/wulkanowy/ui/modules/main/MainPresenterTest.kt +++ b/app/src/test/java/io/github/wulkanowy/ui/modules/main/MainPresenterTest.kt @@ -4,6 +4,7 @@ import io.github.wulkanowy.TestSchedulersProvider import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.services.job.ServiceHelper +import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import org.junit.Before import org.junit.Test @@ -15,7 +16,7 @@ import org.mockito.MockitoAnnotations class MainPresenterTest { @Mock - lateinit var errorHandler: MainErrorHandler + lateinit var errorHandler: ErrorHandler @Mock lateinit var studentRepository: StudentRepository diff --git a/app/src/test/java/io/github/wulkanowy/ui/modules/splash/SplashPresenterTest.kt b/app/src/test/java/io/github/wulkanowy/ui/modules/splash/SplashPresenterTest.kt index d9bc745f..ee4b17cf 100644 --- a/app/src/test/java/io/github/wulkanowy/ui/modules/splash/SplashPresenterTest.kt +++ b/app/src/test/java/io/github/wulkanowy/ui/modules/splash/SplashPresenterTest.kt @@ -1,7 +1,7 @@ package io.github.wulkanowy.ui.modules.splash -import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.data.repositories.StudentRepository +import io.github.wulkanowy.ui.base.ErrorHandler import org.junit.Before import org.junit.Test import org.mockito.Mock