mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-19 17:06:46 -06:00
Merge branch 'release/1.6.3'
This commit is contained in:
commit
775b5122ef
@ -22,8 +22,8 @@ android {
|
|||||||
testApplicationId "io.github.tests.wulkanowy"
|
testApplicationId "io.github.tests.wulkanowy"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
versionCode 106
|
versionCode 107
|
||||||
versionName "1.6.2"
|
versionName "1.6.3"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
resValue "string", "app_name", "Wulkanowy"
|
resValue "string", "app_name", "Wulkanowy"
|
||||||
@ -174,7 +174,7 @@ ext {
|
|||||||
room = "2.4.2"
|
room = "2.4.2"
|
||||||
chucker = "3.5.2"
|
chucker = "3.5.2"
|
||||||
mockk = "1.12.2"
|
mockk = "1.12.2"
|
||||||
coroutines = "1.6.0"
|
coroutines = "1.6.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -233,7 +233,7 @@ dependencies {
|
|||||||
implementation 'me.xdrop:fuzzywuzzy:1.4.0'
|
implementation 'me.xdrop:fuzzywuzzy:1.4.0'
|
||||||
implementation 'com.fredporciuncula:flow-preferences:1.6.0'
|
implementation 'com.fredporciuncula:flow-preferences:1.6.0'
|
||||||
|
|
||||||
playImplementation platform('com.google.firebase:firebase-bom:29.3.0')
|
playImplementation platform('com.google.firebase:firebase-bom:29.3.1')
|
||||||
playImplementation 'com.google.firebase:firebase-analytics-ktx'
|
playImplementation 'com.google.firebase:firebase-analytics-ktx'
|
||||||
playImplementation 'com.google.firebase:firebase-messaging:'
|
playImplementation 'com.google.firebase:firebase-messaging:'
|
||||||
playImplementation 'com.google.firebase:firebase-crashlytics:'
|
playImplementation 'com.google.firebase:firebase-crashlytics:'
|
||||||
@ -241,8 +241,8 @@ dependencies {
|
|||||||
playImplementation 'com.google.android.play:core-ktx:1.8.1'
|
playImplementation 'com.google.android.play:core-ktx:1.8.1'
|
||||||
playImplementation 'com.google.android.gms:play-services-ads:20.6.0'
|
playImplementation 'com.google.android.gms:play-services-ads:20.6.0'
|
||||||
|
|
||||||
hmsImplementation 'com.huawei.hms:hianalytics:6.4.1.301'
|
hmsImplementation 'com.huawei.hms:hianalytics:6.4.1.302'
|
||||||
hmsImplementation 'com.huawei.agconnect:agconnect-crash:1.6.5.200'
|
hmsImplementation 'com.huawei.agconnect:agconnect-crash:1.6.5.300'
|
||||||
|
|
||||||
releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:$chucker"
|
releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:$chucker"
|
||||||
|
|
||||||
|
@ -15,79 +15,41 @@ import javax.inject.Singleton
|
|||||||
@Singleton
|
@Singleton
|
||||||
class ShortcutsHelper @Inject constructor(@ApplicationContext private val context: Context) {
|
class ShortcutsHelper @Inject constructor(@ApplicationContext private val context: Context) {
|
||||||
|
|
||||||
// Destination cannot be used here as shortcuts
|
fun initializeShortcuts() {
|
||||||
// require their intents to only use primitive types (see PersistableBundle.isValidType).
|
|
||||||
|
|
||||||
private val destinations = mapOf(
|
|
||||||
"grade" to Destination.Grade,
|
|
||||||
"attendance" to Destination.Attendance,
|
|
||||||
"exam" to Destination.Exam,
|
|
||||||
"timetable" to Destination.Timetable()
|
|
||||||
)
|
|
||||||
|
|
||||||
init {
|
|
||||||
initializeShortcuts()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getDestination(intent: Intent) =
|
|
||||||
destinations[intent.getStringExtra(EXTRA_SHORTCUT_DESTINATION_ID)]
|
|
||||||
|
|
||||||
private fun initializeShortcuts() {
|
|
||||||
val shortcutsInfo = listOf(
|
val shortcutsInfo = listOf(
|
||||||
ShortcutInfoCompat.Builder(context, "grade_shortcut")
|
ShortcutInfoCompat.Builder(context, "grade_shortcut")
|
||||||
.setShortLabel(context.getString(R.string.grade_title))
|
.setShortLabel(context.getString(R.string.grade_title))
|
||||||
.setLongLabel(context.getString(R.string.grade_title))
|
.setLongLabel(context.getString(R.string.grade_title))
|
||||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_grade))
|
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_grade))
|
||||||
.setIntent(SplashActivity.getStartIntent(context)
|
.setIntent(SplashActivity.getStartIntent(context, Destination.Grade)
|
||||||
.apply {
|
.apply { action = Intent.ACTION_VIEW })
|
||||||
action = Intent.ACTION_VIEW
|
|
||||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "grade")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.build(),
|
.build(),
|
||||||
|
|
||||||
ShortcutInfoCompat.Builder(context, "attendance_shortcut")
|
ShortcutInfoCompat.Builder(context, "attendance_shortcut")
|
||||||
.setShortLabel(context.getString(R.string.attendance_title))
|
.setShortLabel(context.getString(R.string.attendance_title))
|
||||||
.setLongLabel(context.getString(R.string.attendance_title))
|
.setLongLabel(context.getString(R.string.attendance_title))
|
||||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_attendance))
|
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_attendance))
|
||||||
.setIntent(SplashActivity.getStartIntent(context)
|
.setIntent(SplashActivity.getStartIntent(context, Destination.Attendance)
|
||||||
.apply {
|
.apply { action = Intent.ACTION_VIEW })
|
||||||
action = Intent.ACTION_VIEW
|
|
||||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "attendance")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.build(),
|
.build(),
|
||||||
|
|
||||||
ShortcutInfoCompat.Builder(context, "exam_shortcut")
|
ShortcutInfoCompat.Builder(context, "exam_shortcut")
|
||||||
.setShortLabel(context.getString(R.string.exam_title))
|
.setShortLabel(context.getString(R.string.exam_title))
|
||||||
.setLongLabel(context.getString(R.string.exam_title))
|
.setLongLabel(context.getString(R.string.exam_title))
|
||||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_exam))
|
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_exam))
|
||||||
.setIntent(SplashActivity.getStartIntent(context)
|
.setIntent(SplashActivity.getStartIntent(context, Destination.Exam)
|
||||||
.apply {
|
.apply { action = Intent.ACTION_VIEW })
|
||||||
action = Intent.ACTION_VIEW
|
|
||||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "exam")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.build(),
|
.build(),
|
||||||
|
|
||||||
ShortcutInfoCompat.Builder(context, "timetable_shortcut")
|
ShortcutInfoCompat.Builder(context, "timetable_shortcut")
|
||||||
.setShortLabel(context.getString(R.string.timetable_title))
|
.setShortLabel(context.getString(R.string.timetable_title))
|
||||||
.setLongLabel(context.getString(R.string.timetable_title))
|
.setLongLabel(context.getString(R.string.timetable_title))
|
||||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_timetable))
|
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_timetable))
|
||||||
.setIntent(SplashActivity.getStartIntent(context)
|
.setIntent(SplashActivity.getStartIntent(context, Destination.Timetable())
|
||||||
.apply {
|
.apply { action = Intent.ACTION_VIEW })
|
||||||
action = Intent.ACTION_VIEW
|
|
||||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "timetable")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
|
|
||||||
shortcutsInfo.forEach { ShortcutManagerCompat.pushDynamicShortcut(context, it) }
|
shortcutsInfo.forEach { ShortcutManagerCompat.pushDynamicShortcut(context, it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
|
||||||
|
|
||||||
private const val EXTRA_SHORTCUT_DESTINATION_ID = "shortcut_destination_id"
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package io.github.wulkanowy.ui.modules
|
package io.github.wulkanowy.ui.modules
|
||||||
|
|
||||||
import android.os.Parcelable
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import io.github.wulkanowy.data.serializers.LocalDateSerializer
|
import io.github.wulkanowy.data.serializers.LocalDateSerializer
|
||||||
import io.github.wulkanowy.ui.modules.attendance.AttendanceFragment
|
import io.github.wulkanowy.ui.modules.attendance.AttendanceFragment
|
||||||
@ -16,12 +15,11 @@ import io.github.wulkanowy.ui.modules.note.NoteFragment
|
|||||||
import io.github.wulkanowy.ui.modules.schoolandteachers.school.SchoolFragment
|
import io.github.wulkanowy.ui.modules.schoolandteachers.school.SchoolFragment
|
||||||
import io.github.wulkanowy.ui.modules.schoolannouncement.SchoolAnnouncementFragment
|
import io.github.wulkanowy.ui.modules.schoolannouncement.SchoolAnnouncementFragment
|
||||||
import io.github.wulkanowy.ui.modules.timetable.TimetableFragment
|
import io.github.wulkanowy.ui.modules.timetable.TimetableFragment
|
||||||
import kotlinx.parcelize.Parcelize
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
sealed class Destination : Parcelable {
|
sealed class Destination {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Type in children classes have to be as getter to avoid null in enums
|
Type in children classes have to be as getter to avoid null in enums
|
||||||
@ -47,35 +45,30 @@ sealed class Destination : Parcelable {
|
|||||||
MESSAGE(Message);
|
MESSAGE(Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Dashboard : Destination() {
|
object Dashboard : Destination() {
|
||||||
override val destinationType get() = Type.DASHBOARD
|
override val destinationType get() = Type.DASHBOARD
|
||||||
override val destinationFragment get() = DashboardFragment.newInstance()
|
override val destinationFragment get() = DashboardFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Grade : Destination() {
|
object Grade : Destination() {
|
||||||
override val destinationType get() = Type.GRADE
|
override val destinationType get() = Type.GRADE
|
||||||
override val destinationFragment get() = GradeFragment.newInstance()
|
override val destinationFragment get() = GradeFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Attendance : Destination() {
|
object Attendance : Destination() {
|
||||||
override val destinationType get() = Type.ATTENDANCE
|
override val destinationType get() = Type.ATTENDANCE
|
||||||
override val destinationFragment get() = AttendanceFragment.newInstance()
|
override val destinationFragment get() = AttendanceFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Exam : Destination() {
|
object Exam : Destination() {
|
||||||
override val destinationType get() = Type.EXAM
|
override val destinationType get() = Type.EXAM
|
||||||
override val destinationFragment get() = ExamFragment.newInstance()
|
override val destinationFragment get() = ExamFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Timetable(
|
data class Timetable(
|
||||||
@Serializable(with = LocalDateSerializer::class)
|
@Serializable(with = LocalDateSerializer::class)
|
||||||
@ -85,56 +78,48 @@ sealed class Destination : Parcelable {
|
|||||||
override val destinationFragment get() = TimetableFragment.newInstance(date)
|
override val destinationFragment get() = TimetableFragment.newInstance(date)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Homework : Destination() {
|
object Homework : Destination() {
|
||||||
override val destinationType get() = Type.HOMEWORK
|
override val destinationType get() = Type.HOMEWORK
|
||||||
override val destinationFragment get() = HomeworkFragment.newInstance()
|
override val destinationFragment get() = HomeworkFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Note : Destination() {
|
object Note : Destination() {
|
||||||
override val destinationType get() = Type.NOTE
|
override val destinationType get() = Type.NOTE
|
||||||
override val destinationFragment get() = NoteFragment.newInstance()
|
override val destinationFragment get() = NoteFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Conference : Destination() {
|
object Conference : Destination() {
|
||||||
override val destinationType get() = Type.CONFERENCE
|
override val destinationType get() = Type.CONFERENCE
|
||||||
override val destinationFragment get() = ConferenceFragment.newInstance()
|
override val destinationFragment get() = ConferenceFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object SchoolAnnouncement : Destination() {
|
object SchoolAnnouncement : Destination() {
|
||||||
override val destinationType get() = Type.SCHOOL_ANNOUNCEMENT
|
override val destinationType get() = Type.SCHOOL_ANNOUNCEMENT
|
||||||
override val destinationFragment get() = SchoolAnnouncementFragment.newInstance()
|
override val destinationFragment get() = SchoolAnnouncementFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object School : Destination() {
|
object School : Destination() {
|
||||||
override val destinationType get() = Type.SCHOOL
|
override val destinationType get() = Type.SCHOOL
|
||||||
override val destinationFragment get() = SchoolFragment.newInstance()
|
override val destinationFragment get() = SchoolFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object LuckyNumber : Destination() {
|
object LuckyNumber : Destination() {
|
||||||
override val destinationType get() = Type.LUCKY_NUMBER
|
override val destinationType get() = Type.LUCKY_NUMBER
|
||||||
override val destinationFragment get() = LuckyNumberFragment.newInstance()
|
override val destinationFragment get() = LuckyNumberFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object More : Destination() {
|
object More : Destination() {
|
||||||
override val destinationType get() = Type.MORE
|
override val destinationType get() = Type.MORE
|
||||||
override val destinationFragment get() = MoreFragment.newInstance()
|
override val destinationFragment get() = MoreFragment.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Message : Destination() {
|
object Message : Destination() {
|
||||||
override val destinationType get() = Type.MESSAGE
|
override val destinationType get() = Type.MESSAGE
|
||||||
|
@ -9,6 +9,7 @@ import android.os.Looper
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import androidx.core.text.parseAsHtml
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.core.view.updateMarginsRelative
|
import androidx.core.view.updateMarginsRelative
|
||||||
@ -563,7 +564,7 @@ class DashboardAdapter @Inject constructor() : RecyclerView.Adapter<RecyclerView
|
|||||||
) {
|
) {
|
||||||
with(binding.dashboardLessonsItemDayHeader) {
|
with(binding.dashboardLessonsItemDayHeader) {
|
||||||
isVisible = header != null
|
isVisible = header != null
|
||||||
text = header?.content
|
text = header?.content?.parseAsHtml()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ import io.github.wulkanowy.ui.base.BaseActivity
|
|||||||
import io.github.wulkanowy.ui.modules.Destination
|
import io.github.wulkanowy.ui.modules.Destination
|
||||||
import io.github.wulkanowy.ui.modules.account.accountquick.AccountQuickDialog
|
import io.github.wulkanowy.ui.modules.account.accountquick.AccountQuickDialog
|
||||||
import io.github.wulkanowy.utils.*
|
import io.github.wulkanowy.utils.*
|
||||||
|
import kotlinx.serialization.encodeToString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -55,13 +57,13 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
private const val EXTRA_START_DESTINATION = "start_destination"
|
private const val EXTRA_START_DESTINATION = "start_destination_json"
|
||||||
|
|
||||||
fun getStartIntent(
|
fun getStartIntent(
|
||||||
context: Context,
|
context: Context,
|
||||||
destination: Destination? = null,
|
destination: Destination? = null,
|
||||||
) = Intent(context, MainActivity::class.java).apply {
|
) = Intent(context, MainActivity::class.java).apply {
|
||||||
putExtra(EXTRA_START_DESTINATION, destination)
|
destination?.let { putExtra(EXTRA_START_DESTINATION, Json.encodeToString(it)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,9 +72,8 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
override val currentStackSize get() = navController.currentStack?.size
|
override val currentStackSize get() = navController.currentStack?.size
|
||||||
|
|
||||||
override val currentViewTitle
|
override val currentViewTitle
|
||||||
get() = (navController.currentFrag as? MainView.TitledView)?.titleStringId?.let {
|
get() = (navController.currentFrag as? MainView.TitledView)?.titleStringId
|
||||||
getString(it)
|
?.let { getString(it) }
|
||||||
}
|
|
||||||
|
|
||||||
override val currentViewSubtitle get() = (navController.currentFrag as? MainView.TitledView)?.subtitleString
|
override val currentViewSubtitle get() = (navController.currentFrag as? MainView.TitledView)?.subtitleString
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
messageContainer = binding.mainMessageContainer
|
messageContainer = binding.mainMessageContainer
|
||||||
updateHelper.messageContainer = binding.mainFragmentContainer
|
updateHelper.messageContainer = binding.mainFragmentContainer
|
||||||
|
|
||||||
val destination = (intent.getParcelableExtra(EXTRA_START_DESTINATION) as Destination?)
|
val destination = intent.getStringExtra(EXTRA_START_DESTINATION)
|
||||||
?.takeIf { savedInstanceState == null }
|
?.takeIf { savedInstanceState == null }
|
||||||
|
|
||||||
presenter.onAttachView(this, destination)
|
presenter.onAttachView(this, destination)
|
||||||
|
@ -19,6 +19,8 @@ import io.github.wulkanowy.ui.modules.message.MessageView
|
|||||||
import io.github.wulkanowy.ui.modules.schoolandteachers.SchoolAndTeachersView
|
import io.github.wulkanowy.ui.modules.schoolandteachers.SchoolAndTeachersView
|
||||||
import io.github.wulkanowy.ui.modules.studentinfo.StudentInfoView
|
import io.github.wulkanowy.ui.modules.studentinfo.StudentInfoView
|
||||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@ -30,6 +32,7 @@ class MainPresenter @Inject constructor(
|
|||||||
private val prefRepository: PreferencesRepository,
|
private val prefRepository: PreferencesRepository,
|
||||||
private val syncManager: SyncManager,
|
private val syncManager: SyncManager,
|
||||||
private val analytics: AnalyticsHelper,
|
private val analytics: AnalyticsHelper,
|
||||||
|
private val json: Json
|
||||||
) : BasePresenter<MainView>(errorHandler, studentRepository) {
|
) : BasePresenter<MainView>(errorHandler, studentRepository) {
|
||||||
|
|
||||||
private var studentsWitSemesters: List<StudentWithSemesters>? = null
|
private var studentsWitSemesters: List<StudentWithSemesters>? = null
|
||||||
@ -51,9 +54,11 @@ class MainPresenter @Inject constructor(
|
|||||||
else -> 4
|
else -> 4
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onAttachView(view: MainView, initDestination: Destination?) {
|
fun onAttachView(view: MainView, initDestinationJson: String?) {
|
||||||
super.onAttachView(view)
|
super.onAttachView(view)
|
||||||
|
|
||||||
|
val initDestination: Destination? = initDestinationJson?.let { json.decodeFromString(it) }
|
||||||
|
|
||||||
val startMenuIndex = initDestination.startMenuIndex
|
val startMenuIndex = initDestination.startMenuIndex
|
||||||
val destinations = rootDestinationTypeList.map {
|
val destinations = rootDestinationTypeList.map {
|
||||||
if (it == initDestination?.destinationType) initDestination else it.defaultDestination
|
if (it == initDestination?.destinationType) initDestination else it.defaultDestination
|
||||||
|
@ -15,6 +15,8 @@ import io.github.wulkanowy.ui.modules.Destination
|
|||||||
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
|
||||||
import io.github.wulkanowy.utils.openInternetBrowser
|
import io.github.wulkanowy.utils.openInternetBrowser
|
||||||
|
import kotlinx.serialization.encodeToString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@SuppressLint("CustomSplashScreen")
|
@SuppressLint("CustomSplashScreen")
|
||||||
@ -29,13 +31,13 @@ class SplashActivity : BaseActivity<SplashPresenter, ViewBinding>(), SplashView
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
private const val EXTRA_START_DESTINATION = "start_destination"
|
private const val EXTRA_START_DESTINATION = "start_destination_json"
|
||||||
|
|
||||||
private const val EXTRA_EXTERNAL_URL = "external_url"
|
private const val EXTRA_EXTERNAL_URL = "external_url"
|
||||||
|
|
||||||
fun getStartIntent(context: Context, destination: Destination? = null) =
|
fun getStartIntent(context: Context, destination: Destination? = null) =
|
||||||
Intent(context, SplashActivity::class.java).apply {
|
Intent(context, SplashActivity::class.java).apply {
|
||||||
putExtra(EXTRA_START_DESTINATION, destination)
|
destination?.let { putExtra(EXTRA_START_DESTINATION, Json.encodeToString(it)) }
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,12 +45,12 @@ class SplashActivity : BaseActivity<SplashPresenter, ViewBinding>(), SplashView
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
installSplashScreen().setKeepOnScreenCondition { true }
|
installSplashScreen().setKeepOnScreenCondition { true }
|
||||||
|
shortcutsHelper.initializeShortcuts()
|
||||||
|
|
||||||
val externalLink = intent?.getStringExtra(EXTRA_EXTERNAL_URL)
|
val externalLink = intent?.getStringExtra(EXTRA_EXTERNAL_URL)
|
||||||
val startDestination = intent?.getParcelableExtra(EXTRA_START_DESTINATION) as Destination?
|
val startDestinationJson = intent?.getStringExtra(EXTRA_START_DESTINATION)
|
||||||
?: shortcutsHelper.getDestination(intent)
|
|
||||||
|
|
||||||
presenter.onAttachView(this, externalLink, startDestination)
|
presenter.onAttachView(this, externalLink, startDestinationJson)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openLoginView() {
|
override fun openLoginView() {
|
||||||
|
@ -5,16 +5,21 @@ 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.ui.modules.Destination
|
import io.github.wulkanowy.ui.modules.Destination
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class SplashPresenter @Inject constructor(
|
class SplashPresenter @Inject constructor(
|
||||||
errorHandler: ErrorHandler,
|
errorHandler: ErrorHandler,
|
||||||
studentRepository: StudentRepository,
|
studentRepository: StudentRepository,
|
||||||
|
private val json: Json
|
||||||
) : BasePresenter<SplashView>(errorHandler, studentRepository) {
|
) : BasePresenter<SplashView>(errorHandler, studentRepository) {
|
||||||
|
|
||||||
fun onAttachView(view: SplashView, externalUrl: String?, startDestination: Destination?) {
|
fun onAttachView(view: SplashView, externalUrl: String?, startDestinationJson: String?) {
|
||||||
super.onAttachView(view)
|
super.onAttachView(view)
|
||||||
|
|
||||||
|
val startDestination: Destination? = startDestinationJson?.let { json.decodeFromString(it) }
|
||||||
|
|
||||||
if (!externalUrl.isNullOrBlank()) {
|
if (!externalUrl.isNullOrBlank()) {
|
||||||
view.openExternalUrlAndFinish(externalUrl)
|
view.openExternalUrlAndFinish(externalUrl)
|
||||||
return
|
return
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Wersja 1.6.2
|
Wersja 1.6.3
|
||||||
|
|
||||||
- dodaliśmy możliwość usuwania wielu wiadomości jednocześnie
|
- dodaliśmy możliwość usuwania wielu wiadomości jednocześnie
|
||||||
- dodaliśmy opcję szybkiego dodawania sprawdzianów do kalendarza
|
- dodaliśmy opcję szybkiego dodawania sprawdzianów do kalendarza
|
||||||
|
@ -5,13 +5,9 @@ import io.github.wulkanowy.data.repositories.StudentRepository
|
|||||||
import io.github.wulkanowy.services.sync.SyncManager
|
import io.github.wulkanowy.services.sync.SyncManager
|
||||||
import io.github.wulkanowy.ui.base.ErrorHandler
|
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||||
import io.mockk.MockKAnnotations
|
import io.mockk.*
|
||||||
import io.mockk.Runs
|
|
||||||
import io.mockk.clearMocks
|
|
||||||
import io.mockk.every
|
|
||||||
import io.mockk.impl.annotations.MockK
|
import io.mockk.impl.annotations.MockK
|
||||||
import io.mockk.just
|
import kotlinx.serialization.json.Json
|
||||||
import io.mockk.verify
|
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@ -43,8 +39,14 @@ class MainPresenterTest {
|
|||||||
clearMocks(mainView)
|
clearMocks(mainView)
|
||||||
|
|
||||||
every { mainView.initView(any(), any()) } just Runs
|
every { mainView.initView(any(), any()) } just Runs
|
||||||
presenter =
|
presenter = MainPresenter(
|
||||||
MainPresenter(errorHandler, studentRepository, prefRepository, syncManager, analytics)
|
errorHandler = errorHandler,
|
||||||
|
studentRepository = studentRepository,
|
||||||
|
prefRepository = prefRepository,
|
||||||
|
syncManager = syncManager,
|
||||||
|
analytics = analytics,
|
||||||
|
json = Json
|
||||||
|
)
|
||||||
presenter.onAttachView(mainView, null)
|
presenter.onAttachView(mainView, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import io.mockk.MockKAnnotations
|
|||||||
import io.mockk.coEvery
|
import io.mockk.coEvery
|
||||||
import io.mockk.impl.annotations.MockK
|
import io.mockk.impl.annotations.MockK
|
||||||
import io.mockk.verify
|
import io.mockk.verify
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -30,7 +31,7 @@ class SplashPresenterTest {
|
|||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
MockKAnnotations.init(this)
|
MockKAnnotations.init(this)
|
||||||
presenter = SplashPresenter(errorHandler, studentRepository)
|
presenter = SplashPresenter(errorHandler, studentRepository, Json)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -13,10 +13,10 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
classpath 'com.android.tools.build:gradle:7.1.3'
|
||||||
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
|
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
|
||||||
classpath 'com.google.gms:google-services:4.3.10'
|
classpath 'com.google.gms:google-services:4.3.10'
|
||||||
classpath 'com.huawei.agconnect:agcp:1.6.5.200'
|
classpath 'com.huawei.agconnect:agcp:1.6.5.300'
|
||||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
|
||||||
classpath "com.github.triplet.gradle:play-publisher:3.6.0"
|
classpath "com.github.triplet.gradle:play-publisher:3.6.0"
|
||||||
classpath "ru.cian:huawei-publish-gradle-plugin:1.3.3"
|
classpath "ru.cian:huawei-publish-gradle-plugin:1.3.3"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user