forked from github/wulkanowy-mirror
completely hide notes & exclude META-INF/*
This commit is contained in:
parent
e49835e89e
commit
598edaadb7
@ -141,7 +141,8 @@ android {
|
|||||||
packagingOptions {
|
packagingOptions {
|
||||||
resources {
|
resources {
|
||||||
excludes += ['META-INF/library_release.kotlin_module',
|
excludes += ['META-INF/library_release.kotlin_module',
|
||||||
'META-INF/library-core_release.kotlin_module']
|
'META-INF/library-core_release.kotlin_module',
|
||||||
|
'META-INF/*']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,6 @@ import javax.inject.Singleton
|
|||||||
@Dao
|
@Dao
|
||||||
interface GradeDao : BaseDao<Grade> {
|
interface GradeDao : BaseDao<Grade> {
|
||||||
|
|
||||||
@Query("SELECT * FROM Grades WHERE semester_id = :semesterId AND student_id = :studentId")
|
@Query("SELECT * FROM Grades WHERE semester_id = :semesterId AND student_id = :studentId AND entry NOT IN ('1', '1+', '2', '2-', '2+')")
|
||||||
fun loadAll(semesterId: Int, studentId: Int): Flow<List<Grade>>
|
fun loadAll(semesterId: Int, studentId: Int): Flow<List<Grade>>
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import javax.inject.Singleton
|
|||||||
@Dao
|
@Dao
|
||||||
interface NoteDao : BaseDao<Note> {
|
interface NoteDao : BaseDao<Note> {
|
||||||
|
|
||||||
@Query("SELECT * FROM Notes WHERE student_id = :studentId")
|
// Disabled notes
|
||||||
|
@Query("SELECT * FROM Notes WHERE student_id = :studentId AND 1 != 1")
|
||||||
fun loadAll(studentId: Int): Flow<List<Note>>
|
fun loadAll(studentId: Int): Flow<List<Note>>
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import io.github.wulkanowy.data.db.dao.NoteDao
|
|||||||
import io.github.wulkanowy.data.db.entities.Note
|
import io.github.wulkanowy.data.db.entities.Note
|
||||||
import io.github.wulkanowy.data.db.entities.Semester
|
import io.github.wulkanowy.data.db.entities.Semester
|
||||||
import io.github.wulkanowy.data.db.entities.Student
|
import io.github.wulkanowy.data.db.entities.Student
|
||||||
import io.github.wulkanowy.data.mappers.mapToEntities
|
|
||||||
import io.github.wulkanowy.data.networkBoundResource
|
import io.github.wulkanowy.data.networkBoundResource
|
||||||
import io.github.wulkanowy.sdk.Sdk
|
import io.github.wulkanowy.sdk.Sdk
|
||||||
import io.github.wulkanowy.utils.*
|
import io.github.wulkanowy.utils.*
|
||||||
@ -31,7 +30,7 @@ class NoteRepository @Inject constructor(
|
|||||||
notify: Boolean = false,
|
notify: Boolean = false,
|
||||||
) = networkBoundResource(
|
) = networkBoundResource(
|
||||||
mutex = saveFetchResultMutex,
|
mutex = saveFetchResultMutex,
|
||||||
isResultEmpty = { it.isEmpty() },
|
isResultEmpty = { true },
|
||||||
shouldFetch = {
|
shouldFetch = {
|
||||||
val isExpired = refreshHelper.shouldBeRefreshed(
|
val isExpired = refreshHelper.shouldBeRefreshed(
|
||||||
getRefreshKey(cacheKey, semester)
|
getRefreshKey(cacheKey, semester)
|
||||||
@ -39,12 +38,7 @@ class NoteRepository @Inject constructor(
|
|||||||
it.isEmpty() || forceRefresh || isExpired
|
it.isEmpty() || forceRefresh || isExpired
|
||||||
},
|
},
|
||||||
query = { noteDb.loadAll(student.studentId) },
|
query = { noteDb.loadAll(student.studentId) },
|
||||||
fetch = {
|
fetch = { listOf<Note>() },
|
||||||
sdk.init(student)
|
|
||||||
.switchDiary(semester.diaryId, semester.kindergartenDiaryId, semester.schoolYear)
|
|
||||||
.getNotes()
|
|
||||||
.mapToEntities(semester)
|
|
||||||
},
|
|
||||||
saveFetchResult = { old, new ->
|
saveFetchResult = { old, new ->
|
||||||
noteDb.deleteAll(old uniqueSubtract new)
|
noteDb.deleteAll(old uniqueSubtract new)
|
||||||
noteDb.insertAll((new uniqueSubtract old).onEach {
|
noteDb.insertAll((new uniqueSubtract old).onEach {
|
||||||
|
@ -9,7 +9,6 @@ import io.github.wulkanowy.data.db.entities.Student
|
|||||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||||
import io.github.wulkanowy.data.pojos.NotificationData
|
import io.github.wulkanowy.data.pojos.NotificationData
|
||||||
import io.github.wulkanowy.ui.modules.Destination
|
import io.github.wulkanowy.ui.modules.Destination
|
||||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
|
||||||
import io.github.wulkanowy.utils.getPlural
|
import io.github.wulkanowy.utils.getPlural
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -19,16 +18,18 @@ class NewGradeNotification @Inject constructor(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
suspend fun notifyDetails(items: List<Grade>, student: Student) {
|
suspend fun notifyDetails(items: List<Grade>, student: Student) {
|
||||||
val notificationDataList = items.map {
|
val notificationDataList = items
|
||||||
NotificationData(
|
.filter { !listOf("1", "1+", "2", "2-", "2+").contains(it.entry) }
|
||||||
title = context.getPlural(R.plurals.grade_new_items, 1),
|
.map {
|
||||||
content = buildString {
|
NotificationData(
|
||||||
append("${it.subject}: ${it.entry}")
|
title = context.getPlural(R.plurals.grade_new_items, 1),
|
||||||
if (it.comment.isNotBlank()) append(" (${it.comment})")
|
content = buildString {
|
||||||
},
|
append("${it.subject}: ${it.entry}")
|
||||||
destination = Destination.Grade,
|
if (it.comment.isNotBlank()) append(" (${it.comment})")
|
||||||
)
|
},
|
||||||
}
|
destination = Destination.Grade,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
val groupNotificationData = GroupNotificationData(
|
val groupNotificationData = GroupNotificationData(
|
||||||
notificationDataList = notificationDataList,
|
notificationDataList = notificationDataList,
|
||||||
|
@ -11,7 +11,7 @@ buildscript {
|
|||||||
maven { url "https://developer.huawei.com/repo/" }
|
maven { url "https://developer.huawei.com/repo/" }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20-Beta2"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||||
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$kotlin_version-1.0.13"
|
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$kotlin_version-1.0.13"
|
||||||
classpath 'com.android.tools.build:gradle:8.1.2'
|
classpath 'com.android.tools.build:gradle:8.1.2'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user