mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-31 13:48:20 +01:00
Merge branch 'develop'
This commit is contained in:
commit
9a6d56ec77
7
.github/workflows/build-nightly-apk.yml
vendored
7
.github/workflows/build-nightly-apk.yml
vendored
@ -54,9 +54,8 @@ jobs:
|
|||||||
- name: Setup JDK 11
|
- name: Setup JDK 11
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
cache: 'gradle'
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v2
|
uses: android-actions/setup-android@v2
|
||||||
- name: Clean build artifacts
|
- name: Clean build artifacts
|
||||||
@ -65,7 +64,9 @@ jobs:
|
|||||||
rm -rf app/build/outputs/apk/*
|
rm -rf app/build/outputs/apk/*
|
||||||
rm -rf app/build/outputs/bundle/*
|
rm -rf app/build/outputs/bundle/*
|
||||||
- name: Assemble official release with Gradle
|
- name: Assemble official release with Gradle
|
||||||
run: ./gradlew assembleOfficialRelease
|
uses: gradle/gradle-build-action@v2
|
||||||
|
with:
|
||||||
|
arguments: assembleOfficialRelease
|
||||||
sign:
|
sign:
|
||||||
name: Sign APK
|
name: Sign APK
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
|
7
.github/workflows/build-release-aab-play.yml
vendored
7
.github/workflows/build-release-aab-play.yml
vendored
@ -46,9 +46,8 @@ jobs:
|
|||||||
- name: Setup JDK 11
|
- name: Setup JDK 11
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
cache: 'gradle'
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v2
|
uses: android-actions/setup-android@v2
|
||||||
- name: Clean build artifacts
|
- name: Clean build artifacts
|
||||||
@ -57,7 +56,9 @@ jobs:
|
|||||||
rm -rf app/build/outputs/apk/*
|
rm -rf app/build/outputs/apk/*
|
||||||
rm -rf app/build/outputs/bundle/*
|
rm -rf app/build/outputs/bundle/*
|
||||||
- name: Bundle play release with Gradle
|
- name: Bundle play release with Gradle
|
||||||
run: ./gradlew bundlePlayRelease
|
uses: gradle/gradle-build-action@v2
|
||||||
|
with:
|
||||||
|
arguments: bundlePlayRelease
|
||||||
sign:
|
sign:
|
||||||
name: Sign App Bundle
|
name: Sign App Bundle
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
|
7
.github/workflows/build-release-apk.yml
vendored
7
.github/workflows/build-release-apk.yml
vendored
@ -46,9 +46,8 @@ jobs:
|
|||||||
- name: Setup JDK 11
|
- name: Setup JDK 11
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
cache: 'gradle'
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v2
|
uses: android-actions/setup-android@v2
|
||||||
- name: Clean build artifacts
|
- name: Clean build artifacts
|
||||||
@ -57,7 +56,9 @@ jobs:
|
|||||||
rm -rf app/build/outputs/apk/*
|
rm -rf app/build/outputs/apk/*
|
||||||
rm -rf app/build/outputs/bundle/*
|
rm -rf app/build/outputs/bundle/*
|
||||||
- name: Assemble official release with Gradle
|
- name: Assemble official release with Gradle
|
||||||
run: ./gradlew assembleOfficialRelease
|
uses: gradle/gradle-build-action@v2
|
||||||
|
with:
|
||||||
|
arguments: assembleOfficialRelease
|
||||||
sign:
|
sign:
|
||||||
name: Sign APK
|
name: Sign APK
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
|
1
.idea/codeStyles/Project.xml
generated
1
.idea/codeStyles/Project.xml
generated
@ -1,6 +1,7 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
|
<option name="ALLOW_TRAILING_COMMA" value="true" />
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="XML">
|
<codeStyleSettings language="XML">
|
||||||
|
6
.idea/copyright/Antoni.xml
generated
Normal file
6
.idea/copyright/Antoni.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value="Copyright (c) Antoni Czaplicki &#36;{today.year}-&#36;{today.month}-&#36;{today.day}. " />
|
||||||
|
<option name="myName" value="Antoni" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
@ -31,6 +31,12 @@ android {
|
|||||||
cppFlags "-std=c++11"
|
cppFlags "-std=c++11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kapt {
|
||||||
|
arguments {
|
||||||
|
arg("room.schemaLocation", "$projectDir/schemas")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -50,7 +56,7 @@ android {
|
|||||||
flavorDimensions "platform"
|
flavorDimensions "platform"
|
||||||
productFlavors {
|
productFlavors {
|
||||||
main {
|
main {
|
||||||
versionName gitInfo.versionHuman
|
versionName "${release.versionName}-${gitInfo.versionSuffix}"
|
||||||
}
|
}
|
||||||
official {}
|
official {}
|
||||||
play {}
|
play {}
|
||||||
@ -126,7 +132,7 @@ dependencies {
|
|||||||
// Android Jetpack
|
// Android Jetpack
|
||||||
implementation "androidx.appcompat:appcompat:1.3.1"
|
implementation "androidx.appcompat:appcompat:1.3.1"
|
||||||
implementation "androidx.cardview:cardview:1.0.0"
|
implementation "androidx.cardview:cardview:1.0.0"
|
||||||
implementation "androidx.constraintlayout:constraintlayout:2.1.0"
|
implementation "androidx.constraintlayout:constraintlayout:2.1.1"
|
||||||
implementation "androidx.core:core-ktx:1.6.0"
|
implementation "androidx.core:core-ktx:1.6.0"
|
||||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
|
||||||
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
|
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
|
||||||
@ -137,12 +143,12 @@ dependencies {
|
|||||||
|
|
||||||
// Google design libs
|
// Google design libs
|
||||||
implementation "com.google.android.material:material:1.4.0"
|
implementation "com.google.android.material:material:1.4.0"
|
||||||
implementation "com.google.android:flexbox:2.0.1"
|
implementation "com.google.android.flexbox:flexbox:3.0.0"
|
||||||
|
|
||||||
// Play Services/Firebase
|
// Play Services/Firebase
|
||||||
implementation "com.google.android.gms:play-services-wearable:17.1.0"
|
implementation "com.google.android.gms:play-services-wearable:17.1.0"
|
||||||
implementation "com.google.firebase:firebase-core:19.0.1"
|
implementation "com.google.firebase:firebase-core:19.0.2"
|
||||||
implementation "com.google.firebase:firebase-crashlytics:18.2.1"
|
implementation "com.google.firebase:firebase-crashlytics:18.2.3"
|
||||||
implementation("com.google.firebase:firebase-messaging") { version { strictly "20.1.3" } }
|
implementation("com.google.firebase:firebase-messaging") { version { strictly "20.1.3" } }
|
||||||
|
|
||||||
// OkHttp, Retrofit, Gson, Jsoup
|
// OkHttp, Retrofit, Gson, Jsoup
|
||||||
@ -150,14 +156,14 @@ dependencies {
|
|||||||
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
||||||
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
||||||
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
|
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
implementation 'com.google.code.gson:gson:2.8.8'
|
||||||
implementation "org.jsoup:jsoup:1.13.1"
|
implementation 'org.jsoup:jsoup:1.14.3'
|
||||||
implementation "pl.droidsonroids:jspoon:1.3.2"
|
implementation "pl.droidsonroids:jspoon:1.3.2"
|
||||||
implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2"
|
implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2"
|
||||||
|
|
||||||
// Szkolny.eu libraries/forks
|
// Szkolny.eu libraries/forks
|
||||||
implementation "eu.szkolny:android-snowfall:1ca9ea2da3"
|
implementation "eu.szkolny:android-snowfall:1ca9ea2da3"
|
||||||
implementation "eu.szkolny:agendacalendarview:ac0f3dcf42"
|
implementation "eu.szkolny:agendacalendarview:1.0.4"
|
||||||
implementation "eu.szkolny:cafebar:5bf0c618de"
|
implementation "eu.szkolny:cafebar:5bf0c618de"
|
||||||
implementation "eu.szkolny.fslogin:lib:2.0.0"
|
implementation "eu.szkolny.fslogin:lib:2.0.0"
|
||||||
implementation "eu.szkolny:material-about-library:1d5ebaf47c"
|
implementation "eu.szkolny:material-about-library:1d5ebaf47c"
|
||||||
@ -172,33 +178,34 @@ dependencies {
|
|||||||
kapt "eu.szkolny.selective-dao:codegen:27f8f3f194"
|
kapt "eu.szkolny.selective-dao:codegen:27f8f3f194"
|
||||||
|
|
||||||
// Iconics & related
|
// Iconics & related
|
||||||
implementation "com.mikepenz:iconics-core:5.3.1"
|
implementation "com.mikepenz:iconics-core:5.3.2"
|
||||||
implementation "com.mikepenz:iconics-views:5.3.1"
|
implementation "com.mikepenz:iconics-views:5.3.2"
|
||||||
implementation "com.mikepenz:community-material-typeface:5.8.55.0-kotlin@aar"
|
implementation "com.mikepenz:community-material-typeface:5.8.55.0-kotlin@aar"
|
||||||
implementation "eu.szkolny:szkolny-font:77e33acc2a"
|
implementation "eu.szkolny:szkolny-font:77e33acc2a"
|
||||||
|
|
||||||
// Other dependencies
|
// Other dependencies
|
||||||
implementation "cat.ereza:customactivityoncrash:2.3.0"
|
implementation "cat.ereza:customactivityoncrash:2.3.0"
|
||||||
implementation "com.applandeo:material-calendar-view:1.5.0"
|
implementation "com.android.volley:volley:1.2.1"
|
||||||
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
|
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
|
||||||
implementation "com.github.antonKozyriatskyi:CircularProgressIndicator:1.2.2"
|
implementation "com.github.Applandeo:Material-Calendar-View:15de569cbc" // https://github.com/Applandeo/Material-Calendar-View
|
||||||
implementation "com.github.bassaer:chatmessageview:2.0.1"
|
implementation "com.github.CanHub:Android-Image-Cropper:2.2.2" // https://github.com/CanHub/Android-Image-Cropper
|
||||||
implementation "com.github.CanHub:Android-Image-Cropper:2.2.2"
|
implementation "com.github.ChuckerTeam.Chucker:library:3.0.1" // https://github.com/ChuckerTeam/chucker
|
||||||
implementation "com.github.ChuckerTeam.Chucker:library:3.0.1"
|
implementation "com.github.antonKozyriatskyi:CircularProgressIndicator:1.2.2" // https://github.com/antonKozyriatskyi/CircularProgressIndicator
|
||||||
implementation "com.github.wulkanowy.uonet-request-signer:hebe-jvm:a99ca50a31"
|
implementation "com.github.bassaer:chatmessageview:2.0.1" // https://github.com/bassaer/ChatMessageView
|
||||||
implementation("com.heinrichreimersoftware:material-intro") { version { strictly "1.5.8" } }
|
implementation "com.github.hypertrack:hyperlog-android:0.0.10" // https://github.com/hypertrack/hyperlog-android
|
||||||
implementation "com.hypertrack:hyperlog:0.0.10"
|
implementation "com.github.smuyyh:JsonViewer:V1.0.6" // https://github.com/smuyyh/JsonViewer
|
||||||
|
implementation "com.github.underwindfall.PowerPermission:powerpermission-coroutines:1.4.0" // https://github.com/underwindfall/PowerPermission
|
||||||
|
implementation "com.github.underwindfall.PowerPermission:powerpermission:1.4.0" // https://github.com/underwindfall/PowerPermission
|
||||||
|
implementation "com.github.wulkanowy.uonet-request-signer:hebe-jvm:a99ca50a31" // https://github.com/wulkanowy/uonet-request-signer
|
||||||
implementation "com.jaredrummler:colorpicker:1.1.0"
|
implementation "com.jaredrummler:colorpicker:1.1.0"
|
||||||
implementation "com.qifan.powerpermission:powerpermission-coroutines:1.3.0"
|
|
||||||
implementation "com.qifan.powerpermission:powerpermission:1.3.0"
|
|
||||||
implementation "com.yuyh.json:jsonviewer:1.0.6"
|
|
||||||
implementation "io.coil-kt:coil:1.1.1"
|
implementation "io.coil-kt:coil:1.1.1"
|
||||||
implementation "me.dm7.barcodescanner:zxing:1.9.8"
|
implementation "me.dm7.barcodescanner:zxing:1.9.8"
|
||||||
implementation "me.grantland:autofittextview:0.2.1"
|
implementation "me.grantland:autofittextview:0.2.1"
|
||||||
implementation "me.leolin:ShortcutBadger:1.1.22@aar"
|
implementation "me.leolin:ShortcutBadger:1.1.22@aar"
|
||||||
implementation "org.greenrobot:eventbus:3.2.0"
|
implementation "org.greenrobot:eventbus:3.2.0"
|
||||||
|
implementation("com.heinrichreimersoftware:material-intro") { version { strictly "1.5.8" } }
|
||||||
implementation("pl.droidsonroids.gif:android-gif-drawable") { version { strictly "1.2.15" } }
|
implementation("pl.droidsonroids.gif:android-gif-drawable") { version { strictly "1.2.15" } }
|
||||||
|
|
||||||
// Debug-only dependencies
|
// Debug-only dependencies
|
||||||
debugImplementation "com.amitshekhar.android:debug-db:1.0.5"
|
debugImplementation "com.github.amitshekhariitbhu.Android-Debug-Database:debug-db:v1.0.6"
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,6 @@ private def buildGitInfo() {
|
|||||||
def tag = getLastTag(repo, git, head)
|
def tag = getLastTag(repo, git, head)
|
||||||
def tagName = tag[1]
|
def tagName = tag[1]
|
||||||
def tagRevCount = tag[2]
|
def tagRevCount = tag[2]
|
||||||
def versionName = tagName.replace("v", "")
|
|
||||||
|
|
||||||
def result = [
|
def result = [
|
||||||
hash : head.objectId.name,
|
hash : head.objectId.name,
|
||||||
@ -108,7 +107,7 @@ private def buildGitInfo() {
|
|||||||
tag : tagName,
|
tag : tagName,
|
||||||
revCount : tagRevCount,
|
revCount : tagRevCount,
|
||||||
version : """$tagName-$tagRevCount-g${head.objectId.name.substring(0, 8)}""" + (dirty ? ".dirty" : ""),
|
version : """$tagName-$tagRevCount-g${head.objectId.name.substring(0, 8)}""" + (dirty ? ".dirty" : ""),
|
||||||
versionHuman: """$versionName-${repo.branch.replace("/", "_")}""" + (dirty ? ".dirty" : "")
|
versionSuffix : """${repo.branch.replace("/", "_")}""" + (dirty ? ".dirty" : "")
|
||||||
]
|
]
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
5
app/proguard-rules.pro
vendored
5
app/proguard-rules.pro
vendored
@ -25,7 +25,8 @@
|
|||||||
-keep class pl.szczodrzynski.edziennik.data.db.entity.Event { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.entity.Event { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.data.db.full.EventFull { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.full.EventFull { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.ui.modules.home.HomeCardModel { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.entity.Note { *; }
|
||||||
|
-keep class pl.szczodrzynski.edziennik.ui.home.HomeCardModel { *; }
|
||||||
-keepclassmembers class pl.szczodrzynski.edziennik.ui.widgets.WidgetConfig { public *; }
|
-keepclassmembers class pl.szczodrzynski.edziennik.ui.widgets.WidgetConfig { public *; }
|
||||||
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.timetable.WidgetTimetableProvider
|
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.timetable.WidgetTimetableProvider
|
||||||
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.notifications.WidgetNotificationsProvider
|
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.notifications.WidgetNotificationsProvider
|
||||||
@ -67,7 +68,7 @@
|
|||||||
|
|
||||||
-keepclassmembers class pl.szczodrzynski.edziennik.data.api.szkolny.request.** { *; }
|
-keepclassmembers class pl.szczodrzynski.edziennik.data.api.szkolny.request.** { *; }
|
||||||
-keepclassmembers class pl.szczodrzynski.edziennik.data.api.szkolny.response.** { *; }
|
-keepclassmembers class pl.szczodrzynski.edziennik.data.api.szkolny.response.** { *; }
|
||||||
-keepclassmembernames class pl.szczodrzynski.edziennik.ui.modules.login.LoginInfo$Platform { *; }
|
-keepclassmembernames class pl.szczodrzynski.edziennik.ui.login.LoginInfo$Platform { *; }
|
||||||
|
|
||||||
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData { *; }
|
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData { *; }
|
||||||
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData$Type { *; }
|
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData$Type { *; }
|
||||||
|
2293
app/schemas/pl.szczodrzynski.edziennik.data.db.AppDb/97.json
Normal file
2293
app/schemas/pl.szczodrzynski.edziennik.data.db.AppDb/97.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -121,32 +121,32 @@
|
|||||||
/ ____ \ (__| |_| |\ V /| | |_| | __/\__ \
|
/ ____ \ (__| |_| |\ V /| | |_| | __/\__ \
|
||||||
/_/ \_\___|\__|_| \_/ |_|\__|_|\___||___/
|
/_/ \_\___|\__|_| \_/ |_|\__|_|\___||___/
|
||||||
-->
|
-->
|
||||||
<activity android:name=".ui.modules.base.CrashActivity"
|
<activity android:name=".ui.base.CrashActivity"
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||||
android:process=":error_activity"
|
android:process=":error_activity"
|
||||||
android:theme="@style/DeadTheme" />
|
android:theme="@style/DeadTheme" />
|
||||||
<activity android:name=".ui.modules.intro.ChangelogIntroActivity"
|
<activity android:name=".ui.intro.ChangelogIntroActivity"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/Theme.Intro" />
|
android:theme="@style/Theme.Intro" />
|
||||||
<activity android:name=".ui.modules.login.LoginActivity"
|
<activity android:name=".ui.login.LoginActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/AppTheme.Light" />
|
android:theme="@style/AppTheme.Light" />
|
||||||
<activity android:name=".ui.modules.home.CounterActivity"
|
<activity android:name=".ui.home.CounterActivity"
|
||||||
android:theme="@style/AppTheme.Black" />
|
android:theme="@style/AppTheme.Black" />
|
||||||
<activity android:name=".ui.modules.feedback.FeedbackActivity"
|
<activity android:name=".ui.feedback.FeedbackActivity"
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" />
|
android:theme="@style/AppTheme" />
|
||||||
<activity android:name=".ui.modules.settings.SettingsLicenseActivity"
|
<activity android:name=".ui.settings.SettingsLicenseActivity"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:theme="@style/AppTheme" />
|
android:theme="@style/AppTheme" />
|
||||||
<activity android:name="com.canhub.cropper.CropImageActivity"
|
<activity android:name="com.canhub.cropper.CropImageActivity"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:theme="@style/Base.Theme.AppCompat" />
|
android:theme="@style/Base.Theme.AppCompat" />
|
||||||
<activity android:name=".ui.modules.base.BuildInvalidActivity" />
|
<activity android:name=".ui.base.BuildInvalidActivity" />
|
||||||
<activity android:name=".ui.modules.settings.contributors.ContributorsActivity" />
|
<activity android:name=".ui.settings.contributors.ContributorsActivity" />
|
||||||
|
|
||||||
<!-- _____ _
|
<!-- _____ _
|
||||||
| __ \ (_)
|
| __ \ (_)
|
||||||
|
@ -1,6 +1,21 @@
|
|||||||
<h3>Wersja 4.10, 2021-09-22</h3>
|
<h3>Wersja 4.11, 2021-11-01</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Dodano wyświetlanie informacji o frekwencji w planie lekcji. @Antoni-Czaplicki</li>
|
<li>Nowości w module Wiadomości:</li>
|
||||||
|
<li>→ <b>Formatowanie tekstu</b> przy wysyłaniu wiadomości oraz dodawaniu wydarzeń.</li>
|
||||||
|
<li>→ Zapisywanie <b>wersji roboczych</b> wiadomości, do późniejszej edycji i wysłania.</li>
|
||||||
|
<li>→ Możliwość <b>wyszukiwania zadań domowych</b>, podobnie jak wiadomości.</li>
|
||||||
|
<li>→ Dodawanie gwiazdki do wiadomości, w celu "przypięcia" na górę listy.</li>
|
||||||
|
<br>
|
||||||
|
<li>Opcja <b>dodawania notatek</b> do wydarzeń, ocen, lekcji, itp.</li>
|
||||||
|
<li>Możliwość udostępniania notatek w klasie, jako "ogłoszenia" widoczne na ekranie głównym.</li>
|
||||||
|
<br>
|
||||||
|
<li>Dodano <b>listę nauczycieli</b> w menu Więcej. @Antoni-Czaplicki</li>
|
||||||
|
<li>Logowanie: skaner kodów QR, uproszczone pole adresu w Mobidzienniku.</li>
|
||||||
|
<li>Naprawiono filtrowanie powiadomień.</li>
|
||||||
|
<li>Mobidziennik: dodano wyświetlanie lekcji z planów "pozalekcyjnych".</li>
|
||||||
|
<li>Mobidziennik: dodano pobieranie pełnej treści "informacji" w kalendarzu.</li>
|
||||||
|
<li>Mobidziennik: poprawiono wyświetlanie załączników oraz ich wielkości.</li>
|
||||||
|
<li>Dodano tajne funkcje. @Antoni-Czaplicki</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
/*secret password - removed for source code publication*/
|
/*secret password - removed for source code publication*/
|
||||||
static toys AES_IV[16] = {
|
static toys AES_IV[16] = {
|
||||||
0xda, 0x2a, 0x5f, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
0x17, 0xf8, 0xac, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||||
|
|
||||||
unsigned char *agony(unsigned int laugh, unsigned char *box, unsigned char *heat);
|
unsigned char *agony(unsigned int laugh, unsigned char *box, unsigned char *heat);
|
||||||
|
|
||||||
|
@ -35,13 +35,17 @@ import okhttp3.OkHttpClient
|
|||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import pl.szczodrzynski.edziennik.config.Config
|
import pl.szczodrzynski.edziennik.config.Config
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.ProfileListEmptyEvent
|
import pl.szczodrzynski.edziennik.data.api.events.ProfileListEmptyEvent
|
||||||
|
import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
|
||||||
import pl.szczodrzynski.edziennik.data.api.szkolny.interceptor.Signing
|
import pl.szczodrzynski.edziennik.data.api.szkolny.interceptor.Signing
|
||||||
import pl.szczodrzynski.edziennik.data.db.AppDb
|
import pl.szczodrzynski.edziennik.data.db.AppDb
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
||||||
|
import pl.szczodrzynski.edziennik.ext.DAY
|
||||||
|
import pl.szczodrzynski.edziennik.ext.MS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.setLanguage
|
||||||
import pl.szczodrzynski.edziennik.network.cookie.DumbCookieJar
|
import pl.szczodrzynski.edziennik.network.cookie.DumbCookieJar
|
||||||
import pl.szczodrzynski.edziennik.sync.SyncWorker
|
import pl.szczodrzynski.edziennik.sync.SyncWorker
|
||||||
import pl.szczodrzynski.edziennik.sync.UpdateWorker
|
import pl.szczodrzynski.edziennik.sync.UpdateWorker
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.base.CrashActivity
|
import pl.szczodrzynski.edziennik.ui.base.CrashActivity
|
||||||
import pl.szczodrzynski.edziennik.utils.*
|
import pl.szczodrzynski.edziennik.utils.*
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import pl.szczodrzynski.edziennik.utils.managers.*
|
import pl.szczodrzynski.edziennik.utils.managers.*
|
||||||
@ -63,6 +67,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
var devMode = false
|
var devMode = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val api by lazy { SzkolnyApi(this) }
|
||||||
val notificationChannelsManager by lazy { NotificationChannelsManager(this) }
|
val notificationChannelsManager by lazy { NotificationChannelsManager(this) }
|
||||||
val userActionManager by lazy { UserActionManager(this) }
|
val userActionManager by lazy { UserActionManager(this) }
|
||||||
val gradesManager by lazy { GradesManager(this) }
|
val gradesManager by lazy { GradesManager(this) }
|
||||||
@ -72,6 +77,9 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
val attendanceManager by lazy { AttendanceManager(this) }
|
val attendanceManager by lazy { AttendanceManager(this) }
|
||||||
val buildManager by lazy { BuildManager(this) }
|
val buildManager by lazy { BuildManager(this) }
|
||||||
val availabilityManager by lazy { AvailabilityManager(this) }
|
val availabilityManager by lazy { AvailabilityManager(this) }
|
||||||
|
val textStylingManager by lazy { TextStylingManager(this) }
|
||||||
|
val messageManager by lazy { MessageManager(this) }
|
||||||
|
val noteManager by lazy { NoteManager(this) }
|
||||||
|
|
||||||
val db
|
val db
|
||||||
get() = App.db
|
get() = App.db
|
||||||
|
@ -4,8 +4,11 @@
|
|||||||
package pl.szczodrzynski.edziennik
|
package pl.szczodrzynski.edziennik
|
||||||
|
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import androidx.databinding.BindingAdapter
|
import androidx.databinding.BindingAdapter
|
||||||
|
import pl.szczodrzynski.edziennik.ext.dp
|
||||||
|
|
||||||
object Binding {
|
object Binding {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@ -17,4 +20,64 @@ object Binding {
|
|||||||
textView.paintFlags = textView.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
textView.paintFlags = textView.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@BindingAdapter("android:isVisible")
|
||||||
|
fun isVisible(view: View, isVisible: Boolean) {
|
||||||
|
view.isVisible = isVisible
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun resizeDrawable(textView: TextView, index: Int, size: Int) {
|
||||||
|
val drawables = textView.compoundDrawables
|
||||||
|
drawables[index]?.setBounds(0, 0, size, size)
|
||||||
|
textView.setCompoundDrawables(drawables[0], drawables[1], drawables[2], drawables[3])
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@BindingAdapter("android:drawableLeftAutoSize")
|
||||||
|
fun drawableLeftAutoSize(textView: TextView, enable: Boolean) = resizeDrawable(
|
||||||
|
textView,
|
||||||
|
index = 0,
|
||||||
|
size = textView.textSize.toInt(),
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@BindingAdapter("android:drawableRightAutoSize")
|
||||||
|
fun drawableRightAutoSize(textView: TextView, enable: Boolean) = resizeDrawable(
|
||||||
|
textView,
|
||||||
|
index = 2,
|
||||||
|
size = textView.textSize.toInt(),
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@BindingAdapter("android:drawableLeftSize")
|
||||||
|
fun drawableLeftSize(textView: TextView, sizeDp: Int) = resizeDrawable(
|
||||||
|
textView,
|
||||||
|
index = 0,
|
||||||
|
size = sizeDp.dp,
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@BindingAdapter("android:drawableTopSize")
|
||||||
|
fun drawableTopSize(textView: TextView, sizeDp: Int) = resizeDrawable(
|
||||||
|
textView,
|
||||||
|
index = 1,
|
||||||
|
size = sizeDp.dp,
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@BindingAdapter("android:drawableRightSize")
|
||||||
|
fun drawableRightSize(textView: TextView, sizeDp: Int) = resizeDrawable(
|
||||||
|
textView,
|
||||||
|
index = 2,
|
||||||
|
size = sizeDp.dp,
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@BindingAdapter("android:drawableBottomSize")
|
||||||
|
fun drawableBottomSize(textView: TextView, sizeDp: Int) = resizeDrawable(
|
||||||
|
textView,
|
||||||
|
index = 3,
|
||||||
|
size = sizeDp.dp,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@ import android.provider.OpenableColumns
|
|||||||
import com.canhub.cropper.CropImage
|
import com.canhub.cropper.CropImage
|
||||||
import com.canhub.cropper.CropImageView
|
import com.canhub.cropper.CropImageView
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity
|
import pl.szczodrzynski.edziennik.ui.login.LoginActivity
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ import kotlin.coroutines.CoroutineContext
|
|||||||
|
|
||||||
class ProfileConfig(val db: AppDb, val profileId: Int, rawEntries: List<ConfigEntry>) : CoroutineScope, AbstractConfig {
|
class ProfileConfig(val db: AppDb, val profileId: Int, rawEntries: List<ConfigEntry>) : CoroutineScope, AbstractConfig {
|
||||||
companion object {
|
companion object {
|
||||||
const val DATA_VERSION = 2
|
const val DATA_VERSION = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
private val job = Job()
|
private val job = Job()
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.config
|
package pl.szczodrzynski.edziennik.config
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.config.utils.get
|
import pl.szczodrzynski.edziennik.config.utils.getIntList
|
||||||
import pl.szczodrzynski.edziennik.config.utils.set
|
import pl.szczodrzynski.edziennik.config.utils.set
|
||||||
|
|
||||||
class ProfileConfigSync(private val config: ProfileConfig) {
|
class ProfileConfigSync(private val config: ProfileConfig) {
|
||||||
private var mNotificationFilter: List<Int>? = null
|
private var mNotificationFilter: List<Int>? = null
|
||||||
var notificationFilter: List<Int>
|
var notificationFilter: List<Int>
|
||||||
get() { mNotificationFilter = mNotificationFilter ?: config.values.get("notificationFilter", listOf()); return mNotificationFilter ?: listOf() }
|
get() { mNotificationFilter = mNotificationFilter ?: config.values.getIntList("notificationFilter", listOf()); return mNotificationFilter ?: listOf() }
|
||||||
set(value) { config.set("notificationFilter", value); mNotificationFilter = value }
|
set(value) { config.set("notificationFilter", value); mNotificationFilter = value }
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ package pl.szczodrzynski.edziennik.config
|
|||||||
import pl.szczodrzynski.edziennik.config.utils.get
|
import pl.szczodrzynski.edziennik.config.utils.get
|
||||||
import pl.szczodrzynski.edziennik.config.utils.set
|
import pl.szczodrzynski.edziennik.config.utils.set
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile.Companion.AGENDA_DEFAULT
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile.Companion.AGENDA_DEFAULT
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardModel
|
import pl.szczodrzynski.edziennik.ui.home.HomeCardModel
|
||||||
|
|
||||||
class ProfileConfigUI(private val config: ProfileConfig) {
|
class ProfileConfigUI(private val config: ProfileConfig) {
|
||||||
private var mAgendaViewType: Int? = null
|
private var mAgendaViewType: Int? = null
|
||||||
|
@ -5,13 +5,14 @@ package pl.szczodrzynski.edziennik.config.utils
|
|||||||
|
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.JsonParser
|
import com.google.gson.JsonParser
|
||||||
import pl.szczodrzynski.edziennik.getInt
|
import pl.szczodrzynski.edziennik.ext.getInt
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeCardModel
|
import pl.szczodrzynski.edziennik.ui.home.HomeCardModel
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
|
|
||||||
class ConfigGsonUtils {
|
class ConfigGsonUtils {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun <T> deserializeList(gson: Gson, str: String?, classOfT: Class<T>): List<T> {
|
fun <T> deserializeList(gson: Gson, str: String?, classOfT: Class<T>): List<T> {
|
||||||
val json = JsonParser().parse(str)
|
val json = JsonParser.parseString(str)
|
||||||
val list: MutableList<T> = mutableListOf()
|
val list: MutableList<T> = mutableListOf()
|
||||||
if (!json.isJsonArray)
|
if (!json.isJsonArray)
|
||||||
return list
|
return list
|
||||||
|
@ -7,9 +7,9 @@ package pl.szczodrzynski.edziennik.config.utils
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.BuildConfig
|
import pl.szczodrzynski.edziennik.BuildConfig
|
||||||
import pl.szczodrzynski.edziennik.HOUR
|
|
||||||
import pl.szczodrzynski.edziennik.MainActivity
|
import pl.szczodrzynski.edziennik.MainActivity
|
||||||
import pl.szczodrzynski.edziennik.config.Config
|
import pl.szczodrzynski.edziennik.config.Config
|
||||||
|
import pl.szczodrzynski.edziennik.ext.HOUR
|
||||||
import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.ORDER_BY_DATE_DESC
|
import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.ORDER_BY_DATE_DESC
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
@ -42,7 +42,7 @@ class ConfigMigration(app: App, config: Config) {
|
|||||||
MainActivity.DRAWER_ITEM_SETTINGS
|
MainActivity.DRAWER_ITEM_SETTINGS
|
||||||
)
|
)
|
||||||
sync.enabled = true
|
sync.enabled = true
|
||||||
sync.interval = 1*HOUR.toInt()
|
sync.interval = 1* HOUR.toInt()
|
||||||
sync.notifyAboutUpdates = true
|
sync.notifyAboutUpdates = true
|
||||||
sync.onlyWifi = false
|
sync.onlyWifi = false
|
||||||
sync.quietHoursEnabled = false
|
sync.quietHoursEnabled = false
|
||||||
|
@ -7,6 +7,8 @@ package pl.szczodrzynski.edziennik.config.utils
|
|||||||
import pl.szczodrzynski.edziennik.config.ProfileConfig
|
import pl.szczodrzynski.edziennik.config.ProfileConfig
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Notification
|
import pl.szczodrzynski.edziennik.data.db.entity.Notification
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile.Companion.AGENDA_DEFAULT
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile.Companion.AGENDA_DEFAULT
|
||||||
|
import pl.szczodrzynski.edziennik.ui.home.HomeCard
|
||||||
|
import pl.szczodrzynski.edziennik.ui.home.HomeCardModel
|
||||||
import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.COLOR_MODE_WEIGHTED
|
import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.COLOR_MODE_WEIGHTED
|
||||||
import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.YEAR_ALL_GRADES
|
import pl.szczodrzynski.edziennik.utils.managers.GradesManager.Companion.YEAR_ALL_GRADES
|
||||||
|
|
||||||
@ -33,5 +35,15 @@ class ProfileConfigMigration(config: ProfileConfig) {
|
|||||||
|
|
||||||
dataVersion = 2
|
dataVersion = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dataVersion < 3) {
|
||||||
|
if (ui.homeCards.isNotEmpty()) {
|
||||||
|
ui.homeCards = ui.homeCards.toMutableList().also {
|
||||||
|
it.add(HomeCardModel(config.profileId, HomeCard.CARD_NOTES))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dataVersion = 3
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import pl.szczodrzynski.edziennik.data.api.task.ErrorReportTask
|
|||||||
import pl.szczodrzynski.edziennik.data.api.task.IApiTask
|
import pl.szczodrzynski.edziennik.data.api.task.IApiTask
|
||||||
import pl.szczodrzynski.edziennik.data.api.task.SzkolnyTask
|
import pl.szczodrzynski.edziennik.data.api.task.SzkolnyTask
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
||||||
import pl.szczodrzynski.edziennik.toApiError
|
import pl.szczodrzynski.edziennik.ext.toApiError
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
@ -109,6 +109,7 @@ const val VULCAN_HEBE_ENDPOINT_PUSH_ALL = "api/mobile/push/all"
|
|||||||
const val VULCAN_HEBE_ENDPOINT_TIMETABLE = "api/mobile/schedule"
|
const val VULCAN_HEBE_ENDPOINT_TIMETABLE = "api/mobile/schedule"
|
||||||
const val VULCAN_HEBE_ENDPOINT_TIMETABLE_CHANGES = "api/mobile/schedule/changes"
|
const val VULCAN_HEBE_ENDPOINT_TIMETABLE_CHANGES = "api/mobile/schedule/changes"
|
||||||
const val VULCAN_HEBE_ENDPOINT_ADDRESSBOOK = "api/mobile/addressbook"
|
const val VULCAN_HEBE_ENDPOINT_ADDRESSBOOK = "api/mobile/addressbook"
|
||||||
|
const val VULCAN_HEBE_ENDPOINT_TEACHERS = "api/mobile/teacher"
|
||||||
const val VULCAN_HEBE_ENDPOINT_EXAMS = "api/mobile/exam"
|
const val VULCAN_HEBE_ENDPOINT_EXAMS = "api/mobile/exam"
|
||||||
const val VULCAN_HEBE_ENDPOINT_GRADES = "api/mobile/grade"
|
const val VULCAN_HEBE_ENDPOINT_GRADES = "api/mobile/grade"
|
||||||
const val VULCAN_HEBE_ENDPOINT_GRADE_SUMMARY = "api/mobile/grade/summary"
|
const val VULCAN_HEBE_ENDPOINT_GRADE_SUMMARY = "api/mobile/grade/summary"
|
||||||
|
@ -11,8 +11,8 @@ import android.content.Context
|
|||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import androidx.core.app.NotificationCompat.PRIORITY_MIN
|
import androidx.core.app.NotificationCompat.PRIORITY_MIN
|
||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.Bundle
|
|
||||||
import pl.szczodrzynski.edziennik.R
|
import pl.szczodrzynski.edziennik.R
|
||||||
|
import pl.szczodrzynski.edziennik.ext.Bundle
|
||||||
import pl.szczodrzynski.edziennik.receivers.SzkolnyReceiver
|
import pl.szczodrzynski.edziennik.receivers.SzkolnyReceiver
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
@ -16,6 +16,10 @@ object Regexes {
|
|||||||
"""[^0-9]""".toRegex()
|
"""[^0-9]""".toRegex()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val HTML_BR by lazy {
|
||||||
|
"""<br\s?/?>""".toRegex()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val MOBIDZIENNIK_GRADES_SUBJECT_NAME by lazy {
|
val MOBIDZIENNIK_GRADES_SUBJECT_NAME by lazy {
|
||||||
@ -50,15 +54,16 @@ object Regexes {
|
|||||||
"""events: (.+),$""".toRegex(RegexOption.MULTILINE)
|
"""events: (.+),$""".toRegex(RegexOption.MULTILINE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val MOBIDZIENNIK_WEB_ATTACHMENT by lazy {
|
||||||
|
"""href="https://.+?\.mobidziennik.pl/.+?&(?:amp;)?zalacznik(_rozwiazania)?=([0-9]+)".+?>(.+?)(?: <small.+?\(([0-9.]+)\s(M|K|G|)B\)</small>)?</a>""".toRegex()
|
||||||
|
}
|
||||||
|
|
||||||
val MOBIDZIENNIK_MESSAGE_READ_DATE by lazy {
|
val MOBIDZIENNIK_MESSAGE_READ_DATE by lazy {
|
||||||
"""czas przeczytania:.+?,\s([0-9]+)\s(.+?)\s([0-9]{4}),\sgodzina\s([0-9:]+)""".toRegex(DOT_MATCHES_ALL)
|
"""czas przeczytania:.+?,\s([0-9]+)\s(.+?)\s([0-9]{4}),\sgodzina\s([0-9:]+)""".toRegex(DOT_MATCHES_ALL)
|
||||||
}
|
}
|
||||||
val MOBIDZIENNIK_MESSAGE_SENT_READ_DATE by lazy {
|
val MOBIDZIENNIK_MESSAGE_SENT_READ_DATE by lazy {
|
||||||
""".+?,\s([0-9]+)\s(.+?)\s([0-9]{4}),\sgodzina\s([0-9:]+)""".toRegex(DOT_MATCHES_ALL)
|
""".+?,\s([0-9]+)\s(.+?)\s([0-9]{4}),\sgodzina\s([0-9:]+)""".toRegex(DOT_MATCHES_ALL)
|
||||||
}
|
}
|
||||||
val MOBIDZIENNIK_MESSAGE_ATTACHMENT by lazy {
|
|
||||||
"""href="https://.+?\.mobidziennik.pl/.+?&(?:amp;)?zalacznik=([0-9]+)"(?:.+?<small.+?\(([0-9.]+)\s(M|K|G|)B\))*""".toRegex(DOT_MATCHES_ALL)
|
|
||||||
}
|
|
||||||
val MOBIDZIENNIK_MESSAGE_SENT_READ_BY by lazy {
|
val MOBIDZIENNIK_MESSAGE_SENT_READ_BY by lazy {
|
||||||
"""([0-9]+)/([0-9]+)""".toRegex()
|
"""([0-9]+)/([0-9]+)""".toRegex()
|
||||||
}
|
}
|
||||||
@ -100,22 +105,26 @@ object Regexes {
|
|||||||
"""<strong>(.+?)</strong>\s*<small>\s*\((.+?),\s*(.+?)\)""".toRegex(DOT_MATCHES_ALL)
|
"""<strong>(.+?)</strong>\s*<small>\s*\((.+?),\s*(.+?)\)""".toRegex(DOT_MATCHES_ALL)
|
||||||
}
|
}
|
||||||
|
|
||||||
val MOBIDZIENNIK_HOMEWORK_ROW by lazy {
|
val MOBIDZIENNIK_MOBILE_HOMEWORK_ROW by lazy {
|
||||||
"""class="rowRolling">(.+?</div>\s*</td>)""".toRegex(DOT_MATCHES_ALL)
|
"""class="rowRolling">(.+?</div>\s*</td>)""".toRegex(DOT_MATCHES_ALL)
|
||||||
}
|
}
|
||||||
val MOBIDZIENNIK_HOMEWORK_ITEM by lazy {
|
val MOBIDZIENNIK_MOBILE_HOMEWORK_ITEM by lazy {
|
||||||
"""<p><b>(.+?):</b>\s*(.+?)\s*</p>""".toRegex(DOT_MATCHES_ALL)
|
"""<p><b>(.+?):</b>\s*(.+?)\s*</p>""".toRegex(DOT_MATCHES_ALL)
|
||||||
}
|
}
|
||||||
val MOBIDZIENNIK_HOMEWORK_BODY by lazy {
|
val MOBIDZIENNIK_MOBILE_HOMEWORK_BODY by lazy {
|
||||||
"""Treść:</b>(.+?)<p><b>""".toRegex(DOT_MATCHES_ALL)
|
"""Treść:</b>(.+?)<p><b>""".toRegex(DOT_MATCHES_ALL)
|
||||||
}
|
}
|
||||||
val MOBIDZIENNIK_HOMEWORK_ID by lazy {
|
val MOBIDZIENNIK_MOBILE_HOMEWORK_ID by lazy {
|
||||||
"""zadanieFormularz\(([0-9]+),""".toRegex(DOT_MATCHES_ALL)
|
"""name="id_zadania" value="([0-9]+)"""".toRegex(DOT_MATCHES_ALL)
|
||||||
}
|
}
|
||||||
val MOBIDZIENNIK_HOMEWORK_ATTACHMENT by lazy {
|
val MOBIDZIENNIK_MOBILE_HOMEWORK_ATTACHMENT by lazy {
|
||||||
"""zalacznik(_zadania)?=([0-9]+)'.+?word-break">(.+?)</td>""".toRegex(DOT_MATCHES_ALL)
|
"""zalacznik(_zadania)?=([0-9]+)'.+?word-break">(.+?)</td>""".toRegex(DOT_MATCHES_ALL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val MOBIDZIENNIK_WEB_HOMEWORK_ADDED_DATE by lazy {
|
||||||
|
"""Wpisał\(a\):</td>\s+<th>\s+(.+?), (.+?), ([0-9]{1,2}) (.+?) ([0-9]{4}), godzina ([0-9:]+)""".toRegex()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
val MOBIDZIENNIK_TIMETABLE_TOP by lazy {
|
val MOBIDZIENNIK_TIMETABLE_TOP by lazy {
|
||||||
"""<div class="plansc_top">.+?</div></div>""".toRegex(DOT_MATCHES_ALL)
|
"""<div class="plansc_top">.+?</div></div>""".toRegex(DOT_MATCHES_ALL)
|
||||||
@ -128,6 +137,11 @@ object Regexes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val MOBIDZIENNIK_EVENT_CONTENT by lazy {
|
||||||
|
"""<h1>(.+?) <small>\(wpisał\(a\) (.+?) w dniu ([0-9-]{10})\).+?<strong>(.+?)</strong><br""".toRegex(DOT_MATCHES_ALL)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val IDZIENNIK_LOGIN_HIDDEN_FIELDS by lazy {
|
val IDZIENNIK_LOGIN_HIDDEN_FIELDS by lazy {
|
||||||
"""<input type="hidden".+?name="([A-z0-9_]+)?".+?value="([A-z0-9_+-/=]+)?".+?>""".toRegex(DOT_MATCHES_ALL)
|
"""<input type="hidden".+?name="([A-z0-9_]+)?".+?value="([A-z0-9_+-/=]+)?".+?>""".toRegex(DOT_MATCHES_ALL)
|
||||||
|
@ -6,9 +6,9 @@ package pl.szczodrzynski.edziennik.data.api.edziennik
|
|||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.Intent
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.*
|
import pl.szczodrzynski.edziennik.data.api.*
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
||||||
|
import pl.szczodrzynski.edziennik.ext.Intent
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
|
@ -4,10 +4,13 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.*
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_EDUDZIENNIK_WEB
|
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_EDUDZIENNIK_WEB
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.Data
|
import pl.szczodrzynski.edziennik.data.api.models.Data
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.*
|
import pl.szczodrzynski.edziennik.data.db.entity.EventType
|
||||||
|
import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
|
||||||
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use http://patorjk.com/software/taag/#p=display&f=Big for the ascii art
|
* Use http://patorjk.com/software/taag/#p=display&f=Big for the ascii art
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.crc32
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ANNOUNCEMENT_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ANNOUNCEMENT_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_ANNOUNCEMENTS
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_ANNOUNCEMENTS
|
||||||
@ -13,7 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.Edudzienni
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Announcement
|
import pl.szczodrzynski.edziennik.data.db.entity.Announcement
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.crc32
|
||||||
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class EdudziennikWebAnnouncements(override val data: DataEdudziennik,
|
class EdudziennikWebAnnouncements(override val data: DataEdudziennik,
|
||||||
@ -40,7 +40,7 @@ class EdudziennikWebAnnouncements(override val data: DataEdudziennik,
|
|||||||
val teacherName = announcementElement.child(1).text()
|
val teacherName = announcementElement.child(1).text()
|
||||||
val teacher = data.getTeacherByFirstLast(teacherName)
|
val teacher = data.getTeacherByFirstLast(teacherName)
|
||||||
|
|
||||||
val dateString = announcementElement.getElementsByClass("datetime").first().text()
|
val dateString = announcementElement.getElementsByClass("datetime").first()?.text()
|
||||||
val startDate = Date.fromY_m_d(dateString)
|
val startDate = Date.fromY_m_d(dateString)
|
||||||
val addedDate = Date.fromIsoHm(dateString)
|
val addedDate = Date.fromIsoHm(dateString)
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.crc32
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_ENTRIES
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_ENTRIES
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_TYPE
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_TYPE
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_TYPES
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_TYPES
|
||||||
@ -14,8 +13,9 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.Edudzienni
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.crc32
|
||||||
import pl.szczodrzynski.edziennik.singleOrNull
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
|
import pl.szczodrzynski.edziennik.ext.singleOrNull
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class EdudziennikWebAttendance(override val data: DataEdudziennik,
|
|||||||
return@map Triple(
|
return@map Triple(
|
||||||
symbol,
|
symbol,
|
||||||
name,
|
name,
|
||||||
when (name.toLowerCase(Locale.ROOT)) {
|
when (name.lowercase()) {
|
||||||
"obecność" -> Attendance.TYPE_PRESENT
|
"obecność" -> Attendance.TYPE_PRESENT
|
||||||
"nieobecność" -> Attendance.TYPE_ABSENT
|
"nieobecność" -> Attendance.TYPE_ABSENT
|
||||||
"spóźnienie" -> Attendance.TYPE_BELATED
|
"spóźnienie" -> Attendance.TYPE_BELATED
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.crc32
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_EVENT_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_EVENT_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_EVENTS
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_EVENTS
|
||||||
@ -14,7 +13,8 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.crc32
|
||||||
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class EdudziennikWebEvents(override val data: DataEdudziennik,
|
class EdudziennikWebEvents(override val data: DataEdudziennik,
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.crc32
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_EVENT_TYPE_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_EVENT_TYPE_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_EXAM_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_EXAM_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECT_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECT_ID
|
||||||
@ -16,7 +15,8 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.crc32
|
||||||
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class EdudziennikWebExams(override val data: DataEdudziennik,
|
class EdudziennikWebExams(override val data: DataEdudziennik,
|
||||||
|
@ -10,7 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.AnnouncementGetEvent
|
import pl.szczodrzynski.edziennik.data.api.events.AnnouncementGetEvent
|
||||||
import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull
|
import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
|
|
||||||
class EdudziennikWebGetAnnouncement(override val data: DataEdudziennik,
|
class EdudziennikWebGetAnnouncement(override val data: DataEdudziennik,
|
||||||
private val announcement: AnnouncementFull,
|
private val announcement: AnnouncementFull,
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import android.text.Html
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes
|
import pl.szczodrzynski.edziennik.data.api.Regexes
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent
|
import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent
|
||||||
import pl.szczodrzynski.edziennik.data.db.full.EventFull
|
import pl.szczodrzynski.edziennik.data.db.full.EventFull
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.isNotNullNorEmpty
|
import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
|
||||||
|
import pl.szczodrzynski.edziennik.utils.html.BetterHtml
|
||||||
|
|
||||||
class EdudziennikWebGetHomework(
|
class EdudziennikWebGetHomework(
|
||||||
override val data: DataEdudziennik,
|
override val data: DataEdudziennik,
|
||||||
@ -26,9 +26,11 @@ class EdudziennikWebGetHomework(
|
|||||||
webGet(TAG, "Homework/$id") { text ->
|
webGet(TAG, "Homework/$id") { text ->
|
||||||
val description = Regexes.EDUDZIENNIK_HOMEWORK_DESCRIPTION.find(text)?.get(1)?.trim()
|
val description = Regexes.EDUDZIENNIK_HOMEWORK_DESCRIPTION.find(text)?.get(1)?.trim()
|
||||||
|
|
||||||
if (description != null) event.topic = Html.fromHtml(description).toString()
|
if (description != null)
|
||||||
|
event.topic = BetterHtml.fromHtml(context = null, description).toString()
|
||||||
|
|
||||||
event.homeworkBody = ""
|
event.homeworkBody = ""
|
||||||
|
event.isDownloaded = true
|
||||||
event.attachmentNames = null
|
event.attachmentNames = null
|
||||||
|
|
||||||
data.eventList += event
|
data.eventList += event
|
||||||
|
@ -6,8 +6,6 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
|||||||
|
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.colorFromCssName
|
|
||||||
import pl.szczodrzynski.edziennik.crc32
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes
|
import pl.szczodrzynski.edziennik.data.api.Regexes
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_GRADES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_GRADES
|
||||||
@ -22,7 +20,9 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_SEMESTER2_
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_SEMESTER2_PROPOSED
|
import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_SEMESTER2_PROPOSED
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.colorFromCssName
|
||||||
|
import pl.szczodrzynski.edziennik.ext.crc32
|
||||||
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils
|
import pl.szczodrzynski.edziennik.utils.Utils
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
@ -67,13 +67,13 @@ class EdudziennikWebGrades(override val data: DataEdudziennik,
|
|||||||
|
|
||||||
val gradeValues = if (grades.isNotEmpty()) {
|
val gradeValues = if (grades.isNotEmpty()) {
|
||||||
subjects.select(".avg-$subjectId .grade-tip > p").first()
|
subjects.select(".avg-$subjectId .grade-tip > p").first()
|
||||||
.text().split('+').map {
|
?.text()?.split('+')?.map {
|
||||||
val split = it.split('*')
|
val split = it.split('*')
|
||||||
val value = split[1].trim().toFloatOrNull()
|
val value = split[1].trim().toFloatOrNull()
|
||||||
val weight = value?.let { split[0].trim().toFloatOrNull() } ?: 0f
|
val weight = value?.let { split[0].trim().toFloatOrNull() } ?: 0f
|
||||||
|
|
||||||
Pair(value ?: 0f, weight)
|
Pair(value ?: 0f, weight)
|
||||||
}
|
} ?: emptyList()
|
||||||
} else emptyList()
|
} else emptyList()
|
||||||
|
|
||||||
grades.forEachIndexed { index, gradeElement ->
|
grades.forEachIndexed { index, gradeElement ->
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.crc32
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_HOMEWORK_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_HOMEWORK_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECT_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECT_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
@ -15,7 +14,8 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.crc32
|
||||||
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class EdudziennikWebHomework(override val data: DataEdudziennik,
|
class EdudziennikWebHomework(override val data: DataEdudziennik,
|
||||||
@ -32,7 +32,7 @@ class EdudziennikWebHomework(override val data: DataEdudziennik,
|
|||||||
|
|
||||||
if (doc.getElementsByClass("message").text().trim() != "Brak prac domowych") {
|
if (doc.getElementsByClass("message").text().trim() != "Brak prac domowych") {
|
||||||
doc.getElementsByTag("tr").forEach { homeworkElement ->
|
doc.getElementsByTag("tr").forEach { homeworkElement ->
|
||||||
val dateElement = homeworkElement.getElementsByClass("date").first().child(0)
|
val dateElement = homeworkElement.getElementsByClass("date").first()?.child(0) ?: return@forEach
|
||||||
val idStr = EDUDZIENNIK_HOMEWORK_ID.find(dateElement.attr("href"))?.get(1) ?: return@forEach
|
val idStr = EDUDZIENNIK_HOMEWORK_ID.find(dateElement.attr("href"))?.get(1) ?: return@forEach
|
||||||
val id = idStr.crc32()
|
val id = idStr.crc32()
|
||||||
val date = Date.fromY_m_d(dateElement.text())
|
val date = Date.fromY_m_d(dateElement.text())
|
||||||
@ -49,7 +49,7 @@ class EdudziennikWebHomework(override val data: DataEdudziennik,
|
|||||||
val teacherName = homeworkElement.child(2).text()
|
val teacherName = homeworkElement.child(2).text()
|
||||||
val teacher = data.getTeacherByFirstLast(teacherName)
|
val teacher = data.getTeacherByFirstLast(teacherName)
|
||||||
|
|
||||||
val topic = homeworkElement.child(4).text()?.trim()
|
val topic = homeworkElement.child(4).text().trim()
|
||||||
|
|
||||||
val eventObject = Event(
|
val eventObject = Event(
|
||||||
profileId = profileId,
|
profileId = profileId,
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.crc32
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_NOTE_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_NOTE_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_NOTES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_NOTES
|
||||||
@ -13,7 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.Edudzienni
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Notice
|
import pl.szczodrzynski.edziennik.data.db.entity.Notice
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.crc32
|
||||||
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class EdudziennikWebNotes(override val data: DataEdudziennik,
|
class EdudziennikWebNotes(override val data: DataEdudziennik,
|
||||||
@ -29,7 +29,7 @@ class EdudziennikWebNotes(override val data: DataEdudziennik,
|
|||||||
val doc = Jsoup.parseBodyFragment("<table>" + text.trim() + "</table>")
|
val doc = Jsoup.parseBodyFragment("<table>" + text.trim() + "</table>")
|
||||||
|
|
||||||
doc.getElementsByTag("tr").forEach { noteElement ->
|
doc.getElementsByTag("tr").forEach { noteElement ->
|
||||||
val dateElement = noteElement.getElementsByClass("date").first().child(0)
|
val dateElement = noteElement.getElementsByClass("date").first()?.child(0) ?: return@forEach
|
||||||
val addedDate = Date.fromY_m_d(dateElement.text()).inMillis
|
val addedDate = Date.fromY_m_d(dateElement.text()).inMillis
|
||||||
|
|
||||||
val id = EDUDZIENNIK_NOTE_ID.find(dateElement.attr("href"))?.get(0)?.crc32()
|
val id = EDUDZIENNIK_NOTE_ID.find(dateElement.attr("href"))?.get(0)?.crc32()
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.MONTH
|
|
||||||
import pl.szczodrzynski.edziennik.crc32
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.ERROR_EDUDZIENNIK_WEB_TEAM_MISSING
|
import pl.szczodrzynski.edziennik.data.api.ERROR_EDUDZIENNIK_WEB_TEAM_MISSING
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes
|
import pl.szczodrzynski.edziennik.data.api.Regexes
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECTS_START
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECTS_START
|
||||||
@ -14,8 +12,10 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZI
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Team
|
import pl.szczodrzynski.edziennik.data.db.entity.Team
|
||||||
import pl.szczodrzynski.edziennik.firstLettersName
|
import pl.szczodrzynski.edziennik.ext.MONTH
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.crc32
|
||||||
|
import pl.szczodrzynski.edziennik.ext.firstLettersName
|
||||||
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
|
|
||||||
class EdudziennikWebStart(override val data: DataEdudziennik,
|
class EdudziennikWebStart(override val data: DataEdudziennik,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.MONTH
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_TEACHERS
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_TEACHERS
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_TEACHERS
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_TEACHERS
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.MONTH
|
||||||
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
|
|
||||||
class EdudziennikWebTeachers(override val data: DataEdudziennik,
|
class EdudziennikWebTeachers(override val data: DataEdudziennik,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.web
|
||||||
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.crc32
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECT_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_SUBJECT_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_TEACHER_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_TEACHER_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
@ -16,9 +15,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.Lesson
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
|
import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.crc32
|
||||||
import pl.szczodrzynski.edziennik.getString
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.singleOrNull
|
import pl.szczodrzynski.edziennik.ext.getString
|
||||||
|
import pl.szczodrzynski.edziennik.ext.singleOrNull
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
@ -57,7 +57,7 @@ class EdudziennikWebTimetable(override val data: DataEdudziennik,
|
|||||||
|
|
||||||
val table = doc.select("#Schedule tbody").first()
|
val table = doc.select("#Schedule tbody").first()
|
||||||
|
|
||||||
if (!table.text().contains("Brak planu lekcji.")) {
|
if (table?.text()?.contains("Brak planu lekcji.") == false) {
|
||||||
table.children().forEach { row ->
|
table.children().forEach { row ->
|
||||||
val rowElements = row.children()
|
val rowElements = row.children()
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.Edudzienni
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.login.EdudziennikLoginWeb
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.login.EdudziennikLoginWeb
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent
|
import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
||||||
import pl.szczodrzynski.edziennik.fixName
|
import pl.szczodrzynski.edziennik.ext.fixName
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.getShortName
|
import pl.szczodrzynski.edziennik.ext.getShortName
|
||||||
import pl.szczodrzynski.edziennik.set
|
import pl.szczodrzynski.edziennik.ext.set
|
||||||
|
|
||||||
class EdudziennikFirstLogin(val data: DataEdudziennik, val onSuccess: () -> Unit) {
|
class EdudziennikFirstLogin(val data: DataEdudziennik, val onSuccess: () -> Unit) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -10,8 +10,8 @@ import im.wangchao.mhttp.callback.TextCallbackHandler
|
|||||||
import pl.szczodrzynski.edziennik.data.api.*
|
import pl.szczodrzynski.edziennik.data.api.*
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
import pl.szczodrzynski.edziennik.getUnixDate
|
import pl.szczodrzynski.edziennik.ext.getUnixDate
|
||||||
import pl.szczodrzynski.edziennik.isNotNullNorEmpty
|
import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
|
|
||||||
class EdudziennikLoginWeb(val data: DataEdudziennik, val onSuccess: () -> Unit) {
|
class EdudziennikLoginWeb(val data: DataEdudziennik, val onSuccess: () -> Unit) {
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.currentTimeUnix
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_API
|
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_API
|
||||||
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_MESSAGES
|
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_MESSAGES
|
||||||
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_PORTAL
|
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_PORTAL
|
||||||
@ -13,7 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_LIBRUS_SYNERGIA
|
|||||||
import pl.szczodrzynski.edziennik.data.api.models.Data
|
import pl.szczodrzynski.edziennik.data.api.models.Data
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
|
import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
||||||
import pl.szczodrzynski.edziennik.isNotNullNorEmpty
|
import pl.szczodrzynski.edziennik.ext.currentTimeUnix
|
||||||
|
import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
|
||||||
|
|
||||||
class DataLibrus(app: App, profile: Profile?, loginStore: LoginStore) : Data(app, profile, loginStore) {
|
class DataLibrus(app: App, profile: Profile?, loginStore: LoginStore) : Data(app, profile, loginStore) {
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import pl.szczodrzynski.edziennik.startCoroutineTimer
|
import pl.szczodrzynski.edziennik.ext.startCoroutineTimer
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
class LibrusRecaptchaHelper(
|
class LibrusRecaptchaHelper(
|
||||||
|
@ -11,7 +11,7 @@ import im.wangchao.mhttp.callback.JsonCallbackHandler
|
|||||||
import pl.szczodrzynski.edziennik.data.api.*
|
import pl.szczodrzynski.edziennik.data.api.*
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
import pl.szczodrzynski.edziennik.getString
|
import pl.szczodrzynski.edziennik.ext.getString
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import java.net.HttpURLConnection.*
|
import java.net.HttpURLConnection.*
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import im.wangchao.mhttp.callback.JsonCallbackHandler
|
|||||||
import pl.szczodrzynski.edziennik.data.api.*
|
import pl.szczodrzynski.edziennik.data.api.*
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
import pl.szczodrzynski.edziennik.getString
|
import pl.szczodrzynski.edziennik.ext.getString
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Announcement
|
import pl.szczodrzynski.edziennik.data.db.entity.Announcement
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusApiAnnouncements(override val data: DataLibrus,
|
class LibrusApiAnnouncements(override val data: DataLibrus,
|
||||||
|
@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.AttendanceType
|
import pl.szczodrzynski.edziennik.data.db.entity.AttendanceType
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiAttendanceTypes(override val data: DataLibrus,
|
class LibrusApiAttendanceTypes(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
@ -58,7 +59,7 @@ class LibrusApiAttendanceTypes(override val data: DataLibrus,
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_ATTENDANCE_TYPES, 2*DAY)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_ATTENDANCE_TYPES, 2* DAY)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_ATTENDANCE_TYPES)
|
onSuccess(ENDPOINT_LIBRUS_API_ATTENDANCE_TYPES)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusApiAttendances(override val data: DataLibrus,
|
class LibrusApiAttendances(override val data: DataLibrus,
|
||||||
|
@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_BEHAVIOUR_GRADE_CATEGORIES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_BEHAVIOUR_GRADE_CATEGORIES
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiBehaviourGradeCategories(override val data: DataLibrus,
|
class LibrusApiBehaviourGradeCategories(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiBehaviourGradeComments(override val data: DataLibrus,
|
class LibrusApiBehaviourGradeComments(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_POINT_SUM
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.DAY
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_CLASSES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_CLASSES
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Team
|
import pl.szczodrzynski.edziennik.data.db.entity.Team
|
||||||
import pl.szczodrzynski.edziennik.getJsonObject
|
import pl.szczodrzynski.edziennik.ext.DAY
|
||||||
import pl.szczodrzynski.edziennik.getLong
|
import pl.szczodrzynski.edziennik.ext.getJsonObject
|
||||||
import pl.szczodrzynski.edziennik.getString
|
import pl.szczodrzynski.edziennik.ext.getLong
|
||||||
|
import pl.szczodrzynski.edziennik.ext.getString
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusApiClasses(override val data: DataLibrus,
|
class LibrusApiClasses(override val data: DataLibrus,
|
||||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_CLASSROOMS
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_CLASSROOMS
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Classroom
|
import pl.szczodrzynski.edziennik.data.db.entity.Classroom
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class LibrusApiClassrooms(override val data: DataLibrus,
|
class LibrusApiClassrooms(override val data: DataLibrus,
|
||||||
@ -25,8 +26,8 @@ class LibrusApiClassrooms(override val data: DataLibrus,
|
|||||||
|
|
||||||
classrooms?.forEach { classroom ->
|
classrooms?.forEach { classroom ->
|
||||||
val id = classroom.getLong("Id") ?: return@forEach
|
val id = classroom.getLong("Id") ?: return@forEach
|
||||||
val name = classroom.getString("Name")?.toLowerCase(Locale.getDefault()) ?: ""
|
val name = classroom.getString("Name")?.lowercase() ?: ""
|
||||||
val symbol = classroom.getString("Symbol")?.toLowerCase(Locale.getDefault()) ?: ""
|
val symbol = classroom.getString("Symbol")?.lowercase() ?: ""
|
||||||
val nameShort = name.fixWhiteSpaces().split(" ").onEach { it[0] }.joinToString()
|
val nameShort = name.fixWhiteSpaces().split(" ").onEach { it[0] }.joinToString()
|
||||||
val symbolParts = symbol.fixWhiteSpaces().split(" ")
|
val symbolParts = symbol.fixWhiteSpaces().split(" ")
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ class LibrusApiClassrooms(override val data: DataLibrus,
|
|||||||
data.classrooms.put(id, Classroom(profileId, id, friendlyName))
|
data.classrooms.put(id, Classroom(profileId, id, friendlyName))
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_CLASSROOMS, 4*DAY)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_CLASSROOMS, 4* DAY)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_CLASSROOMS)
|
onSuccess(ENDPOINT_LIBRUS_API_CLASSROOMS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_DESCRIPTIVE_GRADE_CATEGORIES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_DESCRIPTIVE_GRADE_CATEGORIES
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiDescriptiveGradeCategories(override val data: DataLibrus,
|
class LibrusApiDescriptiveGradeCategories(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -15,6 +15,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_TEXT
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusApiDescriptiveGrades(override val data: DataLibrus,
|
class LibrusApiDescriptiveGrades(override val data: DataLibrus,
|
||||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_EVENT_TYPES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_EVENT_TYPES
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.EventType
|
import pl.szczodrzynski.edziennik.data.db.entity.EventType
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiEventTypes(override val data: DataLibrus,
|
class LibrusApiEventTypes(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
@ -30,7 +31,7 @@ class LibrusApiEventTypes(override val data: DataLibrus,
|
|||||||
data.eventTypes.put(id, EventType(profileId, id, name, color))
|
data.eventTypes.put(id, EventType(profileId, id, name, color))
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_EVENT_TYPES, 4*DAY)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_EVENT_TYPES, 4* DAY)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_EVENT_TYPES)
|
onSuccess(ENDPOINT_LIBRUS_API_EVENT_TYPES)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiGradeCategories(override val data: DataLibrus,
|
class LibrusApiGradeCategories(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiGradeComments(override val data: DataLibrus,
|
class LibrusApiGradeComments(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -16,6 +16,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_YEAR_PROPO
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils
|
import pl.szczodrzynski.edziennik.utils.Utils
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusApiHomework(override val data: DataLibrus,
|
class LibrusApiHomework(override val data: DataLibrus,
|
||||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_LESSONS
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_LESSONS
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.LibrusLesson
|
import pl.szczodrzynski.edziennik.data.db.entity.LibrusLesson
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiLessons(override val data: DataLibrus,
|
class LibrusApiLessons(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
@ -39,7 +40,7 @@ class LibrusApiLessons(override val data: DataLibrus,
|
|||||||
data.librusLessons.put(id, librusLesson)
|
data.librusLessons.put(id, librusLesson)
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_LESSONS, 4*DAY)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_LESSONS, 4* DAY)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_LESSONS)
|
onSuccess(ENDPOINT_LIBRUS_API_LESSONS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.*
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_LUCKY_NUMBER
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_LUCKY_NUMBER
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.LuckyNumber
|
import pl.szczodrzynski.edziennik.data.db.entity.LuckyNumber
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ class LibrusApiLuckyNumber(override val data: DataLibrus,
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
var nextSync = System.currentTimeMillis() + 2*DAY*1000
|
var nextSync = System.currentTimeMillis() + 2* DAY *1000
|
||||||
|
|
||||||
apiGet(TAG, "LuckyNumbers") { json ->
|
apiGet(TAG, "LuckyNumbers") { json ->
|
||||||
if (json.isJsonNull) {
|
if (json.isJsonNull) {
|
||||||
@ -41,7 +41,7 @@ class LibrusApiLuckyNumber(override val data: DataLibrus,
|
|||||||
if (luckyNumberDate >= Date.getToday())
|
if (luckyNumberDate >= Date.getToday())
|
||||||
nextSync = luckyNumberDate.combineWith(Time(15, 0, 0))
|
nextSync = luckyNumberDate.combineWith(Time(15, 0, 0))
|
||||||
else
|
else
|
||||||
nextSync = System.currentTimeMillis() + 6*HOUR*1000
|
nextSync = System.currentTimeMillis() + 6* HOUR *1000
|
||||||
|
|
||||||
data.luckyNumberList.add(luckyNumberObject)
|
data.luckyNumberList.add(luckyNumberObject)
|
||||||
data.metadataList.add(
|
data.metadataList.add(
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.*
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_ME
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_ME
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiMe(override val data: DataLibrus,
|
class LibrusApiMe(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
@ -34,7 +34,7 @@ class LibrusApiMe(override val data: DataLibrus,
|
|||||||
data.profile?.studentNameLong =
|
data.profile?.studentNameLong =
|
||||||
buildFullName(user?.getString("FirstName"), user?.getString("LastName"))
|
buildFullName(user?.getString("FirstName"), user?.getString("LastName"))
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_ME, 2*DAY)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_ME, 2* DAY)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_ME)
|
onSuccess(ENDPOINT_LIBRUS_API_ME)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_NOTICE_TYPES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_NOTICE_TYPES
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.NoticeType
|
import pl.szczodrzynski.edziennik.data.db.entity.NoticeType
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiNoticeTypes(override val data: DataLibrus,
|
class LibrusApiNoticeTypes(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
@ -29,7 +30,7 @@ class LibrusApiNoticeTypes(override val data: DataLibrus,
|
|||||||
data.noticeTypes.put(id, NoticeType(profileId, id, name))
|
data.noticeTypes.put(id, NoticeType(profileId, id, name))
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_NOTICE_TYPES, 4*DAY)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_NOTICE_TYPES, 4* DAY)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_NOTICE_TYPES)
|
onSuccess(ENDPOINT_LIBRUS_API_NOTICE_TYPES)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Notice
|
import pl.szczodrzynski.edziennik.data.db.entity.Notice
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusApiNotices(override val data: DataLibrus,
|
class LibrusApiNotices(override val data: DataLibrus,
|
||||||
|
@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_POINT_GRADE_CATEGORIES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_POINT_GRADE_CATEGORIES
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiPointGradeCategories(override val data: DataLibrus,
|
class LibrusApiPointGradeCategories(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_POINT_AVG
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusApiPointGrades(override val data: DataLibrus,
|
class LibrusApiPointGrades(override val data: DataLibrus,
|
||||||
|
@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
|||||||
import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ class LibrusApiPtMeetings(override val data: DataLibrus,
|
|||||||
|
|
||||||
data.toRemove.add(DataRemoveModel.Events.futureWithType(Event.TYPE_PT_MEETING))
|
data.toRemove.add(DataRemoveModel.Events.futureWithType(Event.TYPE_PT_MEETING))
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_PT_MEETINGS, 12*HOUR)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_PT_MEETINGS, 12* HOUR)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_PT_MEETINGS)
|
onSuccess(ENDPOINT_LIBRUS_API_PT_MEETINGS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.api
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.JsonObject
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_PUSH_CONFIG
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_PUSH_CONFIG
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.getInt
|
import pl.szczodrzynski.edziennik.ext.JsonObject
|
||||||
import pl.szczodrzynski.edziennik.getJsonObject
|
import pl.szczodrzynski.edziennik.ext.getInt
|
||||||
|
import pl.szczodrzynski.edziennik.ext.getJsonObject
|
||||||
|
|
||||||
class LibrusApiPushConfig(override val data: DataLibrus,
|
class LibrusApiPushConfig(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_SCHOOLS
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_SCHOOLS
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
|
import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ class LibrusApiSchools(override val data: DataLibrus,
|
|||||||
// create the school's short name using first letters of each long name's word
|
// create the school's short name using first letters of each long name's word
|
||||||
// append the town name and save to student data
|
// append the town name and save to student data
|
||||||
val schoolNameShort = schoolNameLong?.firstLettersName
|
val schoolNameShort = schoolNameLong?.firstLettersName
|
||||||
val schoolTown = school?.getString("Town")?.toLowerCase(Locale.getDefault())
|
val schoolTown = school?.getString("Town")?.lowercase()
|
||||||
data.schoolName = schoolId.toString() + schoolNameShort + "_" + schoolTown
|
data.schoolName = schoolId.toString() + schoolNameShort + "_" + schoolTown
|
||||||
|
|
||||||
school?.getJsonArray("LessonsRange")?.let { ranges ->
|
school?.getJsonArray("LessonsRange")?.let { ranges ->
|
||||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_SUBJECTS
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_SUBJECTS
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Subject
|
import pl.szczodrzynski.edziennik.data.db.entity.Subject
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiSubjects(override val data: DataLibrus,
|
class LibrusApiSubjects(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
@ -32,7 +33,7 @@ class LibrusApiSubjects(override val data: DataLibrus,
|
|||||||
|
|
||||||
data.subjectList.put(1, Subject(profileId, 1, "Zachowanie", "zach"))
|
data.subjectList.put(1, Subject(profileId, 1, "Zachowanie", "zach"))
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_SUBJECTS, 4*DAY)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_SUBJECTS, 4* DAY)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_SUBJECTS)
|
onSuccess(ENDPOINT_LIBRUS_API_SUBJECTS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_TEACHER_FREE_DAY_TYPES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_TEACHER_FREE_DAY_TYPES
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.TeacherAbsenceType
|
import pl.szczodrzynski.edziennik.data.db.entity.TeacherAbsenceType
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiTeacherFreeDayTypes(override val data: DataLibrus,
|
class LibrusApiTeacherFreeDayTypes(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -12,6 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.TeacherAbsence
|
import pl.szczodrzynski.edziennik.data.db.entity.TeacherAbsence
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ class LibrusApiTeacherFreeDays(override val data: DataLibrus,
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_TEACHER_FREE_DAYS, 6*HOUR, DRAWER_ITEM_AGENDA)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_TEACHER_FREE_DAYS, 6* HOUR, DRAWER_ITEM_AGENDA)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_TEACHER_FREE_DAYS)
|
onSuccess(ENDPOINT_LIBRUS_API_TEACHER_FREE_DAYS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_TEXT_GRADE_CATEGORIES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_TEXT_GRADE_CATEGORIES
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiTextGradeCategories(override val data: DataLibrus,
|
class LibrusApiTextGradeCategories(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_DESCRIPTIV
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
import pl.szczodrzynski.edziennik.data.db.entity.GradeCategory
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusApiTextGrades(override val data: DataLibrus,
|
class LibrusApiTextGrades(override val data: DataLibrus,
|
||||||
|
@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Lesson
|
import pl.szczodrzynski.edziennik.data.db.entity.Lesson
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
|
@ -8,6 +8,7 @@ import pl.szczodrzynski.edziennik.*
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_UNITS
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_UNITS
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiUnits(override val data: DataLibrus,
|
class LibrusApiUnits(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_USERS
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_USERS
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiUsers(override val data: DataLibrus,
|
class LibrusApiUsers(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
@ -37,7 +38,7 @@ class LibrusApiUsers(override val data: DataLibrus,
|
|||||||
data.teacherList.put(id, teacher)
|
data.teacherList.put(id, teacher)
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_USERS, 4*DAY)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_USERS, 4* DAY)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_USERS)
|
onSuccess(ENDPOINT_LIBRUS_API_USERS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Team
|
import pl.szczodrzynski.edziennik.data.db.entity.Team
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusApiVirtualClasses(override val data: DataLibrus,
|
class LibrusApiVirtualClasses(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
@ -31,7 +32,7 @@ class LibrusApiVirtualClasses(override val data: DataLibrus,
|
|||||||
data.teamList.put(id, Team(profileId, id, name, 2, code, teacherId))
|
data.teamList.put(id, Team(profileId, id, name, 2, code, teacherId))
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES, 4*DAY)
|
data.setSyncNext(ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES, 4* DAY)
|
||||||
onSuccess(ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES)
|
onSuccess(ENDPOINT_LIBRUS_API_VIRTUAL_CLASSES)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.messages
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.messages
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.DAY
|
|
||||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES
|
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES
|
||||||
import pl.szczodrzynski.edziennik.data.api.ERROR_NOT_IMPLEMENTED
|
import pl.szczodrzynski.edziennik.data.api.ERROR_NOT_IMPLEMENTED
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
@ -13,8 +12,9 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_MESS
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.*
|
import pl.szczodrzynski.edziennik.data.db.entity.*
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_RECEIVED
|
import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_RECEIVED
|
||||||
import pl.szczodrzynski.edziennik.fixName
|
import pl.szczodrzynski.edziennik.ext.DAY
|
||||||
import pl.szczodrzynski.edziennik.singleOrNull
|
import pl.szczodrzynski.edziennik.ext.fixName
|
||||||
|
import pl.szczodrzynski.edziennik.ext.singleOrNull
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils
|
import pl.szczodrzynski.edziennik.utils.Utils
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ class LibrusMessagesGetList(override val data: DataLibrus,
|
|||||||
id
|
id
|
||||||
)
|
)
|
||||||
|
|
||||||
element.select("isAnyFileAttached")?.text()?.let {
|
element.select("isAnyFileAttached").text()?.let {
|
||||||
if (it == "1")
|
if (it == "1")
|
||||||
messageObject.hasAttachments = true
|
messageObject.hasAttachments = true
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
||||||
import pl.szczodrzynski.edziennik.data.db.full.MessageFull
|
import pl.szczodrzynski.edziennik.data.db.full.MessageFull
|
||||||
import pl.szczodrzynski.edziennik.data.db.full.MessageRecipientFull
|
import pl.szczodrzynski.edziennik.data.db.full.MessageRecipientFull
|
||||||
import pl.szczodrzynski.edziennik.fixName
|
import pl.szczodrzynski.edziennik.ext.fixName
|
||||||
import pl.szczodrzynski.edziennik.isNotNullNorEmpty
|
import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
|
||||||
import pl.szczodrzynski.edziennik.notEmptyOrNull
|
import pl.szczodrzynski.edziennik.ext.notEmptyOrNull
|
||||||
import pl.szczodrzynski.edziennik.singleOrNull
|
import pl.szczodrzynski.edziennik.ext.singleOrNull
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ class LibrusMessagesGetMessage(override val data: DataLibrus,
|
|||||||
"messageId" to messageObject.id,
|
"messageId" to messageObject.id,
|
||||||
"archive" to 0
|
"archive" to 0
|
||||||
)) { doc ->
|
)) { doc ->
|
||||||
val message = doc.select("response GetMessage data").first()
|
val message = doc.select("response GetMessage data").first() ?: return@messagesGet
|
||||||
|
|
||||||
val body = Base64.decode(message.select("Message").text(), Base64.DEFAULT)
|
val body = Base64.decode(message.select("Message").text(), Base64.DEFAULT)
|
||||||
.toString(Charset.defaultCharset())
|
.toString(Charset.defaultCharset())
|
||||||
@ -108,7 +108,7 @@ class LibrusMessagesGetMessage(override val data: DataLibrus,
|
|||||||
readDate = readDate
|
readDate = readDate
|
||||||
)
|
)
|
||||||
|
|
||||||
messageRecipientObject.fullName = profile.accountName ?: profile.studentNameLong ?: ""
|
messageRecipientObject.fullName = profile.accountName ?: profile.studentNameLong
|
||||||
|
|
||||||
messageRecipientList.add(messageRecipientObject)
|
messageRecipientList.add(messageRecipientObject)
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.RecipientListGetEvent
|
import pl.szczodrzynski.edziennik.data.api.events.RecipientListGetEvent
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusMessagesGetRecipientList(override val data: DataLibrus,
|
class LibrusMessagesGetRecipientList(override val data: DataLibrus,
|
||||||
val onSuccess: () -> Unit
|
val onSuccess: () -> Unit
|
||||||
@ -28,9 +29,9 @@ class LibrusMessagesGetRecipientList(override val data: DataLibrus,
|
|||||||
messagesGet(TAG, "Receivers/action/GetTypes", parameters = mapOf(
|
messagesGet(TAG, "Receivers/action/GetTypes", parameters = mapOf(
|
||||||
"includeClass" to 1
|
"includeClass" to 1
|
||||||
)) { doc ->
|
)) { doc ->
|
||||||
doc.select("response GetTypes data list ArrayItem")?.forEach {
|
doc.select("response GetTypes data list ArrayItem").forEach {
|
||||||
val id = it.getElementsByTag("id")?.firstOrNull()?.ownText() ?: return@forEach
|
val id = it.getElementsByTag("id").firstOrNull()?.ownText() ?: return@forEach
|
||||||
val name = it.getElementsByTag("name")?.firstOrNull()?.ownText() ?: return@forEach
|
val name = it.getElementsByTag("name").firstOrNull()?.ownText() ?: return@forEach
|
||||||
listTypes += id to name
|
listTypes += id to name
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ class LibrusMessagesGetRecipientList(override val data: DataLibrus,
|
|||||||
if (dataEl is JsonObject) {
|
if (dataEl is JsonObject) {
|
||||||
val listEl = dataEl.get("ArrayItem")
|
val listEl = dataEl.get("ArrayItem")
|
||||||
if (listEl is JsonArray) {
|
if (listEl is JsonArray) {
|
||||||
listEl.asJsonObjectList()?.forEach { item ->
|
listEl.asJsonObjectList().forEach { item ->
|
||||||
processElement(item, type.first, type.second)
|
processElement(item, type.first, type.second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +72,7 @@ class LibrusMessagesGetRecipientList(override val data: DataLibrus,
|
|||||||
private fun processElement(element: JsonObject, typeId: String, typeName: String, listName: String? = null) {
|
private fun processElement(element: JsonObject, typeId: String, typeName: String, listName: String? = null) {
|
||||||
val listEl = element.getJsonObject("list")?.get("ArrayItem")
|
val listEl = element.getJsonObject("list")?.get("ArrayItem")
|
||||||
if (listEl is JsonArray) {
|
if (listEl is JsonArray) {
|
||||||
listEl.asJsonObjectList()?.let { list ->
|
listEl.asJsonObjectList().let { list ->
|
||||||
val label = element.getString("label") ?: ""
|
val label = element.getString("label") ?: ""
|
||||||
list.forEach { item ->
|
list.forEach { item ->
|
||||||
processElement(item, typeId, typeName, label)
|
processElement(item, typeId, typeName, label)
|
||||||
|
@ -5,16 +5,15 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.messages
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.messages
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import pl.szczodrzynski.edziennik.base64Encode
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.MessageSentEvent
|
import pl.szczodrzynski.edziennik.data.api.events.MessageSentEvent
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Message
|
import pl.szczodrzynski.edziennik.data.db.entity.Message
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
||||||
import pl.szczodrzynski.edziennik.getJsonObject
|
import pl.szczodrzynski.edziennik.ext.base64Encode
|
||||||
import pl.szczodrzynski.edziennik.getLong
|
import pl.szczodrzynski.edziennik.ext.getJsonObject
|
||||||
import pl.szczodrzynski.edziennik.getString
|
import pl.szczodrzynski.edziennik.ext.getLong
|
||||||
|
import pl.szczodrzynski.edziennik.ext.getString
|
||||||
|
|
||||||
class LibrusMessagesSendMessage(override val data: DataLibrus,
|
class LibrusMessagesSendMessage(override val data: DataLibrus,
|
||||||
val recipients: List<Teacher>,
|
val recipients: List<Teacher>,
|
||||||
@ -42,14 +41,14 @@ class LibrusMessagesSendMessage(override val data: DataLibrus,
|
|||||||
val id = response.getLong("data")
|
val id = response.getLong("data")
|
||||||
|
|
||||||
if (response.getString("status") != "ok" || id == null) {
|
if (response.getString("status") != "ok" || id == null) {
|
||||||
val message = response.getString("message")
|
// val message = response.getString("message")
|
||||||
// TODO error
|
// TODO error
|
||||||
return@messagesGetJson
|
return@messagesGetJson
|
||||||
}
|
}
|
||||||
|
|
||||||
LibrusMessagesGetList(data, type = Message.TYPE_SENT, lastSync = null) {
|
LibrusMessagesGetList(data, type = Message.TYPE_SENT, lastSync = null) {
|
||||||
val message = data.messageList.firstOrNull { it.type == Message.TYPE_SENT && it.id == id }
|
val message = data.messageList.firstOrNull { it.isSent && it.id == id }
|
||||||
val metadata = data.metadataList.firstOrNull { it.thingType == Metadata.TYPE_MESSAGE && it.thingId == message?.id }
|
// val metadata = data.metadataList.firstOrNull { it.thingType == Metadata.TYPE_MESSAGE && it.thingId == message?.id }
|
||||||
val event = MessageSentEvent(data.profileId, message, message?.addedDate)
|
val event = MessageSentEvent(data.profileId, message, message?.addedDate)
|
||||||
|
|
||||||
EventBus.getDefault().postSticky(event)
|
EventBus.getDefault().postSticky(event)
|
||||||
|
@ -7,8 +7,8 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusMessages
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.AttachmentGetEvent
|
import pl.szczodrzynski.edziennik.data.api.events.AttachmentGetEvent
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.getString
|
import pl.szczodrzynski.edziennik.ext.getString
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils
|
import pl.szczodrzynski.edziennik.utils.Utils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
|
||||||
|
|
||||||
import android.text.Html
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
|
||||||
import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent
|
import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent
|
||||||
import pl.szczodrzynski.edziennik.data.db.full.EventFull
|
import pl.szczodrzynski.edziennik.data.db.full.EventFull
|
||||||
|
import pl.szczodrzynski.edziennik.utils.html.BetterHtml
|
||||||
|
|
||||||
class LibrusSynergiaGetHomework(override val data: DataLibrus,
|
class LibrusSynergiaGetHomework(override val data: DataLibrus,
|
||||||
val event: EventFull,
|
val event: EventFull,
|
||||||
@ -23,7 +23,11 @@ class LibrusSynergiaGetHomework(override val data: DataLibrus,
|
|||||||
val table = doc.select("table.decorated tbody > tr")
|
val table = doc.select("table.decorated tbody > tr")
|
||||||
|
|
||||||
event.topic = table[1].select("td")[1].text()
|
event.topic = table[1].select("td")[1].text()
|
||||||
event.homeworkBody = Html.fromHtml(table[5].select("td")[1].html()).toString()
|
event.homeworkBody = BetterHtml.fromHtml(
|
||||||
|
context = null,
|
||||||
|
html = table[5].select("td")[1].html(),
|
||||||
|
).toString()
|
||||||
|
event.isDownloaded = true
|
||||||
|
|
||||||
event.attachmentIds = mutableListOf()
|
event.attachmentIds = mutableListOf()
|
||||||
event.attachmentNames = mutableListOf()
|
event.attachmentNames = mutableListOf()
|
||||||
|
@ -10,10 +10,10 @@ import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
|
||||||
import pl.szczodrzynski.edziennik.data.db.full.MessageFull
|
import pl.szczodrzynski.edziennik.data.db.full.MessageFull
|
||||||
import pl.szczodrzynski.edziennik.data.db.full.MessageRecipientFull
|
import pl.szczodrzynski.edziennik.data.db.full.MessageRecipientFull
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
import pl.szczodrzynski.edziennik.isNotNullNorEmpty
|
import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
|
||||||
import pl.szczodrzynski.edziennik.singleOrNull
|
import pl.szczodrzynski.edziennik.ext.singleOrNull
|
||||||
import pl.szczodrzynski.edziennik.swapFirstLastName
|
import pl.szczodrzynski.edziennik.ext.swapFirstLastName
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusSynergiaGetMessage(override val data: DataLibrus,
|
class LibrusSynergiaGetMessage(override val data: DataLibrus,
|
||||||
@ -87,7 +87,7 @@ class LibrusSynergiaGetMessage(override val data: DataLibrus,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
val readDateText = readElement.select(".left").text()
|
val readDateText = readElement?.select(".left")?.text()
|
||||||
val readDate = when (readDateText.isNotNullNorEmpty()) {
|
val readDate = when (readDateText.isNotNullNorEmpty()) {
|
||||||
true -> Date.fromIso(readDateText)
|
true -> Date.fromIso(readDateText)
|
||||||
else -> 0
|
else -> 0
|
||||||
@ -108,7 +108,7 @@ class LibrusSynergiaGetMessage(override val data: DataLibrus,
|
|||||||
|
|
||||||
Message.TYPE_SENT -> {
|
Message.TYPE_SENT -> {
|
||||||
|
|
||||||
readElement.select("tr").forEachIndexed { i, receiver ->
|
readElement?.select("tr")?.forEachIndexed { i, receiver ->
|
||||||
if (i == 0) return@forEachIndexed // Skip the header
|
if (i == 0) return@forEachIndexed // Skip the header
|
||||||
|
|
||||||
val receiverFullName = receiver.child(0).text()
|
val receiverFullName = receiver.child(0).text()
|
||||||
|
@ -7,6 +7,7 @@ import pl.szczodrzynski.edziennik.data.api.Regexes
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.*
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.*
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.*
|
import pl.szczodrzynski.edziennik.data.db.entity.*
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils
|
import pl.szczodrzynski.edziennik.utils.Utils
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ class LibrusSynergiaGetMessages(override val data: DataLibrus,
|
|||||||
|
|
||||||
fun getRecipientId(name: String): Long = data.teacherList.singleOrNull {
|
fun getRecipientId(name: String): Long = data.teacherList.singleOrNull {
|
||||||
it.fullNameLastFirst == name
|
it.fullNameLastFirst == name
|
||||||
}?.id ?: {
|
}?.id ?: run {
|
||||||
val teacherObject = Teacher(
|
val teacherObject = Teacher(
|
||||||
profileId,
|
profileId,
|
||||||
-1 * Utils.crc16(name.swapFirstLastName().toByteArray()).toLong(),
|
-1 * Utils.crc16(name.swapFirstLastName().toByteArray()).toLong(),
|
||||||
@ -45,10 +46,10 @@ class LibrusSynergiaGetMessages(override val data: DataLibrus,
|
|||||||
)
|
)
|
||||||
data.teacherList.put(teacherObject.id, teacherObject)
|
data.teacherList.put(teacherObject.id, teacherObject)
|
||||||
teacherObject.id
|
teacherObject.id
|
||||||
}.invoke()
|
}
|
||||||
|
|
||||||
doc.select(".decorated.stretch tbody > tr").forEach { messageElement ->
|
doc.select(".decorated.stretch tbody > tr").forEach { messageElement ->
|
||||||
val url = messageElement.select("a").first().attr("href")
|
val url = messageElement.select("a").first()?.attr("href") ?: return@forEach
|
||||||
val id = Regexes.LIBRUS_MESSAGE_ID.find(url)?.get(1)?.toLong() ?: return@forEach
|
val id = Regexes.LIBRUS_MESSAGE_ID.find(url)?.get(1)?.toLong() ?: return@forEach
|
||||||
val subject = messageElement.child(3).text()
|
val subject = messageElement.child(3).text()
|
||||||
val sentDate = Date.fromIso(messageElement.child(4).text())
|
val sentDate = Date.fromIso(messageElement.child(4).text())
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
|
||||||
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.HOUR
|
|
||||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_HOMEWORK
|
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_HOMEWORK
|
||||||
import pl.szczodrzynski.edziennik.data.api.POST
|
import pl.szczodrzynski.edziennik.data.api.POST
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
@ -14,8 +13,9 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
|
|||||||
import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.ext.HOUR
|
||||||
import pl.szczodrzynski.edziennik.singleOrNull
|
import pl.szczodrzynski.edziennik.ext.get
|
||||||
|
import pl.szczodrzynski.edziennik.ext.singleOrNull
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
class LibrusSynergiaHomework(override val data: DataLibrus,
|
class LibrusSynergiaHomework(override val data: DataLibrus,
|
||||||
@ -42,7 +42,7 @@ class LibrusSynergiaHomework(override val data: DataLibrus,
|
|||||||
doc.select("table.myHomeworkTable > tbody").firstOrNull()?.also { homeworkTable ->
|
doc.select("table.myHomeworkTable > tbody").firstOrNull()?.also { homeworkTable ->
|
||||||
val homeworkElements = homeworkTable.children()
|
val homeworkElements = homeworkTable.children()
|
||||||
|
|
||||||
homeworkElements.forEachIndexed { i, el ->
|
homeworkElements.forEach { el ->
|
||||||
val elements = el.children()
|
val elements = el.children()
|
||||||
|
|
||||||
val subjectName = elements[0].text().trim()
|
val subjectName = elements[0].text().trim()
|
||||||
@ -56,7 +56,7 @@ class LibrusSynergiaHomework(override val data: DataLibrus,
|
|||||||
val eventDate = Date.fromY_m_d(elements[6].text().trim())
|
val eventDate = Date.fromY_m_d(elements[6].text().trim())
|
||||||
val id = "/podglad/([0-9]+)'".toRegex().find(
|
val id = "/podglad/([0-9]+)'".toRegex().find(
|
||||||
elements[9].select("input").attr("onclick")
|
elements[9].select("input").attr("onclick")
|
||||||
)?.get(1)?.toLong() ?: return@forEachIndexed
|
)?.get(1)?.toLong() ?: return@forEach
|
||||||
|
|
||||||
val lessons = data.db.timetableDao().getAllForDateNow(profileId, eventDate)
|
val lessons = data.db.timetableDao().getAllForDateNow(profileId, eventDate)
|
||||||
val startTime = lessons.firstOrNull { it.subjectId == subjectId }?.startTime
|
val startTime = lessons.firstOrNull { it.subjectId == subjectId }?.startTime
|
||||||
@ -79,6 +79,7 @@ class LibrusSynergiaHomework(override val data: DataLibrus,
|
|||||||
teamId = data.teamClass?.id ?: -1,
|
teamId = data.teamClass?.id ?: -1,
|
||||||
addedDate = addedDate.inMillis
|
addedDate = addedDate.inMillis
|
||||||
)
|
)
|
||||||
|
eventObject.isDownloaded = false
|
||||||
|
|
||||||
data.eventList.add(eventObject)
|
data.eventList.add(eventObject)
|
||||||
data.metadataList.add(Metadata(
|
data.metadataList.add(Metadata(
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
|
package pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.synergia
|
||||||
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.MONTH
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_SYNERGIA_INFO
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.ENDPOINT_LIBRUS_SYNERGIA_INFO
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusSynergia
|
||||||
|
import pl.szczodrzynski.edziennik.ext.MONTH
|
||||||
|
|
||||||
class LibrusSynergiaInfo(override val data: DataLibrus,
|
class LibrusSynergiaInfo(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
|
@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.librus.login.LibrusLoginPor
|
|||||||
import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent
|
import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
|
|
||||||
class LibrusFirstLogin(val data: DataLibrus, val onSuccess: () -> Unit) {
|
class LibrusFirstLogin(val data: DataLibrus, val onSuccess: () -> Unit) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -12,9 +12,9 @@ import im.wangchao.mhttp.callback.JsonCallbackHandler
|
|||||||
import pl.szczodrzynski.edziennik.data.api.*
|
import pl.szczodrzynski.edziennik.data.api.*
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
import pl.szczodrzynski.edziennik.getInt
|
import pl.szczodrzynski.edziennik.ext.getInt
|
||||||
import pl.szczodrzynski.edziennik.getString
|
import pl.szczodrzynski.edziennik.ext.getString
|
||||||
import pl.szczodrzynski.edziennik.getUnixDate
|
import pl.szczodrzynski.edziennik.ext.getUnixDate
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import java.net.HttpURLConnection.*
|
import java.net.HttpURLConnection.*
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class LibrusLoginApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun copyFromLoginStore() {
|
private fun copyFromLoginStore() {
|
||||||
data.loginStore.data?.apply {
|
data.loginStore.data.apply {
|
||||||
if (has("accountLogin")) {
|
if (has("accountLogin")) {
|
||||||
data.apiLogin = getString("accountLogin")
|
data.apiLogin = getString("accountLogin")
|
||||||
remove("accountLogin")
|
remove("accountLogin")
|
||||||
|
@ -12,7 +12,7 @@ import pl.szczodrzynski.edziennik.data.api.*
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.LibrusRecaptchaHelper
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.LibrusRecaptchaHelper
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
import pl.szczodrzynski.edziennik.getUnixDate
|
import pl.szczodrzynski.edziennik.ext.getUnixDate
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
import javax.xml.parsers.DocumentBuilderFactory
|
import javax.xml.parsers.DocumentBuilderFactory
|
||||||
|
@ -11,6 +11,7 @@ import pl.szczodrzynski.edziennik.*
|
|||||||
import pl.szczodrzynski.edziennik.data.api.*
|
import pl.szczodrzynski.edziennik.data.api.*
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import java.net.HttpURLConnection.*
|
import java.net.HttpURLConnection.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -83,7 +84,7 @@ class LibrusLoginPortal(val data: DataLibrus, val onSuccess: () -> Unit) {
|
|||||||
} else {
|
} else {
|
||||||
val csrfMatcher = Pattern.compile("name=\"csrf-token\" content=\"([A-z0-9=+/\\-_]+?)\"", Pattern.DOTALL).matcher(text)
|
val csrfMatcher = Pattern.compile("name=\"csrf-token\" content=\"([A-z0-9=+/\\-_]+?)\"", Pattern.DOTALL).matcher(text)
|
||||||
if (csrfMatcher.find()) {
|
if (csrfMatcher.find()) {
|
||||||
login(csrfMatcher.group(1))
|
login(csrfMatcher.group(1) ?: "")
|
||||||
} else {
|
} else {
|
||||||
data.error(ApiError(TAG, ERROR_LOGIN_LIBRUS_PORTAL_CSRF_MISSING)
|
data.error(ApiError(TAG, ERROR_LOGIN_LIBRUS_PORTAL_CSRF_MISSING)
|
||||||
.withResponse(response)
|
.withResponse(response)
|
||||||
|
@ -12,8 +12,8 @@ import pl.szczodrzynski.edziennik.data.api.*
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusApi
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
import pl.szczodrzynski.edziennik.getString
|
import pl.szczodrzynski.edziennik.ext.getString
|
||||||
import pl.szczodrzynski.edziennik.getUnixDate
|
import pl.szczodrzynski.edziennik.ext.getUnixDate
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import pl.szczodrzynski.edziennik.data.api.*
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.DataLibrus
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusPortal
|
import pl.szczodrzynski.edziennik.data.api.edziennik.librus.data.LibrusPortal
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
import pl.szczodrzynski.edziennik.data.api.models.ApiError
|
||||||
|
import pl.szczodrzynski.edziennik.ext.*
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
|
|
||||||
class SynergiaTokenExtractor(override val data: DataLibrus, val onSuccess: () -> Unit) : LibrusPortal(data) {
|
class SynergiaTokenExtractor(override val data: DataLibrus, val onSuccess: () -> Unit) : LibrusPortal(data) {
|
||||||
|
@ -6,12 +6,12 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik
|
|||||||
|
|
||||||
import android.util.LongSparseArray
|
import android.util.LongSparseArray
|
||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.currentTimeUnix
|
|
||||||
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_MOBIDZIENNIK_WEB
|
import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_MOBIDZIENNIK_WEB
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.Data
|
import pl.szczodrzynski.edziennik.data.api.models.Data
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
|
import pl.szczodrzynski.edziennik.data.db.entity.LoginStore
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
||||||
import pl.szczodrzynski.edziennik.isNotNullNorEmpty
|
import pl.szczodrzynski.edziennik.ext.currentTimeUnix
|
||||||
|
import pl.szczodrzynski.edziennik.ext.isNotNullNorEmpty
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
|
|
||||||
|
@ -120,10 +120,17 @@ class Mobidziennik(val app: App, val profile: Profile?, val loginStore: LoginSto
|
|||||||
|
|
||||||
override fun getEvent(eventFull: EventFull) {
|
override fun getEvent(eventFull: EventFull) {
|
||||||
login(LOGIN_METHOD_MOBIDZIENNIK_WEB) {
|
login(LOGIN_METHOD_MOBIDZIENNIK_WEB) {
|
||||||
|
if (eventFull.isHomework) {
|
||||||
MobidziennikWebGetHomework(data, eventFull) {
|
MobidziennikWebGetHomework(data, eventFull) {
|
||||||
completed()
|
completed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
MobidziennikWebGetEvent(data, eventFull) {
|
||||||
|
completed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun firstLogin() { MobidziennikFirstLogin(data) { completed() } }
|
override fun firstLogin() { MobidziennikFirstLogin(data) { completed() } }
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user