forked from github/wulkanowy-mirror
Drop support for android 4.x (#1232)
This commit is contained in:
parent
0bdd33ef4a
commit
6cb4ea4b0f
@ -19,11 +19,10 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "io.github.wulkanowy"
|
applicationId "io.github.wulkanowy"
|
||||||
testApplicationId "io.github.tests.wulkanowy"
|
testApplicationId "io.github.tests.wulkanowy"
|
||||||
minSdkVersion 17
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 90
|
versionCode 90
|
||||||
versionName "1.1.4"
|
versionName "1.1.4"
|
||||||
multiDexEnabled true
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
@ -78,7 +77,6 @@ android {
|
|||||||
productFlavors {
|
productFlavors {
|
||||||
hms {
|
hms {
|
||||||
dimension "platform"
|
dimension "platform"
|
||||||
minSdkVersion 19
|
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
install_channel: "AppGallery"
|
install_channel: "AppGallery"
|
||||||
]
|
]
|
||||||
@ -175,7 +173,6 @@ dependencies {
|
|||||||
implementation "androidx.appcompat:appcompat-resources:1.2.0"
|
implementation "androidx.appcompat:appcompat-resources:1.2.0"
|
||||||
implementation "androidx.fragment:fragment-ktx:1.3.2"
|
implementation "androidx.fragment:fragment-ktx:1.3.2"
|
||||||
implementation "androidx.annotation:annotation:1.2.0"
|
implementation "androidx.annotation:annotation:1.2.0"
|
||||||
implementation "androidx.multidex:multidex:2.0.1"
|
|
||||||
|
|
||||||
implementation "androidx.preference:preference-ktx:1.1.1"
|
implementation "androidx.preference:preference-ktx:1.1.1"
|
||||||
implementation "androidx.recyclerview:recyclerview:1.1.0"
|
implementation "androidx.recyclerview:recyclerview:1.1.0"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
apply plugin: "jacoco"
|
apply plugin: "jacoco"
|
||||||
|
|
||||||
jacoco {
|
jacoco {
|
||||||
toolVersion "0.8.5"
|
toolVersion "0.8.6"
|
||||||
reportsDir = file("$buildDir/reports")
|
reportsDirectory = file("$buildDir/reports")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(Test) {
|
tasks.withType(Test) {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
|
@ -2,14 +2,12 @@ package io.github.wulkanowy
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.Context
|
|
||||||
import android.util.Log.DEBUG
|
import android.util.Log.DEBUG
|
||||||
import android.util.Log.INFO
|
import android.util.Log.INFO
|
||||||
import android.util.Log.VERBOSE
|
import android.util.Log.VERBOSE
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.hilt.work.HiltWorkerFactory
|
import androidx.hilt.work.HiltWorkerFactory
|
||||||
import androidx.multidex.MultiDex
|
|
||||||
import androidx.work.Configuration
|
import androidx.work.Configuration
|
||||||
import com.yariksoffice.lingver.Lingver
|
import com.yariksoffice.lingver.Lingver
|
||||||
import dagger.hilt.android.HiltAndroidApp
|
import dagger.hilt.android.HiltAndroidApp
|
||||||
@ -43,11 +41,6 @@ class WulkanowyApp : Application(), Configuration.Provider {
|
|||||||
@Inject
|
@Inject
|
||||||
lateinit var analyticsHelper: AnalyticsHelper
|
lateinit var analyticsHelper: AnalyticsHelper
|
||||||
|
|
||||||
override fun attachBaseContext(base: Context?) {
|
|
||||||
super.attachBaseContext(base)
|
|
||||||
MultiDex.install(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("UnsafeOptInUsageWarning")
|
@SuppressLint("UnsafeOptInUsageWarning")
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
@ -15,6 +15,7 @@ class AppCreatorRepository @Inject constructor(
|
|||||||
private val dispatchers: DispatchersProvider
|
private val dispatchers: DispatchersProvider
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@Suppress("BlockingMethodInNonBlockingContext")
|
||||||
suspend fun getAppCreators() = withContext(dispatchers.backgroundThread) {
|
suspend fun getAppCreators() = withContext(dispatchers.backgroundThread) {
|
||||||
val moshi = Moshi.Builder().build()
|
val moshi = Moshi.Builder().build()
|
||||||
val type = Types.newParameterizedType(List::class.java, Contributor::class.java)
|
val type = Types.newParameterizedType(List::class.java, Contributor::class.java)
|
||||||
|
@ -2,7 +2,6 @@ package io.github.wulkanowy.data.repositories
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import androidx.core.content.edit
|
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import io.github.wulkanowy.R
|
import io.github.wulkanowy.R
|
||||||
import io.github.wulkanowy.ui.modules.grade.GradeAverageMode
|
import io.github.wulkanowy.ui.modules.grade.GradeAverageMode
|
||||||
@ -151,10 +150,6 @@ class PreferencesRepository @Inject constructor(
|
|||||||
R.string.pref_key_optional_arithmetic_average,
|
R.string.pref_key_optional_arithmetic_average,
|
||||||
R.bool.pref_default_optional_arithmetic_average
|
R.bool.pref_default_optional_arithmetic_average
|
||||||
)
|
)
|
||||||
|
|
||||||
var isKitkatDialogDisabled: Boolean
|
|
||||||
get() = sharedPref.getBoolean("kitkat_dialog_disabled", false)
|
|
||||||
set(value) = sharedPref.edit { putBoolean("kitkat_dialog_disabled", value) }
|
|
||||||
|
|
||||||
private fun getString(id: Int, default: Int) = getString(context.getString(id), default)
|
private fun getString(id: Int, default: Int) = getString(context.getString(id), default)
|
||||||
|
|
||||||
|
@ -4,9 +4,6 @@ import android.content.Intent
|
|||||||
import android.content.Intent.EXTRA_EMAIL
|
import android.content.Intent.EXTRA_EMAIL
|
||||||
import android.content.Intent.EXTRA_STREAM
|
import android.content.Intent.EXTRA_STREAM
|
||||||
import android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION
|
import android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Build.VERSION.SDK_INT
|
|
||||||
import android.os.Build.VERSION_CODES.LOLLIPOP
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
@ -81,8 +78,7 @@ class LogViewerFragment : BaseFragment<FragmentLogviewerBinding>(R.layout.fragme
|
|||||||
putExtra(EXTRA_EMAIL, arrayOf("wulkanowyinc@gmail.com"))
|
putExtra(EXTRA_EMAIL, arrayOf("wulkanowyinc@gmail.com"))
|
||||||
addFlags(FLAG_GRANT_READ_URI_PERMISSION)
|
addFlags(FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
putParcelableArrayListExtra(EXTRA_STREAM, ArrayList(files.map {
|
putParcelableArrayListExtra(EXTRA_STREAM, ArrayList(files.map {
|
||||||
if (SDK_INT < LOLLIPOP) Uri.fromFile(it)
|
FileProvider.getUriForFile(requireContext(), "$APPLICATION_ID.fileprovider", it)
|
||||||
else FileProvider.getUriForFile(requireContext(), "$APPLICATION_ID.fileprovider", it)
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import timber.log.Timber
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class AccountEditPresenter @Inject constructor(
|
class AccountEditPresenter @Inject constructor(
|
||||||
private val appInfo: AppInfo,
|
appInfo: AppInfo,
|
||||||
errorHandler: ErrorHandler,
|
errorHandler: ErrorHandler,
|
||||||
studentRepository: StudentRepository
|
studentRepository: StudentRepository
|
||||||
) : BasePresenter<AccountEditView>(errorHandler, studentRepository) {
|
) : BasePresenter<AccountEditView>(errorHandler, studentRepository) {
|
||||||
|
@ -5,15 +5,11 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import io.github.wulkanowy.data.db.entities.Grade
|
|
||||||
import io.github.wulkanowy.data.db.entities.GradeSummary
|
import io.github.wulkanowy.data.db.entities.GradeSummary
|
||||||
import io.github.wulkanowy.data.db.entities.Student
|
|
||||||
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
||||||
import io.github.wulkanowy.databinding.ItemGradeSummaryBinding
|
import io.github.wulkanowy.databinding.ItemGradeSummaryBinding
|
||||||
import io.github.wulkanowy.databinding.ScrollableHeaderGradeSummaryBinding
|
import io.github.wulkanowy.databinding.ScrollableHeaderGradeSummaryBinding
|
||||||
import io.github.wulkanowy.sdk.Sdk
|
|
||||||
import io.github.wulkanowy.utils.calcAverage
|
import io.github.wulkanowy.utils.calcAverage
|
||||||
import io.github.wulkanowy.utils.changeModifier
|
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import io.github.wulkanowy.data.db.entities.LuckyNumber
|
|||||||
import io.github.wulkanowy.databinding.ItemLuckyNumberHistoryBinding
|
import io.github.wulkanowy.databinding.ItemLuckyNumberHistoryBinding
|
||||||
import io.github.wulkanowy.utils.toFormattedString
|
import io.github.wulkanowy.utils.toFormattedString
|
||||||
import io.github.wulkanowy.utils.weekDayName
|
import io.github.wulkanowy.utils.weekDayName
|
||||||
import java.util.Locale
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class LuckyNumberHistoryAdapter @Inject constructor() :
|
class LuckyNumberHistoryAdapter @Inject constructor() :
|
||||||
|
@ -15,7 +15,6 @@ import io.github.wulkanowy.ui.modules.main.MainView
|
|||||||
import io.github.wulkanowy.ui.widgets.DividerItemDecoration
|
import io.github.wulkanowy.ui.widgets.DividerItemDecoration
|
||||||
import io.github.wulkanowy.utils.SchooldaysRangeLimiter
|
import io.github.wulkanowy.utils.SchooldaysRangeLimiter
|
||||||
import io.github.wulkanowy.utils.dpToPx
|
import io.github.wulkanowy.utils.dpToPx
|
||||||
import io.github.wulkanowy.utils.getThemeAttrColor
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@ import android.content.pm.ShortcutInfo
|
|||||||
import android.content.pm.ShortcutManager
|
import android.content.pm.ShortcutManager
|
||||||
import android.graphics.drawable.Icon
|
import android.graphics.drawable.Icon
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Build.VERSION.SDK_INT
|
|
||||||
import android.os.Build.VERSION_CODES.LOLLIPOP
|
|
||||||
import android.os.Build.VERSION_CODES.P
|
import android.os.Build.VERSION_CODES.P
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
@ -211,7 +209,7 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
override fun initView() {
|
override fun initView() {
|
||||||
with(binding.mainToolbar) {
|
with(binding.mainToolbar) {
|
||||||
if (SDK_INT >= LOLLIPOP) stateListAnimator = null
|
stateListAnimator = null
|
||||||
setBackgroundColor(
|
setBackgroundColor(
|
||||||
overlayProvider.compositeOverlayWithThemeSurfaceColorIfNeeded(dpToPx(4f))
|
overlayProvider.compositeOverlayWithThemeSurfaceColorIfNeeded(dpToPx(4f))
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,7 @@ class MainPresenter @Inject constructor(
|
|||||||
private val analytics: AnalyticsHelper,
|
private val analytics: AnalyticsHelper,
|
||||||
) : BasePresenter<MainView>(errorHandler, studentRepository) {
|
) : BasePresenter<MainView>(errorHandler, studentRepository) {
|
||||||
|
|
||||||
var studentsWitSemesters: List<StudentWithSemesters>? = null
|
private var studentsWitSemesters: List<StudentWithSemesters>? = null
|
||||||
|
|
||||||
fun onAttachView(view: MainView, initMenu: MainView.Section?) {
|
fun onAttachView(view: MainView, initMenu: MainView.Section?) {
|
||||||
super.onAttachView(view)
|
super.onAttachView(view)
|
||||||
|
@ -8,7 +8,6 @@ import dagger.hilt.android.AndroidEntryPoint
|
|||||||
import io.github.wulkanowy.R
|
import io.github.wulkanowy.R
|
||||||
import io.github.wulkanowy.databinding.FragmentMoreBinding
|
import io.github.wulkanowy.databinding.FragmentMoreBinding
|
||||||
import io.github.wulkanowy.ui.base.BaseFragment
|
import io.github.wulkanowy.ui.base.BaseFragment
|
||||||
import io.github.wulkanowy.ui.modules.about.AboutFragment
|
|
||||||
import io.github.wulkanowy.ui.modules.conference.ConferenceFragment
|
import io.github.wulkanowy.ui.modules.conference.ConferenceFragment
|
||||||
import io.github.wulkanowy.ui.modules.homework.HomeworkFragment
|
import io.github.wulkanowy.ui.modules.homework.HomeworkFragment
|
||||||
import io.github.wulkanowy.ui.modules.luckynumber.LuckyNumberFragment
|
import io.github.wulkanowy.ui.modules.luckynumber.LuckyNumberFragment
|
||||||
|
@ -2,4 +2,4 @@ package io.github.wulkanowy.ui.modules.settings.advanced
|
|||||||
|
|
||||||
import io.github.wulkanowy.ui.base.BaseView
|
import io.github.wulkanowy.ui.base.BaseView
|
||||||
|
|
||||||
interface AdvancedView : BaseView {}
|
interface AdvancedView : BaseView
|
||||||
|
@ -3,10 +3,8 @@ package io.github.wulkanowy.ui.modules.splash
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import android.widget.Toast.LENGTH_LONG
|
import android.widget.Toast.LENGTH_LONG
|
||||||
import androidx.appcompat.app.AlertDialog
|
|
||||||
import androidx.viewbinding.ViewBinding
|
import androidx.viewbinding.ViewBinding
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import io.github.wulkanowy.R
|
|
||||||
import io.github.wulkanowy.ui.base.BaseActivity
|
import io.github.wulkanowy.ui.base.BaseActivity
|
||||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||||
@ -46,14 +44,4 @@ class SplashActivity : BaseActivity<SplashPresenter, ViewBinding>(), SplashView
|
|||||||
override fun showError(text: String, error: Throwable) {
|
override fun showError(text: String, error: Throwable) {
|
||||||
Toast.makeText(this, text, LENGTH_LONG).show()
|
Toast.makeText(this, text, LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showKitkatView() {
|
|
||||||
AlertDialog.Builder(this)
|
|
||||||
.setTitle(R.string.drop_kitkat_title)
|
|
||||||
.setMessage(R.string.drop_kitkat_content)
|
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
|
||||||
.setNeutralButton(R.string.drop_kitkat_again) { _, _ -> presenter.onNeutralButtonSelected() }
|
|
||||||
.setOnDismissListener { presenter.onKitkatViewDismissed() }
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package io.github.wulkanowy.ui.modules.splash
|
package io.github.wulkanowy.ui.modules.splash
|
||||||
|
|
||||||
import android.os.Build
|
|
||||||
import io.github.wulkanowy.data.Status
|
import io.github.wulkanowy.data.Status
|
||||||
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.ui.base.BasePresenter
|
import io.github.wulkanowy.ui.base.BasePresenter
|
||||||
import io.github.wulkanowy.ui.base.ErrorHandler
|
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||||
import io.github.wulkanowy.utils.AppInfo
|
|
||||||
import io.github.wulkanowy.utils.flowWithResource
|
import io.github.wulkanowy.utils.flowWithResource
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
@ -15,26 +12,13 @@ import javax.inject.Inject
|
|||||||
class SplashPresenter @Inject constructor(
|
class SplashPresenter @Inject constructor(
|
||||||
errorHandler: ErrorHandler,
|
errorHandler: ErrorHandler,
|
||||||
studentRepository: StudentRepository,
|
studentRepository: StudentRepository,
|
||||||
private val preferencesRepository: PreferencesRepository,
|
|
||||||
private val appInfo: AppInfo
|
|
||||||
) : BasePresenter<SplashView>(errorHandler, studentRepository) {
|
) : BasePresenter<SplashView>(errorHandler, studentRepository) {
|
||||||
|
|
||||||
private var externalUrl: String? = null
|
|
||||||
|
|
||||||
fun onAttachView(view: SplashView, externalUrl: String?) {
|
fun onAttachView(view: SplashView, externalUrl: String?) {
|
||||||
super.onAttachView(view)
|
super.onAttachView(view)
|
||||||
this.externalUrl = externalUrl
|
|
||||||
|
|
||||||
if (appInfo.systemVersion < Build.VERSION_CODES.LOLLIPOP && !preferencesRepository.isKitkatDialogDisabled) {
|
|
||||||
view.showKitkatView()
|
|
||||||
} else {
|
|
||||||
loadCorrectDataOrUser()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadCorrectDataOrUser() {
|
|
||||||
if (!externalUrl.isNullOrBlank()) {
|
if (!externalUrl.isNullOrBlank()) {
|
||||||
view?.openExternalUrlAndFinish(externalUrl!!)
|
view.openExternalUrlAndFinish(externalUrl)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,19 +26,11 @@ class SplashPresenter @Inject constructor(
|
|||||||
when (it.status) {
|
when (it.status) {
|
||||||
Status.LOADING -> Timber.d("Is current user set check started")
|
Status.LOADING -> Timber.d("Is current user set check started")
|
||||||
Status.SUCCESS -> {
|
Status.SUCCESS -> {
|
||||||
if (it.data!!) view?.openMainView()
|
if (it.data!!) view.openMainView()
|
||||||
else view?.openLoginView()
|
else view.openLoginView()
|
||||||
}
|
}
|
||||||
Status.ERROR -> errorHandler.dispatch(it.error!!)
|
Status.ERROR -> errorHandler.dispatch(it.error!!)
|
||||||
}
|
}
|
||||||
}.launch()
|
}.launch()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onKitkatViewDismissed() {
|
|
||||||
loadCorrectDataOrUser()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun onNeutralButtonSelected() {
|
|
||||||
preferencesRepository.isKitkatDialogDisabled = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,4 @@ interface SplashView : BaseView {
|
|||||||
fun openMainView()
|
fun openMainView()
|
||||||
|
|
||||||
fun openExternalUrlAndFinish(url: String)
|
fun openExternalUrlAndFinish(url: String)
|
||||||
|
|
||||||
fun showKitkatView()
|
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ class TimetableWidgetFactory(
|
|||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Timber.e(e, "An error has occurred in timetable widget factory")
|
Timber.e(e, "An error has occurred in timetable widget factory")
|
||||||
emptyList<Timetable>()
|
emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("DefaultLocale")
|
@SuppressLint("DefaultLocale")
|
||||||
|
@ -230,7 +230,7 @@ class TimetableWidgetProvider : HiltBroadcastReceiver() {
|
|||||||
|
|
||||||
private suspend fun getStudent(studentId: Long, appWidgetId: Int) = try {
|
private suspend fun getStudent(studentId: Long, appWidgetId: Int) = try {
|
||||||
val students = studentRepository.getSavedStudents(false)
|
val students = studentRepository.getSavedStudents(false)
|
||||||
val student = students.singleOrNull { it -> it.student.id == studentId }?.student
|
val student = students.singleOrNull { it.student.id == studentId }?.student
|
||||||
when {
|
when {
|
||||||
student != null -> student
|
student != null -> student
|
||||||
studentId != 0L && studentRepository.isCurrentStudentSet() -> {
|
studentId != 0L && studentRepository.isCurrentStudentSet() -> {
|
||||||
|
@ -58,10 +58,6 @@ private val cipher: Cipher
|
|||||||
fun encrypt(plainText: String, context: Context): String {
|
fun encrypt(plainText: String, context: Context): String {
|
||||||
if (plainText.isEmpty()) throw ScramblerException("Text to be encrypted is empty")
|
if (plainText.isEmpty()) throw ScramblerException("Text to be encrypted is empty")
|
||||||
|
|
||||||
if (SDK_INT < JELLY_BEAN_MR2) {
|
|
||||||
return String(encode(plainText.toByteArray(KEY_CHARSET), DEFAULT), KEY_CHARSET)
|
|
||||||
}
|
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
if (!isKeyPairExists) generateKeyPair(context)
|
if (!isKeyPairExists) generateKeyPair(context)
|
||||||
|
|
||||||
@ -90,10 +86,6 @@ fun decrypt(cipherText: String): String {
|
|||||||
if (cipherText.isEmpty()) throw ScramblerException("Text to be encrypted is empty")
|
if (cipherText.isEmpty()) throw ScramblerException("Text to be encrypted is empty")
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
if (SDK_INT < JELLY_BEAN_MR2 || cipherText.length < 250) {
|
|
||||||
return String(decode(cipherText.toByteArray(KEY_CHARSET), DEFAULT), KEY_CHARSET)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isKeyPairExists) throw ScramblerException("KeyPair doesn't exist")
|
if (!isKeyPairExists) throw ScramblerException("KeyPair doesn't exist")
|
||||||
|
|
||||||
cipher.let {
|
cipher.let {
|
||||||
|
@ -29,6 +29,6 @@
|
|||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:text="@string/logviewer_refresh"
|
android:text="@string/logviewer_refresh"
|
||||||
android:tint="?colorOnSecondary"
|
android:tint="?colorOnSecondary"
|
||||||
app:srcCompat="@drawable/ic_refresh" />
|
app:srcCompat="@drawable/ic_refresh"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
@ -111,5 +111,6 @@
|
|||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:tint="?colorOnSecondary"
|
android:tint="?colorOnSecondary"
|
||||||
app:srcCompat="@drawable/ic_all_add" />
|
app:srcCompat="@drawable/ic_all_add"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:srcCompat="@drawable/ic_excuse_waiting"
|
app:srcCompat="@drawable/ic_excuse_waiting"
|
||||||
app:tint="?attr/colorOnSurface" />
|
app:tint="?attr/colorOnSurface"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
android:src="@drawable/ic_widget_clover"
|
android:src="@drawable/ic_widget_clover"
|
||||||
android:tint="@android:color/white"
|
android:tint="@android:color/white"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible"
|
||||||
|
tools:ignore="UseAppTint" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/luckyNumberWidgetTitle"
|
android:id="@+id/luckyNumberWidgetTitle"
|
||||||
@ -46,7 +47,8 @@
|
|||||||
android:src="@drawable/ic_widget_clover"
|
android:src="@drawable/ic_widget_clover"
|
||||||
android:tint="@android:color/white"
|
android:tint="@android:color/white"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible"
|
||||||
|
tools:ignore="UseAppTint" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/luckyNumberWidgetNumber"
|
android:id="@+id/luckyNumberWidgetNumber"
|
||||||
|
@ -10,44 +10,38 @@
|
|||||||
<item name="colorSwipeRefresh">@color/colorSwipeRefreshDark</item>
|
<item name="colorSwipeRefresh">@color/colorSwipeRefreshDark</item>
|
||||||
<item name="android:windowBackground">?colorSurface</item>
|
<item name="android:windowBackground">?colorSurface</item>
|
||||||
<item name="android:textColor">?android:textColorPrimary</item>
|
<item name="android:textColor">?android:textColorPrimary</item>
|
||||||
<item name="android:navigationBarColor" tools:targetApi="lollipop">
|
<item name="android:navigationBarColor">@color/colorNavigationBarLight</item>
|
||||||
@color/colorNavigationBarLight
|
<item name="android:statusBarColor">@color/colorStatusBarLight</item>
|
||||||
</item>
|
|
||||||
<item name="android:statusBarColor" tools:targetApi="lollipop">
|
|
||||||
@color/colorStatusBarLight
|
|
||||||
</item>
|
|
||||||
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">false</item>
|
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">false</item>
|
||||||
<item name="mdtp_theme_dark">true</item>
|
|
||||||
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
|
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
|
||||||
|
<item name="mdtp_theme_dark">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="WulkanowyTheme.Black" parent="WulkanowyTheme.NoActionBar">
|
<style name="WulkanowyTheme.Black" parent="WulkanowyTheme.NoActionBar">
|
||||||
<item name="colorSurface">@android:color/black</item>
|
<item name="colorSurface">@android:color/black</item>
|
||||||
<item name="android:navigationBarColor" tools:targetApi="lollipop">
|
<item name="android:navigationBarColor">@color/colorNavigationBarBlack</item>
|
||||||
@color/colorNavigationBarBlack
|
<item name="android:statusBarColor">@color/colorStatusBarBlack</item>
|
||||||
</item>
|
|
||||||
<item name="android:statusBarColor" tools:targetApi="lollipop">@color/colorStatusBarBlack</item>
|
|
||||||
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
|
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="WulkanowyTheme.Login" parent="WulkanowyTheme.NoActionBar">
|
<style name="WulkanowyTheme.Login" parent="WulkanowyTheme.NoActionBar">
|
||||||
<item name="android:navigationBarColor" tools:targetApi="lollipop">?colorSurface</item>
|
<item name="android:navigationBarColor">?colorSurface</item>
|
||||||
<item name="android:statusBarColor" tools:targetApi="lollipop">?colorSurface</item>
|
<item name="android:statusBarColor">?colorSurface</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="WulkanowyTheme.Login.Black" parent="WulkanowyTheme.Black">
|
<style name="WulkanowyTheme.Login.Black" parent="WulkanowyTheme.Black">
|
||||||
<item name="android:navigationBarColor" tools:targetApi="lollipop">?colorSurface</item>
|
<item name="android:navigationBarColor">?colorSurface</item>
|
||||||
<item name="android:statusBarColor" tools:targetApi="lollipop">?colorSurface</item>
|
<item name="android:statusBarColor">?colorSurface</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="WulkanowyTheme.MessageSend" parent="WulkanowyTheme.NoActionBar">
|
<style name="WulkanowyTheme.MessageSend" parent="WulkanowyTheme.NoActionBar">
|
||||||
<item name="android:navigationBarColor" tools:targetApi="lollipop">?colorSurface</item>
|
<item name="android:navigationBarColor">?colorSurface</item>
|
||||||
<item name="android:statusBarColor" tools:targetApi="lollipop">#1C1C1C</item>
|
<item name="android:statusBarColor">#1C1C1C</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="WulkanowyTheme.MessageSend.Black" parent="WulkanowyTheme.Black">
|
<style name="WulkanowyTheme.MessageSend.Black" parent="WulkanowyTheme.Black">
|
||||||
<item name="android:navigationBarColor" tools:targetApi="lollipop">?colorSurface</item>
|
<item name="android:navigationBarColor">?colorSurface</item>
|
||||||
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/black</item>
|
<item name="android:statusBarColor">@android:color/black</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="WulkanowyTheme.WidgetAccountSwitcher" parent="Theme.MaterialComponents.Dialog">
|
<style name="WulkanowyTheme.WidgetAccountSwitcher" parent="Theme.MaterialComponents.Dialog">
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<style name="WulkanowyTheme" parent="BaseWulkanowyTheme">
|
|
||||||
<item name="android:statusBarColor">@android:color/darker_gray</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="WulkanowyTheme.SplashScreen" parent="WulkanowyTheme.NoActionBar">
|
|
||||||
<item name="android:windowBackground">@drawable/layer_splash_background</item>
|
|
||||||
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
|
|
||||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
@ -109,15 +109,4 @@
|
|||||||
<item>both_semesters</item>
|
<item>both_semesters</item>
|
||||||
<item>all_year</item>
|
<item>all_year</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="timetable_show_whole_class_entries">
|
|
||||||
<item>Don\'t show</item>
|
|
||||||
<item>Show all</item>
|
|
||||||
<item>Show smaller</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="timetable_show_whole_class_values" translatable="false">
|
|
||||||
<item>no</item>
|
|
||||||
<item>yes</item>
|
|
||||||
<item>small</item>
|
|
||||||
</string-array>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
<string name="login_type_hybrid">Hybrid</string>
|
<string name="login_type_hybrid">Hybrid</string>
|
||||||
<string name="login_token_hint">Token</string>
|
<string name="login_token_hint">Token</string>
|
||||||
<string name="login_pin_hint">PIN</string>
|
<string name="login_pin_hint">PIN</string>
|
||||||
<string name="login_api_key_hint">API key</string>
|
|
||||||
<string name="login_symbol_hint">Symbol</string>
|
<string name="login_symbol_hint">Symbol</string>
|
||||||
<string name="login_sign_in">Sign in</string>
|
<string name="login_sign_in">Sign in</string>
|
||||||
<string name="login_invalid_password">Password too short</string>
|
<string name="login_invalid_password">Password too short</string>
|
||||||
@ -66,7 +65,6 @@
|
|||||||
<string name="login_contact_email">Email</string>
|
<string name="login_contact_email">Email</string>
|
||||||
<string name="login_contact_discord">Discord</string>
|
<string name="login_contact_discord">Discord</string>
|
||||||
<string name="login_email_intent_title">Send email</string>
|
<string name="login_email_intent_title">Send email</string>
|
||||||
<string name="login_email_details">Describe details of problem:</string>
|
|
||||||
<string name="login_email_subject" translatable="false">Zgłoszenie: Problemy z logowaniem</string>
|
<string name="login_email_subject" translatable="false">Zgłoszenie: Problemy z logowaniem</string>
|
||||||
<string name="login_email_text" translatable="false">Informacje o aplikacji:\n\nUrządzenie: %1$s\nWersja SDK: %2$s\nWersja aplikacji: %3$s\nDodatkowe informacje: %4$s\nOstatni błąd: %5$s\n\nOpis problemu: </string>
|
<string name="login_email_text" translatable="false">Informacje o aplikacji:\n\nUrządzenie: %1$s\nWersja SDK: %2$s\nWersja aplikacji: %3$s\nDodatkowe informacje: %4$s\nOstatni błąd: %5$s\n\nOpis problemu: </string>
|
||||||
<string name="login_recover_warning">Make sure you select the correct UONET+ register variation!</string>
|
<string name="login_recover_warning">Make sure you select the correct UONET+ register variation!</string>
|
||||||
@ -91,13 +89,10 @@
|
|||||||
<string name="grade_weight">Weight</string>
|
<string name="grade_weight">Weight</string>
|
||||||
<string name="grade_weight_value">Weight: %s</string>
|
<string name="grade_weight_value">Weight: %s</string>
|
||||||
<string name="grade_comment">Comment</string>
|
<string name="grade_comment">Comment</string>
|
||||||
<string name="grade_no_new_items">No new grades</string>
|
|
||||||
<string name="grade_number_new_items">Number of new ratings: %1$d</string>
|
<string name="grade_number_new_items">Number of new ratings: %1$d</string>
|
||||||
<string name="grade_average">Average: %1$.2f</string>
|
<string name="grade_average">Average: %1$.2f</string>
|
||||||
<string name="grade_points_sum">Points: %s</string>
|
<string name="grade_points_sum">Points: %s</string>
|
||||||
<string name="grade_no_average">No average</string>
|
<string name="grade_no_average">No average</string>
|
||||||
<string name="grade_predicted">Predicted: %1$s</string>
|
|
||||||
<string name="grade_final">Final: %1$s</string>
|
|
||||||
<string name="grade_summary_points">Total points</string>
|
<string name="grade_summary_points">Total points</string>
|
||||||
<string name="grade_summary_final_grade">Final grade</string>
|
<string name="grade_summary_final_grade">Final grade</string>
|
||||||
<string name="grade_summary_predicted_grade">Predicted grade</string>
|
<string name="grade_summary_predicted_grade">Predicted grade</string>
|
||||||
@ -188,10 +183,6 @@
|
|||||||
<string name="attendance_unknown">Unknown</string>
|
<string name="attendance_unknown">Unknown</string>
|
||||||
<string name="attendance_number">Number of lesson</string>
|
<string name="attendance_number">Number of lesson</string>
|
||||||
<string name="attendance_no_items">No entries</string>
|
<string name="attendance_no_items">No entries</string>
|
||||||
<plurals name="attendance_number_absences">
|
|
||||||
<item quantity="one">%1$d absence</item>
|
|
||||||
<item quantity="other">%1$d absences</item>
|
|
||||||
</plurals>
|
|
||||||
<string name="attendance_excuse_dialog_reason">Absence reason (optional)</string>
|
<string name="attendance_excuse_dialog_reason">Absence reason (optional)</string>
|
||||||
<string name="attendance_excuse_dialog_submit">Send</string>
|
<string name="attendance_excuse_dialog_submit">Send</string>
|
||||||
<string name="attendance_excuse_success">Absence excuse request sent successfully!</string>
|
<string name="attendance_excuse_success">Absence excuse request sent successfully!</string>
|
||||||
@ -200,7 +191,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<!--Attendance summary-->
|
<!--Attendance summary-->
|
||||||
<string name="attendance_summary_final">Attendance</string>
|
|
||||||
<string name="attendance_summary_total">Total</string>
|
<string name="attendance_summary_total">Total</string>
|
||||||
|
|
||||||
|
|
||||||
@ -216,7 +206,6 @@
|
|||||||
<string name="message_trash">Trash</string>
|
<string name="message_trash">Trash</string>
|
||||||
<string name="message_no_subject">(no subject)</string>
|
<string name="message_no_subject">(no subject)</string>
|
||||||
<string name="message_no_items">No messages</string>
|
<string name="message_no_items">No messages</string>
|
||||||
<string name="message_preview_error">An error occurred while downloading message content</string>
|
|
||||||
<string name="message_from">From:</string>
|
<string name="message_from">From:</string>
|
||||||
<string name="message_to">To:</string>
|
<string name="message_to">To:</string>
|
||||||
<string name="message_date">Date: %s</string>
|
<string name="message_date">Date: %s</string>
|
||||||
@ -357,8 +346,6 @@
|
|||||||
<string name="account_logout_student">Student logout</string>
|
<string name="account_logout_student">Student logout</string>
|
||||||
<string name="account_type_student">Student account</string>
|
<string name="account_type_student">Student account</string>
|
||||||
<string name="account_type_parent">Parent account</string>
|
<string name="account_type_parent">Parent account</string>
|
||||||
<string name="account_login_mobile_api">Mobile API mode</string>
|
|
||||||
<string name="account_login_hybrid">Hybrid mode</string>
|
|
||||||
<string name="account_details_edit">Edit data</string>
|
<string name="account_details_edit">Edit data</string>
|
||||||
<string name="account_quick_manager">Accounts manager</string>
|
<string name="account_quick_manager">Accounts manager</string>
|
||||||
<string name="account_select_student">Select student</string>
|
<string name="account_select_student">Select student</string>
|
||||||
@ -479,7 +466,6 @@
|
|||||||
<string name="pref_view_timetable_show_timers">Mark current lesson</string>
|
<string name="pref_view_timetable_show_timers">Mark current lesson</string>
|
||||||
<string name="pref_view_timetable_show_groups">Show groups next to subjects</string>
|
<string name="pref_view_timetable_show_groups">Show groups next to subjects</string>
|
||||||
<string name="pref_view_grade_statistics_list">Show chart list in class grades</string>
|
<string name="pref_view_grade_statistics_list">Show chart list in class grades</string>
|
||||||
<string name="pref_view_timetable_show_whole_class">Show whole class lessons</string>
|
|
||||||
<string name="pref_view_subjects_without_grades">Show subjects without grades</string>
|
<string name="pref_view_subjects_without_grades">Show subjects without grades</string>
|
||||||
<string name="pref_view_grade_color_scheme">Grades color scheme</string>
|
<string name="pref_view_grade_color_scheme">Grades color scheme</string>
|
||||||
<string name="pref_view_grade_sorting_mode">Subjects sorting</string>
|
<string name="pref_view_grade_sorting_mode">Subjects sorting</string>
|
||||||
@ -532,7 +518,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<!--Notification Channels-->
|
<!--Notification Channels-->
|
||||||
<string name="channel_new_entries">New entries in register</string>
|
|
||||||
<string name="channel_new_grades">New grades</string>
|
<string name="channel_new_grades">New grades</string>
|
||||||
<string name="channel_lucky_number">Lucky number</string>
|
<string name="channel_lucky_number">Lucky number</string>
|
||||||
<string name="channel_new_message">New messages</string>
|
<string name="channel_new_message">New messages</string>
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
<item name="colorError">@color/colorError</item>
|
<item name="colorError">@color/colorError</item>
|
||||||
<item name="colorDivider">@color/colorDivider</item>
|
<item name="colorDivider">@color/colorDivider</item>
|
||||||
<item name="colorSwipeRefresh">@color/colorSwipeRefresh</item>
|
<item name="colorSwipeRefresh">@color/colorSwipeRefresh</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/darker_gray</item>
|
||||||
<item name="android:textColor">?android:textColorPrimary</item>
|
<item name="android:textColor">?android:textColorPrimary</item>
|
||||||
<item name="android:preferenceStyle">@style/PreferenceThemeOverlay</item>
|
<item name="android:preferenceStyle">@style/PreferenceThemeOverlay</item>
|
||||||
<item name="mdtp_theme_dark">false</item>
|
<item name="mdtp_theme_dark">false</item>
|
||||||
@ -24,6 +25,8 @@
|
|||||||
|
|
||||||
<style name="WulkanowyTheme.SplashScreen" parent="WulkanowyTheme.NoActionBar">
|
<style name="WulkanowyTheme.SplashScreen" parent="WulkanowyTheme.NoActionBar">
|
||||||
<item name="android:windowBackground">@drawable/layer_splash_background</item>
|
<item name="android:windowBackground">@drawable/layer_splash_background</item>
|
||||||
|
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
|
||||||
|
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="WulkanowyTheme.WidgetAccountSwitcher" parent="Theme.MaterialComponents.Light.Dialog">
|
<style name="WulkanowyTheme.WidgetAccountSwitcher" parent="Theme.MaterialComponents.Light.Dialog">
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package io.github.wulkanowy.ui.modules.splash
|
package io.github.wulkanowy.ui.modules.splash
|
||||||
|
|
||||||
import io.github.wulkanowy.MainCoroutineRule
|
import io.github.wulkanowy.MainCoroutineRule
|
||||||
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.ui.base.ErrorHandler
|
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||||
import io.github.wulkanowy.utils.AppInfo
|
|
||||||
import io.mockk.MockKAnnotations
|
import io.mockk.MockKAnnotations
|
||||||
import io.mockk.coEvery
|
import io.mockk.coEvery
|
||||||
import io.mockk.every
|
|
||||||
import io.mockk.impl.annotations.MockK
|
import io.mockk.impl.annotations.MockK
|
||||||
import io.mockk.verify
|
import io.mockk.verify
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
@ -25,12 +22,6 @@ class SplashPresenterTest {
|
|||||||
@MockK
|
@MockK
|
||||||
lateinit var studentRepository: StudentRepository
|
lateinit var studentRepository: StudentRepository
|
||||||
|
|
||||||
@MockK
|
|
||||||
lateinit var preferencesRepository: PreferencesRepository
|
|
||||||
|
|
||||||
@MockK
|
|
||||||
lateinit var appInfo: AppInfo
|
|
||||||
|
|
||||||
@MockK(relaxed = true)
|
@MockK(relaxed = true)
|
||||||
lateinit var errorHandler: ErrorHandler
|
lateinit var errorHandler: ErrorHandler
|
||||||
|
|
||||||
@ -39,13 +30,11 @@ class SplashPresenterTest {
|
|||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
MockKAnnotations.init(this)
|
MockKAnnotations.init(this)
|
||||||
presenter = SplashPresenter(errorHandler, studentRepository, preferencesRepository, appInfo)
|
presenter = SplashPresenter(errorHandler, studentRepository)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testOpenLoginView() {
|
fun testOpenLoginView() {
|
||||||
every { appInfo.systemVersion } returns 30
|
|
||||||
every { preferencesRepository.isKitkatDialogDisabled } returns true
|
|
||||||
coEvery { studentRepository.isCurrentStudentSet() } returns false
|
coEvery { studentRepository.isCurrentStudentSet() } returns false
|
||||||
|
|
||||||
presenter.onAttachView(splashView, null)
|
presenter.onAttachView(splashView, null)
|
||||||
@ -54,8 +43,6 @@ class SplashPresenterTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testMainMainView() {
|
fun testMainMainView() {
|
||||||
every { appInfo.systemVersion } returns 30
|
|
||||||
every { preferencesRepository.isKitkatDialogDisabled } returns true
|
|
||||||
coEvery { studentRepository.isCurrentStudentSet() } returns true
|
coEvery { studentRepository.isCurrentStudentSet() } returns true
|
||||||
|
|
||||||
presenter.onAttachView(splashView, null)
|
presenter.onAttachView(splashView, null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user