diff --git a/.circleci/config.yml b/.circleci/config.yml
index cad321125..d4e59be19 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -7,11 +7,11 @@ references:
container_config: &container_config
docker:
- - image: circleci/android@sha256:5cdc8626cc6f13efe5ed982cdcdb432b0472f8740fed8743a6461e025ad6cdfc
+ - image: circleci/android:api-28-alpha
working_directory: *workspace_root
environment:
environment:
- _JAVA_OPTS: -Xmx3072m
+ JVM_OPTS: -Xmx3200m
attach_workspace: &attach_workspace
attach_workspace:
@@ -35,7 +35,7 @@ jobs:
command: ./gradlew dependencies --no-daemon --stacktrace --console=plain -PdisablePreDex || true
- run:
name: Initial build
- command: ./gradlew build -x test -x lint -x fabricGenerateResourcesFdroidRelease -x fabricGenerateResourcesPlayRelease -x packageRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
+ command: ./gradlew build -x test -x lint -x fabricGenerateResourcesRelease -x packageRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
- run:
name: Run FOSSA
command: fossa --no-ansi || true
@@ -56,7 +56,7 @@ jobs:
<<: *general_cache_key
- run:
name: Run lint
- command: ./gradlew lint -x fabricGenerateResourcesFdroidRelease -x fabricGenerateResourcesPlayRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
+ command: ./gradlew lint -x fabricGenerateResourcesRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
- store_artifacts:
path: ./app/build/reports/
destination: lint_reports/app/
@@ -75,7 +75,7 @@ jobs:
<<: *general_cache_key
- run:
name: Run app tests
- command: ./gradlew :app:test :app:jacocoTestReport -x fabricGenerateResourcesFdroidRelease -x fabricGenerateResourcesPlayRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
+ command: ./gradlew :app:test :app:jacocoTestReport -x fabricGenerateResourcesRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
- run:
name: Upload unit code coverage to codecov
command: bash <(curl -s https://codecov.io/bash) -F app
@@ -93,9 +93,6 @@ jobs:
<<: *container_config
steps:
- *attach_workspace
- - run:
- name: Accept licenses
- command: yes | sdkmanager --licenses && yes | sdkmanager --update
- run:
name: Setup emulator
command: sdkmanager "system-images;android-19;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-19;default;armeabi-v7a"
@@ -116,7 +113,7 @@ jobs:
adb shell input keyevent 82
- run:
name: Run instrumented tests
- command: ./gradlew clean createPlayDebugCoverageReport jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex
+ command: ./gradlew clean createDebugCoverageReport jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex
- run:
name: Collect logs from emulator
command: adb logcat -d > ./app/build/reports/logcat_emulator.txt
@@ -162,7 +159,7 @@ jobs:
openssl aes-256-cbc -d -in ./app/upload-key-encrypted.jks -k $ENCRYPT_KEY >> ./app/upload-key.jks
- run:
name: Publish release
- command: ./gradlew publishPlayRelease --no-daemon --stacktrace --console=plain -PenableCrashlytics -PdisablePreDex
+ command: ./gradlew publish --no-daemon --stacktrace --console=plain -PenableCrashlytics -PdisablePreDex
workflows:
version: 2
diff --git a/.gitignore b/.gitignore
index 63783326a..6bc531b64 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,4 +48,3 @@ app/key.p12
app/upload-key.jks
*.log
.idea/assetWizardSettings.xml
-.idea/uiDesigner.xml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a84ac8396..0d1bcd5d2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,7 +12,7 @@ build:
script:
- ./gradlew --no-daemon --stacktrace dependencies || true
- ./gradlew --no-daemon --stacktrace assembleDebug
- - mv app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk .
+ - mv app/build/outputs/apk/debug/app-debug.apk .
artifacts:
name: "${CI_PROJECT_NAME}_${CI_BUILD_REF_NAME}-${CI_BUILD_ID}"
paths:
@@ -26,7 +26,7 @@ tests:
- .gradle
policy: pull
script:
- - ./gradlew --no-daemon --stacktrace -x fabricGenerateResourcesFdroidRelease -x fabricGenerateResourcesPlayRelease test
+ - ./gradlew --no-daemon --stacktrace -x fabricGenerateResourcesRelease test
artifacts:
paths:
- app/build/reports/tests
@@ -39,7 +39,7 @@ lint:
- .gradle
policy: pull
script:
- - ./gradlew --no-daemon --stacktrace -x fabricGenerateResourcesFdroidRelease -x fabricGenerateResourcesPlayRelease lint
+ - ./gradlew --no-daemon --stacktrace -x fabricGenerateResourcesRelease lint
artifacts:
paths:
- app/build/reports
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 43e9b544a..a8407c848 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -21,6 +21,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 000000000..7f68460d8
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 0bcf9bdb7..56c648589 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,10 +11,10 @@ cache:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
-branches:
- only:
- - develop
- - 0.9.2
+#branches:
+# only:
+# - master
+# - 0.7.x
android:
licenses:
@@ -48,20 +48,20 @@ before_script:
script:
- ./gradlew dependencies --stacktrace --daemon
- fossa --no-ansi || true
- #- ./gradlew lintPlayRelease -x fabricGenerateResourcesPlayRelease --stacktrace --daemon
- - ./gradlew testPlayDebugUnitTest -x fabricGenerateResourcesPlay --stacktrace --daemon
- - ./gradlew createPlayDebugCoverageReport --stacktrace --daemon
+ - ./gradlew lint -x fabricGenerateResourcesRelease --stacktrace --daemon
+ - ./gradlew test -x fabricGenerateResourcesRelease --stacktrace --daemon
+ - ./gradlew createDebugCoverageReport --stacktrace --daemon
- ./gradlew jacocoTestReport --stacktrace --daemon
- if [ -z ${SONAR_HOST+x} ]; then echo "sonar scan skipped"; else
git fetch --unshallow;
- ./gradlew sonarqube -x test -x lint -x fabricGenerateResourcesPlayRelease -x fabricGenerateResourcesFdroidRelease -Dsonar.host.url=$SONAR_HOST -Dsonar.organization=$SONAR_ORG -Dsonar.login=$SONAR_KEY -Dsonar.branch.name=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} --stacktrace --daemon;
+ ./gradlew sonarqube -x test -x lint -x fabricGenerateResourcesRelease -Dsonar.host.url=$SONAR_HOST -Dsonar.organization=$SONAR_ORG -Dsonar.login=$SONAR_KEY -Dsonar.branch.name=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} --stacktrace --daemon;
fi
- |
if [ $TRAVIS_TAG ]; then
gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/google-services.json.gpg;
gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/key.p12.gpg;
gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/upload-key.jks.gpg;
- ./gradlew publishPlayRelease -PenableCrashlytics --stacktrace;
+ ./gradlew publish -PenableCrashlytics --stacktrace;
fi
after_success:
diff --git a/README.md b/README.md
index 07f06d7f2..97a4172c4 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
# Wulkanowy
+[](https://circleci.com/gh/wulkanowy/wulkanowy)
[](https://travis-ci.com/wulkanowy/wulkanowy)
[](https://www.bitrise.io/app/daeff1893f3c8128)
[](https://codecov.io/gh/wulkanowy/wulkanowy)
@@ -7,8 +8,6 @@
[](https://sonarcloud.io/dashboard?id=io.github.wulkanowy%3Aapp)
[](https://app.fossa.com/projects/custom%2B5644%2Fgithub.com%2Fwulkanowy%2Fwulkanowy?ref=badge_shield)
[](https://discord.gg/vccAQBr)
-[](https://f-droid.org/packages/io.github.wulkanowy/)
-[](https://github.com/wulkanowy/wulkanowy/releases)
[Pobierz wersję beta z Google Play](https://play.google.com/store/apps/details?id=io.github.wulkanowy&utm_source=vcs)
diff --git a/app/build.gradle b/app/build.gradle
index 2a59303c5..c58c1e337 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,7 +6,6 @@ apply plugin: 'io.fabric'
apply plugin: 'com.github.triplet.play'
apply from: 'jacoco.gradle'
apply from: 'sonarqube.gradle'
-apply from: 'hooks.gradle'
android {
compileSdkVersion 28
@@ -17,13 +16,13 @@ android {
testApplicationId "io.github.tests.wulkanowy"
minSdkVersion 15
targetSdkVersion 28
- versionCode 41
- versionName "0.9.3"
+ versionCode 31
+ versionName "0.7.5"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [
- fabric_api_key : System.getenv("FABRIC_API_KEY") ?: "null",
+ fabric_api_key: System.getenv("FABRIC_API_KEY") ?: "null",
crashlytics_enabled: project.hasProperty("enableCrashlytics")
]
javaCompileOptions {
@@ -64,18 +63,6 @@ android {
}
}
- flavorDimensions "platform"
- productFlavors {
- play {
- dimension "platform"
- }
-
- fdroid {
- buildConfigField "boolean", "CRASHLYTICS_ENABLED", "false"
- dimension "platform"
- }
- }
-
lintOptions {
disable 'HardwareIds'
}
@@ -93,86 +80,74 @@ androidExtensions {
play {
serviceAccountEmail = System.getenv("PLAY_SERVICE_ACCOUNT_EMAIL") ?: "jan@fakelog.cf"
serviceAccountCredentials = file('key.p12')
- defaultToAppBundles = false
+ defaultToAppBundles = true
track = 'alpha'
}
dependencies {
- implementation "io.github.wulkanowy:api:0.9.3"
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
- implementation "androidx.core:core:1.0.2"
+ implementation('io.github.wulkanowy:api:0.7.5') { exclude module: "threetenbp" }
+
+ implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.2"
- implementation "androidx.fragment:fragment:1.0.0"
- implementation "androidx.annotation:annotation:1.1.0"
- implementation "androidx.multidex:multidex:2.0.1"
+ implementation "androidx.cardview:cardview:1.0.0"
+ implementation "com.google.android.material:material:1.0.0"
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.multidex:multidex:2.0.1'
- implementation "androidx.recyclerview:recyclerview:1.0.0"
- implementation "androidx.viewpager:viewpager:1.0.0"
- implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
- implementation "androidx.constraintlayout:constraintlayout:1.1.3"
- implementation "androidx.coordinatorlayout:coordinatorlayout:1.0.0"
- implementation "com.google.android.material:material:1.1.0-alpha07"
- implementation "com.github.wulkanowy:MaterialChipsInput:b72fd0ee6f"
- implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"
+ implementation "android.arch.work:work-runtime:1.0.0"
+ implementation "android.arch.work:work-rxjava2:1.0.0"
- implementation "androidx.work:work-runtime:2.0.1"
- implementation "androidx.work:work-rxjava2:2.0.1"
+ implementation "androidx.room:room-runtime:2.1.0-alpha06"
+ implementation "androidx.room:room-rxjava2:2.1.0-alpha06"
+ kapt "androidx.room:room-compiler:2.1.0-alpha06"
- implementation "androidx.room:room-runtime:2.1.0"
- implementation "androidx.room:room-rxjava2:2.1.0"
- kapt "androidx.room:room-compiler:2.1.0"
+ implementation 'com.takisoft.preferencex:preferencex:1.0.0'
- implementation "com.google.dagger:dagger-android-support:2.23.1"
- kapt "com.google.dagger:dagger-compiler:2.23.1"
- kapt "com.google.dagger:dagger-android-processor:2.23.1"
- implementation "com.squareup.inject:assisted-inject-annotations-dagger2:0.4.0"
- kapt "com.squareup.inject:assisted-inject-processor-dagger2:0.4.0"
+ implementation 'com.squareup.inject:assisted-inject-annotations-dagger2:0.3.3'
+ kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.3.3'
+
+ implementation "com.google.dagger:dagger-android-support:2.21"
+ kapt "com.google.dagger:dagger-compiler:2.21"
+ kapt "com.google.dagger:dagger-android-processor:2.21"
implementation "eu.davidea:flexible-adapter:5.1.0"
implementation "eu.davidea:flexible-adapter-ui:1.0.0"
implementation "com.aurelhubert:ahbottomnavigation:2.3.4"
- implementation "com.ncapdevi:frag-nav:3.2.0"
+ implementation 'com.ncapdevi:frag-nav:3.2.0'
- implementation "com.github.pwittchen:reactivenetwork-rx2:3.0.3"
- implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
- implementation "io.reactivex.rxjava2:rxjava:2.2.9"
+ implementation 'com.github.wulkanowy:MaterialChipsInput:b72fd0ee6f'
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
- implementation "com.google.code.gson:gson:2.8.5"
- implementation "com.jakewharton.threetenabp:threetenabp:1.2.1"
+ implementation 'com.github.pwittchen:reactivenetwork-rx2:3.0.2'
+ implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
+ implementation "io.reactivex.rxjava2:rxjava:2.2.7"
+
+ implementation "com.jakewharton.threetenabp:threetenabp:1.2.0"
implementation "com.jakewharton.timber:timber:4.7.1"
implementation "at.favre.lib:slf4j-timber:1.0.1"
- implementation "com.squareup.okhttp3:logging-interceptor:3.12.3"
-
implementation "com.mikepenz:aboutlibraries:6.2.3"
- implementation "com.takisoft.preferencex:preferencex:1.0.0"
- playImplementation "com.google.firebase:firebase-core:16.0.9"
- playImplementation "com.crashlytics.sdk.android:crashlytics:2.10.1"
+ implementation 'com.google.firebase:firebase-core:16.0.8'
+ implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
- releaseImplementation "fr.o80.chucker:library-no-op:2.0.4"
+ releaseImplementation 'fr.o80.chucker:library-no-op:2.0.4'
- debugImplementation "fr.o80.chucker:library:2.0.4"
+ debugImplementation 'fr.o80.chucker:library:2.0.4'
debugImplementation "com.amitshekhar.android:debug-db:1.0.6"
testImplementation "junit:junit:4.12"
testImplementation "io.mockk:mockk:1.9.2"
- testImplementation "org.threeten:threetenbp:1.4.0"
- testImplementation "org.mockito:mockito-core:2.28.2"
- testImplementation("org.mockito:mockito-inline:2.28.2") {
- exclude group: "org.mockito", module: "mockito-core"
- }
+ testImplementation "org.mockito:mockito-inline:2.25.1"
+ testImplementation 'org.threeten:threetenbp:1.3.8'
- androidTestImplementation "androidx.test:core:1.2.0"
- androidTestImplementation "androidx.test:runner:1.2.0"
- androidTestImplementation "androidx.test.ext:junit:1.1.1"
+ androidTestImplementation 'androidx.test:core:1.1.0'
+ androidTestImplementation 'androidx.test:runner:1.1.1'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation "io.mockk:mockk-android:1.9.2"
- androidTestImplementation "androidx.room:room-testing:2.1.0"
+ androidTestImplementation 'org.mockito:mockito-android:2.25.1'
+ androidTestImplementation "androidx.room:room-testing:2.1.0-alpha06"
androidTestImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
- androidTestImplementation "org.mockito:mockito-core:2.28.2"
- androidTestImplementation("org.mockito:mockito-android:2.28.2") {
- exclude group: 'org.mockito', module: 'mockito-core'
- }
}
apply plugin: 'com.google.gms.google-services'
diff --git a/app/hooks.gradle b/app/hooks.gradle
deleted file mode 100644
index 038fa9fb2..000000000
--- a/app/hooks.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-apply plugin: "com.star-zero.gradle.githook"
-
-githook {
- failOnMissingHooksDir = false
- hooks {
- "pre-push" {
- shell = "./app/play-publish-lint.sh"
- }
- }
-}
diff --git a/app/jacoco.gradle b/app/jacoco.gradle
index 44cd3f621..f2b01b483 100644
--- a/app/jacoco.gradle
+++ b/app/jacoco.gradle
@@ -31,20 +31,17 @@ task jacocoTestReport(type: JacocoReport) {
'**/*_Provide*Factory*.*',
'**/*_Factory.*']
- classDirectories.setFrom(fileTree(
+ classDirectories = fileTree(
dir: "$buildDir/intermediates/classes/debug",
excludes: excludes
) + fileTree(
- dir: "$buildDir/tmp/kotlin-classes/playDebug",
+ dir: "$buildDir/tmp/kotlin-classes/debug",
excludes: excludes
- ))
+ )
- sourceDirectories.setFrom(files([
- "src/main/java",
- "src/play/java"
- ]))
- executionData.setFrom(fileTree(
+ sourceDirectories = files("$project.projectDir/src/main/java")
+ executionData = fileTree(
dir: project.projectDir,
includes: ["**/*.exec", "**/*.ec"]
- ))
+ )
}
diff --git a/app/play-publish-lint.sh b/app/play-publish-lint.sh
deleted file mode 100755
index d3354b1ad..000000000
--- a/app/play-publish-lint.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash -
-
-content=$(cat < "app/src/main/play/release-notes/pl-PL/default.txt") || exit
-if [[ "${#content}" -gt 500 ]]; then
- echo >&2 "Release notes content has reached the limit of 500 characters"
- exit 1
-fi
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 7d42536d1..15b628384 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -37,6 +37,3 @@
#Config for API
-keep class io.github.wulkanowy.api.** {*;}
-
-#Config for Material Components
--keep class com.google.android.material.tabs.** {*;}
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/14.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/14.json
deleted file mode 100644
index 82b764922..000000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/14.json
+++ /dev/null
@@ -1,1386 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 14,
- "identityHash": "b22945c41e7841ff2e6b16af346dde0c",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `endpoint` TEXT NOT NULL, `loginType` TEXT NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_name` TEXT NOT NULL, `class_name` TEXT NOT NULL, `class_id` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "endpoint",
- "columnName": "endpoint",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "loginType",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "className",
- "columnName": "class_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id_class_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id",
- "class_id"
- ],
- "createSql": "CREATE UNIQUE INDEX `index_Students_email_symbol_student_id_school_id_class_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`, `class_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `school_year` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolYear",
- "columnName": "school_year",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` INTEGER NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `position` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predicted_grade` TEXT NOT NULL, `final_grade` TEXT NOT NULL, `proposed_points` TEXT NOT NULL, `final_points` TEXT NOT NULL, `points_sum` TEXT NOT NULL, `average` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "position",
- "columnName": "position",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predicted_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "final_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "proposedPoints",
- "columnName": "proposed_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalPoints",
- "columnName": "final_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pointsSum",
- "columnName": "points_sum",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "average",
- "columnName": "average",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `grade` INTEGER NOT NULL, `amount` INTEGER NOT NULL, `is_semester` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "grade",
- "columnName": "grade",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "amount",
- "columnName": "amount",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semester",
- "columnName": "is_semester",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `content` TEXT, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `removed` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `category` TEXT NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "views": [],
- "setupQueries": [
- "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
- "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'b22945c41e7841ff2e6b16af346dde0c')"
- ]
- }
-}
\ No newline at end of file
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/15.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/15.json
deleted file mode 100644
index 6f2d1d1da..000000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/15.json
+++ /dev/null
@@ -1,1430 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 15,
- "identityHash": "84b300bf53c7dd70b60a29a842275bb2",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `endpoint` TEXT NOT NULL, `loginType` TEXT NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_name` TEXT NOT NULL, `class_name` TEXT NOT NULL, `class_id` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "endpoint",
- "columnName": "endpoint",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "loginType",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "className",
- "columnName": "class_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id_class_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id",
- "class_id"
- ],
- "createSql": "CREATE UNIQUE INDEX `index_Students_email_symbol_student_id_school_id_class_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`, `class_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `school_year` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolYear",
- "columnName": "school_year",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` INTEGER NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `position` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predicted_grade` TEXT NOT NULL, `final_grade` TEXT NOT NULL, `proposed_points` TEXT NOT NULL, `final_points` TEXT NOT NULL, `points_sum` TEXT NOT NULL, `average` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "position",
- "columnName": "position",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predicted_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "final_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "proposedPoints",
- "columnName": "proposed_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalPoints",
- "columnName": "final_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pointsSum",
- "columnName": "points_sum",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "average",
- "columnName": "average",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `grade` INTEGER NOT NULL, `amount` INTEGER NOT NULL, `is_semester` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "grade",
- "columnName": "grade",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "amount",
- "columnName": "amount",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semester",
- "columnName": "is_semester",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `content` TEXT, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `removed` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `category` TEXT NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MobileDevices",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `device_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deviceId",
- "columnName": "device_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "views": [],
- "setupQueries": [
- "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
- "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '84b300bf53c7dd70b60a29a842275bb2')"
- ]
- }
-}
\ No newline at end of file
diff --git a/app/sonarqube.gradle b/app/sonarqube.gradle
index 3dad10344..52fd2dd8b 100644
--- a/app/sonarqube.gradle
+++ b/app/sonarqube.gradle
@@ -29,6 +29,5 @@ sonarqube {
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.android.lint.report", "build/reports/lint-results.xml"
property "sonar.jacoco.reportPaths", fileTree(dir: project.projectDir, includes: ['**/*.exec', '**/*.ec'])
- property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacocoTestReport/jacocoTestReport.xml"
}
}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/AbstractMigrationTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/AbstractMigrationTest.kt
index f720663b0..507105f6d 100644
--- a/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/AbstractMigrationTest.kt
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/AbstractMigrationTest.kt
@@ -22,12 +22,7 @@ abstract class AbstractMigrationTest {
fun getMigratedRoomDatabase(): AppDatabase {
val database = Room.databaseBuilder(ApplicationProvider.getApplicationContext(),
AppDatabase::class.java, dbName)
- .addMigrations(
- Migration12(),
- Migration13(),
- Migration14(),
- Migration15()
- )
+ .addMigrations(Migration12(), Migration13())
.build()
// close the database and release any stream resources when the test finishes
helper.closeWhenFinished(database)
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt
index a0acb5a76..17e788fc0 100644
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt
@@ -22,7 +22,6 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.threeten.bp.LocalDate.of
import org.threeten.bp.LocalDateTime
-import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import io.github.wulkanowy.api.grades.Grade as GradeApi
@@ -110,73 +109,4 @@ class GradeRepositoryTest {
assertTrue { grades[2].isRead }
assertTrue { grades[3].isRead }
}
-
- @Test
- fun subtractLocaleDuplicateGrades() {
- gradeLocal.saveGrades(listOf(
- createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
- createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
- createGradeLocal(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
- ))
-
- every { mockApi.getGrades(1) } returns Single.just(listOf(
- createGradeApi(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
- createGradeApi(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
- ))
-
- val grades = GradeRepository(settings, gradeLocal, gradeRemote)
- .getGrades(studentMock, semesterMock, true).blockingGet()
-
- assertEquals(2, grades.size)
- }
-
- @Test
- fun subtractRemoteDuplicateGrades() {
- gradeLocal.saveGrades(listOf(
- createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
- createGradeLocal(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
- ))
-
- every { mockApi.getGrades(1) } returns Single.just(listOf(
- createGradeApi(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
- createGradeApi(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
- createGradeApi(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
- ))
-
- val grades = GradeRepository(settings, gradeLocal, gradeRemote)
- .getGrades(studentMock, semesterMock, true).blockingGet()
-
- assertEquals(3, grades.size)
- }
-
- @Test
- fun emptyLocal() {
- gradeLocal.saveGrades(listOf())
-
- every { mockApi.getGrades(1) } returns Single.just(listOf(
- createGradeApi(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
- createGradeApi(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
- createGradeApi(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
- ))
-
- val grades = GradeRepository(settings, gradeLocal, gradeRemote)
- .getGrades(studentMock, semesterMock, true).blockingGet()
-
- assertEquals(3, grades.size)
- }
-
- @Test
- fun emptyRemote() {
- gradeLocal.saveGrades(listOf(
- createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
- createGradeLocal(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
- ))
-
- every { mockApi.getGrades(1) } returns Single.just(listOf())
-
- val grades = GradeRepository(settings, gradeLocal, gradeRemote)
- .getGrades(studentMock, semesterMock, true).blockingGet()
-
- assertEquals(0, grades.size)
- }
}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt
index cecd80992..b27446faf 100644
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt
@@ -39,7 +39,7 @@ class StudentLocalTest {
@Test
fun saveAndReadTest() {
- studentLocal.saveStudents(listOf(Student(email = "test", password = "test123", schoolSymbol = "23", endpoint = "fakelog.cf", loginType = "AUTO", isCurrent = true, studentName = "", schoolName = "", studentId = 0, classId = 1, symbol = "", registrationDate = now(), className = "")))
+ studentLocal.saveStudent(Student(email = "test", password = "test123", schoolSymbol = "23", endpoint = "fakelog.cf", loginType = "AUTO", isCurrent = true, studentName = "", schoolName = "", studentId = 0, classId = 1, symbol = "", registrationDate = now(), className = ""))
.blockingGet()
val student = studentLocal.getCurrentStudent(true).blockingGet()
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt
index eea5463d1..438e95f48 100644
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt
@@ -7,7 +7,7 @@ import org.threeten.bp.LocalDateTime.now
import io.github.wulkanowy.api.timetable.Timetable as TimetableRemote
import io.github.wulkanowy.data.db.entities.Timetable as TimetableLocal
-fun createTimetableLocal(number: Int, start: LocalDateTime, room: String = "", subject: String = "", teacher: String = ""): TimetableLocal {
+fun createTimetableLocal(number: Int, start: LocalDateTime, room: String = "", subject: String = ""): TimetableLocal {
return TimetableLocal(
studentId = 1,
diaryId = 2,
@@ -20,7 +20,7 @@ fun createTimetableLocal(number: Int, start: LocalDateTime, room: String = "", s
group = "",
room = room,
roomOld = "",
- teacher = teacher,
+ teacher = "",
teacherOld = "",
info = "",
changes = false,
@@ -28,7 +28,7 @@ fun createTimetableLocal(number: Int, start: LocalDateTime, room: String = "", s
)
}
-fun createTimetableRemote(number: Int, start: LocalDateTime, room: String, subject: String = "", teacher: String = ""): TimetableRemote {
+fun createTimetableRemote(number: Int, start: LocalDateTime, room: String, subject: String = ""): TimetableRemote {
return TimetableRemote(
number = number,
start = start.toDate(),
@@ -37,7 +37,7 @@ fun createTimetableRemote(number: Int, start: LocalDateTime, room: String, subje
subject = subject,
group = "",
room = room,
- teacher = teacher,
+ teacher = "",
info = "",
changes = false,
canceled = false
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt
index 79216d552..1c0802637 100644
--- a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt
@@ -63,27 +63,23 @@ class TimetableRepositoryTest {
fun copyDetailsToCompletedFromPrevious() {
timetableLocal.saveTimetable(listOf(
createTimetableLocal(1, of(2019, 3, 5, 8, 0), "123", "Przyroda"),
- createTimetableLocal(2, of(2019, 3, 5, 8, 50), "321", "Religia"),
- createTimetableLocal(3, of(2019, 3, 5, 9, 40), "213", "W-F"),
- createTimetableLocal(4, of(2019, 3, 5, 10, 30), "213", "W-F", "Jan Kowalski")
+ createTimetableLocal(1, of(2019, 3, 5, 8, 50), "321", "Religia"),
+ createTimetableLocal(1, of(2019, 3, 5, 9, 40), "213", "W-F")
))
every { mockApi.getTimetable(any(), any()) } returns Single.just(listOf(
createTimetableRemote(1, of(2019, 3, 5, 8, 0), "", "Przyroda"),
- createTimetableRemote(2, of(2019, 3, 5, 8, 50), "", "Religia"),
- createTimetableRemote(3, of(2019, 3, 5, 9, 40), "", "W-F"),
- createTimetableRemote(4, of(2019, 3, 5, 10, 30), "", "W-F")
+ createTimetableRemote(1, of(2019, 3, 5, 8, 50), "", "Religia"),
+ createTimetableRemote(1, of(2019, 3, 5, 9, 40), "", "W-F")
))
val lessons = TimetableRepository(settings, timetableLocal, timetableRemote)
.getTimetable(semesterMock, LocalDate.of(2019, 3, 5), LocalDate.of(2019, 3, 5), true)
.blockingGet()
- assertEquals(4, lessons.size)
+ assertEquals(3, lessons.size)
assertEquals("123", lessons[0].room)
assertEquals("321", lessons[1].room)
assertEquals("213", lessons[2].room)
-
- assertEquals("", lessons[3].teacher)
}
}
diff --git a/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt b/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
deleted file mode 100644
index be4c0ebeb..000000000
--- a/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-@file:Suppress("UNUSED_PARAMETER")
-
-package io.github.wulkanowy.utils
-
-import android.content.Context
-import timber.log.Timber
-
-fun initCrashlytics(context: Context, appInfo: AppInfo) {
- // do nothing
-}
-
-class CrashlyticsTree : Timber.Tree() {
-
- override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
- // do nothing
- }
-}
diff --git a/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt b/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
deleted file mode 100644
index 0b1274f15..000000000
--- a/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package io.github.wulkanowy.utils
-
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class FirebaseAnalyticsHelper @Inject constructor() {
-
- @Suppress("UNUSED_PARAMETER")
- fun logEvent(name: String, vararg params: Pair) {
- // do nothing
- }
-}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 65a140f2d..0c6edab46 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -34,7 +34,6 @@
android:name=".ui.modules.login.LoginActivity"
android:configChanges="orientation|screenSize"
android:label="@string/login_title"
- android:theme="@style/WulkanowyTheme.NoActionBar"
android:windowSoftInputMode="adjustResize" />
-
-
-
-
-
-
-
-
-
-
@@ -80,16 +61,6 @@
android:name="android.appwidget.provider"
android:resource="@xml/provider_widget_timetable" />
-
-
-
-
-
-
{
- return DaggerAppComponent.factory().create(this)
+ return DaggerAppComponent.builder().create(this)
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt b/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt
index 97da6bb8f..c832368a5 100644
--- a/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt
@@ -132,8 +132,4 @@ internal class RepositoryModule {
@Singleton
@Provides
fun provideRecipientDao(database: AppDatabase) = database.recipientDao
-
- @Singleton
- @Provides
- fun provideMobileDevicesDao(database: AppDatabase) = database.mobileDeviceDao
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/AppDatabase.kt b/app/src/main/java/io/github/wulkanowy/data/db/AppDatabase.kt
index a97a3042c..d867583e4 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/AppDatabase.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/AppDatabase.kt
@@ -16,7 +16,6 @@ import io.github.wulkanowy.data.db.dao.GradeSummaryDao
import io.github.wulkanowy.data.db.dao.HomeworkDao
import io.github.wulkanowy.data.db.dao.LuckyNumberDao
import io.github.wulkanowy.data.db.dao.MessagesDao
-import io.github.wulkanowy.data.db.dao.MobileDeviceDao
import io.github.wulkanowy.data.db.dao.NoteDao
import io.github.wulkanowy.data.db.dao.RecipientDao
import io.github.wulkanowy.data.db.dao.ReportingUnitDao
@@ -34,7 +33,6 @@ import io.github.wulkanowy.data.db.entities.GradeSummary
import io.github.wulkanowy.data.db.entities.Homework
import io.github.wulkanowy.data.db.entities.LuckyNumber
import io.github.wulkanowy.data.db.entities.Message
-import io.github.wulkanowy.data.db.entities.MobileDevice
import io.github.wulkanowy.data.db.entities.Note
import io.github.wulkanowy.data.db.entities.Recipient
import io.github.wulkanowy.data.db.entities.ReportingUnit
@@ -46,8 +44,6 @@ import io.github.wulkanowy.data.db.migrations.Migration10
import io.github.wulkanowy.data.db.migrations.Migration11
import io.github.wulkanowy.data.db.migrations.Migration12
import io.github.wulkanowy.data.db.migrations.Migration13
-import io.github.wulkanowy.data.db.migrations.Migration14
-import io.github.wulkanowy.data.db.migrations.Migration15
import io.github.wulkanowy.data.db.migrations.Migration2
import io.github.wulkanowy.data.db.migrations.Migration3
import io.github.wulkanowy.data.db.migrations.Migration4
@@ -77,8 +73,7 @@ import javax.inject.Singleton
LuckyNumber::class,
CompletedLesson::class,
ReportingUnit::class,
- Recipient::class,
- MobileDevice::class
+ Recipient::class
],
version = AppDatabase.VERSION_SCHEMA,
exportSchema = true
@@ -87,7 +82,7 @@ import javax.inject.Singleton
abstract class AppDatabase : RoomDatabase() {
companion object {
- const val VERSION_SCHEMA = 15
+ const val VERSION_SCHEMA = 13
fun newInstance(context: Context): AppDatabase {
return Room.databaseBuilder(context, AppDatabase::class.java, "wulkanowy_database")
@@ -106,9 +101,7 @@ abstract class AppDatabase : RoomDatabase() {
Migration10(),
Migration11(),
Migration12(),
- Migration13(),
- Migration14(),
- Migration15()
+ Migration13()
)
.build()
}
@@ -147,6 +140,4 @@ abstract class AppDatabase : RoomDatabase() {
abstract val reportingUnitDao: ReportingUnitDao
abstract val recipientDao: RecipientDao
-
- abstract val mobileDeviceDao: MobileDeviceDao
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefHelper.kt b/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefHelper.kt
index 74f9fa654..b3b6f5e3e 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefHelper.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefHelper.kt
@@ -6,16 +6,18 @@ import javax.inject.Inject
import javax.inject.Singleton
@Singleton
-@SuppressLint("ApplySharedPref")
class SharedPrefHelper @Inject constructor(private val sharedPref: SharedPreferences) {
+ @SuppressLint("ApplySharedPref")
fun putLong(key: String, value: Long, sync: Boolean = false) {
sharedPref.edit().putLong(key, value).apply {
if (sync) commit() else apply()
}
}
- fun getLong(key: String, defaultValue: Long) = sharedPref.getLong(key, defaultValue)
+ fun getLong(key: String, defaultValue: Long): Long {
+ return sharedPref.getLong(key, defaultValue)
+ }
fun delete(key: String) {
sharedPref.edit().remove(key).apply()
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/MessagesDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/MessagesDao.kt
index 4f72c6c91..3ef5d6905 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/MessagesDao.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/MessagesDao.kt
@@ -23,8 +23,8 @@ interface MessagesDao {
@Query("SELECT * FROM Messages WHERE student_id = :studentId AND folder_id = :folder AND removed = 0 ORDER BY date DESC")
fun loadAll(studentId: Int, folder: Int): Maybe>
- @Query("SELECT * FROM Messages WHERE id = :id")
- fun load(id: Long): Maybe
+ @Query("SELECT * FROM Messages WHERE student_id = :studentId AND real_id = :id")
+ fun load(studentId: Int, id: Int): Maybe
@Query("SELECT * FROM Messages WHERE student_id = :studentId AND removed = 1 ORDER BY date DESC")
fun loadDeleted(studentId: Int): Maybe>
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/MobileDeviceDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/MobileDeviceDao.kt
deleted file mode 100644
index d6b97f6ad..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/MobileDeviceDao.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Delete
-import androidx.room.Insert
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.MobileDevice
-import io.reactivex.Maybe
-
-@Dao
-interface MobileDeviceDao {
-
- @Insert
- fun insertAll(devices: List)
-
- @Delete
- fun deleteAll(devices: List)
-
- @Query("SELECT * FROM MobileDevices WHERE student_id = :studentId ORDER BY date DESC")
- fun loadAll(studentId: Int): Maybe>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt
index 57bf25fb8..8110bb696 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt
@@ -14,7 +14,7 @@ import javax.inject.Singleton
interface StudentDao {
@Insert(onConflict = ABORT)
- fun insertAll(student: List): List
+ fun insert(student: Student): Long
@Delete
fun delete(student: Student)
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSummary.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSummary.kt
index 6e29112b2..e6ac4926d 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSummary.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSummary.kt
@@ -13,26 +13,11 @@ data class GradeSummary(
@ColumnInfo(name = "student_id")
val studentId: Int,
- val position: Int,
-
val subject: String,
- @ColumnInfo(name = "predicted_grade")
val predictedGrade: String,
- @ColumnInfo(name = "final_grade")
- val finalGrade: String,
-
- @ColumnInfo(name = "proposed_points")
- val proposedPoints: String,
-
- @ColumnInfo(name = "final_points")
- val finalPoints: String,
-
- @ColumnInfo(name = "points_sum")
- val pointsSum: String,
-
- val average: Double
+ val finalGrade: String
) {
@PrimaryKey(autoGenerate = true)
var id: Long = 0
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/MobileDevice.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/MobileDevice.kt
deleted file mode 100644
index f67ed599f..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/MobileDevice.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import org.threeten.bp.LocalDateTime
-import java.io.Serializable
-
-@Entity(tableName = "MobileDevices")
-data class MobileDevice(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "device_id")
- val deviceId: Int,
-
- val name: String,
-
- val date: LocalDateTime
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration11.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration11.kt
index 6d129bca0..cb437c0ee 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration11.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration11.kt
@@ -8,7 +8,7 @@ class Migration11 : Migration(10, 11) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("""
CREATE TABLE IF NOT EXISTS Grades_temp (
- id INTEGER PRIMARY KEY NOT NULL,
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
is_read INTEGER NOT NULL,
is_notified INTEGER NOT NULL,
semester_id INTEGER NOT NULL,
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration14.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration14.kt
deleted file mode 100644
index 4dac0d306..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration14.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration14 : Migration(13, 14) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("DROP TABLE IF EXISTS GradesSummary")
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS GradesSummary (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- semester_id INTEGER NOT NULL,
- student_id INTEGER NOT NULL,
- position INTEGER NOT NULL,
- subject TEXT NOT NULL,
- predicted_grade TEXT NOT NULL,
- final_grade TEXT NOT NULL,
- proposed_points TEXT NOT NULL,
- final_points TEXT NOT NULL,
- points_sum TEXT NOT NULL,
- average REAL NOT NULL
- )
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration15.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration15.kt
deleted file mode 100644
index 5be49a95b..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration15.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration15 : Migration(14, 15) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS MobileDevices (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- student_id INTEGER NOT NULL,
- device_id INTEGER NOT NULL,
- name TEXT NOT NULL,
- date INTEGER NOT NULL
- )
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/pojos/MobileDeviceToken.kt b/app/src/main/java/io/github/wulkanowy/data/pojos/MobileDeviceToken.kt
deleted file mode 100644
index 401018211..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/pojos/MobileDeviceToken.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package io.github.wulkanowy.data.pojos
-
-data class MobileDeviceToken(
-
- val token: String,
-
- val symbol: String,
-
- val pin: String,
-
- val qr: String
-)
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
index 85102b3c5..f6eb07dae 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
@@ -6,7 +6,6 @@ import io.github.wulkanowy.data.db.entities.Attendance
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.utils.friday
import io.github.wulkanowy.utils.monday
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import org.threeten.bp.LocalDate
import java.net.UnknownHostException
@@ -32,8 +31,8 @@ class AttendanceRepository @Inject constructor(
local.getAttendance(semester, dates.first, dates.second)
.toSingle(emptyList())
.doOnSuccess { oldAttendance ->
- local.deleteAttendance(oldAttendance.uniqueSubtract(newAttendance))
- local.saveAttendance(newAttendance.uniqueSubtract(oldAttendance))
+ local.deleteAttendance(oldAttendance - newAttendance)
+ local.saveAttendance(newAttendance - oldAttendance)
}
}.flatMap {
local.getAttendance(semester, dates.first, dates.second)
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt
index c65870508..90d39aab2 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt
@@ -4,7 +4,6 @@ import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
import io.github.wulkanowy.data.db.entities.AttendanceSummary
import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import java.net.UnknownHostException
import javax.inject.Inject
@@ -26,8 +25,8 @@ class AttendanceSummaryRepository @Inject constructor(
}.flatMap { new ->
local.getAttendanceSummary(semester, subjectId).toSingle(emptyList())
.doOnSuccess { old ->
- local.deleteAttendanceSummary(old.uniqueSubtract(new))
- local.saveAttendanceSummary(new.uniqueSubtract(old))
+ local.deleteAttendanceSummary(old - new)
+ local.saveAttendanceSummary(new - old)
}
}.flatMap { local.getAttendanceSummary(semester, subjectId).toSingle(emptyList()) })
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
index c22fabc39..5b5941076 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
@@ -6,7 +6,6 @@ import io.github.wulkanowy.data.db.entities.CompletedLesson
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.utils.friday
import io.github.wulkanowy.utils.monday
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import org.threeten.bp.LocalDate
import java.net.UnknownHostException
@@ -32,8 +31,8 @@ class CompletedLessonsRepository @Inject constructor(
local.getCompletedLessons(semester, dates.first, dates.second)
.toSingle(emptyList())
.doOnSuccess { old ->
- local.deleteCompleteLessons(old.uniqueSubtract(new))
- local.saveCompletedLessons(new.uniqueSubtract(old))
+ local.deleteCompleteLessons(old - new)
+ local.saveCompletedLessons(new - old)
}
}.flatMap {
local.getCompletedLessons(semester, dates.first, dates.second)
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
index be60eaecd..a0cb5ba11 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
@@ -6,7 +6,6 @@ import io.github.wulkanowy.data.db.entities.Exam
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.utils.friday
import io.github.wulkanowy.utils.monday
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import org.threeten.bp.LocalDate
import java.net.UnknownHostException
@@ -28,12 +27,12 @@ class ExamRepository @Inject constructor(
.flatMap {
if (it) remote.getExams(semester, dates.first, dates.second)
else Single.error(UnknownHostException())
- }.flatMap { new ->
+ }.flatMap { newExams ->
local.getExams(semester, dates.first, dates.second)
.toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteExams(old.uniqueSubtract(new))
- local.saveExams(new.uniqueSubtract(old))
+ .doOnSuccess { oldExams ->
+ local.deleteExams(oldExams - newExams)
+ local.saveExams(newExams - oldExams)
}
}.flatMap {
local.getExams(semester, dates.first, dates.second)
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt
index 7f8e92a2e..3dd456bff 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt
@@ -5,7 +5,6 @@ import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.Inter
import io.github.wulkanowy.data.db.entities.Grade
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Completable
import io.reactivex.Single
import java.net.UnknownHostException
@@ -25,12 +24,13 @@ class GradeRepository @Inject constructor(
.flatMap {
if (it) remote.getGrades(semester)
else Single.error(UnknownHostException())
- }.flatMap { new ->
+ }.flatMap { newGrades ->
local.getGrades(semester).toSingle(emptyList())
- .doOnSuccess { old ->
- val notifyBreakDate = old.maxBy { it.date }?.date ?: student.registrationDate.toLocalDate()
- local.deleteGrades(old.uniqueSubtract(new))
- local.saveGrades(new.uniqueSubtract(old)
+ .doOnSuccess { oldGrades ->
+ val notifyBreakDate = oldGrades.maxBy { it.date }?.date
+ ?: student.registrationDate.toLocalDate()
+ local.deleteGrades(oldGrades - newGrades)
+ local.saveGrades((newGrades - oldGrades)
.onEach {
if (it.date >= notifyBreakDate) it.apply {
isRead = false
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/gradessummary/GradeSummaryRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/gradessummary/GradeSummaryRemote.kt
index 3335cfb02..d395decf8 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/gradessummary/GradeSummaryRemote.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/gradessummary/GradeSummaryRemote.kt
@@ -18,14 +18,9 @@ class GradeSummaryRemote @Inject constructor(private val api: Api) {
GradeSummary(
semesterId = semester.semesterId,
studentId = semester.studentId,
- position = it.order,
subject = it.name,
predictedGrade = it.predicted,
- finalGrade = it.final,
- pointsSum = it.pointsSum,
- proposedPoints = it.proposedPoints,
- finalPoints = it.finalPoints,
- average = it.average
+ finalGrade = it.final
)
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/gradessummary/GradeSummaryRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/gradessummary/GradeSummaryRepository.kt
index 660a032c2..b19e07f00 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/gradessummary/GradeSummaryRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/gradessummary/GradeSummaryRepository.kt
@@ -4,7 +4,6 @@ import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
import io.github.wulkanowy.data.db.entities.GradeSummary
import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import java.net.UnknownHostException
import javax.inject.Inject
@@ -23,11 +22,11 @@ class GradeSummaryRepository @Inject constructor(
.flatMap {
if (it) remote.getGradeSummary(semester)
else Single.error(UnknownHostException())
- }.flatMap { new ->
+ }.flatMap { newGradesSummary ->
local.getGradesSummary(semester).toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteGradesSummary(old.uniqueSubtract(new))
- local.saveGradesSummary(new.uniqueSubtract(old))
+ .doOnSuccess { oldGradesSummary ->
+ local.deleteGradesSummary(oldGradesSummary - newGradesSummary)
+ local.saveGradesSummary(newGradesSummary - oldGradesSummary)
}
}.flatMap { local.getGradesSummary(semester).toSingle(emptyList()) })
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRepository.kt
index 9617cdd64..870bd1e93 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRepository.kt
@@ -4,7 +4,6 @@ import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
import io.github.wulkanowy.data.db.entities.GradeStatistics
import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import java.net.UnknownHostException
import javax.inject.Inject
@@ -23,11 +22,11 @@ class GradeStatisticsRepository @Inject constructor(
.flatMap {
if (it) remote.getGradeStatistics(semester, isSemester)
else Single.error(UnknownHostException())
- }.flatMap { new ->
+ }.flatMap { newGradesStats ->
local.getGradesStatistics(semester, isSemester).toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteGradesStatistics(old.uniqueSubtract(new))
- local.saveGradesStatistics(new.uniqueSubtract(old))
+ .doOnSuccess { oldGradesStats ->
+ local.deleteGradesStatistics(oldGradesStats - newGradesStats)
+ local.saveGradesStatistics(newGradesStats - oldGradesStats)
}
}.flatMap { local.getGradesStatistics(semester, isSemester, subjectName).toSingle(emptyList()) })
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt
index 3f924944d..0447c86fe 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt
@@ -6,7 +6,6 @@ import io.github.wulkanowy.data.db.entities.Homework
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.utils.friday
import io.github.wulkanowy.utils.monday
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import org.threeten.bp.LocalDate
import java.net.UnknownHostException
@@ -27,11 +26,11 @@ class HomeworkRepository @Inject constructor(
.flatMap {
if (it) remote.getHomework(semester, monday, friday)
else Single.error(UnknownHostException())
- }.flatMap { new ->
+ }.flatMap { newGrades ->
local.getHomework(semester, monday, friday).toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteHomework(old.uniqueSubtract(new))
- local.saveHomework(new.uniqueSubtract(old))
+ .doOnSuccess { oldGrades ->
+ local.deleteHomework(oldGrades - newGrades)
+ local.saveHomework(newGrades - oldGrades)
}
}.flatMap { local.getHomework(semester, monday, friday).toSingle(emptyList()) })
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageLocal.kt
index ce08d13ec..411cca395 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageLocal.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageLocal.kt
@@ -23,8 +23,8 @@ class MessageLocal @Inject constructor(private val messagesDb: MessagesDao) {
messagesDb.deleteAll(messages)
}
- fun getMessage(id: Long): Maybe {
- return messagesDb.load(id)
+ fun getMessage(student: Student, id: Int): Maybe {
+ return messagesDb.load(student.id.toInt(), id)
}
fun getMessages(student: Student, folder: MessageFolder): Maybe> {
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRemote.kt
index b2bff1e77..d50c40f37 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRemote.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRemote.kt
@@ -59,8 +59,4 @@ class MessageRemote @Inject constructor(private val api: Api) {
}
)
}
-
- fun deleteMessage(message: Message): Single {
- return api.deleteMessages(listOf(Pair(message.realId, message.folderId)))
- }
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRepository.kt
index c10cd5181..3b4f9582f 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRepository.kt
@@ -8,9 +8,7 @@ import io.github.wulkanowy.data.db.entities.Message
import io.github.wulkanowy.data.db.entities.Recipient
import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.repositories.message.MessageFolder.RECEIVED
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Completable
-import io.reactivex.Maybe
import io.reactivex.Single
import java.net.UnknownHostException
import javax.inject.Inject
@@ -35,8 +33,8 @@ class MessageRepository @Inject constructor(
}.flatMap { new ->
local.getMessages(student, folder).toSingle(emptyList())
.doOnSuccess { old ->
- local.deleteMessages(old.uniqueSubtract(new))
- local.saveMessages(new.uniqueSubtract(old)
+ local.deleteMessages(old - new)
+ local.saveMessages((new - old)
.onEach {
it.isNotified = !notify
})
@@ -46,14 +44,14 @@ class MessageRepository @Inject constructor(
}
}
- fun getMessage(student: Student, messageDbId: Long, markAsRead: Boolean = false): Single {
+ fun getMessage(student: Student, messageId: Int, markAsRead: Boolean = false): Single {
return Single.just(apiHelper.initApi(student))
.flatMap { _ ->
- local.getMessage(messageDbId)
+ local.getMessage(student, messageId)
.filter { !it.content.isNullOrEmpty() }
.switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
.flatMap {
- if (it) local.getMessage(messageDbId).toSingle()
+ if (it) local.getMessage(student, messageId).toSingle()
else Single.error(UnknownHostException())
}
.flatMap { dbMessage ->
@@ -64,7 +62,7 @@ class MessageRepository @Inject constructor(
}))
}
}.flatMap {
- local.getMessage(messageDbId).toSingle()
+ local.getMessage(student, messageId).toSingle()
}
)
}
@@ -91,20 +89,4 @@ class MessageRepository @Inject constructor(
else Single.error(UnknownHostException())
}
}
-
- fun deleteMessage(message: Message): Maybe {
- return ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.deleteMessage(message)
- else Single.error(UnknownHostException())
- }
- .filter { it }
- .doOnSuccess {
- if (!message.removed) local.updateMessages(listOf(message.copy(removed = true).apply {
- id = message.id
- content = message.content
- }))
- else local.deleteMessages(listOf(message))
- }
- }
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceLocal.kt
deleted file mode 100644
index 8f0efa5b6..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceLocal.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.wulkanowy.data.repositories.mobiledevice
-
-import io.github.wulkanowy.data.db.dao.MobileDeviceDao
-import io.github.wulkanowy.data.db.entities.MobileDevice
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.reactivex.Maybe
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MobileDeviceLocal @Inject constructor(private val mobileDb: MobileDeviceDao) {
-
- fun saveDevices(devices: List) {
- mobileDb.insertAll(devices)
- }
-
- fun deleteDevices(devices: List) {
- mobileDb.deleteAll(devices)
- }
-
- fun getDevices(semester: Semester): Maybe> {
- return mobileDb.loadAll(semester.studentId).filter { it.isNotEmpty() }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRemote.kt
deleted file mode 100644
index 86fdce97a..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRemote.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package io.github.wulkanowy.data.repositories.mobiledevice
-
-import io.github.wulkanowy.api.Api
-import io.github.wulkanowy.data.db.entities.MobileDevice
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.pojos.MobileDeviceToken
-import io.github.wulkanowy.utils.toLocalDateTime
-import io.reactivex.Single
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MobileDeviceRemote @Inject constructor(private val api: Api) {
-
- fun getDevices(semester: Semester): Single> {
- return Single.just(api.apply { diaryId = semester.diaryId })
- .flatMap { api.getRegisteredDevices() }
- .map { devices ->
- devices.map {
- MobileDevice(
- studentId = semester.studentId,
- date = it.date.toLocalDateTime(),
- deviceId = it.id,
- name = it.name
- )
- }
- }
- }
-
- fun unregisterDevice(semester: Semester, device: MobileDevice): Single {
- return Single.just(api.apply { diaryId = semester.diaryId })
- .flatMap { api.unregisterDevice(device.deviceId) }
- }
-
- fun getToken(semester: Semester): Single {
- return Single.just(api.apply { diaryId = semester.diaryId })
- .flatMap { api.getToken() }
- .map {
- MobileDeviceToken(
- token = it.token,
- symbol = it.symbol,
- pin = it.pin,
- qr = it.qrCodeImage
- )
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRepository.kt
deleted file mode 100644
index ac450ff46..000000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRepository.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.github.wulkanowy.data.repositories.mobiledevice
-
-import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
-import io.github.wulkanowy.data.db.entities.MobileDevice
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.pojos.MobileDeviceToken
-import io.github.wulkanowy.utils.uniqueSubtract
-import io.reactivex.Single
-import java.net.UnknownHostException
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MobileDeviceRepository @Inject constructor(
- private val settings: InternetObservingSettings,
- private val local: MobileDeviceLocal,
- private val remote: MobileDeviceRemote
-) {
-
- fun getDevices(semester: Semester, forceRefresh: Boolean = false): Single> {
- return local.getDevices(semester).filter { !forceRefresh }
- .switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getDevices(semester)
- else Single.error(UnknownHostException())
- }.flatMap { new ->
- local.getDevices(semester).toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteDevices(old uniqueSubtract new)
- local.saveDevices(new uniqueSubtract old)
- }
- }
- ).flatMap { local.getDevices(semester).toSingle(emptyList()) }
- }
-
- fun unregisterDevice(semester: Semester, device: MobileDevice): Single {
- return ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.unregisterDevice(semester, device)
- else Single.error(UnknownHostException())
- }
- }
-
- fun getToken(semester: Semester): Single {
- return ReactiveNetwork.checkInternetConnectivity(settings)
- .flatMap {
- if (it) remote.getToken(semester)
- else Single.error(UnknownHostException())
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRepository.kt
index 52cb2d0f5..d74bc7eaf 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRepository.kt
@@ -5,7 +5,6 @@ import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.Inter
import io.github.wulkanowy.data.db.entities.Note
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Completable
import io.reactivex.Single
import java.net.UnknownHostException
@@ -28,8 +27,8 @@ class NoteRepository @Inject constructor(
}.flatMap { new ->
local.getNotes(student).toSingle(emptyList())
.doOnSuccess { old ->
- local.deleteNotes(old.uniqueSubtract(new))
- local.saveNotes(new.uniqueSubtract(old)
+ local.deleteNotes(old - new)
+ local.saveNotes((new - old)
.onEach {
if (it.date >= student.registrationDate.toLocalDate()) it.apply {
isRead = false
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt
index bb9a39b1c..d51fc4957 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt
@@ -17,18 +17,12 @@ class PreferencesRepository @Inject constructor(
val isShowPresent: Boolean
get() = sharedPref.getBoolean(context.getString(R.string.pref_key_attendance_present), true)
- val gradeAverageMode: String
- get() = sharedPref.getString(context.getString(R.string.pref_key_grade_average_mode), "only_one_semester") ?: "only_one_semester"
-
- val gradeAverageForceCalc: Boolean
- get() = sharedPref.getBoolean(context.getString(R.string.pref_key_grade_average_force_calc), false)
-
val isGradeExpandable: Boolean
get() = !sharedPref.getBoolean(context.getString(R.string.pref_key_expand_grade), false)
- val appThemeKey: String = context.getString(R.string.pref_key_app_theme)
- val appTheme: String
- get() = sharedPref.getString(appThemeKey, "light") ?: "light"
+ val currentThemeKey: String = context.getString(R.string.pref_key_theme)
+ val currentTheme: Int
+ get() = sharedPref.getString(currentThemeKey, "1")?.toIntOrNull() ?: 1
val gradeColorTheme: String
get() = sharedPref.getString(context.getString(R.string.pref_key_grade_color_scheme), "vulcan") ?: "vulcan"
@@ -43,7 +37,7 @@ class PreferencesRepository @Inject constructor(
val servicesOnlyWifiKey: String = context.getString(R.string.pref_key_services_wifi_only)
val isServicesOnlyWifi: Boolean
- get() = sharedPref.getBoolean(servicesOnlyWifiKey, false)
+ get() = sharedPref.getBoolean(servicesOnlyWifiKey, true)
val isNotificationsEnable: Boolean
get() = sharedPref.getBoolean(context.getString(R.string.pref_key_notifications_enable), true)
@@ -56,7 +50,8 @@ class PreferencesRepository @Inject constructor(
get() = sharedPref.getString(context.getString(R.string.pref_key_grade_modifier_plus), "0.0")?.toDouble() ?: 0.0
val gradeMinusModifier: Double
- get() = sharedPref.getString(context.getString(R.string.pref_key_grade_modifier_minus), "0.0")?.toDouble() ?: 0.0
+ get() = sharedPref.getString(context.getString(R.string.pref_key_grade_modifier_minus), "0.0")?.toDouble()
+ ?: 0.0
val fillMessageContent: Boolean
get() = sharedPref.getBoolean(context.getString(R.string.pref_key_fill_message_content), true)
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRepository.kt
index cde75ea8b..0b02721f1 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRepository.kt
@@ -7,7 +7,6 @@ import io.github.wulkanowy.data.db.entities.Message
import io.github.wulkanowy.data.db.entities.Recipient
import io.github.wulkanowy.data.db.entities.ReportingUnit
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import java.net.UnknownHostException
import javax.inject.Inject
@@ -32,8 +31,8 @@ class RecipientRepository @Inject constructor(
}.flatMap { new ->
local.getRecipients(student, role, unit).toSingle(emptyList())
.doOnSuccess { old ->
- local.deleteRecipients(old.uniqueSubtract(new))
- local.saveRecipients(new.uniqueSubtract(old))
+ local.deleteRecipients(old - new)
+ local.saveRecipients(new - old)
}
}.flatMap {
local.getRecipients(student, role, unit).toSingle(emptyList())
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRepository.kt
index 6758898e2..9184b4bb1 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRepository.kt
@@ -5,7 +5,6 @@ import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.Inter
import io.github.wulkanowy.data.ApiHelper
import io.github.wulkanowy.data.db.entities.ReportingUnit
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Maybe
import io.reactivex.Single
import java.net.UnknownHostException
@@ -31,8 +30,8 @@ class ReportingUnitRepository @Inject constructor(
}.flatMap { new ->
local.getReportingUnits(student).toSingle(emptyList())
.doOnSuccess { old ->
- local.deleteReportingUnits(old.uniqueSubtract(new))
- local.saveReportingUnits(new.uniqueSubtract(old))
+ local.deleteReportingUnits(old - new)
+ local.saveReportingUnits(new - old)
}
}.flatMap { local.getReportingUnits(student).toSingle(emptyList()) }
)
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRepository.kt
index 593014032..9735f0290 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRepository.kt
@@ -5,7 +5,6 @@ import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.Inter
import io.github.wulkanowy.data.ApiHelper
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Maybe
import io.reactivex.Single
import timber.log.Timber
@@ -32,8 +31,8 @@ class SemesterRepository @Inject constructor(
if (currentSemesters.size == 1) {
local.getSemesters(student).toSingle(emptyList())
.doOnSuccess { old ->
- local.deleteSemesters(old.uniqueSubtract(new))
- local.saveSemesters(new.uniqueSubtract(old))
+ local.deleteSemesters(old - new)
+ local.saveSemesters(new - old)
}
} else {
Timber.i("Current semesters list:\n${currentSemesters.joinToString(separator = "\n")}")
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentLocal.kt
index e6d744213..7bbd283fb 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentLocal.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentLocal.kt
@@ -17,8 +17,8 @@ class StudentLocal @Inject constructor(
private val context: Context
) {
- fun saveStudents(students: List): Single> {
- return Single.fromCallable { studentDb.insertAll(students.map { it.copy(password = encrypt(it.password, context)) }) }
+ fun saveStudent(student: Student): Single {
+ return Single.fromCallable { studentDb.insert(student.copy(password = encrypt(student.password, context))) }
}
fun getStudents(decryptPass: Boolean): Maybe> {
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRepository.kt
index 5c4a60558..b4b7c8289 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRepository.kt
@@ -22,8 +22,6 @@ class StudentRepository @Inject constructor(
fun isStudentSaved(): Single = local.getStudents(false).isEmpty.map { !it }
- fun isCurrentStudentSet(): Single = local.getCurrentStudent(false).isEmpty.map { !it }
-
fun getStudents(email: String, password: String, endpoint: String, symbol: String = ""): Single> {
return ReactiveNetwork.checkInternetConnectivity(settings)
.flatMap {
@@ -43,8 +41,8 @@ class StudentRepository @Inject constructor(
.toSingle()
}
- fun saveStudents(students: List): Single> {
- return local.saveStudents(students)
+ fun saveStudent(student: Student): Single {
+ return local.saveStudent(student)
}
fun switchStudent(student: Student): Completable {
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRepository.kt
index 0c5f386b6..6167251b9 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRepository.kt
@@ -4,7 +4,6 @@ import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Subject
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import java.net.UnknownHostException
import javax.inject.Inject
@@ -27,8 +26,8 @@ class SubjectRepository @Inject constructor(
local.getSubjects(semester)
.toSingle(emptyList())
.doOnSuccess { old ->
- local.deleteSubjects(old.uniqueSubtract(new))
- local.saveSubjects(new.uniqueSubtract(old))
+ local.deleteSubjects(old - new)
+ local.saveSubjects(new - old)
}
}.flatMap {
local.getSubjects(semester).toSingle(emptyList())
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt
index 0e6331f91..460d55fd7 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt
@@ -6,7 +6,6 @@ import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Timetable
import io.github.wulkanowy.utils.friday
import io.github.wulkanowy.utils.monday
-import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
import org.threeten.bp.LocalDate
import java.net.UnknownHostException
@@ -26,16 +25,17 @@ class TimetableRepository @Inject constructor(
.switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings).flatMap {
if (it) remote.getTimetable(semester, monday, friday)
else Single.error(UnknownHostException())
- }.flatMap { new ->
+ }.flatMap { newTimetable ->
local.getTimetable(semester, monday, friday)
.toSingle(emptyList())
- .doOnSuccess { old ->
- local.deleteTimetable(old.uniqueSubtract(new))
- local.saveTimetable(new.uniqueSubtract(old).map { item ->
+ .doOnSuccess { oldTimetable ->
+ local.deleteTimetable(oldTimetable - newTimetable)
+ local.saveTimetable((newTimetable - oldTimetable).map { item ->
item.apply {
- old.singleOrNull { this.start == it.start }?.let {
+ oldTimetable.singleOrNull { this.start == it.start }?.let {
return@map copy(
- room = if (room.isEmpty()) it.room else room
+ room = if (room.isEmpty()) it.room else room,
+ teacher = if (teacher.isEmpty()) it.teacher else teacher
)
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/di/AppComponent.kt b/app/src/main/java/io/github/wulkanowy/di/AppComponent.kt
index 3ac3a525b..9e8b24ab8 100644
--- a/app/src/main/java/io/github/wulkanowy/di/AppComponent.kt
+++ b/app/src/main/java/io/github/wulkanowy/di/AppComponent.kt
@@ -17,6 +17,6 @@ import javax.inject.Singleton
BuilderModule::class])
interface AppComponent : AndroidInjector {
- @Component.Factory
- interface Factory : AndroidInjector.Factory
+ @Component.Builder
+ abstract class Builder : AndroidInjector.Builder()
}
diff --git a/app/src/main/java/io/github/wulkanowy/di/AppModule.kt b/app/src/main/java/io/github/wulkanowy/di/AppModule.kt
index 42e50fa4e..eb3b18f99 100644
--- a/app/src/main/java/io/github/wulkanowy/di/AppModule.kt
+++ b/app/src/main/java/io/github/wulkanowy/di/AppModule.kt
@@ -2,13 +2,16 @@ package io.github.wulkanowy.di
import android.appwidget.AppWidgetManager
import android.content.Context
+import com.google.firebase.analytics.FirebaseAnalytics
import dagger.Module
import dagger.Provides
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
+import io.github.wulkanowy.BuildConfig.DEBUG
import io.github.wulkanowy.WulkanowyApp
-import io.github.wulkanowy.utils.AppInfo
+import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider
+import javax.inject.Named
import javax.inject.Singleton
@Module
@@ -27,9 +30,14 @@ internal class AppModule {
@Singleton
@Provides
- fun provideAppWidgetManager(context: Context): AppWidgetManager = AppWidgetManager.getInstance(context)
+ fun provideFirebaseAnalyticsHelper(context: Context) = FirebaseAnalyticsHelper(FirebaseAnalytics.getInstance(context))
@Singleton
@Provides
- fun provideAppInfo() = AppInfo()
+ fun provideAppWidgetManager(context: Context) = AppWidgetManager.getInstance(context)
+
+ @Singleton
+ @Named("isDebug")
+ @Provides
+ fun provideIsDebug() = DEBUG
}
diff --git a/app/src/main/java/io/github/wulkanowy/di/BuilderModule.kt b/app/src/main/java/io/github/wulkanowy/di/BuilderModule.kt
index a963e9a96..7f4776304 100644
--- a/app/src/main/java/io/github/wulkanowy/di/BuilderModule.kt
+++ b/app/src/main/java/io/github/wulkanowy/di/BuilderModule.kt
@@ -5,14 +5,11 @@ import dagger.android.ContributesAndroidInjector
import io.github.wulkanowy.di.scopes.PerActivity
import io.github.wulkanowy.ui.modules.login.LoginActivity
import io.github.wulkanowy.ui.modules.login.LoginModule
-import io.github.wulkanowy.ui.modules.luckynumberwidget.LuckyNumberWidgetConfigureActivity
import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainModule
import io.github.wulkanowy.ui.modules.message.send.SendMessageActivity
import io.github.wulkanowy.ui.modules.splash.SplashActivity
-import io.github.wulkanowy.ui.modules.luckynumberwidget.LuckyNumberWidgetProvider
-import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetConfigureActivity
-import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetProvider
+import io.github.wulkanowy.ui.widgets.timetable.TimetableWidgetProvider
@Module
internal abstract class BuilderModule {
@@ -32,15 +29,6 @@ internal abstract class BuilderModule {
@ContributesAndroidInjector
abstract fun bindMessageSendActivity(): SendMessageActivity
- @ContributesAndroidInjector
- abstract fun bindTimetableWidgetAccountActivity(): TimetableWidgetConfigureActivity
-
@ContributesAndroidInjector
abstract fun bindTimetableWidgetProvider(): TimetableWidgetProvider
-
- @ContributesAndroidInjector
- abstract fun bindLuckyNumberWidgetAccountActivity(): LuckyNumberWidgetConfigureActivity
-
- @ContributesAndroidInjector
- abstract fun bindLuckyNumberWidgetProvider(): LuckyNumberWidgetProvider
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt b/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt
index d85c75c30..c1820afb9 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt
@@ -6,50 +6,34 @@ import androidx.work.BackoffPolicy.EXPONENTIAL
import androidx.work.Constraints
import androidx.work.ExistingPeriodicWorkPolicy.KEEP
import androidx.work.ExistingPeriodicWorkPolicy.REPLACE
-import androidx.work.NetworkType.CONNECTED
+import androidx.work.NetworkType.METERED
import androidx.work.NetworkType.UNMETERED
import androidx.work.PeriodicWorkRequest
import androidx.work.WorkManager
-import io.github.wulkanowy.data.db.SharedPrefHelper
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.DebugChannel
import io.github.wulkanowy.services.sync.channels.NewEntriesChannel
-import io.github.wulkanowy.utils.AppInfo
import io.github.wulkanowy.utils.isHolidays
import org.threeten.bp.LocalDate.now
import timber.log.Timber
import java.util.concurrent.TimeUnit.MINUTES
import javax.inject.Inject
+import javax.inject.Named
import javax.inject.Singleton
@Singleton
class SyncManager @Inject constructor(
private val workManager: WorkManager,
private val preferencesRepository: PreferencesRepository,
- sharedPrefHelper: SharedPrefHelper,
newEntriesChannel: NewEntriesChannel,
debugChannel: DebugChannel,
- appInfo: AppInfo
+ @Named("isDebug") isDebug: Boolean
) {
- companion object {
-
- private const val APP_VERSION_CODE_KEY = "app_version_code"
- }
-
init {
+ if (SDK_INT >= O) newEntriesChannel.create()
+ if (SDK_INT >= O && isDebug) debugChannel.create()
if (now().isHolidays) stopSyncWorker()
-
- if (SDK_INT > O) {
- newEntriesChannel.create()
- if (appInfo.isDebug) debugChannel.create()
- }
-
- if (sharedPrefHelper.getLong(APP_VERSION_CODE_KEY, -1L) != appInfo.versionCode.toLong()) {
- startSyncWorker(true)
- sharedPrefHelper.putLong(APP_VERSION_CODE_KEY, appInfo.versionCode.toLong(), true)
- }
-
Timber.i("SyncManager was initialized")
}
@@ -59,7 +43,7 @@ class SyncManager @Inject constructor(
PeriodicWorkRequest.Builder(SyncWorker::class.java, preferencesRepository.servicesInterval, MINUTES, 10, MINUTES)
.setBackoffCriteria(EXPONENTIAL, 30, MINUTES)
.setConstraints(Constraints.Builder()
- .setRequiredNetworkType(if (preferencesRepository.isServicesOnlyWifi) UNMETERED else CONNECTED)
+ .setRequiredNetworkType(if (preferencesRepository.isServicesOnlyWifi) METERED else UNMETERED)
.build())
.build())
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt b/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt
index 6a4c4ca6d..134fb0344 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt
@@ -35,7 +35,7 @@ class SyncWorker @AssistedInject constructor(
override fun createWork(): Single {
Timber.i("SyncWorker is starting")
- return studentRepository.isCurrentStudentSet()
+ return studentRepository.isStudentSaved()
.filter { true }
.flatMap { studentRepository.getCurrentStudent().toMaybe() }
.flatMapCompletable { student ->
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeWork.kt
index 0c70b476f..66316934a 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeWork.kt
@@ -15,7 +15,7 @@ import io.github.wulkanowy.data.repositories.grade.GradeRepository
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewEntriesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity
-import io.github.wulkanowy.ui.modules.main.MainView.MenuView
+import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX
import io.github.wulkanowy.utils.getCompatColor
import io.reactivex.Completable
import javax.inject.Inject
@@ -47,8 +47,8 @@ class GradeWork @Inject constructor(
.setDefaults(DEFAULT_ALL)
.setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent(
- PendingIntent.getActivity(context, MenuView.GRADE.id,
- MainActivity.getStartIntent(context, MenuView.GRADE, true), FLAG_UPDATE_CURRENT))
+ PendingIntent.getActivity(context, 0,
+ MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 0), FLAG_UPDATE_CURRENT))
.setStyle(NotificationCompat.InboxStyle().run {
setSummaryText(context.resources.getQuantityString(R.plurals.grade_number_item, grades.size, grades.size))
grades.forEach { addLine("${it.subject}: ${it.entry}") }
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/LuckyNumberWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/LuckyNumberWork.kt
index ebd536b75..ca7aaac60 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/LuckyNumberWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/LuckyNumberWork.kt
@@ -15,7 +15,7 @@ import io.github.wulkanowy.data.repositories.luckynumber.LuckyNumberRepository
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewEntriesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity
-import io.github.wulkanowy.ui.modules.main.MainView.MenuView
+import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX
import io.github.wulkanowy.utils.getCompatColor
import io.reactivex.Completable
import javax.inject.Inject
@@ -47,8 +47,9 @@ class LuckyNumberWork @Inject constructor(
.setPriority(PRIORITY_HIGH)
.setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent(
- PendingIntent.getActivity(context, MenuView.MESSAGE.id,
- MainActivity.getStartIntent(context, MenuView.LUCKY_NUMBER, true), FLAG_UPDATE_CURRENT))
+ PendingIntent.getActivity(context, 0,
+ MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT)
+ )
.build())
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/MessageWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/MessageWork.kt
index d5016aeed..7ab2c8d4b 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/MessageWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/MessageWork.kt
@@ -16,7 +16,7 @@ import io.github.wulkanowy.data.repositories.message.MessageRepository
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewEntriesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity
-import io.github.wulkanowy.ui.modules.main.MainView.MenuView
+import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX
import io.github.wulkanowy.utils.getCompatColor
import io.reactivex.Completable
import javax.inject.Inject
@@ -48,8 +48,8 @@ class MessageWork @Inject constructor(
.setPriority(PRIORITY_HIGH)
.setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent(
- PendingIntent.getActivity(context, MenuView.MESSAGE.id,
- MainActivity.getStartIntent(context, MenuView.MESSAGE, true), FLAG_UPDATE_CURRENT)
+ PendingIntent.getActivity(context, 0,
+ MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT)
)
.setStyle(NotificationCompat.InboxStyle().run {
setSummaryText(context.resources.getQuantityString(R.plurals.message_number_item, messages.size, messages.size))
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt
index 86e540c43..d0e8fe21c 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt
@@ -15,7 +15,7 @@ import io.github.wulkanowy.data.repositories.note.NoteRepository
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewEntriesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity
-import io.github.wulkanowy.ui.modules.main.MainView.MenuView
+import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX
import io.github.wulkanowy.utils.getCompatColor
import io.reactivex.Completable
import javax.inject.Inject
@@ -47,8 +47,9 @@ class NoteWork @Inject constructor(
.setPriority(PRIORITY_HIGH)
.setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent(
- PendingIntent.getActivity(context, MenuView.NOTE.id,
- MainActivity.getStartIntent(context, MenuView.NOTE, true), FLAG_UPDATE_CURRENT))
+ PendingIntent.getActivity(context, 0,
+ MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT)
+ )
.setStyle(NotificationCompat.InboxStyle().run {
setSummaryText(context.resources.getQuantityString(R.plurals.note_number_item, notes.size, notes.size))
notes.forEach { addLine("${it.teacher}: ${it.category}") }
diff --git a/app/src/main/java/io/github/wulkanowy/services/widgets/TimetableWidgetService.kt b/app/src/main/java/io/github/wulkanowy/services/widgets/TimetableWidgetService.kt
index f3429457b..0432ee146 100644
--- a/app/src/main/java/io/github/wulkanowy/services/widgets/TimetableWidgetService.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/widgets/TimetableWidgetService.kt
@@ -7,7 +7,7 @@ import io.github.wulkanowy.data.db.SharedPrefHelper
import io.github.wulkanowy.data.repositories.semester.SemesterRepository
import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.data.repositories.timetable.TimetableRepository
-import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetFactory
+import io.github.wulkanowy.ui.widgets.timetable.TimetableWidgetFactory
import io.github.wulkanowy.utils.SchedulersProvider
import javax.inject.Inject
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/BaseActivity.kt b/app/src/main/java/io/github/wulkanowy/ui/base/BaseActivity.kt
index 0879aa3c4..f227dc19a 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/BaseActivity.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/BaseActivity.kt
@@ -1,82 +1,34 @@
package io.github.wulkanowy.ui.base
-import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
-import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
import android.os.Bundle
import android.view.View
-import android.widget.Toast
-import androidx.appcompat.app.AlertDialog
-import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
-import androidx.fragment.app.Fragment
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.snackbar.Snackbar.LENGTH_LONG
-import dagger.android.AndroidInjection
-import dagger.android.DispatchingAndroidInjector
-import dagger.android.support.HasSupportFragmentInjector
+import dagger.android.support.DaggerAppCompatActivity
import io.github.wulkanowy.R
-import io.github.wulkanowy.ui.modules.login.LoginActivity
-import io.github.wulkanowy.utils.FragmentLifecycleLogger
-import javax.inject.Inject
-abstract class BaseActivity> : AppCompatActivity(), BaseView,
- HasSupportFragmentInjector {
+abstract class BaseActivity : DaggerAppCompatActivity(), BaseView {
- @Inject
- lateinit var supportFragmentInjector: DispatchingAndroidInjector
-
- @Inject
- lateinit var fragmentLifecycleLogger: FragmentLifecycleLogger
-
- @Inject
- lateinit var themeManager: ThemeManager
-
- protected var messageContainer: View? = null
-
- abstract var presenter: T
+ protected lateinit var messageContainer: View
public override fun onCreate(savedInstanceState: Bundle?) {
- AndroidInjection.inject(this)
- themeManager.applyTheme(this)
super.onCreate(savedInstanceState)
- supportFragmentManager.registerFragmentLifecycleCallbacks(fragmentLifecycleLogger, true)
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
}
override fun showError(text: String, error: Throwable) {
- if (messageContainer != null) {
- Snackbar.make(messageContainer!!, text, LENGTH_LONG)
- .setAction(R.string.all_details) {
- ErrorDialog.newInstance(error).show(supportFragmentManager, error.toString())
- }
- .show()
- } else showMessage(text)
+ Snackbar.make(messageContainer, text, LENGTH_LONG).setAction(R.string.all_details) {
+ ErrorDialog.newInstance(error).show(supportFragmentManager, error.toString())
+ }.show()
}
override fun showMessage(text: String) {
- if (messageContainer != null) Snackbar.make(messageContainer!!, text, LENGTH_LONG).show()
- else Toast.makeText(this, text, Toast.LENGTH_LONG).show()
- }
-
- override fun showExpiredDialog() {
- AlertDialog.Builder(this)
- .setTitle(R.string.main_session_expired)
- .setMessage(R.string.main_session_relogin)
- .setPositiveButton(R.string.main_log_in) { _, _ -> presenter.onExpiredLoginSelected() }
- .setNegativeButton(android.R.string.cancel) { _, _ -> }
- .show()
- }
-
- override fun openClearLoginView() {
- startActivity(LoginActivity.getStartIntent(this)
- .apply { addFlags(FLAG_ACTIVITY_CLEAR_TASK or FLAG_ACTIVITY_NEW_TASK) })
+ Snackbar.make(messageContainer, text, LENGTH_LONG).show()
}
override fun onDestroy() {
super.onDestroy()
invalidateOptionsMenu()
- presenter.onDetachView()
}
-
- override fun supportFragmentInjector() = supportFragmentInjector
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/BaseFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/base/BaseFragment.kt
index 4b2ad053d..6e863c511 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/BaseFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/BaseFragment.kt
@@ -2,7 +2,6 @@ package io.github.wulkanowy.ui.base
import android.view.View
import com.google.android.material.snackbar.Snackbar
-import com.google.android.material.snackbar.Snackbar.LENGTH_LONG
import dagger.android.support.DaggerFragment
import io.github.wulkanowy.R
@@ -11,30 +10,16 @@ abstract class BaseFragment : DaggerFragment(), BaseView {
protected var messageContainer: View? = null
override fun showError(text: String, error: Throwable) {
- if (messageContainer != null) {
- Snackbar.make(messageContainer!!, text, LENGTH_LONG)
- .setAction(R.string.all_details) {
- if (isAdded) ErrorDialog.newInstance(error).show(childFragmentManager, error.toString())
- }
- .show()
- } else {
- (activity as? BaseActivity<*>)?.showError(text, error)
+ if (messageContainer == null) (activity as? BaseActivity)?.showError(text, error)
+ else messageContainer?.also {
+ Snackbar.make(it, text, Snackbar.LENGTH_LONG).setAction(R.string.all_details) {
+ ErrorDialog.newInstance(error).show(childFragmentManager, error.toString())
+ }.show()
}
}
override fun showMessage(text: String) {
- if (messageContainer != null) {
- Snackbar.make(messageContainer!!, text, LENGTH_LONG).show()
- } else {
- (activity as? BaseActivity<*>)?.showMessage(text)
- }
- }
-
- override fun showExpiredDialog() {
- (activity as? BaseActivity<*>)?.showExpiredDialog()
- }
-
- override fun openClearLoginView() {
- (activity as? BaseActivity<*>)?.openClearLoginView()
+ if (messageContainer == null) (activity as? BaseActivity)?.showMessage(text)
+ else messageContainer?.also { Snackbar.make(it, text, Snackbar.LENGTH_LONG).show() }
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt
index 9f0b4047c..c5a31958d 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt
@@ -1,16 +1,8 @@
package io.github.wulkanowy.ui.base
-import io.github.wulkanowy.data.repositories.student.StudentRepository
-import io.github.wulkanowy.utils.SchedulersProvider
-import io.reactivex.Completable
import io.reactivex.disposables.CompositeDisposable
-import timber.log.Timber
-open class BasePresenter(
- protected val errorHandler: ErrorHandler,
- protected val studentRepository: StudentRepository,
- protected val schedulers: SchedulersProvider
-) {
+open class BasePresenter(private val errorHandler: ErrorHandler) {
val disposable = CompositeDisposable()
@@ -18,33 +10,7 @@ open class BasePresenter(
open fun onAttachView(view: T) {
this.view = view
- errorHandler.apply {
- showErrorMessage = view::showError
- onSessionExpired = view::showExpiredDialog
- onNoCurrentStudent = view::openClearLoginView
- }
- }
-
- fun onExpiredLoginSelected() {
- Timber.i("Attempt to switch the student after the session expires")
- disposable.add(studentRepository.getCurrentStudent(false)
- .flatMapCompletable { studentRepository.logoutStudent(it) }
- .andThen(studentRepository.getSavedStudents(false))
- .flatMapCompletable {
- if (it.isNotEmpty()) {
- Timber.i("Switching current student")
- studentRepository.switchStudent(it[0])
- } else Completable.complete()
- }
- .subscribeOn(schedulers.backgroundThread)
- .observeOn(schedulers.mainThread)
- .subscribe({
- Timber.i("Switch student result: Open login view")
- view?.openClearLoginView()
- }, {
- Timber.i("Switch student result: An exception occurred")
- errorHandler.dispatch(it)
- }))
+ errorHandler.showErrorMessage = { text, error -> view.showError(text, error) }
}
open fun onDetachView() {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/BaseView.kt b/app/src/main/java/io/github/wulkanowy/ui/base/BaseView.kt
index 7681263b0..d2470fd17 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/BaseView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/BaseView.kt
@@ -5,8 +5,4 @@ interface BaseView {
fun showError(text: String, error: Throwable)
fun showMessage(text: String)
-
- fun showExpiredDialog()
-
- fun openClearLoginView()
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt
index 16e9a0480..83cbf0ef0 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt
@@ -5,10 +5,7 @@ import com.readystatesoftware.chuck.api.ChuckCollector
import io.github.wulkanowy.R
import io.github.wulkanowy.api.interceptor.FeatureDisabledException
import io.github.wulkanowy.api.interceptor.ServiceUnavailableException
-import io.github.wulkanowy.api.login.BadCredentialsException
import io.github.wulkanowy.api.login.NotLoggedInException
-import io.github.wulkanowy.data.exceptions.NoCurrentStudentException
-import io.github.wulkanowy.utils.security.ScramblerException
import timber.log.Timber
import java.net.SocketTimeoutException
import java.net.UnknownHostException
@@ -18,10 +15,6 @@ open class ErrorHandler @Inject constructor(protected val resources: Resources,
var showErrorMessage: (String, Throwable) -> Unit = { _, _ -> }
- var onSessionExpired: () -> Unit = {}
-
- var onNoCurrentStudent: () -> Unit = {}
-
fun dispatch(error: Throwable) {
chuckCollector.onError(error.javaClass.simpleName, error)
Timber.e(error, "An exception occurred while the Wulkanowy was running")
@@ -29,23 +22,17 @@ open class ErrorHandler @Inject constructor(protected val resources: Resources,
}
protected open fun proceed(error: Throwable) {
- resources.run {
- when (error) {
- is UnknownHostException -> showErrorMessage(getString(R.string.error_no_internet), error)
- is SocketTimeoutException -> showErrorMessage(getString(R.string.error_timeout), error)
- is NotLoggedInException -> showErrorMessage(getString(R.string.error_login_failed), error)
- is ServiceUnavailableException -> showErrorMessage(getString(R.string.error_service_unavailable), error)
- is FeatureDisabledException -> showErrorMessage(getString(R.string.error_feature_disabled), error)
- is ScramblerException, is BadCredentialsException -> onSessionExpired()
- is NoCurrentStudentException -> onNoCurrentStudent()
- else -> showErrorMessage(getString(R.string.error_unknown), error)
- }
- }
+ showErrorMessage((when (error) {
+ is UnknownHostException -> resources.getString(R.string.error_no_internet)
+ is SocketTimeoutException -> resources.getString(R.string.error_timeout)
+ is NotLoggedInException -> resources.getString(R.string.error_login_failed)
+ is ServiceUnavailableException -> resources.getString(R.string.error_service_unavailable)
+ is FeatureDisabledException -> resources.getString(R.string.error_feature_disabled)
+ else -> resources.getString(R.string.error_unknown)
+ }), error)
}
open fun clear() {
showErrorMessage = { _, _ -> }
- onSessionExpired = {}
- onNoCurrentStudent = {}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt
deleted file mode 100644
index 449f451be..000000000
--- a/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.github.wulkanowy.ui.base
-
-import android.content.pm.PackageManager.GET_ACTIVITIES
-import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO
-import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
-import io.github.wulkanowy.R
-import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
-import javax.inject.Inject
-
-class ThemeManager @Inject constructor(private val preferencesRepository: PreferencesRepository) {
-
- fun applyTheme(activity: AppCompatActivity) {
- if (isThemeApplicable(activity)) {
- activity.delegate.apply {
- when (preferencesRepository.appTheme) {
- "light" -> setLocalNightMode(MODE_NIGHT_NO)
- "dark" -> setLocalNightMode(MODE_NIGHT_YES)
- "black" -> {
- setLocalNightMode(MODE_NIGHT_YES)
- activity.setTheme(R.style.WulkanowyTheme_Black)
- }
- }
- }
- }
- }
-
- private fun isThemeApplicable(activity: AppCompatActivity): Boolean {
- return activity.packageManager.getPackageInfo(activity.packageName, GET_ACTIVITIES)
- .activities.singleOrNull { it.name == activity::class.java.canonicalName }?.theme
- .let { it == R.style.WulkanowyTheme_Black || it == R.style.WulkanowyTheme_NoActionBar }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionFragment.kt
new file mode 100644
index 000000000..110729d4f
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionFragment.kt
@@ -0,0 +1,21 @@
+package io.github.wulkanowy.ui.base.session
+
+import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
+import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
+import io.github.wulkanowy.ui.base.BaseFragment
+import io.github.wulkanowy.ui.modules.login.LoginActivity
+import io.github.wulkanowy.ui.modules.main.MainActivity
+
+open class BaseSessionFragment : BaseFragment(), BaseSessionView {
+
+ override fun showExpiredDialog() {
+ (activity as? MainActivity)?.showExpiredDialog()
+ }
+
+ override fun openLoginView() {
+ activity?.also {
+ startActivity(LoginActivity.getStartIntent(it)
+ .apply { addFlags(FLAG_ACTIVITY_CLEAR_TASK or FLAG_ACTIVITY_NEW_TASK) })
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionPresenter.kt
new file mode 100644
index 000000000..2c9f50ea9
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionPresenter.kt
@@ -0,0 +1,15 @@
+package io.github.wulkanowy.ui.base.session
+
+import io.github.wulkanowy.ui.base.BasePresenter
+
+open class BaseSessionPresenter(private val errorHandler: SessionErrorHandler) :
+ BasePresenter(errorHandler) {
+
+ override fun onAttachView(view: T) {
+ super.onAttachView(view)
+ errorHandler.apply {
+ onDecryptionFail = { view.showExpiredDialog() }
+ onNoCurrentStudent = { view.openLoginView() }
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionView.kt b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionView.kt
new file mode 100644
index 000000000..619c2863a
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/session/BaseSessionView.kt
@@ -0,0 +1,10 @@
+package io.github.wulkanowy.ui.base.session
+
+import io.github.wulkanowy.ui.base.BaseView
+
+interface BaseSessionView : BaseView {
+
+ fun showExpiredDialog()
+
+ fun openLoginView()
+}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/session/SessionErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/base/session/SessionErrorHandler.kt
new file mode 100644
index 000000000..017eabbab
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/session/SessionErrorHandler.kt
@@ -0,0 +1,32 @@
+package io.github.wulkanowy.ui.base.session
+
+import android.content.res.Resources
+import com.readystatesoftware.chuck.api.ChuckCollector
+import io.github.wulkanowy.data.exceptions.NoCurrentStudentException
+import io.github.wulkanowy.ui.base.ErrorHandler
+import io.github.wulkanowy.utils.security.ScramblerException
+import javax.inject.Inject
+
+open class SessionErrorHandler @Inject constructor(
+ resources: Resources,
+ chuckCollector: ChuckCollector
+) : ErrorHandler(resources, chuckCollector) {
+
+ var onDecryptionFail: () -> Unit = {}
+
+ var onNoCurrentStudent: () -> Unit = {}
+
+ override fun proceed(error: Throwable) {
+ when (error) {
+ is ScramblerException -> onDecryptionFail()
+ is NoCurrentStudentException -> onNoCurrentStudent()
+ else -> super.proceed(error)
+ }
+ }
+
+ override fun clear() {
+ super.clear()
+ onDecryptionFail = {}
+ onNoCurrentStudent = {}
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt
index 79373be98..52caf731e 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt
@@ -8,11 +8,10 @@ import android.view.View
import android.view.ViewGroup
import com.mikepenz.aboutlibraries.LibsBuilder
import com.mikepenz.aboutlibraries.LibsFragmentCompat
+import io.github.wulkanowy.BuildConfig
import io.github.wulkanowy.R
import io.github.wulkanowy.ui.base.BaseFragment
import io.github.wulkanowy.ui.modules.main.MainView
-import io.github.wulkanowy.utils.AppInfo
-import io.github.wulkanowy.utils.openInternetBrowser
import io.github.wulkanowy.utils.withOnExtraListener
import javax.inject.Inject
@@ -24,9 +23,6 @@ class AboutFragment : BaseFragment(), AboutView, MainView.TitledView {
@Inject
lateinit var fragmentCompat: LibsFragmentCompat
- @Inject
- lateinit var appInfo: AppInfo
-
companion object {
fun newInstance() = AboutFragment()
}
@@ -48,7 +44,7 @@ class AboutFragment : BaseFragment(), AboutView, MainView.TitledView {
.withFields(R.string::class.java.fields)
.withCheckCachedDetection(false)
.withExcludedLibraries("fastadapter", "AndroidIconics", "Jsoup", "Retrofit", "okio",
- "Butterknife", "CircleImageView")
+ "OkHttp", "Butterknife", "CircleImageView")
.withOnExtraListener { presenter.onExtraSelect(it) })
}.let {
fragmentCompat.onCreateView(inflater.context, inflater, container, savedInstanceState, it)
@@ -61,11 +57,11 @@ class AboutFragment : BaseFragment(), AboutView, MainView.TitledView {
}
override fun openDiscordInviteView() {
- context?.openInternetBrowser("https://discord.gg/vccAQBr", ::showMessage)
+ startActivity(Intent.parseUri("https://discord.gg/vccAQBr", 0))
}
override fun openHomepageWebView() {
- context?.openInternetBrowser("https://wulkanowy.github.io/", ::showMessage)
+ startActivity(Intent.parseUri("https://wulkanowy.github.io/", 0))
}
override fun openEmailClientView() {
@@ -74,9 +70,9 @@ class AboutFragment : BaseFragment(), AboutView, MainView.TitledView {
putExtra(Intent.EXTRA_EMAIL, Array(1) { "wulkanowyinc@gmail.com" })
putExtra(Intent.EXTRA_SUBJECT, "Zgłoszenie błędu")
putExtra(Intent.EXTRA_TEXT, "Tu umieść treść zgłoszenia\n\n" + "-".repeat(40) + "\n" + """
- Build: ${appInfo.versionCode}
- SDK: ${appInfo.systemVersion}
- Device: ${appInfo.systemManufacturer} ${appInfo.systemModel}
+ Build: ${BuildConfig.VERSION_CODE}
+ SDK: ${android.os.Build.VERSION.SDK_INT}
+ Device: ${android.os.Build.MANUFACTURER} ${android.os.Build.MODEL}
""".trimIndent())
}
@@ -84,7 +80,7 @@ class AboutFragment : BaseFragment(), AboutView, MainView.TitledView {
if (intent.resolveActivity(it.packageManager) != null) {
startActivity(Intent.createChooser(intent, getString(R.string.about_feedback)))
} else {
- it.openInternetBrowser("https://github.com/wulkanowy/wulkanowy/issues", ::showMessage)
+ startActivity(Intent.parseUri("https://github.com/wulkanowy/wulkanowy/issues", 0))
}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt
index 736bf0ce8..116dbef35 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt
@@ -4,24 +4,20 @@ import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL1
import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL2
import com.mikepenz.aboutlibraries.Libs.SpecialButton.SPECIAL3
-import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
-import io.github.wulkanowy.utils.SchedulersProvider
import timber.log.Timber
import javax.inject.Inject
class AboutPresenter @Inject constructor(
- schedulers: SchedulersProvider,
errorHandler: ErrorHandler,
- studentRepository: StudentRepository,
private val analytics: FirebaseAnalyticsHelper
-) : BasePresenter(errorHandler, studentRepository, schedulers) {
+) : BasePresenter(errorHandler) {
override fun onAttachView(view: AboutView) {
super.onAttachView(view)
- Timber.i("About view was initialized")
+ Timber.i("About view is attached")
}
fun onExtraSelect(type: Libs.SpecialButton?) {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountDialog.kt
index f23a1eb52..32458f276 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountDialog.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountDialog.kt
@@ -1,5 +1,7 @@
package io.github.wulkanowy.ui.modules.account
+import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
+import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@@ -12,8 +14,8 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R
-import io.github.wulkanowy.ui.base.BaseActivity
import io.github.wulkanowy.ui.modules.login.LoginActivity
+import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.utils.setOnItemClickListener
import kotlinx.android.synthetic.main.dialog_account.*
import javax.inject.Inject
@@ -72,17 +74,16 @@ class AccountDialog : DaggerAppCompatDialogFragment(), AccountView {
}
override fun openLoginView() {
- activity?.let {
+ activity?.also {
startActivity(LoginActivity.getStartIntent(it))
}
}
- override fun showExpiredDialog() {
- (activity as? BaseActivity<*>)?.showExpiredDialog()
- }
-
override fun openClearLoginView() {
- (activity as? BaseActivity<*>)?.openClearLoginView()
+ activity?.also {
+ startActivity(LoginActivity.getStartIntent(it)
+ .apply { addFlags(FLAG_ACTIVITY_CLEAR_TASK or FLAG_ACTIVITY_NEW_TASK) })
+ }
}
override fun showConfirmDialog() {
@@ -96,8 +97,11 @@ class AccountDialog : DaggerAppCompatDialogFragment(), AccountView {
}
}
- override fun recreateMainView() {
- activity?.recreate()
+ override fun recreateView() {
+ activity?.also {
+ startActivity(MainActivity.getStartIntent(it))
+ it.finish()
+ }
}
override fun onDestroy() {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt
index e9b4b81ee..0fc6cc45c 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt
@@ -11,16 +11,16 @@ import timber.log.Timber
import javax.inject.Inject
class AccountPresenter @Inject constructor(
- schedulers: SchedulersProvider,
- errorHandler: ErrorHandler,
- studentRepository: StudentRepository,
- private val syncManager: SyncManager
-) : BasePresenter(errorHandler, studentRepository, schedulers) {
+ private val errorHandler: ErrorHandler,
+ private val studentRepository: StudentRepository,
+ private val syncManager: SyncManager,
+ private val schedulers: SchedulersProvider
+) : BasePresenter(errorHandler) {
override fun onAttachView(view: AccountView) {
super.onAttachView(view)
+ Timber.i("Account dialog is attached")
view.initView()
- Timber.i("Account dialog view was initialized")
loadData()
}
@@ -54,7 +54,7 @@ class AccountPresenter @Inject constructor(
openClearLoginView()
} else {
Timber.i("Logout result: Switch to another student")
- recreateMainView()
+ recreateView()
}
}
}, {
@@ -73,10 +73,9 @@ class AccountPresenter @Inject constructor(
disposable.add(studentRepository.switchStudent(item.student)
.subscribeOn(schedulers.backgroundThread)
.observeOn(schedulers.mainThread)
- .doFinally { view?.dismissView() }
.subscribe({
Timber.i("Change a student result: Success")
- view?.recreateMainView()
+ view?.recreateView()
}, {
Timber.i("Change a student result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountView.kt
index ede5023ba..ca74998a1 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountView.kt
@@ -14,6 +14,8 @@ interface AccountView : BaseView {
fun openLoginView()
- fun recreateMainView()
+ fun openClearLoginView()
+
+ fun recreateView()
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt
index f3131098a..f0cab7f11 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt
@@ -13,7 +13,7 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.ui.base.BaseFragment
+import io.github.wulkanowy.ui.base.session.BaseSessionFragment
import io.github.wulkanowy.ui.modules.attendance.summary.AttendanceSummaryFragment
import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainView
@@ -21,7 +21,7 @@ import io.github.wulkanowy.utils.setOnItemClickListener
import kotlinx.android.synthetic.main.fragment_attendance.*
import javax.inject.Inject
-class AttendanceFragment : BaseFragment(), AttendanceView, MainView.MainChildView, MainView.TitledView {
+class AttendanceFragment : BaseSessionFragment(), AttendanceView, MainView.MainChildView, MainView.TitledView {
@Inject
lateinit var presenter: AttendancePresenter
@@ -77,12 +77,12 @@ class AttendanceFragment : BaseFragment(), AttendanceView, MainView.MainChildVie
attendanceNextButton.setOnClickListener { presenter.onNextDay() }
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- inflater.inflate(R.menu.action_menu_attendance, menu)
+ override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
+ inflater?.inflate(R.menu.action_menu_attendance, menu)
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- return if (item.itemId == R.id.attendanceMenuSummary) presenter.onSummarySwitchSelected()
+ override fun onOptionsItemSelected(item: MenuItem?): Boolean {
+ return if (item?.itemId == R.id.attendanceMenuSummary) presenter.onSummarySwitchSelected()
else false
}
@@ -103,7 +103,7 @@ class AttendanceFragment : BaseFragment(), AttendanceView, MainView.MainChildVie
}
override fun onFragmentReselected() {
- if (::presenter.isInitialized) presenter.onViewReselected()
+ presenter.onViewReselected()
}
override fun popView() {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
index 5e7333e19..ec471c16a 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
@@ -1,14 +1,20 @@
package io.github.wulkanowy.ui.modules.attendance
+import com.google.firebase.analytics.FirebaseAnalytics.Param.START_DATE
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.data.repositories.attendance.AttendanceRepository
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.data.repositories.semester.SemesterRepository
import io.github.wulkanowy.data.repositories.student.StudentRepository
-import io.github.wulkanowy.ui.base.BasePresenter
-import io.github.wulkanowy.ui.base.ErrorHandler
+import io.github.wulkanowy.ui.base.session.BaseSessionPresenter
+import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
-import io.github.wulkanowy.utils.*
+import io.github.wulkanowy.utils.SchedulersProvider
+import io.github.wulkanowy.utils.isHolidays
+import io.github.wulkanowy.utils.nextSchoolDay
+import io.github.wulkanowy.utils.previousOrSameSchoolDay
+import io.github.wulkanowy.utils.previousSchoolDay
+import io.github.wulkanowy.utils.toFormattedString
import org.threeten.bp.LocalDate
import org.threeten.bp.LocalDate.now
import org.threeten.bp.LocalDate.ofEpochDay
@@ -17,22 +23,22 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.inject.Inject
class AttendancePresenter @Inject constructor(
- schedulers: SchedulersProvider,
- errorHandler: ErrorHandler,
- studentRepository: StudentRepository,
+ private val errorHandler: SessionErrorHandler,
+ private val schedulers: SchedulersProvider,
private val attendanceRepository: AttendanceRepository,
+ private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository,
private val prefRepository: PreferencesRepository,
private val analytics: FirebaseAnalyticsHelper
-) : BasePresenter(errorHandler, studentRepository, schedulers) {
+) : BaseSessionPresenter(errorHandler) {
lateinit var currentDate: LocalDate
private set
fun onAttachView(view: AttendanceView, date: Long?) {
super.onAttachView(view)
+ Timber.i("Attendance view is attached")
view.initView()
- Timber.i("Attendance view was initialized")
loadData(ofEpochDay(date ?: now().previousOrSameSchoolDay.toEpochDay()))
reloadView()
}
@@ -109,7 +115,7 @@ class AttendancePresenter @Inject constructor(
showEmpty(it.isEmpty())
showContent(it.isNotEmpty())
}
- analytics.logEvent("load_attendance", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent("load_attendance", "items" to it.size, "force_refresh" to forceRefresh, START_DATE to currentDate.toFormattedString("yyyy-MM-dd"))
}) {
Timber.i("Loading attendance result: An exception occurred")
view?.run { showEmpty(isViewEmpty) }
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt
index 04fe94a48..ef3b874b6 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt
@@ -1,9 +1,9 @@
package io.github.wulkanowy.ui.modules.attendance
import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.ui.base.BaseView
+import io.github.wulkanowy.ui.base.session.BaseSessionView
-interface AttendanceView : BaseView {
+interface AttendanceView : BaseSessionView {
val isViewEmpty: Boolean
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt
index 1845bdda7..b8d2c9528 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt
@@ -13,13 +13,13 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R
-import io.github.wulkanowy.ui.base.BaseFragment
+import io.github.wulkanowy.ui.base.session.BaseSessionFragment
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.setOnItemSelectedListener
import kotlinx.android.synthetic.main.fragment_attendance_summary.*
import javax.inject.Inject
-class AttendanceSummaryFragment : BaseFragment(), AttendanceSummaryView, MainView.TitledView {
+class AttendanceSummaryFragment : BaseSessionFragment(), AttendanceSummaryView, MainView.TitledView {
@Inject
lateinit var presenter: AttendanceSummaryPresenter
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt
index dc6fe5b30..8b17f7437 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt
@@ -6,8 +6,8 @@ import io.github.wulkanowy.data.repositories.attendancesummary.AttendanceSummary
import io.github.wulkanowy.data.repositories.semester.SemesterRepository
import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.data.repositories.subject.SubjectRepository
-import io.github.wulkanowy.ui.base.BasePresenter
-import io.github.wulkanowy.ui.base.ErrorHandler
+import io.github.wulkanowy.ui.base.session.BaseSessionPresenter
+import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.calculatePercentage
@@ -19,14 +19,14 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.inject.Inject
class AttendanceSummaryPresenter @Inject constructor(
- schedulers: SchedulersProvider,
- errorHandler: ErrorHandler,
- studentRepository: StudentRepository,
+ private val errorHandler: SessionErrorHandler,
private val attendanceSummaryRepository: AttendanceSummaryRepository,
private val subjectRepository: SubjectRepository,
+ private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository,
+ private val schedulers: SchedulersProvider,
private val analytics: FirebaseAnalyticsHelper
-) : BasePresenter(errorHandler, studentRepository, schedulers) {
+) : BaseSessionPresenter(errorHandler) {
private var subjects = emptyList()
@@ -35,8 +35,8 @@ class AttendanceSummaryPresenter @Inject constructor(
fun onAttachView(view: AttendanceSummaryView, subjectId: Int?) {
super.onAttachView(view)
+ Timber.i("Attendance summary view is attached with subject id ${subjectId ?: -1}")
view.initView()
- Timber.i("Attendance summary view was initialized with subject id ${subjectId ?: -1}")
loadData(subjectId ?: -1)
loadSubjects()
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt
index 50f03e20a..e4c36db7b 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt
@@ -1,8 +1,8 @@
package io.github.wulkanowy.ui.modules.attendance.summary
-import io.github.wulkanowy.ui.base.BaseView
+import io.github.wulkanowy.ui.base.session.BaseSessionView
-interface AttendanceSummaryView : BaseView {
+interface AttendanceSummaryView : BaseSessionView {
val isViewEmpty: Boolean
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamFragment.kt
index 47f6d587b..97e97727f 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamFragment.kt
@@ -13,14 +13,14 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Exam
-import io.github.wulkanowy.ui.base.BaseFragment
+import io.github.wulkanowy.ui.base.session.BaseSessionFragment
import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.setOnItemClickListener
import kotlinx.android.synthetic.main.fragment_exam.*
import javax.inject.Inject
-class ExamFragment : BaseFragment(), ExamView, MainView.MainChildView, MainView.TitledView {
+class ExamFragment : BaseSessionFragment(), ExamView, MainView.MainChildView, MainView.TitledView {
@Inject
lateinit var presenter: ExamPresenter
@@ -88,7 +88,7 @@ class ExamFragment : BaseFragment(), ExamView, MainView.MainChildView, MainView.
}
override fun onFragmentReselected() {
- if (::presenter.isInitialized) presenter.onViewReselected()
+ presenter.onViewReselected()
}
override fun showEmpty(show: Boolean) {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt
index 4045a956f..4b6ef298b 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt
@@ -1,12 +1,13 @@
package io.github.wulkanowy.ui.modules.exam
+import com.google.firebase.analytics.FirebaseAnalytics.Param.START_DATE
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.data.db.entities.Exam
import io.github.wulkanowy.data.repositories.exam.ExamRepository
import io.github.wulkanowy.data.repositories.semester.SemesterRepository
import io.github.wulkanowy.data.repositories.student.StudentRepository
-import io.github.wulkanowy.ui.base.BasePresenter
-import io.github.wulkanowy.ui.base.ErrorHandler
+import io.github.wulkanowy.ui.base.session.BaseSessionPresenter
+import io.github.wulkanowy.ui.base.session.SessionErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.friday
@@ -22,21 +23,21 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.inject.Inject
class ExamPresenter @Inject constructor(
- schedulers: SchedulersProvider,
- errorHandler: ErrorHandler,
- studentRepository: StudentRepository,
+ private val errorHandler: SessionErrorHandler,
+ private val schedulers: SchedulersProvider,
private val examRepository: ExamRepository,
+ private val studentRepository: StudentRepository,
private val semesterRepository: SemesterRepository,
private val analytics: FirebaseAnalyticsHelper
-) : BasePresenter(errorHandler, studentRepository, schedulers) {
+) : BaseSessionPresenter(errorHandler) {
lateinit var currentDate: LocalDate
private set
fun onAttachView(view: ExamView, date: Long?) {
super.onAttachView(view)
+ Timber.i("Exam view is attached")
view.initView()
- Timber.i("Exam view was initialized")
loadData(ofEpochDay(date ?: now().nextOrSameSchoolDay.toEpochDay()))
reloadView()
}
@@ -101,7 +102,7 @@ class ExamPresenter @Inject constructor(
showEmpty(it.isEmpty())
showContent(it.isNotEmpty())
}
- analytics.logEvent("load_exam", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent("load_exam", "items" to it.size, "force_refresh" to forceRefresh, START_DATE to currentDate.toFormattedString("yyyy-MM-dd"))
}) {
Timber.i("Loading exam result: An exception occurred")
view?.run { showEmpty(isViewEmpty) }
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamView.kt
index 888cb05e5..2ced3f2d4 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamView.kt
@@ -1,9 +1,9 @@
package io.github.wulkanowy.ui.modules.exam
import io.github.wulkanowy.data.db.entities.Exam
-import io.github.wulkanowy.ui.base.BaseView
+import io.github.wulkanowy.ui.base.session.BaseSessionView
-interface ExamView : BaseView {
+interface ExamView : BaseSessionView {
val isViewEmpty: Boolean
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeAverageProvider.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeAverageProvider.kt
deleted file mode 100644
index 3f794ff1f..000000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeAverageProvider.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-package io.github.wulkanowy.ui.modules.grade
-
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.grade.GradeRepository
-import io.github.wulkanowy.data.repositories.gradessummary.GradeSummaryRepository
-import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
-import io.github.wulkanowy.utils.calcAverage
-import io.github.wulkanowy.utils.changeModifier
-import io.reactivex.Maybe
-import io.reactivex.Single
-import javax.inject.Inject
-
-class GradeAverageProvider @Inject constructor(
- private val preferencesRepository: PreferencesRepository,
- private val gradeRepository: GradeRepository,
- private val gradeSummaryRepository: GradeSummaryRepository
-) {
-
- fun getGradeAverage(student: Student, semesters: List, selectedSemesterId: Int, forceRefresh: Boolean): Single