Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
a2a7d2ebb2 | |||
a5bc45c5da | |||
5646befbd7 | |||
75f496b5d2 | |||
23d989d22a | |||
9e013f7cd9 | |||
c63a7c03f1 | |||
5ceee84f0e | |||
7f4539fd27 | |||
71ebf1260b | |||
784ee58384 | |||
eceef3f582 | |||
0d950fbd86 | |||
003d63b516 | |||
b4c0440a8e | |||
137c305295 | |||
2c40c221c3 | |||
e82ac78d4a | |||
59d46ce956 | |||
17caa8ecbd | |||
e9540b4012 | |||
643ad60455 | |||
01f892ce5c | |||
f61b6a5e78 | |||
650cf7484e | |||
037cbb0b19 | |||
e49835e89e | |||
c64be2fab0 | |||
ce9cb35172 | |||
7fa9219c7b | |||
1fe1618220 | |||
d9bab2af78 | |||
06b6d88dd1 | |||
3bf27baed5 | |||
6802d74002 | |||
3fd2683df7 | |||
b708c70ea2 | |||
aba08e6aa9 | |||
124b6dfd79 | |||
1dbaa8bfdc | |||
25ac171298 | |||
387ff1cba7 | |||
eef3464d0b | |||
61297a01c7 | |||
762d4b1393 | |||
2e86b67eec |
10
.idea/migrations.xml
generated
Normal file
10
.idea/migrations.xml
generated
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectMigrations">
|
||||||
|
<option name="MigrateToGradleLocalJavaHome">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -27,8 +27,8 @@ android {
|
|||||||
testApplicationId "io.github.tests.wulkanowy"
|
testApplicationId "io.github.tests.wulkanowy"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 34
|
targetSdkVersion 34
|
||||||
versionCode 134
|
versionCode 139
|
||||||
versionName "2.2.2"
|
versionName "2.2.7"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
resValue "string", "app_name", "Wulkanowy"
|
resValue "string", "app_name", "Wulkanowy"
|
||||||
@ -113,6 +113,7 @@ android {
|
|||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding true
|
viewBinding true
|
||||||
|
buildConfig true
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle {
|
bundle {
|
||||||
@ -161,8 +162,8 @@ play {
|
|||||||
defaultToAppBundles = false
|
defaultToAppBundles = false
|
||||||
track = 'production'
|
track = 'production'
|
||||||
releaseStatus = ReleaseStatus.IN_PROGRESS
|
releaseStatus = ReleaseStatus.IN_PROGRESS
|
||||||
userFraction = 0.01d
|
userFraction = 0.99d
|
||||||
updatePriority = 3
|
updatePriority = 5
|
||||||
enabled.set(false)
|
enabled.set(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,28 +184,28 @@ huaweiPublish {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
work_manager = "2.8.1"
|
work_manager = "2.9.0"
|
||||||
android_hilt = "1.0.0"
|
android_hilt = "1.1.0"
|
||||||
room = "2.6.0"
|
room = "2.6.1"
|
||||||
chucker = "3.5.2"
|
chucker = "4.0.0"
|
||||||
mockk = "1.13.8"
|
mockk = "1.13.8"
|
||||||
coroutines = "1.7.3"
|
coroutines = "1.7.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'io.github.wulkanowy:sdk:2.2.2'
|
implementation 'io.github.wulkanowy:sdk:2.2.7'
|
||||||
|
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
||||||
|
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0"
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
|
||||||
|
|
||||||
implementation 'androidx.core:core-ktx:1.12.0'
|
implementation 'androidx.core:core-ktx:1.12.0'
|
||||||
implementation 'androidx.core:core-splashscreen:1.0.1'
|
implementation 'androidx.core:core-splashscreen:1.0.1'
|
||||||
implementation "androidx.activity:activity-ktx:1.8.0"
|
implementation "androidx.activity:activity-ktx:1.8.2"
|
||||||
implementation "androidx.appcompat:appcompat:1.6.1"
|
implementation "androidx.appcompat:appcompat:1.6.1"
|
||||||
implementation "androidx.fragment:fragment-ktx:1.6.1"
|
implementation "androidx.fragment:fragment-ktx:1.6.2"
|
||||||
implementation "androidx.annotation:annotation:1.7.0"
|
implementation "androidx.annotation:annotation:1.7.1"
|
||||||
|
|
||||||
implementation "androidx.preference:preference-ktx:1.2.1"
|
implementation "androidx.preference:preference-ktx:1.2.1"
|
||||||
implementation "androidx.recyclerview:recyclerview:1.3.2"
|
implementation "androidx.recyclerview:recyclerview:1.3.2"
|
||||||
@ -217,7 +218,7 @@ dependencies {
|
|||||||
implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"
|
implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"
|
||||||
implementation 'com.github.lopspower:CircularImageView:4.3.0'
|
implementation 'com.github.lopspower:CircularImageView:4.3.0'
|
||||||
|
|
||||||
implementation "androidx.work:work-runtime-ktx:$work_manager"
|
implementation "androidx.work:work-runtime:$work_manager"
|
||||||
playImplementation "androidx.work:work-gcm:$work_manager"
|
playImplementation "androidx.work:work-gcm:$work_manager"
|
||||||
|
|
||||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.6.2"
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.6.2"
|
||||||
@ -242,28 +243,28 @@ dependencies {
|
|||||||
implementation "at.favre.lib:slf4j-timber:1.0.1"
|
implementation "at.favre.lib:slf4j-timber:1.0.1"
|
||||||
implementation 'com.github.bastienpaulfr:Treessence:1.1.2'
|
implementation 'com.github.bastienpaulfr:Treessence:1.1.2'
|
||||||
implementation "com.mikepenz:aboutlibraries-core:$about_libraries"
|
implementation "com.mikepenz:aboutlibraries-core:$about_libraries"
|
||||||
implementation "io.coil-kt:coil:2.4.0"
|
implementation 'io.coil-kt:coil:2.5.0'
|
||||||
implementation "io.github.wulkanowy:AppKillerManager:3.0.1"
|
implementation "io.github.wulkanowy:AppKillerManager:3.0.1"
|
||||||
implementation 'me.xdrop:fuzzywuzzy:1.4.0'
|
implementation 'me.xdrop:fuzzywuzzy:1.4.0'
|
||||||
implementation 'com.fredporciuncula:flow-preferences:1.9.1'
|
implementation 'com.fredporciuncula:flow-preferences:1.9.1'
|
||||||
implementation 'org.apache.commons:commons-text:1.10.0'
|
implementation 'org.apache.commons:commons-text:1.11.0'
|
||||||
|
|
||||||
playImplementation platform('com.google.firebase:firebase-bom:32.4.0')
|
playImplementation platform('com.google.firebase:firebase-bom:32.7.0')
|
||||||
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:'
|
||||||
playImplementation 'com.google.firebase:firebase-config-ktx'
|
playImplementation 'com.google.firebase:firebase-config-ktx'
|
||||||
playImplementation 'com.google.android.play:core:1.10.3'
|
playImplementation 'com.google.android.gms:play-services-ads:22.6.0'
|
||||||
playImplementation 'com.google.android.play:core-ktx:1.8.1'
|
playImplementation "com.google.android.play:integrity:1.3.0"
|
||||||
playImplementation 'com.google.android.gms:play-services-ads:22.4.0'
|
playImplementation 'com.google.android.play:app-update-ktx:2.1.0'
|
||||||
playImplementation "com.google.android.play:integrity:1.2.0"
|
playImplementation 'com.google.android.play:review-ktx:2.0.1'
|
||||||
|
|
||||||
hmsImplementation 'com.huawei.hms:hianalytics:6.12.0.300'
|
hmsImplementation 'com.huawei.hms:hianalytics:6.12.0.300'
|
||||||
hmsImplementation 'com.huawei.agconnect:agconnect-crash:1.9.1.301'
|
hmsImplementation 'com.huawei.agconnect:agconnect-crash:1.9.1.302'
|
||||||
|
|
||||||
releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:$chucker"
|
releaseImplementation "com.github.chuckerteam.chucker:library-no-op:$chucker"
|
||||||
|
|
||||||
debugImplementation "com.github.ChuckerTeam.Chucker:library:$chucker"
|
debugImplementation "com.github.chuckerteam.chucker:library:$chucker"
|
||||||
debugImplementation 'com.github.amitshekhariitbhu.Android-Debug-Database:debug-db:1.0.6'
|
debugImplementation 'com.github.amitshekhariitbhu.Android-Debug-Database:debug-db:1.0.6'
|
||||||
debugImplementation 'com.github.haroldadmin:WhatTheStack:1.0.0-alpha04'
|
debugImplementation 'com.github.haroldadmin:WhatTheStack:1.0.0-alpha04'
|
||||||
|
|
||||||
@ -272,7 +273,7 @@ dependencies {
|
|||||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines"
|
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines"
|
||||||
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
||||||
|
|
||||||
testImplementation 'org.robolectric:robolectric:4.10.3'
|
testImplementation 'org.robolectric:robolectric:4.11.1'
|
||||||
testImplementation "androidx.test:runner:1.5.2"
|
testImplementation "androidx.test:runner:1.5.2"
|
||||||
testImplementation "androidx.test.ext:junit:1.1.5"
|
testImplementation "androidx.test.ext:junit:1.1.5"
|
||||||
testImplementation "androidx.test:core:1.5.0"
|
testImplementation "androidx.test:core:1.5.0"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
apply plugin: "jacoco"
|
apply plugin: "jacoco"
|
||||||
|
|
||||||
jacoco {
|
jacoco {
|
||||||
toolVersion "0.8.10"
|
toolVersion "0.8.11"
|
||||||
reportsDirectory.set(file("$buildDir/reports"))
|
reportsDirectory.set(file("$buildDir/reports"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package io.github.wulkanowy.utils
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class InAppUpdateHelper @Inject constructor() {
|
||||||
|
|
||||||
|
lateinit var messageContainer: View
|
||||||
|
|
||||||
|
fun checkAndInstallUpdates() {}
|
||||||
|
|
||||||
|
fun onResume() {}
|
||||||
|
}
|
@ -1,17 +0,0 @@
|
|||||||
package io.github.wulkanowy.utils
|
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.view.View
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
@Suppress("UNUSED_PARAMETER")
|
|
||||||
class UpdateHelper @Inject constructor() {
|
|
||||||
|
|
||||||
lateinit var messageContainer: View
|
|
||||||
|
|
||||||
fun checkAndInstallUpdates(activity: Activity) {}
|
|
||||||
|
|
||||||
fun onActivityResult(requestCode: Int, resultCode: Int) {}
|
|
||||||
|
|
||||||
fun onResume(activity: Activity) {}
|
|
||||||
}
|
|
@ -0,0 +1,13 @@
|
|||||||
|
package io.github.wulkanowy.utils
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class InAppUpdateHelper @Inject constructor() {
|
||||||
|
|
||||||
|
lateinit var messageContainer: View
|
||||||
|
|
||||||
|
fun checkAndInstallUpdates() {}
|
||||||
|
|
||||||
|
fun onResume() {}
|
||||||
|
}
|
@ -1,17 +0,0 @@
|
|||||||
package io.github.wulkanowy.utils
|
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.view.View
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
@Suppress("UNUSED_PARAMETER")
|
|
||||||
class UpdateHelper @Inject constructor() {
|
|
||||||
|
|
||||||
lateinit var messageContainer: View
|
|
||||||
|
|
||||||
fun checkAndInstallUpdates(activity: Activity) {}
|
|
||||||
|
|
||||||
fun onActivityResult(requestCode: Int, resultCode: Int) {}
|
|
||||||
|
|
||||||
fun onResume(activity: Activity) {}
|
|
||||||
}
|
|
@ -1,7 +1,9 @@
|
|||||||
package io.github.wulkanowy
|
package io.github.wulkanowy
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.util.Log.*
|
import android.util.Log.DEBUG
|
||||||
|
import android.util.Log.INFO
|
||||||
|
import android.util.Log.VERBOSE
|
||||||
import androidx.hilt.work.HiltWorkerFactory
|
import androidx.hilt.work.HiltWorkerFactory
|
||||||
import androidx.work.Configuration
|
import androidx.work.Configuration
|
||||||
import com.yariksoffice.lingver.Lingver
|
import com.yariksoffice.lingver.Lingver
|
||||||
@ -9,16 +11,20 @@ import dagger.hilt.android.HiltAndroidApp
|
|||||||
import fr.bipi.treessence.file.FileLoggerTree
|
import fr.bipi.treessence.file.FileLoggerTree
|
||||||
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
||||||
import io.github.wulkanowy.ui.base.ThemeManager
|
import io.github.wulkanowy.ui.base.ThemeManager
|
||||||
import io.github.wulkanowy.utils.*
|
import io.github.wulkanowy.utils.ActivityLifecycleLogger
|
||||||
|
import io.github.wulkanowy.utils.AdsHelper
|
||||||
|
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||||
|
import io.github.wulkanowy.utils.AppInfo
|
||||||
|
import io.github.wulkanowy.utils.CrashLogExceptionTree
|
||||||
|
import io.github.wulkanowy.utils.CrashLogTree
|
||||||
|
import io.github.wulkanowy.utils.DebugLogTree
|
||||||
|
import io.github.wulkanowy.utils.RemoteConfigHelper
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@HiltAndroidApp
|
@HiltAndroidApp
|
||||||
class WulkanowyApp : Application(), Configuration.Provider {
|
class WulkanowyApp : Application(), Configuration.Provider {
|
||||||
|
|
||||||
@Inject
|
|
||||||
lateinit var workerFactory: HiltWorkerFactory
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var themeManager: ThemeManager
|
lateinit var themeManager: ThemeManager
|
||||||
|
|
||||||
@ -37,6 +43,15 @@ class WulkanowyApp : Application(), Configuration.Provider {
|
|||||||
@Inject
|
@Inject
|
||||||
lateinit var remoteConfigHelper: RemoteConfigHelper
|
lateinit var remoteConfigHelper: RemoteConfigHelper
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var workerFactory: HiltWorkerFactory
|
||||||
|
|
||||||
|
override val workManagerConfiguration: Configuration
|
||||||
|
get() = Configuration.Builder()
|
||||||
|
.setWorkerFactory(workerFactory)
|
||||||
|
.setMinimumLoggingLevel(if (appInfo.isDebug) VERBOSE else INFO)
|
||||||
|
.build()
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
initializeAppLanguage()
|
initializeAppLanguage()
|
||||||
@ -74,9 +89,4 @@ class WulkanowyApp : Application(), Configuration.Provider {
|
|||||||
analyticsHelper.logEvent("language", "startup" to preferencesRepository.appLanguage)
|
analyticsHelper.logEvent("language", "startup" to preferencesRepository.appLanguage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getWorkManagerConfiguration() = Configuration.Builder()
|
|
||||||
.setWorkerFactory(workerFactory)
|
|
||||||
.setMinimumLoggingLevel(if (appInfo.isDebug) VERBOSE else INFO)
|
|
||||||
.build()
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration10 : Migration(9, 10) {
|
class Migration10 : Migration(9, 10) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Grades_Summary RENAME TO GradesSummary")
|
db.execSQL("ALTER TABLE Grades_Summary RENAME TO GradesSummary")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration11 : Migration(10, 11) {
|
class Migration11 : Migration(10, 11) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Grades_temp (
|
CREATE TABLE IF NOT EXISTS Grades_temp (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
is_read INTEGER NOT NULL,
|
is_read INTEGER NOT NULL,
|
||||||
@ -26,9 +27,10 @@ class Migration11 : Migration(10, 11) {
|
|||||||
date INTEGER NOT NULL,
|
date INTEGER NOT NULL,
|
||||||
teacher TEXT NOT NULL
|
teacher TEXT NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
database.execSQL("INSERT INTO Grades_temp SELECT * FROM Grades")
|
)
|
||||||
database.execSQL("DROP TABLE Grades")
|
db.execSQL("INSERT INTO Grades_temp SELECT * FROM Grades")
|
||||||
database.execSQL("ALTER TABLE Grades_temp RENAME TO Grades")
|
db.execSQL("DROP TABLE Grades")
|
||||||
|
db.execSQL("ALTER TABLE Grades_temp RENAME TO Grades")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,16 +5,17 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration12 : Migration(11, 12) {
|
class Migration12 : Migration(11, 12) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
createTempStudentsTable(database)
|
createTempStudentsTable(db)
|
||||||
replaceStudentTable(database)
|
replaceStudentTable(db)
|
||||||
updateStudentsWithClassId(database, getStudentsIds(database))
|
updateStudentsWithClassId(db, getStudentsIds(db))
|
||||||
removeStudentsWithNoClassId(database)
|
removeStudentsWithNoClassId(db)
|
||||||
ensureThereIsOnlyOneCurrentStudent(database)
|
ensureThereIsOnlyOneCurrentStudent(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createTempStudentsTable(database: SupportSQLiteDatabase) {
|
private fun createTempStudentsTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Students_tmp (
|
CREATE TABLE IF NOT EXISTS Students_tmp (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
endpoint TEXT NOT NULL,
|
endpoint TEXT NOT NULL,
|
||||||
@ -30,15 +31,16 @@ class Migration12 : Migration(11, 12) {
|
|||||||
registration_date INTEGER NOT NULL,
|
registration_date INTEGER NOT NULL,
|
||||||
class_id INTEGER NOT NULL
|
class_id INTEGER NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
database.execSQL("CREATE UNIQUE INDEX index_Students_email_symbol_student_id_school_id_class_id ON Students_tmp (email, symbol, student_id, school_id, class_id)")
|
)
|
||||||
|
db.execSQL("CREATE UNIQUE INDEX index_Students_email_symbol_student_id_school_id_class_id ON Students_tmp (email, symbol, student_id, school_id, class_id)")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun replaceStudentTable(database: SupportSQLiteDatabase) {
|
private fun replaceStudentTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN class_id INTEGER DEFAULT 0 NOT NULL")
|
db.execSQL("ALTER TABLE Students ADD COLUMN class_id INTEGER DEFAULT 0 NOT NULL")
|
||||||
database.execSQL("INSERT INTO Students_tmp SELECT * FROM Students")
|
db.execSQL("INSERT INTO Students_tmp SELECT * FROM Students")
|
||||||
database.execSQL("DROP TABLE Students")
|
db.execSQL("DROP TABLE Students")
|
||||||
database.execSQL("ALTER TABLE Students_tmp RENAME TO Students")
|
db.execSQL("ALTER TABLE Students_tmp RENAME TO Students")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getStudentsIds(database: SupportSQLiteDatabase): List<Int> {
|
private fun getStudentsIds(database: SupportSQLiteDatabase): List<Int> {
|
||||||
@ -54,18 +56,18 @@ class Migration12 : Migration(11, 12) {
|
|||||||
return students
|
return students
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateStudentsWithClassId(database: SupportSQLiteDatabase, students: List<Int>) {
|
private fun updateStudentsWithClassId(db: SupportSQLiteDatabase, students: List<Int>) {
|
||||||
students.forEach {
|
students.forEach {
|
||||||
database.execSQL("UPDATE Students SET class_id = IFNULL((SELECT class_id FROM Semesters WHERE student_id = $it), 0) WHERE student_id = $it")
|
db.execSQL("UPDATE Students SET class_id = IFNULL((SELECT class_id FROM Semesters WHERE student_id = $it), 0) WHERE student_id = $it")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeStudentsWithNoClassId(database: SupportSQLiteDatabase) {
|
private fun removeStudentsWithNoClassId(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DELETE FROM Students WHERE class_id = 0")
|
db.execSQL("DELETE FROM Students WHERE class_id = 0")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ensureThereIsOnlyOneCurrentStudent(database: SupportSQLiteDatabase) {
|
private fun ensureThereIsOnlyOneCurrentStudent(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("UPDATE Students SET is_current = 0")
|
db.execSQL("UPDATE Students SET is_current = 0")
|
||||||
database.execSQL("UPDATE Students SET is_current = 1 WHERE id = (SELECT MAX(id) FROM Students)")
|
db.execSQL("UPDATE Students SET is_current = 1 WHERE id = (SELECT MAX(id) FROM Students)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,27 +5,30 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration13 : Migration(12, 13) {
|
class Migration13 : Migration(12, 13) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
addClassNameToStudents(database, getStudentsIds(database))
|
addClassNameToStudents(db, getStudentsIds(db))
|
||||||
updateSemestersTable(database)
|
updateSemestersTable(db)
|
||||||
markAtLeastAndOnlyOneSemesterAtCurrent(database, getStudentsAndClassIds(database))
|
markAtLeastAndOnlyOneSemesterAtCurrent(db, getStudentsAndClassIds(db))
|
||||||
clearMessagesTable(database)
|
clearMessagesTable(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addClassNameToStudents(database: SupportSQLiteDatabase, students: List<Pair<Int, String>>) {
|
private fun addClassNameToStudents(
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN class_name TEXT DEFAULT \"\" NOT NULL")
|
db: SupportSQLiteDatabase,
|
||||||
|
students: List<Pair<Int, String>>
|
||||||
|
) {
|
||||||
|
db.execSQL("ALTER TABLE Students ADD COLUMN class_name TEXT DEFAULT \"\" NOT NULL")
|
||||||
|
|
||||||
students.forEach { (id, name) ->
|
students.forEach { (id, name) ->
|
||||||
val schoolName = name.substringAfter(" - ")
|
val schoolName = name.substringAfter(" - ")
|
||||||
val className = name.substringBefore(" - ", "").replace("Klasa ", "")
|
val className = name.substringBefore(" - ", "").replace("Klasa ", "")
|
||||||
database.execSQL("UPDATE Students SET class_name = '$className' WHERE id = '$id'")
|
db.execSQL("UPDATE Students SET class_name = '$className' WHERE id = '$id'")
|
||||||
database.execSQL("UPDATE Students SET school_name = '$schoolName' WHERE id = '$id'")
|
db.execSQL("UPDATE Students SET school_name = '$schoolName' WHERE id = '$id'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getStudentsIds(database: SupportSQLiteDatabase): MutableList<Pair<Int, String>> {
|
private fun getStudentsIds(db: SupportSQLiteDatabase): MutableList<Pair<Int, String>> {
|
||||||
val students = mutableListOf<Pair<Int, String>>()
|
val students = mutableListOf<Pair<Int, String>>()
|
||||||
database.query("SELECT id, school_name FROM Students").use {
|
db.query("SELECT id, school_name FROM Students").use {
|
||||||
if (it.moveToFirst()) {
|
if (it.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
students.add(it.getInt(0) to it.getString(1))
|
students.add(it.getInt(0) to it.getString(1))
|
||||||
@ -36,15 +39,15 @@ class Migration13 : Migration(12, 13) {
|
|||||||
return students
|
return students
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateSemestersTable(database: SupportSQLiteDatabase) {
|
private fun updateSemestersTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Semesters ADD COLUMN school_year INTEGER DEFAULT 1970 NOT NULL")
|
db.execSQL("ALTER TABLE Semesters ADD COLUMN school_year INTEGER DEFAULT 1970 NOT NULL")
|
||||||
database.execSQL("ALTER TABLE Semesters ADD COLUMN start INTEGER DEFAULT 0 NOT NULL")
|
db.execSQL("ALTER TABLE Semesters ADD COLUMN start INTEGER DEFAULT 0 NOT NULL")
|
||||||
database.execSQL("ALTER TABLE Semesters ADD COLUMN `end` INTEGER DEFAULT 0 NOT NULL")
|
db.execSQL("ALTER TABLE Semesters ADD COLUMN `end` INTEGER DEFAULT 0 NOT NULL")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getStudentsAndClassIds(database: SupportSQLiteDatabase): List<Pair<Int, Int>> {
|
private fun getStudentsAndClassIds(db: SupportSQLiteDatabase): List<Pair<Int, Int>> {
|
||||||
val students = mutableListOf<Pair<Int, Int>>()
|
val students = mutableListOf<Pair<Int, Int>>()
|
||||||
database.query("SELECT student_id, class_id FROM Students").use {
|
db.query("SELECT student_id, class_id FROM Students").use {
|
||||||
if (it.moveToFirst()) {
|
if (it.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
students.add(it.getInt(0) to it.getInt(1))
|
students.add(it.getInt(0) to it.getInt(1))
|
||||||
@ -55,14 +58,17 @@ class Migration13 : Migration(12, 13) {
|
|||||||
return students
|
return students
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun markAtLeastAndOnlyOneSemesterAtCurrent(database: SupportSQLiteDatabase, students: List<Pair<Int, Int>>) {
|
private fun markAtLeastAndOnlyOneSemesterAtCurrent(
|
||||||
|
db: SupportSQLiteDatabase,
|
||||||
|
students: List<Pair<Int, Int>>
|
||||||
|
) {
|
||||||
students.forEach { (studentId, classId) ->
|
students.forEach { (studentId, classId) ->
|
||||||
database.execSQL("UPDATE Semesters SET is_current = 0 WHERE student_id = '$studentId' AND class_id = '$classId'")
|
db.execSQL("UPDATE Semesters SET is_current = 0 WHERE student_id = '$studentId' AND class_id = '$classId'")
|
||||||
database.execSQL("UPDATE Semesters SET is_current = 1 WHERE id = (SELECT id FROM Semesters WHERE student_id = '$studentId' AND class_id = '$classId' ORDER BY semester_id DESC)")
|
db.execSQL("UPDATE Semesters SET is_current = 1 WHERE id = (SELECT id FROM Semesters WHERE student_id = '$studentId' AND class_id = '$classId' ORDER BY semester_id DESC)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun clearMessagesTable(database: SupportSQLiteDatabase) {
|
private fun clearMessagesTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DELETE FROM Messages")
|
db.execSQL("DELETE FROM Messages")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,10 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration14 : Migration(13, 14) {
|
class Migration14 : Migration(13, 14) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS GradesSummary")
|
db.execSQL("DROP TABLE IF EXISTS GradesSummary")
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS GradesSummary (
|
CREATE TABLE IF NOT EXISTS GradesSummary (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
semester_id INTEGER NOT NULL,
|
semester_id INTEGER NOT NULL,
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration15 : Migration(14, 15) {
|
class Migration15 : Migration(14, 15) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS MobileDevices (
|
CREATE TABLE IF NOT EXISTS MobileDevices (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
@ -14,6 +15,7 @@ class Migration15 : Migration(14, 15) {
|
|||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
date INTEGER NOT NULL
|
date INTEGER NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration16 : Migration(15, 16) {
|
class Migration16 : Migration(15, 16) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Teachers (
|
CREATE TABLE IF NOT EXISTS Teachers (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
@ -15,6 +16,7 @@ class Migration16 : Migration(15, 16) {
|
|||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
short_name TEXT NOT NULL
|
short_name TEXT NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,14 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration17 : Migration(16, 17) {
|
class Migration17 : Migration(16, 17) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
createGradesPointsStatisticsTable(database)
|
createGradesPointsStatisticsTable(db)
|
||||||
truncateSemestersTable(database)
|
truncateSemestersTable(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createGradesPointsStatisticsTable(database: SupportSQLiteDatabase) {
|
private fun createGradesPointsStatisticsTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS GradesPointsStatistics(
|
CREATE TABLE IF NOT EXISTS GradesPointsStatistics(
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
@ -20,10 +21,11 @@ class Migration17 : Migration(16, 17) {
|
|||||||
others REAL NOT NULL,
|
others REAL NOT NULL,
|
||||||
student REAL NOT NULL
|
student REAL NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun truncateSemestersTable(database: SupportSQLiteDatabase) {
|
private fun truncateSemestersTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DELETE FROM Semesters")
|
db.execSQL("DELETE FROM Semesters")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration18 : Migration(17, 18) {
|
class Migration18 : Migration(17, 18) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS School (
|
CREATE TABLE IF NOT EXISTS School (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
|
@ -6,16 +6,17 @@ import io.github.wulkanowy.data.db.SharedPrefProvider
|
|||||||
|
|
||||||
class Migration19(private val sharedPrefProvider: SharedPrefProvider) : Migration(18, 19) {
|
class Migration19(private val sharedPrefProvider: SharedPrefProvider) : Migration(18, 19) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
migrateMessages(database)
|
migrateMessages(db)
|
||||||
migrateGrades(database)
|
migrateGrades(db)
|
||||||
migrateStudents(database)
|
migrateStudents(db)
|
||||||
migrateSharedPreferences()
|
migrateSharedPreferences()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateMessages(database: SupportSQLiteDatabase) {
|
private fun migrateMessages(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE Messages")
|
db.execSQL("DROP TABLE Messages")
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Messages (
|
CREATE TABLE IF NOT EXISTS Messages (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
is_notified INTEGER NOT NULL,
|
is_notified INTEGER NOT NULL,
|
||||||
@ -34,12 +35,14 @@ class Migration19(private val sharedPrefProvider: SharedPrefProvider) : Migratio
|
|||||||
read_by INTEGER NOT NULL,
|
read_by INTEGER NOT NULL,
|
||||||
removed INTEGER NOT NULL
|
removed INTEGER NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateGrades(database: SupportSQLiteDatabase) {
|
private fun migrateGrades(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE Grades")
|
db.execSQL("DROP TABLE Grades")
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Grades (
|
CREATE TABLE IF NOT EXISTS Grades (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
is_read INTEGER NOT NULL,
|
is_read INTEGER NOT NULL,
|
||||||
@ -59,11 +62,13 @@ class Migration19(private val sharedPrefProvider: SharedPrefProvider) : Migratio
|
|||||||
date INTEGER NOT NULL,
|
date INTEGER NOT NULL,
|
||||||
teacher TEXT NOT NULL
|
teacher TEXT NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateStudents(database: SupportSQLiteDatabase) {
|
private fun migrateStudents(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Students_tmp (
|
CREATE TABLE IF NOT EXISTS Students_tmp (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
scrapper_base_url TEXT NOT NULL,
|
scrapper_base_url TEXT NOT NULL,
|
||||||
@ -86,26 +91,29 @@ class Migration19(private val sharedPrefProvider: SharedPrefProvider) : Migratio
|
|||||||
is_current INTEGER NOT NULL,
|
is_current INTEGER NOT NULL,
|
||||||
registration_date INTEGER NOT NULL
|
registration_date INTEGER NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN scrapperBaseUrl TEXT NOT NULL DEFAULT \"\";")
|
db.execSQL("ALTER TABLE Students ADD COLUMN scrapperBaseUrl TEXT NOT NULL DEFAULT \"\";")
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN apiBaseUrl TEXT NOT NULL DEFAULT \"\";")
|
db.execSQL("ALTER TABLE Students ADD COLUMN apiBaseUrl TEXT NOT NULL DEFAULT \"\";")
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN is_parent INT NOT NULL DEFAULT 0;")
|
db.execSQL("ALTER TABLE Students ADD COLUMN is_parent INT NOT NULL DEFAULT 0;")
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN loginMode TEXT NOT NULL DEFAULT \"\";")
|
db.execSQL("ALTER TABLE Students ADD COLUMN loginMode TEXT NOT NULL DEFAULT \"\";")
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN certificateKey TEXT NOT NULL DEFAULT \"\";")
|
db.execSQL("ALTER TABLE Students ADD COLUMN certificateKey TEXT NOT NULL DEFAULT \"\";")
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN privateKey TEXT NOT NULL DEFAULT \"\";")
|
db.execSQL("ALTER TABLE Students ADD COLUMN privateKey TEXT NOT NULL DEFAULT \"\";")
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN user_login_id INTEGER NOT NULL DEFAULT 0;")
|
db.execSQL("ALTER TABLE Students ADD COLUMN user_login_id INTEGER NOT NULL DEFAULT 0;")
|
||||||
|
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
INSERT INTO Students_tmp(
|
INSERT INTO Students_tmp(
|
||||||
id, scrapper_base_url, mobile_base_url, is_parent, login_type, login_mode, certificate_key, private_key, email, password, symbol, student_id, user_login_id, student_name, school_id, school_name, school_id, school_name, class_name, class_id, is_current, registration_date)
|
id, scrapper_base_url, mobile_base_url, is_parent, login_type, login_mode, certificate_key, private_key, email, password, symbol, student_id, user_login_id, student_name, school_id, school_name, school_id, school_name, class_name, class_id, is_current, registration_date)
|
||||||
SELECT
|
SELECT
|
||||||
id, endpoint, apiBaseUrl, is_parent, loginType, "SCRAPPER", certificateKey, privateKey, email, password, symbol, student_id, user_login_id, student_name, school_id, school_name, school_id, school_name, class_name, class_id, is_current, registration_date
|
id, endpoint, apiBaseUrl, is_parent, loginType, "SCRAPPER", certificateKey, privateKey, email, password, symbol, student_id, user_login_id, student_name, school_id, school_name, school_id, school_name, class_name, class_id, is_current, registration_date
|
||||||
FROM Students
|
FROM Students
|
||||||
""")
|
"""
|
||||||
database.execSQL("DROP TABLE Students")
|
)
|
||||||
database.execSQL("ALTER TABLE Students_tmp RENAME TO Students")
|
db.execSQL("DROP TABLE Students")
|
||||||
database.execSQL("CREATE UNIQUE INDEX index_Students_email_symbol_student_id_school_id_class_id ON Students (email, symbol, student_id, school_id, class_id)")
|
db.execSQL("ALTER TABLE Students_tmp RENAME TO Students")
|
||||||
|
db.execSQL("CREATE UNIQUE INDEX index_Students_email_symbol_student_id_school_id_class_id ON Students (email, symbol, student_id, school_id, class_id)")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateSharedPreferences() {
|
private fun migrateSharedPreferences() {
|
||||||
|
@ -5,14 +5,16 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration2 : Migration(1, 2) {
|
class Migration2 : Migration(1, 2) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS LuckyNumbers (
|
CREATE TABLE IF NOT EXISTS LuckyNumbers (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
is_notified INTEGER NOT NULL,
|
is_notified INTEGER NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
date INTEGER NOT NULL,
|
date INTEGER NOT NULL,
|
||||||
lucky_number INTEGER NOT NULL)
|
lucky_number INTEGER NOT NULL)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,15 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration20 : Migration(19, 20) {
|
class Migration20 : Migration(19, 20) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
migrateTimetable(database)
|
migrateTimetable(db)
|
||||||
truncateSubjects(database)
|
truncateSubjects(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateTimetable(database: SupportSQLiteDatabase) {
|
private fun migrateTimetable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE Timetable")
|
db.execSQL("DROP TABLE Timetable")
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `Timetable` (
|
CREATE TABLE IF NOT EXISTS `Timetable` (
|
||||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
`student_id` INTEGER NOT NULL,
|
`student_id` INTEGER NOT NULL,
|
||||||
@ -33,10 +34,11 @@ class Migration20 : Migration(19, 20) {
|
|||||||
`changes` INTEGER NOT NULL,
|
`changes` INTEGER NOT NULL,
|
||||||
`canceled` INTEGER NOT NULL
|
`canceled` INTEGER NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun truncateSubjects(database: SupportSQLiteDatabase) {
|
private fun truncateSubjects(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DELETE FROM Subjects")
|
db.execSQL("DELETE FROM Subjects")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration21 : Migration(20, 21) {
|
class Migration21 : Migration(20, 21) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Attendance ADD COLUMN excusable INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE Attendance ADD COLUMN excusable INTEGER NOT NULL DEFAULT 0")
|
||||||
database.execSQL("ALTER TABLE Attendance ADD COLUMN time_id INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE Attendance ADD COLUMN time_id INTEGER NOT NULL DEFAULT 0")
|
||||||
database.execSQL("ALTER TABLE Attendance ADD COLUMN excuse_status TEXT DEFAULT NULL")
|
db.execSQL("ALTER TABLE Attendance ADD COLUMN excuse_status TEXT DEFAULT NULL")
|
||||||
|
|
||||||
database.execSQL("DELETE FROM Semesters")
|
db.execSQL("DELETE FROM Semesters")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration22 : Migration(21, 22) {
|
class Migration22 : Migration(21, 22) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN school_short TEXT NOT NULL DEFAULT ''")
|
db.execSQL("ALTER TABLE Students ADD COLUMN school_short TEXT NOT NULL DEFAULT ''")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration23 : Migration(22, 23) {
|
class Migration23 : Migration(22, 23) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Notes ADD COLUMN teacher_symbol TEXT NOT NULL DEFAULT ''")
|
db.execSQL("ALTER TABLE Notes ADD COLUMN teacher_symbol TEXT NOT NULL DEFAULT ''")
|
||||||
database.execSQL("ALTER TABLE Notes ADD COLUMN category_type INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE Notes ADD COLUMN category_type INTEGER NOT NULL DEFAULT 0")
|
||||||
database.execSQL("ALTER TABLE Notes ADD COLUMN is_points_show INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE Notes ADD COLUMN is_points_show INTEGER NOT NULL DEFAULT 0")
|
||||||
database.execSQL("ALTER TABLE Notes ADD COLUMN points INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE Notes ADD COLUMN points INTEGER NOT NULL DEFAULT 0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,10 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration24 : Migration(23, 24) {
|
class Migration24 : Migration(23, 24) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Messages ADD COLUMN has_attachments INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE Messages ADD COLUMN has_attachments INTEGER NOT NULL DEFAULT 0")
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS MessageAttachments (
|
CREATE TABLE IF NOT EXISTS MessageAttachments (
|
||||||
real_id INTEGER NOT NULL,
|
real_id INTEGER NOT NULL,
|
||||||
message_id INTEGER NOT NULL,
|
message_id INTEGER NOT NULL,
|
||||||
@ -16,6 +17,7 @@ class Migration24 : Migration(23, 24) {
|
|||||||
filename TEXT NOT NULL,
|
filename TEXT NOT NULL,
|
||||||
PRIMARY KEY(real_id)
|
PRIMARY KEY(real_id)
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration25 : Migration(24, 25) {
|
class Migration25 : Migration(24, 25) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Homework ADD COLUMN is_done INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE Homework ADD COLUMN is_done INTEGER NOT NULL DEFAULT 0")
|
||||||
database.execSQL("ALTER TABLE Homework ADD COLUMN attachments TEXT NOT NULL DEFAULT \"[]\"")
|
db.execSQL("ALTER TABLE Homework ADD COLUMN attachments TEXT NOT NULL DEFAULT \"[]\"")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration26 : Migration(25, 26) {
|
class Migration26 : Migration(25, 26) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE GradesSummary ADD COLUMN is_predicted_grade_notified INTEGER NOT NULL DEFAULT 1")
|
db.execSQL("ALTER TABLE GradesSummary ADD COLUMN is_predicted_grade_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
database.execSQL("ALTER TABLE GradesSummary ADD COLUMN is_final_grade_notified INTEGER NOT NULL DEFAULT 1")
|
db.execSQL("ALTER TABLE GradesSummary ADD COLUMN is_final_grade_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
database.execSQL("ALTER TABLE GradesSummary ADD COLUMN predicted_grade_last_change INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE GradesSummary ADD COLUMN predicted_grade_last_change INTEGER NOT NULL DEFAULT 0")
|
||||||
database.execSQL("ALTER TABLE GradesSummary ADD COLUMN final_grade_last_change INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE GradesSummary ADD COLUMN final_grade_last_change INTEGER NOT NULL DEFAULT 0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,24 +5,25 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration27 : Migration(26, 27) {
|
class Migration27 : Migration(26, 27) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN user_name TEXT NOT NULL DEFAULT \"\"")
|
db.execSQL("ALTER TABLE Students ADD COLUMN user_name TEXT NOT NULL DEFAULT \"\"")
|
||||||
|
|
||||||
val students = getStudentsIdsAndNames(database)
|
val students = getStudentsIdsAndNames(db)
|
||||||
val units = getReportingUnits(database)
|
val units = getReportingUnits(db)
|
||||||
|
|
||||||
students.forEach { (id, userLoginId, studentName) ->
|
students.forEach { (id, userLoginId, studentName) ->
|
||||||
val userNameFromUnits = units.singleOrNull { (senderId, _) -> senderId == userLoginId }?.second
|
val userNameFromUnits =
|
||||||
|
units.singleOrNull { (senderId, _) -> senderId == userLoginId }?.second
|
||||||
val normalizedStudentName = studentName.split(" ").asReversed().joinToString(" ")
|
val normalizedStudentName = studentName.split(" ").asReversed().joinToString(" ")
|
||||||
|
|
||||||
val userName = userNameFromUnits ?: normalizedStudentName
|
val userName = userNameFromUnits ?: normalizedStudentName
|
||||||
database.execSQL("UPDATE Students SET user_name = '$userName' WHERE id = '$id'")
|
db.execSQL("UPDATE Students SET user_name = '$userName' WHERE id = '$id'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getStudentsIdsAndNames(database: SupportSQLiteDatabase): MutableList<Triple<Long, Int, String>> {
|
private fun getStudentsIdsAndNames(db: SupportSQLiteDatabase): MutableList<Triple<Long, Int, String>> {
|
||||||
val students = mutableListOf<Triple<Long, Int, String>>()
|
val students = mutableListOf<Triple<Long, Int, String>>()
|
||||||
database.query("SELECT id, user_login_id, student_name FROM Students").use {
|
db.query("SELECT id, user_login_id, student_name FROM Students").use {
|
||||||
if (it.moveToFirst()) {
|
if (it.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
students.add(Triple(it.getLong(0), it.getInt(1), it.getString(2)))
|
students.add(Triple(it.getLong(0), it.getInt(1), it.getString(2)))
|
||||||
@ -33,9 +34,9 @@ class Migration27 : Migration(26, 27) {
|
|||||||
return students
|
return students
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getReportingUnits(database: SupportSQLiteDatabase): MutableList<Pair<Int, String>> {
|
private fun getReportingUnits(db: SupportSQLiteDatabase): MutableList<Pair<Int, String>> {
|
||||||
val units = mutableListOf<Pair<Int, String>>()
|
val units = mutableListOf<Pair<Int, String>>()
|
||||||
database.query("SELECT sender_id, sender_name FROM ReportingUnits").use {
|
db.query("SELECT sender_id, sender_name FROM ReportingUnits").use {
|
||||||
if (it.moveToFirst()) {
|
if (it.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
units.add(it.getInt(0) to it.getString(1))
|
units.add(it.getInt(0) to it.getString(1))
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration28 : Migration(27, 28) {
|
class Migration28 : Migration(27, 28) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Conferences (
|
CREATE TABLE IF NOT EXISTS Conferences (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
|
@ -5,9 +5,10 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration29 : Migration(28, 29) {
|
class Migration29 : Migration(28, 29) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS GradesStatistics")
|
db.execSQL("DROP TABLE IF EXISTS GradesStatistics")
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS GradeSemesterStatistics (
|
CREATE TABLE IF NOT EXISTS GradeSemesterStatistics (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
@ -16,8 +17,10 @@ class Migration29 : Migration(28, 29) {
|
|||||||
amounts TEXT NOT NULL,
|
amounts TEXT NOT NULL,
|
||||||
student_grade INTEGER NOT NULL
|
student_grade INTEGER NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
database.execSQL("""
|
)
|
||||||
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS GradePartialStatistics (
|
CREATE TABLE IF NOT EXISTS GradePartialStatistics (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration3 : Migration(2, 3) {
|
class Migration3 : Migration(2, 3) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS CompletedLesson (
|
CREATE TABLE IF NOT EXISTS CompletedLesson (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration30 : Migration(29, 30) {
|
class Migration30 : Migration(29, 30) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE TimetableAdditional (
|
CREATE TABLE TimetableAdditional (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
@ -16,6 +17,7 @@ class Migration30 : Migration(29, 30) {
|
|||||||
date INTEGER NOT NULL,
|
date INTEGER NOT NULL,
|
||||||
subject TEXT NOT NULL
|
subject TEXT NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration31 : Migration(30, 31) {
|
class Migration31 : Migration(30, 31) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""CREATE TABLE IF NOT EXISTS StudentInfo (
|
"""CREATE TABLE IF NOT EXISTS StudentInfo (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
|
@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration32 : Migration(31, 32) {
|
class Migration32 : Migration(31, 32) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN nick TEXT NOT NULL DEFAULT \"\"")
|
db.execSQL("ALTER TABLE Students ADD COLUMN nick TEXT NOT NULL DEFAULT \"\"")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration33 : Migration(32, 33) {
|
class Migration33 : Migration(32, 33) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS StudentInfo")
|
db.execSQL("DROP TABLE IF EXISTS StudentInfo")
|
||||||
|
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""CREATE TABLE IF NOT EXISTS StudentInfo (
|
"""CREATE TABLE IF NOT EXISTS StudentInfo (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
|
@ -5,9 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration34 : Migration(33, 34) {
|
class Migration34 : Migration(33, 34) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DELETE FROM ReportingUnits")
|
db.execSQL("DELETE FROM ReportingUnits")
|
||||||
database.execSQL("DELETE FROM Recipients")
|
db.execSQL("DELETE FROM Recipients")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,13 +7,13 @@ import io.github.wulkanowy.utils.AppInfo
|
|||||||
|
|
||||||
class Migration35(private val appInfo: AppInfo) : Migration(34, 35) {
|
class Migration35(private val appInfo: AppInfo) : Migration(34, 35) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN `avatar_color` INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE Students ADD COLUMN `avatar_color` INTEGER NOT NULL DEFAULT 0")
|
||||||
|
|
||||||
database.query("SELECT * FROM Students").use {
|
db.query("SELECT * FROM Students").use {
|
||||||
while (it.moveToNext()) {
|
while (it.moveToNext()) {
|
||||||
val studentId = it.getLongOrNull(0)
|
val studentId = it.getLongOrNull(0)
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
UPDATE Students
|
UPDATE Students
|
||||||
SET avatar_color = ${appInfo.defaultColorsForAvatar.random()}
|
SET avatar_color = ${appInfo.defaultColorsForAvatar.random()}
|
||||||
|
@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration36 : Migration(35, 36) {
|
class Migration36 : Migration(35, 36) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Exams ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
db.execSQL("ALTER TABLE Exams ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
database.execSQL("ALTER TABLE Homework ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
db.execSQL("ALTER TABLE Homework ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration37 : Migration(36, 37) {
|
class Migration37 : Migration(36, 37) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS TimetableHeaders (
|
CREATE TABLE IF NOT EXISTS TimetableHeaders (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration38 : Migration(37, 38) {
|
class Migration38 : Migration(37, 38) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `SchoolAnnouncements` (
|
CREATE TABLE IF NOT EXISTS `SchoolAnnouncements` (
|
||||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
`student_id` INTEGER NOT NULL,
|
`student_id` INTEGER NOT NULL,
|
||||||
@ -14,6 +15,7 @@ class Migration38 : Migration(37, 38) {
|
|||||||
`subject` TEXT NOT NULL,
|
`subject` TEXT NOT NULL,
|
||||||
`content` TEXT NOT NULL
|
`content` TEXT NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration39 : Migration(38, 39) {
|
class Migration39 : Migration(38, 39) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Conferences ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
db.execSQL("ALTER TABLE Conferences ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
database.execSQL("ALTER TABLE SchoolAnnouncements ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
db.execSQL("ALTER TABLE SchoolAnnouncements ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,10 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration4 : Migration(3, 4) {
|
class Migration4 : Migration(3, 4) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS Messages")
|
db.execSQL("DROP TABLE IF EXISTS Messages")
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Messages (
|
CREATE TABLE IF NOT EXISTS Messages (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
is_notified INTEGER NOT NULL,
|
is_notified INTEGER NOT NULL,
|
||||||
|
@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration40 : Migration(39, 40) {
|
class Migration40 : Migration(39, 40) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `Notifications` (
|
CREATE TABLE IF NOT EXISTS `Notifications` (
|
||||||
`student_id` INTEGER NOT NULL,
|
`student_id` INTEGER NOT NULL,
|
||||||
@ -20,4 +20,4 @@ class Migration40 : Migration(39, 40) {
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,9 @@ import io.github.wulkanowy.data.enums.GradeExpandMode
|
|||||||
|
|
||||||
class Migration41(private val sharedPrefProvider: SharedPrefProvider) : Migration(40, 41) {
|
class Migration41(private val sharedPrefProvider: SharedPrefProvider) : Migration(40, 41) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
migrateSharedPreferences()
|
migrateSharedPreferences()
|
||||||
database.execSQL("ALTER TABLE Homework ADD COLUMN is_added_by_user INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE Homework ADD COLUMN is_added_by_user INTEGER NOT NULL DEFAULT 0")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateSharedPreferences() {
|
private fun migrateSharedPreferences() {
|
||||||
@ -18,4 +18,4 @@ class Migration41(private val sharedPrefProvider: SharedPrefProvider) : Migratio
|
|||||||
}
|
}
|
||||||
sharedPrefProvider.delete("pref_key_expand_grade")
|
sharedPrefProvider.delete("pref_key_expand_grade")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration42 : Migration(41, 42) {
|
class Migration42 : Migration(41, 42) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""CREATE TABLE IF NOT EXISTS `AdminMessages` (
|
"""CREATE TABLE IF NOT EXISTS `AdminMessages` (
|
||||||
`id` INTEGER NOT NULL,
|
`id` INTEGER NOT NULL,
|
||||||
`title` TEXT NOT NULL,
|
`title` TEXT NOT NULL,
|
||||||
@ -21,4 +21,4 @@ class Migration42 : Migration(41, 42) {
|
|||||||
PRIMARY KEY(`id`))"""
|
PRIMARY KEY(`id`))"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration43 : Migration(42, 43) {
|
class Migration43 : Migration(42, 43) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Timetable ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
db.execSQL("ALTER TABLE Timetable ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
database.execSQL("ALTER TABLE Attendance ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
db.execSQL("ALTER TABLE Attendance ADD COLUMN is_notified INTEGER NOT NULL DEFAULT 1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration44 : Migration(43, 44) {
|
class Migration44 : Migration(43, 44) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE AdminMessages ADD COLUMN is_dismissible INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE AdminMessages ADD COLUMN is_dismissible INTEGER NOT NULL DEFAULT 0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,65 +8,65 @@ import java.time.ZoneOffset
|
|||||||
|
|
||||||
class Migration46 : Migration(45, 46) {
|
class Migration46 : Migration(45, 46) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
migrateConferences(database)
|
migrateConferences(db)
|
||||||
migrateMessages(database)
|
migrateMessages(db)
|
||||||
migrateMobileDevices(database)
|
migrateMobileDevices(db)
|
||||||
migrateNotifications(database)
|
migrateNotifications(db)
|
||||||
migrateTimetable(database)
|
migrateTimetable(db)
|
||||||
migrateTimetableAdditional(database)
|
migrateTimetableAdditional(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateConferences(database: SupportSQLiteDatabase) {
|
private fun migrateConferences(db: SupportSQLiteDatabase) {
|
||||||
database.query("SELECT * FROM Conferences").use {
|
db.query("SELECT * FROM Conferences").use {
|
||||||
while (it.moveToNext()) {
|
while (it.moveToNext()) {
|
||||||
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
||||||
val timestampLocal = it.getLong(it.getColumnIndexOrThrow("date"))
|
val timestampLocal = it.getLong(it.getColumnIndexOrThrow("date"))
|
||||||
val timestampUtc = timestampLocal.timestampLocalToUTC()
|
val timestampUtc = timestampLocal.timestampLocalToUTC()
|
||||||
|
|
||||||
database.execSQL("UPDATE Conferences SET date = $timestampUtc WHERE id = $id")
|
db.execSQL("UPDATE Conferences SET date = $timestampUtc WHERE id = $id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateMessages(database: SupportSQLiteDatabase) {
|
private fun migrateMessages(db: SupportSQLiteDatabase) {
|
||||||
database.query("SELECT * FROM Messages").use {
|
db.query("SELECT * FROM Messages").use {
|
||||||
while (it.moveToNext()) {
|
while (it.moveToNext()) {
|
||||||
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
||||||
val timestampLocal = it.getLong(it.getColumnIndexOrThrow("date"))
|
val timestampLocal = it.getLong(it.getColumnIndexOrThrow("date"))
|
||||||
val timestampUtc = timestampLocal.timestampLocalToUTC()
|
val timestampUtc = timestampLocal.timestampLocalToUTC()
|
||||||
|
|
||||||
database.execSQL("UPDATE Messages SET date = $timestampUtc WHERE id = $id")
|
db.execSQL("UPDATE Messages SET date = $timestampUtc WHERE id = $id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateMobileDevices(database: SupportSQLiteDatabase) {
|
private fun migrateMobileDevices(db: SupportSQLiteDatabase) {
|
||||||
database.query("SELECT * FROM MobileDevices").use {
|
db.query("SELECT * FROM MobileDevices").use {
|
||||||
while (it.moveToNext()) {
|
while (it.moveToNext()) {
|
||||||
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
||||||
val timestampLocal = it.getLong(it.getColumnIndexOrThrow("date"))
|
val timestampLocal = it.getLong(it.getColumnIndexOrThrow("date"))
|
||||||
val timestampUtc = timestampLocal.timestampLocalToUTC()
|
val timestampUtc = timestampLocal.timestampLocalToUTC()
|
||||||
|
|
||||||
database.execSQL("UPDATE MobileDevices SET date = $timestampUtc WHERE id = $id")
|
db.execSQL("UPDATE MobileDevices SET date = $timestampUtc WHERE id = $id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateNotifications(database: SupportSQLiteDatabase) {
|
private fun migrateNotifications(db: SupportSQLiteDatabase) {
|
||||||
database.query("SELECT * FROM Notifications").use {
|
db.query("SELECT * FROM Notifications").use {
|
||||||
while (it.moveToNext()) {
|
while (it.moveToNext()) {
|
||||||
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
||||||
val timestampLocal = it.getLong(it.getColumnIndexOrThrow("date"))
|
val timestampLocal = it.getLong(it.getColumnIndexOrThrow("date"))
|
||||||
val timestampUtc = timestampLocal.timestampLocalToUTC()
|
val timestampUtc = timestampLocal.timestampLocalToUTC()
|
||||||
|
|
||||||
database.execSQL("UPDATE Notifications SET date = $timestampUtc WHERE id = $id")
|
db.execSQL("UPDATE Notifications SET date = $timestampUtc WHERE id = $id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateTimetable(database: SupportSQLiteDatabase) {
|
private fun migrateTimetable(db: SupportSQLiteDatabase) {
|
||||||
database.query("SELECT * FROM Timetable").use {
|
db.query("SELECT * FROM Timetable").use {
|
||||||
while (it.moveToNext()) {
|
while (it.moveToNext()) {
|
||||||
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
||||||
val timestampLocalStart = it.getLong(it.getColumnIndexOrThrow("start"))
|
val timestampLocalStart = it.getLong(it.getColumnIndexOrThrow("start"))
|
||||||
@ -74,13 +74,13 @@ class Migration46 : Migration(45, 46) {
|
|||||||
val timestampUtcStart = timestampLocalStart.timestampLocalToUTC()
|
val timestampUtcStart = timestampLocalStart.timestampLocalToUTC()
|
||||||
val timestampUtcEnd = timestampLocalEnd.timestampLocalToUTC()
|
val timestampUtcEnd = timestampLocalEnd.timestampLocalToUTC()
|
||||||
|
|
||||||
database.execSQL("UPDATE Timetable SET start = $timestampUtcStart, end = $timestampUtcEnd WHERE id = $id")
|
db.execSQL("UPDATE Timetable SET start = $timestampUtcStart, end = $timestampUtcEnd WHERE id = $id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateTimetableAdditional(database: SupportSQLiteDatabase) {
|
private fun migrateTimetableAdditional(db: SupportSQLiteDatabase) {
|
||||||
database.query("SELECT * FROM TimetableAdditional").use {
|
db.query("SELECT * FROM TimetableAdditional").use {
|
||||||
while (it.moveToNext()) {
|
while (it.moveToNext()) {
|
||||||
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
val id = it.getLong(it.getColumnIndexOrThrow("id"))
|
||||||
val timestampLocalStart = it.getLong(it.getColumnIndexOrThrow("start"))
|
val timestampLocalStart = it.getLong(it.getColumnIndexOrThrow("start"))
|
||||||
@ -88,7 +88,7 @@ class Migration46 : Migration(45, 46) {
|
|||||||
val timestampUtcStart = timestampLocalStart.timestampLocalToUTC()
|
val timestampUtcStart = timestampLocalStart.timestampLocalToUTC()
|
||||||
val timestampUtcEnd = timestampLocalEnd.timestampLocalToUTC()
|
val timestampUtcEnd = timestampLocalEnd.timestampLocalToUTC()
|
||||||
|
|
||||||
database.execSQL("UPDATE TimetableAdditional SET start = $timestampUtcStart, end = $timestampUtcEnd WHERE id = $id")
|
db.execSQL("UPDATE TimetableAdditional SET start = $timestampUtcStart, end = $timestampUtcEnd WHERE id = $id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration49 : Migration(48, 49) {
|
class Migration49 : Migration(48, 49) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS SchoolAnnouncements")
|
db.execSQL("DROP TABLE IF EXISTS SchoolAnnouncements")
|
||||||
|
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `SchoolAnnouncements` (
|
CREATE TABLE IF NOT EXISTS `SchoolAnnouncements` (
|
||||||
`user_login_id` INTEGER NOT NULL,
|
`user_login_id` INTEGER NOT NULL,
|
||||||
|
@ -7,11 +7,16 @@ import java.time.ZoneOffset
|
|||||||
|
|
||||||
class Migration5 : Migration(4, 5) {
|
class Migration5 : Migration(4, 5) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Students ADD COLUMN registration_date INTEGER DEFAULT 0 NOT NULL")
|
db.execSQL("ALTER TABLE Students ADD COLUMN registration_date INTEGER DEFAULT 0 NOT NULL")
|
||||||
database.execSQL("UPDATE Students SET registration_date = '${now().atZone(ZoneOffset.UTC).toInstant().toEpochMilli()}'")
|
db.execSQL(
|
||||||
database.execSQL("DROP TABLE IF EXISTS Notes")
|
"UPDATE Students SET registration_date = '${
|
||||||
database.execSQL("""
|
now().atZone(ZoneOffset.UTC).toInstant().toEpochMilli()
|
||||||
|
}'"
|
||||||
|
)
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS Notes")
|
||||||
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Notes (
|
CREATE TABLE IF NOT EXISTS Notes (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
is_read INTEGER NOT NULL,
|
is_read INTEGER NOT NULL,
|
||||||
@ -21,6 +26,7 @@ class Migration5 : Migration(4, 5) {
|
|||||||
teacher TEXT NOT NULL,
|
teacher TEXT NOT NULL,
|
||||||
category TEXT NOT NULL,
|
category TEXT NOT NULL,
|
||||||
content TEXT NOT NULL)
|
content TEXT NOT NULL)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration50 : Migration(49, 50) {
|
class Migration50 : Migration(49, 50) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS MobileDevices")
|
db.execSQL("DROP TABLE IF EXISTS MobileDevices")
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `MobileDevices` (
|
CREATE TABLE IF NOT EXISTS `MobileDevices` (
|
||||||
`user_login_id` INTEGER NOT NULL,
|
`user_login_id` INTEGER NOT NULL,
|
||||||
|
@ -5,17 +5,17 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration51 : Migration(50, 51) {
|
class Migration51 : Migration(50, 51) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
createMailboxTable(database)
|
createMailboxTable(db)
|
||||||
recreateMessagesTable(database)
|
recreateMessagesTable(db)
|
||||||
recreateMessageAttachmentsTable(database)
|
recreateMessageAttachmentsTable(db)
|
||||||
recreateRecipientsTable(database)
|
recreateRecipientsTable(db)
|
||||||
deleteReportingUnitTable(database)
|
deleteReportingUnitTable(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createMailboxTable(database: SupportSQLiteDatabase) {
|
private fun createMailboxTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS Mailboxes")
|
db.execSQL("DROP TABLE IF EXISTS Mailboxes")
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `Mailboxes` (
|
CREATE TABLE IF NOT EXISTS `Mailboxes` (
|
||||||
`globalKey` TEXT NOT NULL,
|
`globalKey` TEXT NOT NULL,
|
||||||
@ -30,9 +30,9 @@ class Migration51 : Migration(50, 51) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun recreateMessagesTable(database: SupportSQLiteDatabase) {
|
private fun recreateMessagesTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS Messages")
|
db.execSQL("DROP TABLE IF EXISTS Messages")
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `Messages` (
|
CREATE TABLE IF NOT EXISTS `Messages` (
|
||||||
`message_global_key` TEXT NOT NULL,
|
`message_global_key` TEXT NOT NULL,
|
||||||
@ -52,9 +52,9 @@ class Migration51 : Migration(50, 51) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun recreateMessageAttachmentsTable(database: SupportSQLiteDatabase) {
|
private fun recreateMessageAttachmentsTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS MessageAttachments")
|
db.execSQL("DROP TABLE IF EXISTS MessageAttachments")
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `MessageAttachments` (
|
CREATE TABLE IF NOT EXISTS `MessageAttachments` (
|
||||||
`real_id` INTEGER NOT NULL,
|
`real_id` INTEGER NOT NULL,
|
||||||
@ -66,9 +66,9 @@ class Migration51 : Migration(50, 51) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun recreateRecipientsTable(database: SupportSQLiteDatabase) {
|
private fun recreateRecipientsTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS Recipients")
|
db.execSQL("DROP TABLE IF EXISTS Recipients")
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `Recipients` (
|
CREATE TABLE IF NOT EXISTS `Recipients` (
|
||||||
`mailboxGlobalKey` TEXT NOT NULL,
|
`mailboxGlobalKey` TEXT NOT NULL,
|
||||||
@ -82,7 +82,7 @@ class Migration51 : Migration(50, 51) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteReportingUnitTable(database: SupportSQLiteDatabase) {
|
private fun deleteReportingUnitTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS ReportingUnits")
|
db.execSQL("DROP TABLE IF EXISTS ReportingUnits")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,14 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration53 : Migration(52, 53) {
|
class Migration53 : Migration(52, 53) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
createMailboxTable(database)
|
createMailboxTable(db)
|
||||||
recreateMessagesTable(database)
|
recreateMessagesTable(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createMailboxTable(database: SupportSQLiteDatabase) {
|
private fun createMailboxTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS Mailboxes")
|
db.execSQL("DROP TABLE IF EXISTS Mailboxes")
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `Mailboxes` (
|
CREATE TABLE IF NOT EXISTS `Mailboxes` (
|
||||||
`globalKey` TEXT NOT NULL,
|
`globalKey` TEXT NOT NULL,
|
||||||
@ -29,9 +29,9 @@ class Migration53 : Migration(52, 53) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun recreateMessagesTable(database: SupportSQLiteDatabase) {
|
private fun recreateMessagesTable(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS Messages")
|
db.execSQL("DROP TABLE IF EXISTS Messages")
|
||||||
database.execSQL(
|
db.execSQL(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS `Messages` (
|
CREATE TABLE IF NOT EXISTS `Messages` (
|
||||||
`email` TEXT NOT NULL,
|
`email` TEXT NOT NULL,
|
||||||
|
@ -5,22 +5,24 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration54 : Migration(53, 54) {
|
class Migration54 : Migration(53, 54) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
migrateResman(database)
|
migrateResman(db)
|
||||||
removeTomaszowMazowieckiStudents(database)
|
removeTomaszowMazowieckiStudents(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateResman(database: SupportSQLiteDatabase) {
|
private fun migrateResman(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
UPDATE Students SET
|
UPDATE Students SET
|
||||||
scrapper_base_url = 'https://vulcan.net.pl',
|
scrapper_base_url = 'https://vulcan.net.pl',
|
||||||
login_type = 'ADFSLightScoped',
|
login_type = 'ADFSLightScoped',
|
||||||
symbol = 'rzeszowprojekt'
|
symbol = 'rzeszowprojekt'
|
||||||
WHERE scrapper_base_url = 'https://resman.pl'
|
WHERE scrapper_base_url = 'https://resman.pl'
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeTomaszowMazowieckiStudents(database: SupportSQLiteDatabase) {
|
private fun removeTomaszowMazowieckiStudents(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DELETE FROM Students WHERE symbol = 'tomaszowmazowiecki'")
|
db.execSQL("DELETE FROM Students WHERE symbol = 'tomaszowmazowiecki'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration6 : Migration(5, 6) {
|
class Migration6 : Migration(5, 6) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS ReportingUnits (
|
CREATE TABLE IF NOT EXISTS ReportingUnits (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
@ -15,9 +16,11 @@ class Migration6 : Migration(5, 6) {
|
|||||||
sender_id INTEGER NOT NULL,
|
sender_id INTEGER NOT NULL,
|
||||||
sender_name TEXT NOT NULL,
|
sender_name TEXT NOT NULL,
|
||||||
roles TEXT NOT NULL)
|
roles TEXT NOT NULL)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Recipients (
|
CREATE TABLE IF NOT EXISTS Recipients (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
@ -28,10 +31,11 @@ class Migration6 : Migration(5, 6) {
|
|||||||
unit_id INTEGER NOT NULL,
|
unit_id INTEGER NOT NULL,
|
||||||
role INTEGER NOT NULL,
|
role INTEGER NOT NULL,
|
||||||
hash TEXT NOT NULL)
|
hash TEXT NOT NULL)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
database.execSQL("DELETE FROM Semesters WHERE 1")
|
db.execSQL("DELETE FROM Semesters WHERE 1")
|
||||||
database.execSQL("ALTER TABLE Semesters ADD COLUMN class_id INTEGER DEFAULT 0 NOT NULL")
|
db.execSQL("ALTER TABLE Semesters ADD COLUMN class_id INTEGER DEFAULT 0 NOT NULL")
|
||||||
database.execSQL("ALTER TABLE Semesters ADD COLUMN unit_id INTEGER DEFAULT 0 NOT NULL")
|
db.execSQL("ALTER TABLE Semesters ADD COLUMN unit_id INTEGER DEFAULT 0 NOT NULL")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration7 : Migration(6, 7) {
|
class Migration7 : Migration(6, 7) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS GradesStatistics (
|
CREATE TABLE IF NOT EXISTS GradesStatistics (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
@ -15,6 +16,7 @@ class Migration7 : Migration(6, 7) {
|
|||||||
grade INTEGER NOT NULL,
|
grade INTEGER NOT NULL,
|
||||||
amount INTEGER NOT NULL,
|
amount INTEGER NOT NULL,
|
||||||
is_semester INTEGER NOT NULL)
|
is_semester INTEGER NOT NULL)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration8 : Migration(7, 8) {
|
class Migration8 : Migration(7, 8) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE Timetable ADD COLUMN subjectOld TEXT DEFAULT \"\" NOT NULL")
|
db.execSQL("ALTER TABLE Timetable ADD COLUMN subjectOld TEXT DEFAULT \"\" NOT NULL")
|
||||||
database.execSQL("ALTER TABLE Timetable ADD COLUMN roomOld TEXT DEFAULT \"\" NOT NULL")
|
db.execSQL("ALTER TABLE Timetable ADD COLUMN roomOld TEXT DEFAULT \"\" NOT NULL")
|
||||||
database.execSQL("ALTER TABLE Timetable ADD COLUMN teacherOld TEXT DEFAULT \"\" NOT NULL")
|
db.execSQL("ALTER TABLE Timetable ADD COLUMN teacherOld TEXT DEFAULT \"\" NOT NULL")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,10 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||||||
|
|
||||||
class Migration9 : Migration(8, 9) {
|
class Migration9 : Migration(8, 9) {
|
||||||
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
database.execSQL("DROP TABLE IF EXISTS Messages")
|
db.execSQL("DROP TABLE IF EXISTS Messages")
|
||||||
database.execSQL("""
|
db.execSQL(
|
||||||
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS Messages (
|
CREATE TABLE IF NOT EXISTS Messages (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
student_id INTEGER NOT NULL,
|
student_id INTEGER NOT NULL,
|
||||||
|
@ -194,12 +194,6 @@ class PreferencesRepository @Inject constructor(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val showTimetableTimers: Boolean
|
|
||||||
get() = getBoolean(
|
|
||||||
R.string.pref_key_timetable_show_timers,
|
|
||||||
R.bool.pref_default_timetable_show_timers
|
|
||||||
)
|
|
||||||
|
|
||||||
val showTimetableGaps: TimetableGapsMode
|
val showTimetableGaps: TimetableGapsMode
|
||||||
get() = TimetableGapsMode.getByValue(
|
get() = TimetableGapsMode.getByValue(
|
||||||
getString(
|
getString(
|
||||||
|
@ -42,7 +42,7 @@ class GradeSummaryPresenter @Inject constructor(
|
|||||||
val student = studentRepository.getCurrentStudent()
|
val student = studentRepository.getCurrentStudent()
|
||||||
averageProvider.getGradesDetailsWithAverage(student, semesterId, forceRefresh)
|
averageProvider.getGradesDetailsWithAverage(student, semesterId, forceRefresh)
|
||||||
}
|
}
|
||||||
.logResourceStatus("load grade summary", showData = true)
|
.logResourceStatus("load grade summary")
|
||||||
.mapResourceData { createGradeSummaryItems(it) }
|
.mapResourceData { createGradeSummaryItems(it) }
|
||||||
.onResourceData {
|
.onResourceData {
|
||||||
view?.run {
|
view?.run {
|
||||||
|
@ -23,7 +23,7 @@ import io.github.wulkanowy.ui.modules.login.symbol.LoginSymbolFragment
|
|||||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||||
import io.github.wulkanowy.ui.modules.notifications.NotificationsFragment
|
import io.github.wulkanowy.ui.modules.notifications.NotificationsFragment
|
||||||
import io.github.wulkanowy.utils.AppInfo
|
import io.github.wulkanowy.utils.AppInfo
|
||||||
import io.github.wulkanowy.utils.UpdateHelper
|
import io.github.wulkanowy.utils.InAppUpdateHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
@ -33,7 +33,7 @@ class LoginActivity : BaseActivity<LoginPresenter, ActivityLoginBinding>(), Logi
|
|||||||
override lateinit var presenter: LoginPresenter
|
override lateinit var presenter: LoginPresenter
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var updateHelper: UpdateHelper
|
lateinit var inAppUpdateHelper: InAppUpdateHelper
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var appInfo: AppInfo
|
lateinit var appInfo: AppInfo
|
||||||
@ -47,10 +47,10 @@ class LoginActivity : BaseActivity<LoginPresenter, ActivityLoginBinding>(), Logi
|
|||||||
setContentView(ActivityLoginBinding.inflate(layoutInflater).apply { binding = this }.root)
|
setContentView(ActivityLoginBinding.inflate(layoutInflater).apply { binding = this }.root)
|
||||||
setSupportActionBar(binding.loginToolbar)
|
setSupportActionBar(binding.loginToolbar)
|
||||||
messageContainer = binding.loginContainer
|
messageContainer = binding.loginContainer
|
||||||
updateHelper.messageContainer = binding.loginContainer
|
inAppUpdateHelper.messageContainer = binding.loginContainer
|
||||||
|
|
||||||
presenter.onAttachView(this)
|
presenter.onAttachView(this)
|
||||||
updateHelper.checkAndInstallUpdates(this)
|
inAppUpdateHelper.checkAndInstallUpdates()
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
openFragment(LoginFormFragment.newInstance(), clearBackStack = true)
|
openFragment(LoginFormFragment.newInstance(), clearBackStack = true)
|
||||||
@ -117,14 +117,6 @@ class LoginActivity : BaseActivity<LoginPresenter, ActivityLoginBinding>(), Logi
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
updateHelper.onResume(this)
|
inAppUpdateHelper.onResume()
|
||||||
}
|
|
||||||
|
|
||||||
//https://developer.android.com/guide/playcore/in-app-updates#status_callback
|
|
||||||
@Deprecated("Deprecated in Java")
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
|
||||||
updateHelper.onActivityResult(requestCode, resultCode)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
lateinit var analytics: AnalyticsHelper
|
lateinit var analytics: AnalyticsHelper
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var updateHelper: UpdateHelper
|
lateinit var inAppUpdateHelper: InAppUpdateHelper
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var inAppReviewHelper: InAppReviewHelper
|
lateinit var inAppReviewHelper: InAppReviewHelper
|
||||||
@ -100,7 +100,7 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
this.savedInstanceState = savedInstanceState
|
this.savedInstanceState = savedInstanceState
|
||||||
messageContainer = binding.mainMessageContainer
|
messageContainer = binding.mainMessageContainer
|
||||||
messageAnchor = binding.mainMessageContainer
|
messageAnchor = binding.mainMessageContainer
|
||||||
updateHelper.messageContainer = binding.mainFragmentContainer
|
inAppUpdateHelper.messageContainer = binding.mainFragmentContainer
|
||||||
onBackCallback = onBackPressedDispatcher.addCallback(this, enabled = false) {
|
onBackCallback = onBackPressedDispatcher.addCallback(this, enabled = false) {
|
||||||
presenter.onBackPressed()
|
presenter.onBackPressed()
|
||||||
}
|
}
|
||||||
@ -109,19 +109,12 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
?.takeIf { savedInstanceState == null }
|
?.takeIf { savedInstanceState == null }
|
||||||
|
|
||||||
presenter.onAttachView(this, destination)
|
presenter.onAttachView(this, destination)
|
||||||
updateHelper.checkAndInstallUpdates(this)
|
inAppUpdateHelper.checkAndInstallUpdates()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
updateHelper.onResume(this)
|
inAppUpdateHelper.onResume()
|
||||||
}
|
|
||||||
|
|
||||||
//https://developer.android.com/guide/playcore/in-app-updates#status_callback
|
|
||||||
@Deprecated("Deprecated in Java")
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
|
||||||
updateHelper.onActivityResult(requestCode, resultCode)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
|
@ -325,7 +325,7 @@ class TimetableAdapter @Inject constructor() :
|
|||||||
|
|
||||||
override fun getChangePayload(oldItem: TimetableItem, newItem: TimetableItem): Any? {
|
override fun getChangePayload(oldItem: TimetableItem, newItem: TimetableItem): Any? {
|
||||||
return if (oldItem is TimetableItem.Normal && newItem is TimetableItem.Normal) {
|
return if (oldItem is TimetableItem.Normal && newItem is TimetableItem.Normal) {
|
||||||
if (oldItem.lesson == newItem.lesson && oldItem.timeLeft != newItem.timeLeft) {
|
if (oldItem.lesson == newItem.lesson && oldItem.showGroupsInPlan == newItem.showGroupsInPlan && oldItem.timeLeft != newItem.timeLeft) {
|
||||||
"time_left"
|
"time_left"
|
||||||
} else super.getChangePayload(oldItem, newItem)
|
} else super.getChangePayload(oldItem, newItem)
|
||||||
} else super.getChangePayload(oldItem, newItem)
|
} else super.getChangePayload(oldItem, newItem)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package io.github.wulkanowy.ui.modules.timetable
|
package io.github.wulkanowy.ui.modules.timetable
|
||||||
|
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
import io.github.wulkanowy.data.dataOrNull
|
import io.github.wulkanowy.data.dataOrNull
|
||||||
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
|
||||||
@ -236,11 +238,13 @@ class TimetablePresenter @Inject constructor(
|
|||||||
private fun updateData(lessons: List<Timetable>) {
|
private fun updateData(lessons: List<Timetable>) {
|
||||||
tickTimer?.cancel()
|
tickTimer?.cancel()
|
||||||
|
|
||||||
if (!prefRepository.showTimetableTimers) {
|
if (currentDate != now()) {
|
||||||
view?.updateData(createItems(lessons))
|
view?.updateData(createItems(lessons))
|
||||||
} else {
|
} else {
|
||||||
tickTimer = timer(period = 2_000) {
|
tickTimer = timer(period = 2_000) {
|
||||||
view?.updateData(createItems(lessons))
|
Handler(Looper.getMainLooper()).post {
|
||||||
|
view?.updateData(createItems(lessons))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
Wersja 2.2.2
|
Wersja 2.2.7
|
||||||
|
|
||||||
— dodaliśmy możliwość łatwego wejścia w sobotę i niedziele w planie lekcji przy użyciu strzałek
|
— naprawiliśmy logowanie do aplikacji i odświeżanie danych na odmianie standardowej i podobnych
|
||||||
— poprawiliśmy wsparcie dla statystyk ocen z systemem punktowym
|
|
||||||
— poprawiliśmy sortowanie nauczycieli w widoku Szkoła i nauczyciele
|
|
||||||
|
|
||||||
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases
|
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases
|
||||||
|
@ -713,7 +713,6 @@
|
|||||||
<string name="pref_view_present">Zobrazit přítomnost</string>
|
<string name="pref_view_present">Zobrazit přítomnost</string>
|
||||||
<string name="pref_view_app_theme">Motiv</string>
|
<string name="pref_view_app_theme">Motiv</string>
|
||||||
<string name="pref_view_expand_grade">Rozvíjení známek</string>
|
<string name="pref_view_expand_grade">Rozvíjení známek</string>
|
||||||
<string name="pref_view_timetable_show_timers">Označit aktuální lekci</string>
|
|
||||||
<string name="pref_view_timetable_show_groups">Zobrazit skupiny vedle předmětů</string>
|
<string name="pref_view_timetable_show_groups">Zobrazit skupiny vedle předmětů</string>
|
||||||
<string name="pref_view_timetable_show_gaps">Zobrazit prázdné dlaždice, kde není žádná lekce</string>
|
<string name="pref_view_timetable_show_gaps">Zobrazit prázdné dlaždice, kde není žádná lekce</string>
|
||||||
<string name="pref_view_grade_statistics_list">Zobrazit seznam grafů v známkách třídy</string>
|
<string name="pref_view_grade_statistics_list">Zobrazit seznam grafů v známkách třídy</string>
|
||||||
|
@ -623,7 +623,6 @@
|
|||||||
<string name="pref_view_present">Show presence</string>
|
<string name="pref_view_present">Show presence</string>
|
||||||
<string name="pref_view_app_theme">Theme</string>
|
<string name="pref_view_app_theme">Theme</string>
|
||||||
<string name="pref_view_expand_grade">Grades expanding</string>
|
<string name="pref_view_expand_grade">Grades expanding</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_timetable_show_gaps">Show empty tiles where there\'s no lesson</string>
|
<string name="pref_view_timetable_show_gaps">Show empty tiles where there\'s no lesson</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>
|
||||||
|
@ -623,7 +623,6 @@
|
|||||||
<string name="pref_view_present">Anwesendheit zeigen</string>
|
<string name="pref_view_present">Anwesendheit zeigen</string>
|
||||||
<string name="pref_view_app_theme">Thema</string>
|
<string name="pref_view_app_theme">Thema</string>
|
||||||
<string name="pref_view_expand_grade">Steigende Sorten</string>
|
<string name="pref_view_expand_grade">Steigende Sorten</string>
|
||||||
<string name="pref_view_timetable_show_timers">Aktuelle Lektion markieren</string>
|
|
||||||
<string name="pref_view_timetable_show_groups">Gruppen neben Schulfächen anzeigen</string>
|
<string name="pref_view_timetable_show_groups">Gruppen neben Schulfächen anzeigen</string>
|
||||||
<string name="pref_view_timetable_show_gaps">Show empty tiles where there\'s no lesson</string>
|
<string name="pref_view_timetable_show_gaps">Show empty tiles where there\'s no lesson</string>
|
||||||
<string name="pref_view_grade_statistics_list">Liste der Diagramme in Klassenbewertungen anzeigen</string>
|
<string name="pref_view_grade_statistics_list">Liste der Diagramme in Klassenbewertungen anzeigen</string>
|
||||||
|
@ -623,7 +623,6 @@
|
|||||||
<string name="pref_view_present">Show presence</string>
|
<string name="pref_view_present">Show presence</string>
|
||||||
<string name="pref_view_app_theme">Theme</string>
|
<string name="pref_view_app_theme">Theme</string>
|
||||||
<string name="pref_view_expand_grade">Grades expanding</string>
|
<string name="pref_view_expand_grade">Grades expanding</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_timetable_show_gaps">Show empty tiles where there\'s no lesson</string>
|
<string name="pref_view_timetable_show_gaps">Show empty tiles where there\'s no lesson</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>
|
||||||
|
@ -623,7 +623,6 @@
|
|||||||
<string name="pref_view_present">Show presence</string>
|
<string name="pref_view_present">Show presence</string>
|
||||||
<string name="pref_view_app_theme">Theme</string>
|
<string name="pref_view_app_theme">Theme</string>
|
||||||
<string name="pref_view_expand_grade">Grades expanding</string>
|
<string name="pref_view_expand_grade">Grades expanding</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_timetable_show_gaps">Show empty tiles where there\'s no lesson</string>
|
<string name="pref_view_timetable_show_gaps">Show empty tiles where there\'s no lesson</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>
|
||||||
|
@ -713,7 +713,6 @@
|
|||||||
<string name="pref_view_present">Pokazuj obecność</string>
|
<string name="pref_view_present">Pokazuj obecność</string>
|
||||||
<string name="pref_view_app_theme">Motyw</string>
|
<string name="pref_view_app_theme">Motyw</string>
|
||||||
<string name="pref_view_expand_grade">Rozwijanie ocen</string>
|
<string name="pref_view_expand_grade">Rozwijanie ocen</string>
|
||||||
<string name="pref_view_timetable_show_timers">Oznaczaj bieżącą lekcję</string>
|
|
||||||
<string name="pref_view_timetable_show_groups">Pokazuj grupę obok przedmiotu</string>
|
<string name="pref_view_timetable_show_groups">Pokazuj grupę obok przedmiotu</string>
|
||||||
<string name="pref_view_timetable_show_gaps">Pokazuj puste kafelki gdzie nie ma lekcji</string>
|
<string name="pref_view_timetable_show_gaps">Pokazuj puste kafelki gdzie nie ma lekcji</string>
|
||||||
<string name="pref_view_grade_statistics_list">Pokazuj listę wykresów w ocenach klasy</string>
|
<string name="pref_view_grade_statistics_list">Pokazuj listę wykresów w ocenach klasy</string>
|
||||||
|
@ -713,7 +713,6 @@
|
|||||||
<string name="pref_view_present">Показывать присутствия</string>
|
<string name="pref_view_present">Показывать присутствия</string>
|
||||||
<string name="pref_view_app_theme">Тема</string>
|
<string name="pref_view_app_theme">Тема</string>
|
||||||
<string name="pref_view_expand_grade">Разворачивание оценок</string>
|
<string name="pref_view_expand_grade">Разворачивание оценок</string>
|
||||||
<string name="pref_view_timetable_show_timers">Отметить текущий урок</string>
|
|
||||||
<string name="pref_view_timetable_show_groups">Показать группы рядом с темами</string>
|
<string name="pref_view_timetable_show_groups">Показать группы рядом с темами</string>
|
||||||
<string name="pref_view_timetable_show_gaps">Show empty tiles where there\'s no lesson</string>
|
<string name="pref_view_timetable_show_gaps">Show empty tiles where there\'s no lesson</string>
|
||||||
<string name="pref_view_grade_statistics_list">Показывать диаграммы в оценках класса</string>
|
<string name="pref_view_grade_statistics_list">Показывать диаграммы в оценках класса</string>
|
||||||
|
@ -713,7 +713,6 @@
|
|||||||
<string name="pref_view_present">Zobraziť prítomnosť</string>
|
<string name="pref_view_present">Zobraziť prítomnosť</string>
|
||||||
<string name="pref_view_app_theme">Motív</string>
|
<string name="pref_view_app_theme">Motív</string>
|
||||||
<string name="pref_view_expand_grade">Rozvijanie známok</string>
|
<string name="pref_view_expand_grade">Rozvijanie známok</string>
|
||||||
<string name="pref_view_timetable_show_timers">Označiť aktuálne lekciu</string>
|
|
||||||
<string name="pref_view_timetable_show_groups">Zobraziť skupiny vedľa predmetov</string>
|
<string name="pref_view_timetable_show_groups">Zobraziť skupiny vedľa predmetov</string>
|
||||||
<string name="pref_view_timetable_show_gaps">Zobraziť prázdne dlaždice, kde nie je žiadne lekcie</string>
|
<string name="pref_view_timetable_show_gaps">Zobraziť prázdne dlaždice, kde nie je žiadne lekcie</string>
|
||||||
<string name="pref_view_grade_statistics_list">Zobraziť zoznam grafov v známkach triedy</string>
|
<string name="pref_view_grade_statistics_list">Zobraziť zoznam grafov v známkach triedy</string>
|
||||||
|
@ -713,7 +713,6 @@
|
|||||||
<string name="pref_view_present">Показувати присутність</string>
|
<string name="pref_view_present">Показувати присутність</string>
|
||||||
<string name="pref_view_app_theme">Тема</string>
|
<string name="pref_view_app_theme">Тема</string>
|
||||||
<string name="pref_view_expand_grade">Розгортання оцінок</string>
|
<string name="pref_view_expand_grade">Розгортання оцінок</string>
|
||||||
<string name="pref_view_timetable_show_timers">Позначити поточний урок</string>
|
|
||||||
<string name="pref_view_timetable_show_groups">Показувати групи поруч з темами</string>
|
<string name="pref_view_timetable_show_groups">Показувати групи поруч з темами</string>
|
||||||
<string name="pref_view_timetable_show_gaps">Показувати порожні плитки там, де немає уроків</string>
|
<string name="pref_view_timetable_show_gaps">Показувати порожні плитки там, де немає уроків</string>
|
||||||
<string name="pref_view_grade_statistics_list">Показувати діаграми в оцінках класу</string>
|
<string name="pref_view_grade_statistics_list">Показувати діаграми в оцінках класу</string>
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
<bool name="pref_default_timetable_show_groups">false</bool>
|
<bool name="pref_default_timetable_show_groups">false</bool>
|
||||||
<string name="pref_default_timetable_show_whole_class">no</string>
|
<string name="pref_default_timetable_show_whole_class">no</string>
|
||||||
<string name="pref_default_grade_sorting_mode">alphabetic</string>
|
<string name="pref_default_grade_sorting_mode">alphabetic</string>
|
||||||
<bool name="pref_default_timetable_show_timers">false</bool>
|
|
||||||
<string name="pref_default_timetable_show_gaps">between</string>
|
<string name="pref_default_timetable_show_gaps">between</string>
|
||||||
<bool name="pref_default_subjects_without_grades">false</bool>
|
<bool name="pref_default_subjects_without_grades">false</bool>
|
||||||
<bool name="pref_default_optional_arithmetic_average">false</bool>
|
<bool name="pref_default_optional_arithmetic_average">false</bool>
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
<string name="pref_key_grade_sorting_mode">grade_sorting_mode</string>
|
<string name="pref_key_grade_sorting_mode">grade_sorting_mode</string>
|
||||||
<string name="pref_key_timetable_show_whole_class">show_whole_class_plan</string>
|
<string name="pref_key_timetable_show_whole_class">show_whole_class_plan</string>
|
||||||
<string name="pref_key_timetable_show_groups">show_groups_in_plan</string>
|
<string name="pref_key_timetable_show_groups">show_groups_in_plan</string>
|
||||||
<string name="pref_key_timetable_show_timers">timetable_show_timers</string>
|
|
||||||
<string name="pref_key_timetable_show_gaps">timetable_show_gaps</string>
|
<string name="pref_key_timetable_show_gaps">timetable_show_gaps</string>
|
||||||
<string name="pref_key_subjects_without_grades">subjects_without_grades</string>
|
<string name="pref_key_subjects_without_grades">subjects_without_grades</string>
|
||||||
<string name="pref_key_optional_arithmetic_average">optional_arithmetic_average</string>
|
<string name="pref_key_optional_arithmetic_average">optional_arithmetic_average</string>
|
||||||
|
@ -701,7 +701,6 @@
|
|||||||
<string name="pref_view_present">Show presence</string>
|
<string name="pref_view_present">Show presence</string>
|
||||||
<string name="pref_view_app_theme">Theme</string>
|
<string name="pref_view_app_theme">Theme</string>
|
||||||
<string name="pref_view_expand_grade">Grades expanding</string>
|
<string name="pref_view_expand_grade">Grades expanding</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_timetable_show_gaps">Show empty tiles where there\'s no lesson</string>
|
<string name="pref_view_timetable_show_gaps">Show empty tiles where there\'s no lesson</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>
|
||||||
|
@ -90,11 +90,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
app:title="@string/pref_timetable_appearance_view">
|
app:title="@string/pref_timetable_appearance_view">
|
||||||
<SwitchPreferenceCompat
|
|
||||||
app:defaultValue="@bool/pref_default_timetable_show_timers"
|
|
||||||
app:iconSpaceReserved="false"
|
|
||||||
app:key="@string/pref_key_timetable_show_timers"
|
|
||||||
app:title="@string/pref_view_timetable_show_timers" />
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
app:defaultValue="@bool/pref_default_timetable_show_groups"
|
app:defaultValue="@bool/pref_default_timetable_show_groups"
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
|
@ -3,12 +3,15 @@ package io.github.wulkanowy.utils
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.Activity.RESULT_OK
|
import android.app.Activity.RESULT_OK
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.IntentSender
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.activity.result.ActivityResult
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.google.android.play.core.appupdate.AppUpdateInfo
|
import com.google.android.play.core.appupdate.AppUpdateInfo
|
||||||
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
|
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
|
||||||
|
import com.google.android.play.core.appupdate.AppUpdateOptions
|
||||||
import com.google.android.play.core.install.InstallStateUpdatedListener
|
import com.google.android.play.core.install.InstallStateUpdatedListener
|
||||||
import com.google.android.play.core.install.model.AppUpdateType.FLEXIBLE
|
import com.google.android.play.core.install.model.AppUpdateType.FLEXIBLE
|
||||||
import com.google.android.play.core.install.model.AppUpdateType.IMMEDIATE
|
import com.google.android.play.core.install.model.AppUpdateType.IMMEDIATE
|
||||||
@ -20,15 +23,16 @@ import com.google.android.play.core.ktx.isFlexibleUpdateAllowed
|
|||||||
import com.google.android.play.core.ktx.isImmediateUpdateAllowed
|
import com.google.android.play.core.ktx.isImmediateUpdateAllowed
|
||||||
import com.google.android.play.core.ktx.updatePriority
|
import com.google.android.play.core.ktx.updatePriority
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
|
import dagger.hilt.android.scopes.ActivityScoped
|
||||||
import io.github.wulkanowy.R
|
import io.github.wulkanowy.R
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
@ActivityScoped
|
||||||
class UpdateHelper @Inject constructor(
|
class InAppUpdateHelper @Inject constructor(
|
||||||
@ApplicationContext private val context: Context,
|
@ApplicationContext private val context: Context,
|
||||||
private val analyticsHelper: AnalyticsHelper,
|
private val analyticsHelper: AnalyticsHelper,
|
||||||
|
activity: Activity
|
||||||
) {
|
) {
|
||||||
|
|
||||||
lateinit var messageContainer: View
|
lateinit var messageContainer: View
|
||||||
@ -39,6 +43,7 @@ class UpdateHelper @Inject constructor(
|
|||||||
when (state.installStatus()) {
|
when (state.installStatus()) {
|
||||||
PENDING -> Toast.makeText(context, R.string.update_download_started, Toast.LENGTH_SHORT)
|
PENDING -> Toast.makeText(context, R.string.update_download_started, Toast.LENGTH_SHORT)
|
||||||
.show()
|
.show()
|
||||||
|
|
||||||
DOWNLOADED -> popupSnackBarForCompleteUpdate()
|
DOWNLOADED -> popupSnackBarForCompleteUpdate()
|
||||||
else -> Timber.d("Update state: ${state.installStatus()}")
|
else -> Timber.d("Update state: ${state.installStatus()}")
|
||||||
}
|
}
|
||||||
@ -70,45 +75,55 @@ class UpdateHelper @Inject constructor(
|
|||||||
return updateAvailability() == UPDATE_AVAILABLE && isFlexibleUpdateAllowed && isUpdatePriorityAllowUpdate
|
return updateAvailability() == UPDATE_AVAILABLE && isFlexibleUpdateAllowed && isUpdatePriorityAllowUpdate
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkAndInstallUpdates(activity: Activity) {
|
private val activityResultLauncher = (activity as AppCompatActivity).registerForActivityResult(
|
||||||
|
ActivityResultContracts.StartIntentSenderForResult(),
|
||||||
|
::onActivityResult
|
||||||
|
)
|
||||||
|
|
||||||
|
fun checkAndInstallUpdates() {
|
||||||
Timber.d("Checking for updates...")
|
Timber.d("Checking for updates...")
|
||||||
appUpdateManager.appUpdateInfo.addOnSuccessListener { appUpdateInfo ->
|
appUpdateManager.appUpdateInfo.addOnSuccessListener { appUpdateInfo ->
|
||||||
when {
|
when {
|
||||||
appUpdateInfo.isImmediateUpdateAvailable -> {
|
appUpdateInfo.isImmediateUpdateAvailable -> {
|
||||||
startUpdate(activity, appUpdateInfo, IMMEDIATE)
|
startUpdate(appUpdateInfo, IMMEDIATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
appUpdateInfo.isFlexibleUpdateAvailable -> {
|
appUpdateInfo.isFlexibleUpdateAvailable -> {
|
||||||
appUpdateManager.registerListener(flexibleUpdateListener)
|
appUpdateManager.registerListener(flexibleUpdateListener)
|
||||||
startUpdate(activity, appUpdateInfo, FLEXIBLE)
|
startUpdate(appUpdateInfo, FLEXIBLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> Timber.d("No update available")
|
else -> Timber.d("No update available")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startUpdate(activity: Activity, appUpdateInfo: AppUpdateInfo, updateType: Int) {
|
private fun startUpdate(appUpdateInfo: AppUpdateInfo, updateType: Int) {
|
||||||
Timber.d("Start update ($updateType): $appUpdateInfo")
|
Timber.d("Start update ($updateType): $appUpdateInfo")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
appUpdateManager.startUpdateFlowForResult(
|
appUpdateManager.startUpdateFlowForResult(
|
||||||
appUpdateInfo, updateType, activity, IN_APP_UPDATE_REQUEST_CODE
|
appUpdateInfo,
|
||||||
|
activityResultLauncher,
|
||||||
|
AppUpdateOptions.defaultOptions(updateType)
|
||||||
)
|
)
|
||||||
} catch (e: IntentSender.SendIntentException) {
|
} catch (e: Exception) {
|
||||||
Timber.i("Update failed! Duplicated PendingIntent")
|
Timber.e(e, "Update failed!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onActivityResult(requestCode: Int, resultCode: Int) {
|
private fun onActivityResult(activityResult: ActivityResult) {
|
||||||
if (requestCode == IN_APP_UPDATE_REQUEST_CODE) {
|
val resultCode = activityResult.resultCode
|
||||||
if (resultCode != RESULT_OK) {
|
|
||||||
Timber.i("Update failed! Result code: $resultCode")
|
|
||||||
Toast.makeText(context, R.string.update_failed, Toast.LENGTH_LONG).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
analyticsHelper.logEvent("inapp_update", "code" to resultCode)
|
if (resultCode != RESULT_OK) {
|
||||||
|
Timber.i("Update failed! Result code: $resultCode")
|
||||||
|
Toast.makeText(context, R.string.update_failed, Toast.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
analyticsHelper.logEvent("inapp_update", "code" to resultCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onResume(activity: Activity) {
|
fun onResume() {
|
||||||
appUpdateManager.appUpdateInfo.addOnSuccessListener { info ->
|
appUpdateManager.appUpdateInfo.addOnSuccessListener { info ->
|
||||||
Timber.d("InAppUpdate.onResume() listener: $info")
|
Timber.d("InAppUpdate.onResume() listener: $info")
|
||||||
|
|
||||||
@ -116,7 +131,6 @@ class UpdateHelper @Inject constructor(
|
|||||||
DOWNLOADED == info.installStatus() -> popupSnackBarForCompleteUpdate()
|
DOWNLOADED == info.installStatus() -> popupSnackBarForCompleteUpdate()
|
||||||
DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS == info.updateAvailability() -> {
|
DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS == info.updateAvailability() -> {
|
||||||
startUpdate(
|
startUpdate(
|
||||||
activity = activity,
|
|
||||||
appUpdateInfo = info,
|
appUpdateInfo = info,
|
||||||
updateType = if (info.isImmediateUpdateAvailable) IMMEDIATE else FLEXIBLE
|
updateType = if (info.isImmediateUpdateAvailable) IMMEDIATE else FLEXIBLE
|
||||||
)
|
)
|
||||||
@ -139,9 +153,4 @@ class UpdateHelper @Inject constructor(
|
|||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
|
||||||
|
|
||||||
private const val IN_APP_UPDATE_REQUEST_CODE = 1721
|
|
||||||
}
|
|
||||||
}
|
}
|
18
build.gradle
18
build.gradle
@ -1,8 +1,8 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
kotlin_version = '1.9.10'
|
kotlin_version = '1.9.22'
|
||||||
about_libraries = '10.9.1'
|
about_libraries = '10.9.2'
|
||||||
hilt_version = '2.48.1'
|
hilt_version = '2.50'
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -13,14 +13,14 @@ 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.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.16"
|
||||||
classpath 'com.android.tools.build:gradle:8.1.2'
|
classpath 'com.android.tools.build:gradle:8.2.0'
|
||||||
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.4.0'
|
classpath 'com.google.gms:google-services:4.4.0'
|
||||||
classpath 'com.huawei.agconnect:agcp:1.9.1.301'
|
classpath 'com.huawei.agconnect:agcp:1.9.1.302'
|
||||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
|
||||||
classpath "com.github.triplet.gradle:play-publisher:3.8.4"
|
classpath "com.github.triplet.gradle:play-publisher:3.8.4"
|
||||||
classpath "ru.cian:huawei-publish-gradle-plugin:1.4.0"
|
classpath "ru.cian:huawei-publish-gradle-plugin:1.4.2"
|
||||||
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373"
|
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373"
|
||||||
classpath "gradle.plugin.com.star-zero.gradle:githook:1.2.0"
|
classpath "gradle.plugin.com.star-zero.gradle:githook:1.2.0"
|
||||||
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:$about_libraries"
|
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:$about_libraries"
|
||||||
@ -36,7 +36,3 @@ allprojects {
|
|||||||
maven { url "https://developer.huawei.com/repo/" }
|
maven { url "https://developer.huawei.com/repo/" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('clean', Delete) {
|
|
||||||
delete rootProject.buildDir
|
|
||||||
}
|
|
||||||
|
@ -6,8 +6,9 @@ kotlin.code.style=official
|
|||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.nonTransitiveRClass=false
|
android.nonTransitiveRClass=false
|
||||||
android.defaults.buildfeatures.buildconfig=true
|
|
||||||
#
|
#
|
||||||
# https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-common-faq-0000001063210244#section17273113244910
|
# https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-common-faq-0000001063210244#section17273113244910
|
||||||
apmsInstrumentationEnabled=false
|
apmsInstrumentationEnabled=false
|
||||||
|
|
||||||
|
# https://community.sonarsource.com/t/sonarscanner-for-gradle-you-can-now-decide-when-to-compile/102069/2
|
||||||
|
systemProp.sonar.gradle.skipCompile=true
|
||||||
|
Reference in New Issue
Block a user