Fix error message snackbar (#201)

This commit is contained in:
Rafał Borcz 2018-12-17 00:17:21 +01:00 committed by Mikołaj Pich
parent 9c94305ba5
commit 04f386ea3d
54 changed files with 140 additions and 113 deletions

View File

@ -32,5 +32,5 @@
-dontwarn rx.internal.util.** -dontwarn rx.internal.util.**
-dontwarn sun.misc.Unsafe -dontwarn sun.misc.Unsafe
#Confi for API #Config for API
-keep class io.github.wulkanowy.api.** {*;} -keep class io.github.wulkanowy.api.** {*;}

View File

@ -19,7 +19,7 @@ class StudentRemote @Inject constructor(private val api: Api) {
studentId = pupil.studentId, studentId = pupil.studentId,
studentName = pupil.studentName, studentName = pupil.studentName,
schoolSymbol = pupil.schoolSymbol, schoolSymbol = pupil.schoolSymbol,
schoolName = pupil.schoolName, schoolName = pupil.description,
endpoint = endpoint, endpoint = endpoint,
loginType = pupil.loginType.name loginType = pupil.loginType.name
) )

View File

@ -1,6 +1,5 @@
package io.github.wulkanowy.ui.base package io.github.wulkanowy.ui.base
import io.github.wulkanowy.data.ErrorHandler
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
open class BasePresenter<T : BaseView>(private val errorHandler: ErrorHandler) { open class BasePresenter<T : BaseView>(private val errorHandler: ErrorHandler) {

View File

@ -1,4 +1,4 @@
package io.github.wulkanowy.data package io.github.wulkanowy.ui.base
import android.content.res.Resources import android.content.res.Resources
import io.github.wulkanowy.R import io.github.wulkanowy.R

View File

@ -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()
}
}

View File

@ -0,0 +1,12 @@
package io.github.wulkanowy.ui.base.session
import io.github.wulkanowy.ui.base.BasePresenter
open class BaseSessionPresenter<T : BaseSessionView>(private val errorHandler: SessionErrorHandler) :
BasePresenter<T>(errorHandler) {
override fun onAttachView(view: T) {
super.onAttachView(view)
errorHandler.onDecryptionFail = { view.showExpiredDialog() }
}
}

View File

@ -0,0 +1,8 @@
package io.github.wulkanowy.ui.base.session
import io.github.wulkanowy.ui.base.BaseView
interface BaseSessionView : BaseView {
fun showExpiredDialog()
}

View File

@ -1,13 +1,11 @@
package io.github.wulkanowy.ui.modules.main package io.github.wulkanowy.ui.base.session
import android.content.res.Resources import android.content.res.Resources
import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.di.scopes.PerActivity
import io.github.wulkanowy.utils.security.ScramblerException import io.github.wulkanowy.utils.security.ScramblerException
import javax.inject.Inject import javax.inject.Inject
@PerActivity class SessionErrorHandler @Inject constructor(resources: Resources) : ErrorHandler(resources) {
class MainErrorHandler @Inject constructor(resources: Resources) : ErrorHandler(resources) {
var onDecryptionFail: () -> Unit = {} var onDecryptionFail: () -> Unit = {}

View File

@ -4,8 +4,8 @@ import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL1 import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL1
import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL2 import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL2
import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL3 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.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject

View File

@ -3,13 +3,13 @@ package io.github.wulkanowy.ui.modules.account
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.data.repositories.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter 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.github.wulkanowy.utils.SchedulersProvider
import io.reactivex.Single import io.reactivex.Single
import javax.inject.Inject import javax.inject.Inject
class AccountPresenter @Inject constructor( class AccountPresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: ErrorHandler,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val schedulers: SchedulersProvider private val schedulers: SchedulersProvider
) : BasePresenter<AccountView>(errorHandler) { ) : BasePresenter<AccountView>(errorHandler) {

View File

@ -12,7 +12,7 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Attendance 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.attendance.summary.AttendanceSummaryFragment
import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainView 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 kotlinx.android.synthetic.main.fragment_attendance.*
import javax.inject.Inject import javax.inject.Inject
class AttendanceFragment : BaseFragment(), AttendanceView, MainView.MainChildView, MainView.TitledView { class AttendanceFragment : BaseSessionFragment(), AttendanceView, MainView.MainChildView, MainView.TitledView {
@Inject @Inject
lateinit var presenter: AttendancePresenter lateinit var presenter: AttendancePresenter

View File

@ -6,8 +6,8 @@ import io.github.wulkanowy.data.repositories.AttendanceRepository
import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.PreferencesRepository
import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.SemesterRepository
import io.github.wulkanowy.data.repositories.StudentRepository 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.modules.main.MainErrorHandler import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.isHolidays import io.github.wulkanowy.utils.isHolidays
@ -22,14 +22,14 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.inject.Inject import javax.inject.Inject
class AttendancePresenter @Inject constructor( class AttendancePresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: SessionErrorHandler,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val attendanceRepository: AttendanceRepository, private val attendanceRepository: AttendanceRepository,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository, private val semesterRepository: SemesterRepository,
private val prefRepository: PreferencesRepository, private val prefRepository: PreferencesRepository,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<AttendanceView>(errorHandler) { ) : BaseSessionPresenter<AttendanceView>(errorHandler) {
lateinit var currentDate: LocalDate lateinit var currentDate: LocalDate
private set private set

View File

@ -1,9 +1,9 @@
package io.github.wulkanowy.ui.modules.attendance package io.github.wulkanowy.ui.modules.attendance
import io.github.wulkanowy.data.db.entities.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 val isViewEmpty: Boolean

View File

@ -12,13 +12,13 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R 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.ui.modules.main.MainView
import io.github.wulkanowy.utils.setOnItemSelectedListener import io.github.wulkanowy.utils.setOnItemSelectedListener
import kotlinx.android.synthetic.main.fragment_attendance_summary.* import kotlinx.android.synthetic.main.fragment_attendance_summary.*
import javax.inject.Inject import javax.inject.Inject
class AttendanceSummaryFragment : BaseFragment(), AttendanceSummaryView, MainView.TitledView { class AttendanceSummaryFragment : BaseSessionFragment(), AttendanceSummaryView, MainView.TitledView {
@Inject @Inject
lateinit var presenter: AttendanceSummaryPresenter lateinit var presenter: AttendanceSummaryPresenter

View File

@ -1,13 +1,13 @@
package io.github.wulkanowy.ui.modules.attendance.summary 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.AttendanceSummary
import io.github.wulkanowy.data.db.entities.Subject import io.github.wulkanowy.data.db.entities.Subject
import io.github.wulkanowy.data.repositories.AttendanceSummaryRepository import io.github.wulkanowy.data.repositories.AttendanceSummaryRepository
import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.SemesterRepository
import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.data.repositories.StudentRepository
import io.github.wulkanowy.data.repositories.SubjectRepostory 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.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.calculatePercentage import io.github.wulkanowy.utils.calculatePercentage
@ -18,14 +18,14 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.inject.Inject import javax.inject.Inject
class AttendanceSummaryPresenter @Inject constructor( class AttendanceSummaryPresenter @Inject constructor(
private val errorHandler: ErrorHandler, private val errorHandler: SessionErrorHandler,
private val attendanceSummaryRepository: AttendanceSummaryRepository, private val attendanceSummaryRepository: AttendanceSummaryRepository,
private val subjectRepository: SubjectRepostory, private val subjectRepository: SubjectRepostory,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository, private val semesterRepository: SemesterRepository,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<AttendanceSummaryView>(errorHandler) { ) : BaseSessionPresenter<AttendanceSummaryView>(errorHandler) {
private var subjects = emptyList<Subject>() private var subjects = emptyList<Subject>()

View File

@ -1,8 +1,8 @@
package io.github.wulkanowy.ui.modules.attendance.summary 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 val isViewEmpty: Boolean

View File

@ -12,13 +12,13 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Exam 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.ui.modules.main.MainView
import io.github.wulkanowy.utils.setOnItemClickListener import io.github.wulkanowy.utils.setOnItemClickListener
import kotlinx.android.synthetic.main.fragment_exam.* import kotlinx.android.synthetic.main.fragment_exam.*
import javax.inject.Inject import javax.inject.Inject
class ExamFragment : BaseFragment(), ExamView, MainView.MainChildView, MainView.TitledView { class ExamFragment : BaseSessionFragment(), ExamView, MainView.MainChildView, MainView.TitledView {
@Inject @Inject
lateinit var presenter: ExamPresenter lateinit var presenter: ExamPresenter

View File

@ -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.ExamRepository
import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.SemesterRepository
import io.github.wulkanowy.data.repositories.StudentRepository 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.modules.main.MainErrorHandler import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.friday import io.github.wulkanowy.utils.friday
@ -22,13 +22,13 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.inject.Inject import javax.inject.Inject
class ExamPresenter @Inject constructor( class ExamPresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: SessionErrorHandler,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val examRepository: ExamRepository, private val examRepository: ExamRepository,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository, private val semesterRepository: SemesterRepository,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<ExamView>(errorHandler) { ) : BaseSessionPresenter<ExamView>(errorHandler) {
lateinit var currentDate: LocalDate lateinit var currentDate: LocalDate
private set private set

View File

@ -1,9 +1,9 @@
package io.github.wulkanowy.ui.modules.exam package io.github.wulkanowy.ui.modules.exam
import io.github.wulkanowy.data.db.entities.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 val isViewEmpty: Boolean

View File

@ -11,8 +11,8 @@ import android.view.View.VISIBLE
import android.view.ViewGroup import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import io.github.wulkanowy.R 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.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.details.GradeDetailsFragment
import io.github.wulkanowy.ui.modules.grade.summary.GradeSummaryFragment import io.github.wulkanowy.ui.modules.grade.summary.GradeSummaryFragment
import io.github.wulkanowy.ui.modules.main.MainView 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 kotlinx.android.synthetic.main.fragment_grade.*
import javax.inject.Inject import javax.inject.Inject
class GradeFragment : BaseFragment(), GradeView, MainView.MainChildView, MainView.TitledView { class GradeFragment : BaseSessionFragment(), GradeView, MainView.MainChildView, MainView.TitledView {
@Inject @Inject
lateinit var presenter: GradePresenter lateinit var presenter: GradePresenter

View File

@ -3,8 +3,8 @@ package io.github.wulkanowy.ui.modules.grade
import io.github.wulkanowy.data.db.entities.Semester import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.SemesterRepository
import io.github.wulkanowy.data.repositories.StudentRepository 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.modules.main.MainErrorHandler import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.reactivex.Completable import io.reactivex.Completable
@ -12,12 +12,12 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.inject.Inject import javax.inject.Inject
class GradePresenter @Inject constructor( class GradePresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: SessionErrorHandler,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository, private val semesterRepository: SemesterRepository,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<GradeView>(errorHandler) { ) : BaseSessionPresenter<GradeView>(errorHandler) {
var selectedIndex = 0 var selectedIndex = 0
private set private set

View File

@ -1,8 +1,8 @@
package io.github.wulkanowy.ui.modules.grade 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 val currentPageIndex: Int

View File

@ -17,14 +17,14 @@ import eu.davidea.flexibleadapter.items.IExpandable
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Grade 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.GradeFragment
import io.github.wulkanowy.ui.modules.grade.GradeView import io.github.wulkanowy.ui.modules.grade.GradeView
import io.github.wulkanowy.utils.setOnItemClickListener import io.github.wulkanowy.utils.setOnItemClickListener
import kotlinx.android.synthetic.main.fragment_grade_details.* import kotlinx.android.synthetic.main.fragment_grade_details.*
import javax.inject.Inject import javax.inject.Inject
class GradeDetailsFragment : BaseFragment(), GradeDetailsView, GradeView.GradeChildView { class GradeDetailsFragment : BaseSessionFragment(), GradeDetailsView, GradeView.GradeChildView {
@Inject @Inject
lateinit var presenter: GradeDetailsPresenter lateinit var presenter: GradeDetailsPresenter

View File

@ -6,8 +6,8 @@ import io.github.wulkanowy.data.repositories.GradeRepository
import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.PreferencesRepository
import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.SemesterRepository
import io.github.wulkanowy.data.repositories.StudentRepository 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.modules.main.MainErrorHandler import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.calcAverage import io.github.wulkanowy.utils.calcAverage
@ -17,14 +17,14 @@ import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
class GradeDetailsPresenter @Inject constructor( class GradeDetailsPresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: SessionErrorHandler,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val gradeRepository: GradeRepository, private val gradeRepository: GradeRepository,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository, private val semesterRepository: SemesterRepository,
private val preferencesRepository: PreferencesRepository, private val preferencesRepository: PreferencesRepository,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<GradeDetailsView>(errorHandler) { ) : BaseSessionPresenter<GradeDetailsView>(errorHandler) {
private var currentSemesterId = 0 private var currentSemesterId = 0

View File

@ -4,9 +4,9 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IExpandable import eu.davidea.flexibleadapter.items.IExpandable
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import io.github.wulkanowy.data.db.entities.Grade 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 val isViewEmpty: Boolean

View File

@ -11,13 +11,13 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R 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.GradeFragment
import io.github.wulkanowy.ui.modules.grade.GradeView import io.github.wulkanowy.ui.modules.grade.GradeView
import kotlinx.android.synthetic.main.fragment_grade_summary.* import kotlinx.android.synthetic.main.fragment_grade_summary.*
import javax.inject.Inject import javax.inject.Inject
class GradeSummaryFragment : BaseFragment(), GradeSummaryView, GradeView.GradeChildView { class GradeSummaryFragment : BaseSessionFragment(), GradeSummaryView, GradeView.GradeChildView {
@Inject @Inject
lateinit var presenter: GradeSummaryPresenter lateinit var presenter: GradeSummaryPresenter

View File

@ -6,8 +6,8 @@ import io.github.wulkanowy.data.repositories.GradeSummaryRepository
import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.PreferencesRepository
import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.SemesterRepository
import io.github.wulkanowy.data.repositories.StudentRepository 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.modules.main.MainErrorHandler import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.calcAverage import io.github.wulkanowy.utils.calcAverage
@ -17,7 +17,7 @@ import java.util.Locale.FRANCE
import javax.inject.Inject import javax.inject.Inject
class GradeSummaryPresenter @Inject constructor( class GradeSummaryPresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: SessionErrorHandler,
private val gradeSummaryRepository: GradeSummaryRepository, private val gradeSummaryRepository: GradeSummaryRepository,
private val gradeRepository: GradeRepository, private val gradeRepository: GradeRepository,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
@ -25,7 +25,7 @@ class GradeSummaryPresenter @Inject constructor(
private val preferencesRepository: PreferencesRepository, private val preferencesRepository: PreferencesRepository,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<GradeSummaryView>(errorHandler) { ) : BaseSessionPresenter<GradeSummaryView>(errorHandler) {
override fun onAttachView(view: GradeSummaryView) { override fun onAttachView(view: GradeSummaryView) {
super.onAttachView(view) super.onAttachView(view)

View File

@ -1,8 +1,8 @@
package io.github.wulkanowy.ui.modules.grade.summary 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 val isViewEmpty: Boolean

View File

@ -9,13 +9,13 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Homework 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.ui.modules.main.MainView
import io.github.wulkanowy.utils.setOnItemClickListener import io.github.wulkanowy.utils.setOnItemClickListener
import kotlinx.android.synthetic.main.fragment_homework.* import kotlinx.android.synthetic.main.fragment_homework.*
import javax.inject.Inject import javax.inject.Inject
class HomeworkFragment : BaseFragment(), HomeworkView, MainView.TitledView { class HomeworkFragment : BaseSessionFragment(), HomeworkView, MainView.TitledView {
@Inject @Inject
lateinit var presenter: HomeworkPresenter lateinit var presenter: HomeworkPresenter

View File

@ -5,8 +5,8 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.data.repositories.HomeworkRepository import io.github.wulkanowy.data.repositories.HomeworkRepository
import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.SemesterRepository
import io.github.wulkanowy.data.repositories.StudentRepository 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.modules.main.MainErrorHandler import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.isHolidays import io.github.wulkanowy.utils.isHolidays
@ -19,13 +19,13 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject import javax.inject.Inject
class HomeworkPresenter @Inject constructor( class HomeworkPresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: SessionErrorHandler,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val homeworkRepository: HomeworkRepository, private val homeworkRepository: HomeworkRepository,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository, private val semesterRepository: SemesterRepository,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<HomeworkView>(errorHandler) { ) : BaseSessionPresenter<HomeworkView>(errorHandler) {
lateinit var currentDate: LocalDate lateinit var currentDate: LocalDate
private set private set

View File

@ -1,9 +1,9 @@
package io.github.wulkanowy.ui.modules.homework package io.github.wulkanowy.ui.modules.homework
import io.github.wulkanowy.data.db.entities.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() fun initView()

View File

@ -4,7 +4,7 @@ import android.content.res.Resources
import android.database.sqlite.SQLiteConstraintException import android.database.sqlite.SQLiteConstraintException
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.api.login.BadCredentialsException import io.github.wulkanowy.api.login.BadCredentialsException
import io.github.wulkanowy.data.ErrorHandler import io.github.wulkanowy.ui.base.ErrorHandler
import javax.inject.Inject import javax.inject.Inject
class LoginErrorHandler @Inject constructor(resources: Resources) : ErrorHandler(resources) { class LoginErrorHandler @Inject constructor(resources: Resources) : ErrorHandler(resources) {

View File

@ -1,7 +1,7 @@
package io.github.wulkanowy.ui.modules.login 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.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import javax.inject.Inject import javax.inject.Inject
class LoginPresenter @Inject constructor(errorHandler: ErrorHandler) : BasePresenter<LoginView>(errorHandler) { class LoginPresenter @Inject constructor(errorHandler: ErrorHandler) : BasePresenter<LoginView>(errorHandler) {

View File

@ -134,7 +134,7 @@ class MainActivity : BaseActivity(), MainView {
navController.showDialogFragment(AccountDialog.newInstance()) navController.showDialogFragment(AccountDialog.newInstance())
} }
override fun showExpiredDialog() { fun showExpiredDialog() {
AlertDialog.Builder(this) AlertDialog.Builder(this)
.setTitle(R.string.main_session_expired) .setTitle(R.string.main_session_expired)
.setMessage(R.string.main_session_relogin) .setMessage(R.string.main_session_relogin)

View File

@ -6,13 +6,14 @@ import io.github.wulkanowy.data.repositories.PreferencesRepository
import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.data.repositories.StudentRepository
import io.github.wulkanowy.services.job.ServiceHelper import io.github.wulkanowy.services.job.ServiceHelper
import io.github.wulkanowy.ui.base.BasePresenter 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.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.reactivex.Completable import io.reactivex.Completable
import javax.inject.Inject import javax.inject.Inject
class MainPresenter @Inject constructor( class MainPresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: ErrorHandler,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val prefRepository: PreferencesRepository, private val prefRepository: PreferencesRepository,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
@ -24,7 +25,6 @@ class MainPresenter @Inject constructor(
super.onAttachView(view) super.onAttachView(view)
view.run { view.run {
cancelNotifications() cancelNotifications()
errorHandler.onDecryptionFail = { showExpiredDialog() }
startMenuIndex = if (initMenuIndex != -1) initMenuIndex else prefRepository.startMenuIndex startMenuIndex = if (initMenuIndex != -1) initMenuIndex else prefRepository.startMenuIndex
initView() initView()
} }

View File

@ -20,8 +20,6 @@ interface MainView : BaseView {
fun showAccountPicker() fun showAccountPicker()
fun showExpiredDialog()
fun notifyMenuViewReselected() fun notifyMenuViewReselected()
fun setViewTitle(title: String) fun setViewTitle(title: String)

View File

@ -1,7 +1,7 @@
package io.github.wulkanowy.ui.modules.message 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.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.reactivex.Completable import io.reactivex.Completable
import java.util.concurrent.TimeUnit.MILLISECONDS import java.util.concurrent.TimeUnit.MILLISECONDS

View File

@ -5,12 +5,12 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import io.github.wulkanowy.R 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.ui.modules.main.MainView
import kotlinx.android.synthetic.main.fragment_message_preview.* import kotlinx.android.synthetic.main.fragment_message_preview.*
import javax.inject.Inject import javax.inject.Inject
class MessagePreviewFragment : BaseFragment(), MessagePreviewView, MainView.TitledView { class MessagePreviewFragment : BaseSessionFragment(), MessagePreviewView, MainView.TitledView {
@Inject @Inject
lateinit var presenter: MessagePreviewPresenter lateinit var presenter: MessagePreviewPresenter

View File

@ -1,22 +1,22 @@
package io.github.wulkanowy.ui.modules.message.preview package io.github.wulkanowy.ui.modules.message.preview
import com.google.firebase.analytics.FirebaseAnalytics.Param.START_DATE 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.MessagesRepository
import io.github.wulkanowy.data.repositories.StudentRepository 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.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.toFormattedString import io.github.wulkanowy.utils.toFormattedString
import javax.inject.Inject import javax.inject.Inject
class MessagePreviewPresenter @Inject constructor( class MessagePreviewPresenter @Inject constructor(
private val errorHandler: ErrorHandler, private val errorHandler: SessionErrorHandler,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val messagesRepository: MessagesRepository, private val messagesRepository: MessagesRepository,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<MessagePreviewView>(errorHandler) { ) : BaseSessionPresenter<MessagePreviewView>(errorHandler) {
var messageId: Int = 0 var messageId: Int = 0

View File

@ -1,8 +1,8 @@
package io.github.wulkanowy.ui.modules.message.preview 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 val noSubjectString: String

View File

@ -12,7 +12,7 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.data.repositories.MessagesRepository 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.main.MainActivity
import io.github.wulkanowy.ui.modules.message.MessageFragment import io.github.wulkanowy.ui.modules.message.MessageFragment
import io.github.wulkanowy.ui.modules.message.MessageItem 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 kotlinx.android.synthetic.main.fragment_message_tab.*
import javax.inject.Inject import javax.inject.Inject
class MessageTabFragment : BaseFragment(), MessageTabView, MessageView.MessageChildView { class MessageTabFragment : BaseSessionFragment(), MessageTabView, MessageView.MessageChildView {
@Inject @Inject
lateinit var presenter: MessageTabPresenter lateinit var presenter: MessageTabPresenter

View File

@ -1,11 +1,11 @@
package io.github.wulkanowy.ui.modules.message.tab package io.github.wulkanowy.ui.modules.message.tab
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem 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.db.entities.Message
import io.github.wulkanowy.data.repositories.MessagesRepository import io.github.wulkanowy.data.repositories.MessagesRepository
import io.github.wulkanowy.data.repositories.StudentRepository 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.ui.modules.message.MessageItem
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
@ -13,12 +13,12 @@ import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
class MessageTabPresenter @Inject constructor( class MessageTabPresenter @Inject constructor(
private val errorHandler: ErrorHandler, private val errorHandler: SessionErrorHandler,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val messagesRepository: MessagesRepository, private val messagesRepository: MessagesRepository,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<MessageTabView>(errorHandler) { ) : BaseSessionPresenter<MessageTabView>(errorHandler) {
lateinit var folder: MessagesRepository.MessageFolder lateinit var folder: MessagesRepository.MessageFolder

View File

@ -1,10 +1,10 @@
package io.github.wulkanowy.ui.modules.message.tab package io.github.wulkanowy.ui.modules.message.tab
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem 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 import io.github.wulkanowy.ui.modules.message.MessageItem
interface MessageTabView : BaseView { interface MessageTabView : BaseSessionView {
val noSubjectString: String val noSubjectString: String

View File

@ -1,8 +1,8 @@
package io.github.wulkanowy.ui.modules.more package io.github.wulkanowy.ui.modules.more
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem 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.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import javax.inject.Inject import javax.inject.Inject
class MorePresenter @Inject constructor(errorHandler: ErrorHandler) : BasePresenter<MoreView>(errorHandler) { class MorePresenter @Inject constructor(errorHandler: ErrorHandler) : BasePresenter<MoreView>(errorHandler) {

View File

@ -11,13 +11,13 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Note 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.ui.modules.main.MainView
import io.github.wulkanowy.utils.setOnItemClickListener import io.github.wulkanowy.utils.setOnItemClickListener
import kotlinx.android.synthetic.main.fragment_note.* import kotlinx.android.synthetic.main.fragment_note.*
import javax.inject.Inject import javax.inject.Inject
class NoteFragment : BaseFragment(), NoteView, MainView.TitledView { class NoteFragment : BaseSessionFragment(), NoteView, MainView.TitledView {
@Inject @Inject
lateinit var presenter: NotePresenter lateinit var presenter: NotePresenter

View File

@ -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.NoteRepository
import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.SemesterRepository
import io.github.wulkanowy.data.repositories.StudentRepository 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.modules.main.MainErrorHandler import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
class NotePresenter @Inject constructor( class NotePresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: SessionErrorHandler,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val noteRepository: NoteRepository, private val noteRepository: NoteRepository,
private val semesterRepository: SemesterRepository, private val semesterRepository: SemesterRepository,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<NoteView>(errorHandler) { ) : BaseSessionPresenter<NoteView>(errorHandler) {
override fun onAttachView(view: NoteView) { override fun onAttachView(view: NoteView) {
super.onAttachView(view) super.onAttachView(view)

View File

@ -2,9 +2,9 @@ package io.github.wulkanowy.ui.modules.note
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.data.db.entities.Note 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 val isViewEmpty: Boolean

View File

@ -1,9 +1,9 @@
package io.github.wulkanowy.ui.modules.settings package io.github.wulkanowy.ui.modules.settings
import io.github.wulkanowy.data.ErrorHandler
import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.PreferencesRepository
import io.github.wulkanowy.services.job.ServiceHelper import io.github.wulkanowy.services.job.ServiceHelper
import io.github.wulkanowy.ui.base.BasePresenter 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.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.isHolidays import io.github.wulkanowy.utils.isHolidays
import org.threeten.bp.LocalDate.now import org.threeten.bp.LocalDate.now

View File

@ -1,8 +1,8 @@
package io.github.wulkanowy.ui.modules.splash package io.github.wulkanowy.ui.modules.splash
import io.github.wulkanowy.data.ErrorHandler
import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.data.repositories.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import javax.inject.Inject import javax.inject.Inject
class SplashPresenter @Inject constructor( class SplashPresenter @Inject constructor(

View File

@ -9,13 +9,13 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Timetable 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.ui.modules.main.MainView
import io.github.wulkanowy.utils.setOnItemClickListener import io.github.wulkanowy.utils.setOnItemClickListener
import kotlinx.android.synthetic.main.fragment_timetable.* import kotlinx.android.synthetic.main.fragment_timetable.*
import javax.inject.Inject import javax.inject.Inject
class TimetableFragment : BaseFragment(), TimetableView, MainView.MainChildView, MainView.TitledView { class TimetableFragment : BaseSessionFragment(), TimetableView, MainView.MainChildView, MainView.TitledView {
@Inject @Inject
lateinit var presenter: TimetablePresenter lateinit var presenter: TimetablePresenter

View File

@ -5,8 +5,8 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.data.repositories.SemesterRepository import io.github.wulkanowy.data.repositories.SemesterRepository
import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.data.repositories.StudentRepository
import io.github.wulkanowy.data.repositories.TimetableRepository import io.github.wulkanowy.data.repositories.TimetableRepository
import io.github.wulkanowy.ui.base.BasePresenter import io.github.wulkanowy.ui.base.session.BaseSessionPresenter
import io.github.wulkanowy.ui.modules.main.MainErrorHandler import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.isHolidays import io.github.wulkanowy.utils.isHolidays
@ -21,13 +21,13 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.inject.Inject import javax.inject.Inject
class TimetablePresenter @Inject constructor( class TimetablePresenter @Inject constructor(
private val errorHandler: MainErrorHandler, private val errorHandler: SessionErrorHandler,
private val schedulers: SchedulersProvider, private val schedulers: SchedulersProvider,
private val timetableRepository: TimetableRepository, private val timetableRepository: TimetableRepository,
private val studentRepository: StudentRepository, private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository, private val semesterRepository: SemesterRepository,
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<TimetableView>(errorHandler) { ) : BaseSessionPresenter<TimetableView>(errorHandler) {
lateinit var currentDate: LocalDate lateinit var currentDate: LocalDate
private set private set

View File

@ -1,9 +1,9 @@
package io.github.wulkanowy.ui.modules.timetable package io.github.wulkanowy.ui.modules.timetable
import io.github.wulkanowy.data.db.entities.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 val roomString: String

View File

@ -4,6 +4,7 @@ import io.github.wulkanowy.TestSchedulersProvider
import io.github.wulkanowy.data.repositories.PreferencesRepository import io.github.wulkanowy.data.repositories.PreferencesRepository
import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.data.repositories.StudentRepository
import io.github.wulkanowy.services.job.ServiceHelper import io.github.wulkanowy.services.job.ServiceHelper
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
@ -15,7 +16,7 @@ import org.mockito.MockitoAnnotations
class MainPresenterTest { class MainPresenterTest {
@Mock @Mock
lateinit var errorHandler: MainErrorHandler lateinit var errorHandler: ErrorHandler
@Mock @Mock
lateinit var studentRepository: StudentRepository lateinit var studentRepository: StudentRepository

View File

@ -1,7 +1,7 @@
package io.github.wulkanowy.ui.modules.splash package io.github.wulkanowy.ui.modules.splash
import io.github.wulkanowy.data.ErrorHandler
import io.github.wulkanowy.data.repositories.StudentRepository import io.github.wulkanowy.data.repositories.StudentRepository
import io.github.wulkanowy.ui.base.ErrorHandler
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.mockito.Mock import org.mockito.Mock