diff --git a/.travis.yml b/.travis.yml
index ee3e6f3a..d858cf3e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,7 +14,7 @@ cache:
branches:
only:
- develop
- - 0.18.0
+ - 0.18.1
android:
licenses:
diff --git a/app/build.gradle b/app/build.gradle
index c1e8b581..31cada74 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -17,9 +17,10 @@ android {
testApplicationId "io.github.tests.wulkanowy"
minSdkVersion 17
targetSdkVersion 29
- versionCode 59
- versionName "0.18.0"
+ versionCode 60
+ versionName "0.18.1"
multiDexEnabled true
+ resValue "string", "app_name", "Wulkanowy"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [
@@ -56,6 +57,7 @@ android {
signingConfig signingConfigs.release
}
debug {
+ resValue "string", "app_name", "Wulkanowy DEV " + defaultConfig.versionCode
applicationIdSuffix ".dev"
versionNameSuffix "-dev"
testCoverageEnabled = project.hasProperty('coverage')
@@ -122,7 +124,7 @@ configurations.all {
}
dependencies {
- implementation "io.github.wulkanowy:sdk:0.18.0"
+ implementation "io.github.wulkanowy:sdk:0.18.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "androidx.core:core-ktx:1.2.0"
@@ -179,10 +181,10 @@ dependencies {
implementation "io.coil-kt:coil:0.11.0"
implementation "io.github.wulkanowy:AppKillerManager:3.0.0"
- playImplementation 'com.google.firebase:firebase-analytics:17.4.1'
- playImplementation 'com.google.firebase:firebase-inappmessaging-display-ktx:19.0.6'
- playImplementation "com.google.firebase:firebase-inappmessaging-ktx:19.0.6"
- playImplementation 'com.google.firebase:firebase-messaging:20.1.7'
+ playImplementation 'com.google.firebase:firebase-analytics:17.4.2'
+ playImplementation 'com.google.firebase:firebase-inappmessaging-display-ktx:19.0.7'
+ playImplementation "com.google.firebase:firebase-inappmessaging-ktx:19.0.7"
+ playImplementation 'com.google.firebase:firebase-messaging:20.2.0'
playImplementation 'com.google.firebase:firebase-crashlytics:17.0.0'
playImplementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml
deleted file mode 100644
index c90641dd..00000000
--- a/app/src/debug/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Wulkanowy DEV
-
diff --git a/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt b/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
index 60dc6b56..6351997d 100644
--- a/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
+++ b/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
@@ -5,8 +5,6 @@ package io.github.wulkanowy.utils
import android.content.Context
import timber.log.Timber
-fun initCrashlytics(context: Context, appInfo: AppInfo) {}
-
open class TimberTreeNoOp : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {}
}
diff --git a/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt b/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
index 0b1274f1..f23645bc 100644
--- a/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
+++ b/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
@@ -1,13 +1,18 @@
package io.github.wulkanowy.utils
+import android.app.Activity
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
+@Suppress("UNUSED_PARAMETER")
class FirebaseAnalyticsHelper @Inject constructor() {
- @Suppress("UNUSED_PARAMETER")
fun logEvent(name: String, vararg params: Pair) {
// do nothing
}
+
+ fun setCurrentScreen(activity: Activity, name: String?) {
+ // do nothing
+ }
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
index 22fe7fa5..68e7c5f1 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
@@ -5,7 +5,7 @@ import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.Inter
import io.github.wulkanowy.data.db.entities.Attendance
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
@@ -22,19 +22,19 @@ class AttendanceRepository @Inject constructor(
) {
fun getAttendance(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean): Single> {
- return local.getAttendance(semester, start.monday, end.friday).filter { !forceRefresh }
+ return local.getAttendance(semester, start.monday, end.sunday).filter { !forceRefresh }
.switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings).flatMap {
- if (it) remote.getAttendance(student, semester, start.monday, end.friday)
+ if (it) remote.getAttendance(student, semester, start.monday, end.sunday)
else Single.error(UnknownHostException())
}.flatMap { newAttendance ->
- local.getAttendance(semester, start.monday, end.friday)
+ local.getAttendance(semester, start.monday, end.sunday)
.toSingle(emptyList())
.doOnSuccess { oldAttendance ->
local.deleteAttendance(oldAttendance.uniqueSubtract(newAttendance))
local.saveAttendance(newAttendance.uniqueSubtract(oldAttendance))
}
}.flatMap {
- local.getAttendance(semester, start.monday, end.friday)
+ local.getAttendance(semester, start.monday, end.sunday)
.toSingle(emptyList())
}).map { list -> list.filter { it.date in start..end } }
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
index f31e3055..72cc93eb 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
@@ -5,7 +5,7 @@ import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.Inter
import io.github.wulkanowy.data.db.entities.CompletedLesson
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
@@ -22,20 +22,20 @@ class CompletedLessonsRepository @Inject constructor(
) {
fun getCompletedLessons(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean = false): Single> {
- return local.getCompletedLessons(semester, start.monday, end.friday).filter { !forceRefresh }
+ return local.getCompletedLessons(semester, start.monday, end.sunday).filter { !forceRefresh }
.switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
.flatMap {
- if (it) remote.getCompletedLessons(student, semester, start.monday, end.friday)
+ if (it) remote.getCompletedLessons(student, semester, start.monday, end.sunday)
else Single.error(UnknownHostException())
}.flatMap { new ->
- local.getCompletedLessons(semester, start.monday, end.friday)
+ local.getCompletedLessons(semester, start.monday, end.sunday)
.toSingle(emptyList())
.doOnSuccess { old ->
local.deleteCompleteLessons(old.uniqueSubtract(new))
local.saveCompletedLessons(new.uniqueSubtract(old))
}
}.flatMap {
- local.getCompletedLessons(semester, start.monday, end.friday)
+ local.getCompletedLessons(semester, start.monday, end.sunday)
.toSingle(emptyList())
}).map { list -> list.filter { it.date in start..end } }
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
index 452a1551..f29e4fdf 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
@@ -5,7 +5,7 @@ import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.Inter
import io.github.wulkanowy.data.db.entities.Exam
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
@@ -22,20 +22,20 @@ class ExamRepository @Inject constructor(
) {
fun getExams(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean = false): Single> {
- return local.getExams(semester, start.monday, end.friday).filter { !forceRefresh }
+ return local.getExams(semester, start.monday, end.sunday).filter { !forceRefresh }
.switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
.flatMap {
- if (it) remote.getExams(student, semester, start.monday, end.friday)
+ if (it) remote.getExams(student, semester, start.monday, end.sunday)
else Single.error(UnknownHostException())
}.flatMap { new ->
- local.getExams(semester, start.monday, end.friday)
+ local.getExams(semester, start.monday, end.sunday)
.toSingle(emptyList())
.doOnSuccess { old ->
local.deleteExams(old.uniqueSubtract(new))
local.saveExams(new.uniqueSubtract(old))
}
}.flatMap {
- local.getExams(semester, start.monday, end.friday)
+ local.getExams(semester, start.monday, end.sunday)
.toSingle(emptyList())
}).map { list -> list.filter { it.date in start..end } }
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt
index 4454fd88..7e8fd5c3 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt
@@ -5,7 +5,7 @@ import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.Inter
import io.github.wulkanowy.data.db.entities.Homework
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Completable
@@ -23,7 +23,7 @@ class HomeworkRepository @Inject constructor(
) {
fun getHomework(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean = false): Single> {
- return Single.fromCallable { start.monday to end.friday }.flatMap { (monday, friday) ->
+ return Single.fromCallable { start.monday to end.sunday }.flatMap { (monday, friday) ->
local.getHomework(semester, monday, friday).filter { !forceRefresh }
.switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
.flatMap {
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRemote.kt
index 9b77c9ad..15c33650 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRemote.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRemote.kt
@@ -39,7 +39,7 @@ class StudentRemote @Inject constructor(private val sdk: Sdk) {
}
fun getStudentsMobileApi(token: String, pin: String, symbol: String): Single> {
- return sdk.getStudentsFromMobileApi(token, pin, symbol).map { mapStudents(it, "", "") }
+ return sdk.getStudentsFromMobileApi(token, pin, symbol, "").map { mapStudents(it, "", "") }
}
fun getStudentsScrapper(email: String, password: String, scrapperBaseUrl: String, symbol: String): Single> {
@@ -47,6 +47,6 @@ class StudentRemote @Inject constructor(private val sdk: Sdk) {
}
fun getStudentsHybrid(email: String, password: String, scrapperBaseUrl: String, symbol: String): Single> {
- return sdk.getStudentsHybrid(email, password, scrapperBaseUrl, symbol).map { mapStudents(it, email, password) }
+ return sdk.getStudentsHybrid(email, password, scrapperBaseUrl, "", symbol).map { mapStudents(it, email, password) }
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt
index 082b03cf..4a7a0eb2 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt
@@ -6,7 +6,7 @@ import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.db.entities.Timetable
import io.github.wulkanowy.services.alarm.TimetableNotificationSchedulerHelper
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.github.wulkanowy.utils.uniqueSubtract
import io.reactivex.Single
@@ -24,13 +24,13 @@ class TimetableRepository @Inject constructor(
) {
fun getTimetable(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean = false): Single> {
- return Single.fromCallable { start.monday to end.friday }.flatMap { (monday, friday) ->
- local.getTimetable(semester, monday, friday).filter { !forceRefresh }
+ return Single.fromCallable { start.monday to end.sunday }.flatMap { (monday, sunday) ->
+ local.getTimetable(semester, monday, sunday).filter { !forceRefresh }
.switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings).flatMap {
- if (it) remote.getTimetable(student, semester, monday, friday)
+ if (it) remote.getTimetable(student, semester, monday, sunday)
else Single.error(UnknownHostException())
}.flatMap { new ->
- local.getTimetable(semester, monday, friday)
+ local.getTimetable(semester, monday, sunday)
.toSingle(emptyList())
.doOnSuccess { old ->
local.deleteTimetable(old.uniqueSubtract(new).also { schedulerHelper.cancelScheduled(it) })
@@ -46,7 +46,7 @@ class TimetableRepository @Inject constructor(
})
}
}.flatMap {
- local.getTimetable(semester, monday, friday).toSingle(emptyList())
+ local.getTimetable(semester, monday, sunday).toSingle(emptyList())
}).map { list -> list.filter { it.date in start..end }.also { schedulerHelper.scheduleNotifications(it, student) } }
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/channels/DebugChannel.kt b/app/src/main/java/io/github/wulkanowy/services/sync/channels/DebugChannel.kt
index 9b6f213b..a6735055 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/channels/DebugChannel.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/channels/DebugChannel.kt
@@ -22,7 +22,7 @@ class DebugChannel @Inject constructor(
}
override fun create() {
- if (appInfo.isDebug) return
+ if (!appInfo.isDebug) return
notificationManager.createNotificationChannel(
NotificationChannel(CHANNEL_ID, context.getString(R.string.channel_debug), IMPORTANCE_DEFAULT)
.apply {
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceWork.kt
index e8579ddb..063b7482 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceWork.kt
@@ -3,7 +3,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.repositories.attendance.AttendanceRepository
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.reactivex.Completable
import org.threeten.bp.LocalDate.now
@@ -12,7 +12,7 @@ import javax.inject.Inject
class AttendanceWork @Inject constructor(private val attendanceRepository: AttendanceRepository) : Work {
override fun create(student: Student, semester: Semester): Completable {
- return attendanceRepository.getAttendance(student, semester, now().monday, now().friday, true)
+ return attendanceRepository.getAttendance(student, semester, now().monday, now().sunday, true)
.ignoreElement()
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/CompletedLessonWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/CompletedLessonWork.kt
index 0da597e0..26f79a0d 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/CompletedLessonWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/CompletedLessonWork.kt
@@ -3,7 +3,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.repositories.completedlessons.CompletedLessonsRepository
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.reactivex.Completable
import org.threeten.bp.LocalDate.now
@@ -14,7 +14,7 @@ class CompletedLessonWork @Inject constructor(
) : Work {
override fun create(student: Student, semester: Semester): Completable {
- return completedLessonsRepository.getCompletedLessons(student, semester, now().monday, now().friday, true)
+ return completedLessonsRepository.getCompletedLessons(student, semester, now().monday, now().sunday, true)
.ignoreElement()
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/ExamWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/ExamWork.kt
index c6110bbb..1ef97f59 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/ExamWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/ExamWork.kt
@@ -3,7 +3,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.repositories.exam.ExamRepository
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.reactivex.Completable
import org.threeten.bp.LocalDate.now
@@ -12,6 +12,6 @@ import javax.inject.Inject
class ExamWork @Inject constructor(private val examRepository: ExamRepository) : Work {
override fun create(student: Student, semester: Semester): Completable {
- return examRepository.getExams(student, semester, now().monday, now().friday, true).ignoreElement()
+ return examRepository.getExams(student, semester, now().monday, now().sunday, true).ignoreElement()
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/HomeworkWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/HomeworkWork.kt
index cf348439..186d57b0 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/HomeworkWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/HomeworkWork.kt
@@ -3,7 +3,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.repositories.homework.HomeworkRepository
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.reactivex.Completable
import org.threeten.bp.LocalDate.now
@@ -12,6 +12,6 @@ import javax.inject.Inject
class HomeworkWork @Inject constructor(private val homeworkRepository: HomeworkRepository) : Work {
override fun create(student: Student, semester: Semester): Completable {
- return homeworkRepository.getHomework(student, semester, now().monday, now().friday, true).ignoreElement()
+ return homeworkRepository.getHomework(student, semester, now().monday, now().sunday, true).ignoreElement()
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/TimetableWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/TimetableWork.kt
index 0990ed67..d79d2403 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/TimetableWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/TimetableWork.kt
@@ -3,7 +3,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.repositories.timetable.TimetableRepository
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.monday
import io.reactivex.Completable
import org.threeten.bp.LocalDate.now
@@ -12,7 +12,7 @@ import javax.inject.Inject
class TimetableWork @Inject constructor(private val timetableRepository: TimetableRepository) : Work {
override fun create(student: Student, semester: Semester): Completable {
- return timetableRepository.getTimetable(student, semester, now().monday, now().friday, true)
+ return timetableRepository.getTimetable(student, semester, now().monday, now().sunday, true)
.ignoreElement()
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt
index 5fd6a86a..896e4ff1 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt
@@ -9,6 +9,7 @@ import android.view.ViewGroup
import android.widget.HorizontalScrollView
import android.widget.Toast
import android.widget.Toast.LENGTH_LONG
+import androidx.appcompat.app.AlertDialog
import androidx.core.content.getSystemService
import io.github.wulkanowy.R
import io.github.wulkanowy.databinding.DialogErrorBinding
@@ -17,6 +18,7 @@ import io.github.wulkanowy.sdk.exception.FeatureNotAvailableException
import io.github.wulkanowy.sdk.exception.ServiceUnavailableException
import io.github.wulkanowy.utils.AppInfo
import io.github.wulkanowy.utils.getString
+import io.github.wulkanowy.utils.openAppInMarket
import io.github.wulkanowy.utils.openEmailClient
import io.github.wulkanowy.utils.openInternetBrowser
import java.io.InterruptedIOException
@@ -74,7 +76,9 @@ class ErrorDialog : BaseDialogFragment() {
Toast.makeText(context, R.string.all_copied, LENGTH_LONG).show()
}
errorDialogCancel.setOnClickListener { dismiss() }
- errorDialogReport.setOnClickListener { openEmailClient(stringWriter.toString()) }
+ errorDialogReport.setOnClickListener {
+ openConfirmDialog { openEmailClient(stringWriter.toString()) }
+ }
errorDialogMessage.text = resources.getString(error)
errorDialogReport.isEnabled = when (error) {
is UnknownHostException,
@@ -88,6 +92,17 @@ class ErrorDialog : BaseDialogFragment() {
}
}
+ private fun openConfirmDialog(callback: () -> Unit) {
+ AlertDialog.Builder(requireContext())
+ .setTitle(R.string.dialog_error_check_update)
+ .setMessage(R.string.dialog_error_check_update_message)
+ .setNeutralButton(R.string.about_feedback) { _, _ -> callback() }
+ .setPositiveButton(R.string.dialog_error_check_update) { _, _ ->
+ requireContext().openAppInMarket(::showMessage)
+ }
+ .show()
+ }
+
private fun openEmailClient(content: String) {
requireContext().openEmailClient(
chooserTitle = getString(R.string.about_feedback),
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt
index 3828a2bc..d85d01e9 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt
@@ -14,6 +14,7 @@ import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.AppInfo
import io.github.wulkanowy.utils.getCompatDrawable
+import io.github.wulkanowy.utils.openAppInMarket
import io.github.wulkanowy.utils.openEmailClient
import io.github.wulkanowy.utils.openInternetBrowser
import javax.inject.Inject
@@ -98,8 +99,12 @@ class AboutFragment : BaseFragment(R.layout.fragment_about
}
}
+ override fun openAppInMarket() {
+ context?.openAppInMarket(::showMessage)
+ }
+
override fun openLogViewer() {
- if (appInfo.isDebug) (activity as? MainActivity)?.pushView(LogViewerFragment.newInstance())
+ (activity as? MainActivity)?.pushView(LogViewerFragment.newInstance())
}
override fun openDiscordInvite() {
@@ -115,7 +120,7 @@ class AboutFragment : BaseFragment(R.layout.fragment_about
chooserTitle = getString(R.string.about_feedback),
email = "wulkanowyinc@gmail.com",
subject = "Zgłoszenie błędu",
- body = requireContext().getString(R.string.about_feedback_template,
+ body = getString(R.string.about_feedback_template,
"${appInfo.systemManufacturer} ${appInfo.systemModel}", appInfo.systemVersion.toString(), appInfo.versionName
),
onActivityNotFound = {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt
index 27237ea6..ee892adf 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt
@@ -3,6 +3,7 @@ package io.github.wulkanowy.ui.modules.about
import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
+import io.github.wulkanowy.utils.AppInfo
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider
import timber.log.Timber
@@ -12,6 +13,7 @@ class AboutPresenter @Inject constructor(
schedulers: SchedulersProvider,
errorHandler: ErrorHandler,
studentRepository: StudentRepository,
+ private val appInfo: AppInfo,
private val analytics: FirebaseAnalyticsHelper
) : BasePresenter(errorHandler, studentRepository, schedulers) {
@@ -27,7 +29,8 @@ class AboutPresenter @Inject constructor(
when (name) {
versionRes?.first -> {
Timber.i("Opening log viewer")
- openLogViewer()
+ if (appInfo.isDebug) openLogViewer()
+ else openAppInMarket()
analytics.logEvent("about_open", "name" to "log_viewer")
}
feedbackRes?.first -> {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutView.kt
index 79b700ea..4c4b002f 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutView.kt
@@ -25,6 +25,8 @@ interface AboutView : BaseView {
fun updateData(data: List>)
+ fun openAppInMarket()
+
fun openLogViewer()
fun openDiscordInvite()
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
index 3a1fb0ce..437e06c9 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
@@ -215,7 +215,12 @@ class AttendancePresenter @Inject constructor(
showContent(it.isNotEmpty())
showExcuseButton(it.any { item -> item.excusable })
}
- analytics.logEvent("load_attendance", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "attendance",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading attendance result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt
index 72dfc327..33e18c2e 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt
@@ -99,7 +99,13 @@ class AttendanceSummaryPresenter @Inject constructor(
showContent(it.isNotEmpty())
updateDataSet(it)
}
- analytics.logEvent("load_attendance_summary", "items" to it.size, "force_refresh" to forceRefresh, "item_id" to subjectId)
+ analytics.logEvent(
+ "load_data",
+ "type" to "attendance_summary",
+ "items" to it.size,
+ "force_refresh" to forceRefresh,
+ "item_id" to subjectId
+ )
}) {
Timber.i("Loading attendance summary result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt
index 495602fc..1140cb02 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamPresenter.kt
@@ -8,7 +8,7 @@ import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
import io.github.wulkanowy.utils.isHolidays
import io.github.wulkanowy.utils.monday
@@ -110,7 +110,7 @@ class ExamPresenter @Inject constructor(
add(studentRepository.getCurrentStudent()
.flatMap { student ->
semesterRepository.getCurrentSemester(student).flatMap { semester ->
- examRepository.getExams(student, semester, currentDate.monday, currentDate.friday, forceRefresh)
+ examRepository.getExams(student, semester, currentDate.monday, currentDate.sunday, forceRefresh)
}
}
.map { createExamItems(it) }
@@ -131,7 +131,12 @@ class ExamPresenter @Inject constructor(
showErrorView(false)
showContent(it.isNotEmpty())
}
- analytics.logEvent("load_exam", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "exam",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading exam result: An exception occurred")
errorHandler.dispatch(it)
@@ -176,7 +181,7 @@ class ExamPresenter @Inject constructor(
showPreButton(!currentDate.minusDays(7).isHolidays)
showNextButton(!currentDate.plusDays(7).isHolidays)
updateNavigationWeek("${currentDate.monday.toFormattedString("dd.MM")} - " +
- currentDate.friday.toFormattedString("dd.MM"))
+ currentDate.sunday.toFormattedString("dd.MM"))
}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt
index 78885ebd..ec66e2bd 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt
@@ -133,6 +133,7 @@ class GradePresenter @Inject constructor(
}
private fun loadChild(index: Int, forceRefresh: Boolean = false) {
+ Timber.d("Load grade tab child. Selected semester: $selectedIndex, semesters: ${semesters.joinToString { it.semesterName.toString() }}")
semesters.first { it.semesterName == selectedIndex }.semesterId.also {
if (forceRefresh || loadedSemesterId[index] != it) {
Timber.i("Load grade child view index: $index")
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsAdapter.kt
index 7adab547..d5e05f3b 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsAdapter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsAdapter.kt
@@ -14,6 +14,7 @@ import io.github.wulkanowy.databinding.ItemGradeDetailsBinding
import io.github.wulkanowy.ui.base.BaseExpandableAdapter
import io.github.wulkanowy.utils.getBackgroundColor
import io.github.wulkanowy.utils.toFormattedString
+import timber.log.Timber
import javax.inject.Inject
class GradeDetailsAdapter @Inject constructor() : BaseExpandableAdapter() {
@@ -38,12 +39,26 @@ class GradeDetailsAdapter @Inject constructor() : BaseExpandableAdapter 1) {
+ Timber.e("Header with subject $subject found ${candidates.size} times! Items: $candidates, expanded: $expandedPosition")
+ }
+
+ return candidates.first()
}
fun updateHeaderItem(item: GradeDetailsItem) {
@@ -92,7 +107,7 @@ class GradeDetailsAdapter @Inject constructor() : BaseExpandableAdapter bindItemViewHolder(
binding = holder.binding,
grade = items[position].value as Grade,
- position = position
+ position = holder.adapterPosition
)
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt
index 26c22264..37f2c935 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt
@@ -43,7 +43,7 @@ class GradeDetailsPresenter @Inject constructor(
}
fun onGradeItemSelected(grade: Grade, position: Int) {
- Timber.i("Select grade item ${grade.id}")
+ Timber.i("Select grade item ${grade.id}, position: $position")
view?.apply {
showGradeDialog(grade, preferencesRepository.gradeColorTheme)
if (!grade.isRead) {
@@ -152,7 +152,12 @@ class GradeDetailsPresenter @Inject constructor(
gradeColorTheme = preferencesRepository.gradeColorTheme
)
}
- analytics.logEvent("load_grade_details", "items" to grades.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "grade_details",
+ "items" to grades.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading grade details result: An exception occurred")
errorHandler.dispatch(it)
@@ -171,19 +176,22 @@ class GradeDetailsPresenter @Inject constructor(
}
private fun createGradeItems(items: List): List {
- return items.filter { it.grades.isNotEmpty() }.map { (subject, average, points, _, grades) ->
- val subItems = grades.map {
- GradeDetailsItem(it, ViewType.ITEM)
- }
+ return items
+ .filter { it.grades.isNotEmpty() }
+ .sortedBy { it.subject }
+ .map { (subject, average, points, _, grades) ->
+ val subItems = grades
+ .sortedByDescending { it.date }
+ .map { GradeDetailsItem(it, ViewType.ITEM) }
- listOf(GradeDetailsItem(GradeDetailsHeader(
- subject = subject,
- average = average,
- pointsSum = points,
- newGrades = grades.filter { grade -> !grade.isRead }.size,
- grades = subItems
- ), ViewType.HEADER)) + if (preferencesRepository.isGradeExpandable) emptyList() else subItems
- }.flatten()
+ listOf(GradeDetailsItem(GradeDetailsHeader(
+ subject = subject,
+ average = average,
+ pointsSum = points,
+ newGrades = grades.filter { grade -> !grade.isRead }.size,
+ grades = subItems
+ ), ViewType.HEADER)) + if (preferencesRepository.isGradeExpandable) emptyList() else subItems
+ }.flatten()
}
private fun updateGrade(grade: Grade) {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt
index 5cc733cd..590e9ce1 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt
@@ -174,7 +174,12 @@ class GradeStatisticsPresenter @Inject constructor(
updateData(it, preferencesRepository.gradeColorTheme, preferencesRepository.showAllSubjectsOnStatisticsList)
showSubjects(!preferencesRepository.showAllSubjectsOnStatisticsList)
}
- analytics.logEvent("load_grade_statistics", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "grade_statistics",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading grade stats result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt
index 9b837213..9b88689d 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/summary/GradeSummaryPresenter.kt
@@ -49,7 +49,12 @@ class GradeSummaryPresenter @Inject constructor(
showErrorView(false)
updateData(it)
}
- analytics.logEvent("load_grade_summary", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "grade_summary",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading grade summary result: An exception occurred")
errorHandler.dispatch(it)
@@ -103,14 +108,8 @@ class GradeSummaryPresenter @Inject constructor(
}
private fun createGradeSummaryItems(items: List): List {
- return items.map {
- it.summary.copy(average = it.average)
- }
- }
-
- private fun checkEmpty(gradeSummary: GradeSummary, averages: List>): Boolean {
- return gradeSummary.run {
- finalGrade.isBlank() && predictedGrade.isBlank() && averages.singleOrNull { it.first == subject } == null
- }
+ return items
+ .sortedBy { it.subject }
+ .map { it.summary.copy(average = it.average) }
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt
index d39efde1..41735a23 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkPresenter.kt
@@ -8,7 +8,7 @@ import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider
-import io.github.wulkanowy.utils.friday
+import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
import io.github.wulkanowy.utils.isHolidays
import io.github.wulkanowy.utils.monday
@@ -124,7 +124,12 @@ class HomeworkPresenter @Inject constructor(
showErrorView(false)
showContent(it.isNotEmpty())
}
- analytics.logEvent("load_homework", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "homework",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading homework result: An exception occurred")
@@ -170,7 +175,7 @@ class HomeworkPresenter @Inject constructor(
showPreButton(!currentDate.minusDays(7).isHolidays)
showNextButton(!currentDate.plusDays(7).isHolidays)
updateNavigationWeek("${currentDate.monday.toFormattedString("dd.MM")} - " +
- currentDate.friday.toFormattedString("dd.MM"))
+ currentDate.sunday.toFormattedString("dd.MM"))
}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/login/recover/LoginRecoverFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/login/recover/LoginRecoverFragment.kt
index 97e45be9..e27c845a 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/login/recover/LoginRecoverFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/login/recover/LoginRecoverFragment.kt
@@ -22,6 +22,10 @@ import javax.inject.Inject
class LoginRecoverFragment :
BaseFragment(R.layout.fragment_login_recover), LoginRecoverView {
+ private var _binding: FragmentLoginRecoverBinding? = null
+
+ private val bindingLocal: FragmentLoginRecoverBinding get() = _binding!!
+
@Inject
lateinit var presenter: LoginRecoverPresenter
@@ -36,13 +40,13 @@ class LoginRecoverFragment :
private lateinit var hostSymbols: Array
override val recoverHostValue: String
- get() = hostValues.getOrNull(hostKeys.indexOf(binding.loginRecoverHost.text.toString())).orEmpty()
+ get() = hostValues.getOrNull(hostKeys.indexOf(bindingLocal.loginRecoverHost.text.toString())).orEmpty()
override val formHostSymbol: String
- get() = hostSymbols.getOrNull(hostKeys.indexOf(binding.loginRecoverHost.text.toString())).orEmpty()
+ get() = hostSymbols.getOrNull(hostKeys.indexOf(bindingLocal.loginRecoverHost.text.toString())).orEmpty()
override val recoverNameValue: String
- get() = binding.loginRecoverName.text.toString().trim()
+ get() = bindingLocal.loginRecoverName.text.toString().trim()
override val emailHintString: String
get() = getString(R.string.login_email_hint)
@@ -55,7 +59,7 @@ class LoginRecoverFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- binding = FragmentLoginRecoverBinding.bind(view)
+ _binding = FragmentLoginRecoverBinding.bind(view)
presenter.onAttachView(this)
}
@@ -64,7 +68,7 @@ class LoginRecoverFragment :
hostValues = resources.getStringArray(R.array.hosts_values)
hostSymbols = resources.getStringArray(R.array.hosts_symbols)
- with(binding) {
+ with(bindingLocal) {
loginRecoverWebView.setBackgroundColor(Color.TRANSPARENT)
loginRecoverName.doOnTextChanged { _, _, _, _ -> presenter.onNameTextChanged() }
loginRecoverHost.setOnItemClickListener { _, _, _, _ -> presenter.onHostSelected() }
@@ -74,69 +78,69 @@ class LoginRecoverFragment :
loginRecoverLogin.setOnClickListener { (activity as LoginActivity).switchView(0) }
}
- with(binding.loginRecoverHost) {
+ with(bindingLocal.loginRecoverHost) {
setText(hostKeys.getOrNull(0).orEmpty())
setAdapter(LoginSymbolAdapter(context, R.layout.support_simple_spinner_dropdown_item, hostKeys))
- setOnClickListener { if (binding.loginRecoverFormContainer.visibility == GONE) dismissDropDown() }
+ setOnClickListener { if (bindingLocal.loginRecoverFormContainer.visibility == GONE) dismissDropDown() }
}
}
override fun setDefaultCredentials(username: String) {
- binding.loginRecoverName.setText(username)
+ bindingLocal.loginRecoverName.setText(username)
}
override fun setErrorNameRequired() {
- with(binding.loginRecoverNameLayout) {
+ with(bindingLocal.loginRecoverNameLayout) {
requestFocus()
error = getString(R.string.login_field_required)
}
}
override fun setUsernameHint(hint: String) {
- binding.loginRecoverNameLayout.hint = hint
+ bindingLocal.loginRecoverNameLayout.hint = hint
}
override fun setUsernameError(message: String) {
- with(binding.loginRecoverNameLayout) {
+ with(bindingLocal.loginRecoverNameLayout) {
requestFocus()
error = message
}
}
override fun clearUsernameError() {
- binding.loginRecoverNameLayout.error = null
+ bindingLocal.loginRecoverNameLayout.error = null
}
override fun showProgress(show: Boolean) {
- binding.loginRecoverProgress.visibility = if (show) VISIBLE else GONE
+ bindingLocal.loginRecoverProgress.visibility = if (show) VISIBLE else GONE
}
override fun showRecoverForm(show: Boolean) {
- binding.loginRecoverFormContainer.visibility = if (show) VISIBLE else GONE
+ bindingLocal.loginRecoverFormContainer.visibility = if (show) VISIBLE else GONE
}
override fun showCaptcha(show: Boolean) {
- binding.loginRecoverCaptchaContainer.visibility = if (show) VISIBLE else GONE
+ bindingLocal.loginRecoverCaptchaContainer.visibility = if (show) VISIBLE else GONE
}
override fun showErrorView(show: Boolean) {
- binding.loginRecoverError.visibility = if (show) VISIBLE else GONE
+ bindingLocal.loginRecoverError.visibility = if (show) VISIBLE else GONE
}
override fun setErrorDetails(message: String) {
- binding.loginRecoverErrorMessage.text = message
+ bindingLocal.loginRecoverErrorMessage.text = message
}
override fun showSuccessView(show: Boolean) {
- binding.loginRecoverSuccess.visibility = if (show) VISIBLE else GONE
+ bindingLocal.loginRecoverSuccess.visibility = if (show) VISIBLE else GONE
}
override fun setSuccessTitle(title: String) {
- binding.loginRecoverSuccessTitle.text = title
+ bindingLocal.loginRecoverSuccessTitle.text = title
}
override fun setSuccessMessage(message: String) {
- binding.loginRecoverSuccessMessage.text = message
+ bindingLocal.loginRecoverSuccessMessage.text = message
}
override fun showSoftKeyboard() {
@@ -157,7 +161,7 @@ class LoginRecoverFragment :
callback:e =>Android.captchaCallback(e)})
""".trimIndent()
- with(binding.loginRecoverWebView) {
+ with(bindingLocal.loginRecoverWebView) {
settings.javaScriptEnabled = true
webViewClient = object : WebViewClient() {
private var recoverWebViewSuccess: Boolean = true
@@ -197,6 +201,8 @@ class LoginRecoverFragment :
}
override fun onDestroyView() {
+ bindingLocal.loginRecoverWebView.destroy()
+ _binding = null
presenter.onDetachView()
super.onDestroyView()
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/LuckyNumberPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/LuckyNumberPresenter.kt
index 1d3a17bd..e932fedc 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/LuckyNumberPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/LuckyNumberPresenter.kt
@@ -54,7 +54,12 @@ class LuckyNumberPresenter @Inject constructor(
showEmpty(false)
showErrorView(false)
}
- analytics.logEvent("load_lucky_number", "lucky_number" to it.luckyNumber, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_item",
+ "type" to "lucky_number",
+ "number" to it.luckyNumber,
+ "force_refresh" to forceRefresh
+ )
}, {
Timber.i("Loading lucky number result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt
index 9ce19079..f5b7c47c 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt
@@ -31,6 +31,7 @@ import io.github.wulkanowy.ui.modules.message.MessageFragment
import io.github.wulkanowy.ui.modules.more.MoreFragment
import io.github.wulkanowy.ui.modules.note.NoteFragment
import io.github.wulkanowy.ui.modules.timetable.TimetableFragment
+import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.dpToPx
import io.github.wulkanowy.utils.getThemeAttrColor
import io.github.wulkanowy.utils.safelyPopFragments
@@ -46,6 +47,9 @@ class MainActivity : BaseActivity(), MainVie
@Inject
lateinit var navController: FragNavController
+ @Inject
+ lateinit var analytics: FirebaseAnalyticsHelper
+
@Inject
lateinit var overlayProvider: Lazy
@@ -136,6 +140,10 @@ class MainActivity : BaseActivity(), MainVie
}
}
+ override fun setCurrentScreen(name: String?) {
+ analytics.setCurrentScreen(this, name)
+ }
+
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
return if (item?.itemId == R.id.mainMenuAccount) presenter.onAccountManagerSelected()
else false
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt
index f5a49004..233d4491 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt
@@ -37,8 +37,9 @@ class MainPresenter @Inject constructor(
analytics.logEvent("app_open", "destination" to initMenu?.name)
}
- fun onViewChange(section: MainView.Section?) {
+ fun onViewChange(section: MainView.Section?, name: String?) {
view?.apply {
+ setCurrentScreen(name)
showActionBarElevation(section != GRADE && section != MESSAGE && section != SCHOOL)
currentViewTitle?.let { setViewTitle(it) }
currentViewSubtitle?.let { setViewSubTitle(it.ifBlank { null }) }
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt
index 97b556e3..7e583147 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainView.kt
@@ -24,6 +24,8 @@ interface MainView : BaseView {
fun showAccountPicker()
+ fun setCurrentScreen(name: String?)
+
fun showActionBarElevation(show: Boolean)
fun notifyMenuViewReselected()
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt
index 62ac5a53..24678c70 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/preview/MessagePreviewPresenter.kt
@@ -60,7 +60,11 @@ class MessagePreviewPresenter @Inject constructor(
setMessageWithAttachment(message)
initOptions()
}
- analytics.logEvent("load_message_preview", "length" to message.message.content.length)
+ analytics.logEvent(
+ "load_item",
+ "type" to "message_preview",
+ "length" to message.message.content.length
+ )
}) {
Timber.i("Loading message ${message.messageId} preview result: An exception occurred ")
retryCallback = { onMessageLoadRetry(message) }
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabAdapter.kt
index a889dfef..6064f10a 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabAdapter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabAdapter.kt
@@ -77,7 +77,7 @@ class MessageTabAdapter @Inject constructor() :
}
messageItemAttachmentIcon.visibility = if (item.hasAttachments) View.VISIBLE else View.GONE
- root.setOnClickListener { onClickListener(item, position) }
+ root.setOnClickListener { onClickListener(item, holder.adapterPosition) }
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt
index f96fb6c2..221762d1 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt
@@ -64,7 +64,7 @@ class MessageTabPresenter @Inject constructor(
}
fun onMessageItemSelected(message: Message, position: Int) {
- Timber.i("Select message ${message.id} item")
+ Timber.i("Select message ${message.id} item (position: $position)")
view?.run {
openMessage(message)
if (message.unread) {
@@ -97,7 +97,12 @@ class MessageTabPresenter @Inject constructor(
Timber.i("Loading $folder message result: Success")
messages = it
onSearchQueryTextChange(lastSearchQuery)
- analytics.logEvent("load_messages", "items" to it.size, "folder" to folder.name)
+ analytics.logEvent(
+ "load_data",
+ "type" to "messages",
+ "items" to it.size,
+ "folder" to folder.name
+ )
}) {
Timber.i("Loading $folder message result: An exception occurred")
errorHandler.dispatch(it)
@@ -132,6 +137,8 @@ class MessageTabPresenter @Inject constructor(
}
}
+ Timber.d("Applying filter. Full list: ${messages.size}, filtered: ${filteredList.size}")
+
updateData(filteredList)
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/mobiledevice/MobileDevicePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/mobiledevice/MobileDevicePresenter.kt
index d8c99b22..459ca17e 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/mobiledevice/MobileDevicePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/mobiledevice/MobileDevicePresenter.kt
@@ -70,7 +70,12 @@ class MobileDevicePresenter @Inject constructor(
showEmpty(it.isEmpty())
showErrorView(false)
}
- analytics.logEvent("load_devices", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "devices",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading mobile devices result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt
index 00df71b9..7d301c66 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NotePresenter.kt
@@ -69,7 +69,12 @@ class NotePresenter @Inject constructor(
showErrorView(false)
showContent(it.isNotEmpty())
}
- analytics.logEvent("load_note", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "note",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}, {
Timber.i("Loading note result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/school/SchoolPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/school/SchoolPresenter.kt
index e2eb614d..7beff922 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/school/SchoolPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/school/SchoolPresenter.kt
@@ -88,7 +88,11 @@ class SchoolPresenter @Inject constructor(
showEmpty(false)
showErrorView(false)
}
- analytics.logEvent("load_school", "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_item",
+ "type" to "school",
+ "force_refresh" to forceRefresh
+ )
}, {
Timber.i("Loading school result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/teacher/TeacherPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/teacher/TeacherPresenter.kt
index e888308f..0d8eec6d 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/teacher/TeacherPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolandteachers/teacher/TeacherPresenter.kt
@@ -75,7 +75,12 @@ class TeacherPresenter @Inject constructor(
showEmpty(it.isEmpty())
showErrorView(false)
}
- analytics.logEvent("load_teachers", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "teachers",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading teachers result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsFragment.kt
index 0d1d2565..248417fd 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsFragment.kt
@@ -7,6 +7,7 @@ import androidx.appcompat.app.AlertDialog
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import com.thelittlefireman.appkillermanager.AppKillerManager
+import com.thelittlefireman.appkillermanager.exceptions.NoActionFoundException
import com.yariksoffice.lingver.Lingver
import dagger.android.support.AndroidSupportInjection
import io.github.wulkanowy.R
@@ -14,6 +15,7 @@ import io.github.wulkanowy.ui.base.BaseActivity
import io.github.wulkanowy.ui.base.ErrorDialog
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.AppInfo
+import io.github.wulkanowy.utils.openInternetBrowser
import javax.inject.Inject
class SettingsFragment : PreferenceFragmentCompat(),
@@ -133,9 +135,13 @@ class SettingsFragment : PreferenceFragmentCompat(),
.setMessage(R.string.pref_notify_fix_sync_issues_message)
.setNegativeButton(android.R.string.cancel) { _, _ -> }
.setPositiveButton(R.string.pref_notify_fix_sync_issues_settings_button) { _, _ ->
- AppKillerManager.doActionPowerSaving(requireContext())
- AppKillerManager.doActionAutoStart(requireContext())
- AppKillerManager.doActionNotification(requireContext())
+ try {
+ AppKillerManager.doActionPowerSaving(requireContext())
+ AppKillerManager.doActionAutoStart(requireContext())
+ AppKillerManager.doActionNotification(requireContext())
+ } catch (e: NoActionFoundException) {
+ requireContext().openInternetBrowser("https://dontkillmyapp.com/${AppKillerManager.getDevice()?.manufacturer}", ::showMessage)
+ }
}
.show()
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt
index 5354442a..85ded202 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt
@@ -132,41 +132,46 @@ class TimetableAdapter @Inject constructor() : RecyclerView.Adapter {
+ isShowTimeUntil -> {
Timber.d("Show time until lesson: $position")
timetableItemTimeLeft.visibility = GONE
with(timetableItemTimeUntil) {
visibility = VISIBLE
text = context.getString(R.string.timetable_time_until,
- if (lesson.until.seconds <= 60) {
- context.getString(R.string.timetable_seconds, lesson.until.seconds.toString(10))
+ if (until.seconds <= 60) {
+ context.getString(R.string.timetable_seconds, until.seconds.toString(10))
} else {
- context.getString(R.string.timetable_minutes, lesson.until.toMinutes().toString(10))
+ context.getString(R.string.timetable_minutes, until.toMinutes().toString(10))
}
)
}
}
// after lesson start
- lesson.left != null -> {
+ left != null -> {
Timber.d("Show time left lesson: $position")
timetableItemTimeUntil.visibility = GONE
with(timetableItemTimeLeft) {
visibility = VISIBLE
text = context.getString(
R.string.timetable_time_left,
- if (lesson.left!!.seconds < 60) {
- context.getString(R.string.timetable_seconds, lesson.left?.seconds?.toString(10))
+ if (left.seconds < 60) {
+ context.getString(R.string.timetable_seconds, left.seconds.toString(10))
} else {
- context.getString(R.string.timetable_minutes, lesson.left?.toMinutes()?.toString(10))
+ context.getString(R.string.timetable_minutes, left.toMinutes().toString(10))
}
)
}
}
// right after lesson finish
- lesson.isJustFinished -> {
+ isJustFinished -> {
Timber.d("Show just finished lesson: $position")
timetableItemTimeUntil.visibility = GONE
timetableItemTimeLeft.visibility = VISIBLE
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt
index 50c12364..e1ce005e 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt
@@ -154,7 +154,12 @@ class TimetablePresenter @Inject constructor(
showErrorView(false)
showContent(it.isNotEmpty())
}
- analytics.logEvent("load_timetable", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "timetable",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading timetable result: An exception occurred")
errorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt
index 355411eb..7243061d 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt
@@ -134,7 +134,12 @@ class CompletedLessonsPresenter @Inject constructor(
showErrorView(false)
showContent(it.isNotEmpty())
}
- analytics.logEvent("load_completed_lessons", "items" to it.size, "force_refresh" to forceRefresh)
+ analytics.logEvent(
+ "load_data",
+ "type" to "completed_lessons",
+ "items" to it.size,
+ "force_refresh" to forceRefresh
+ )
}) {
Timber.i("Loading completed lessons result: An exception occurred")
completedLessonsErrorHandler.dispatch(it)
diff --git a/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt
index 489e7e6f..2b40cb47 100644
--- a/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt
+++ b/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt
@@ -10,7 +10,7 @@ import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils
-import io.github.wulkanowy.R
+import io.github.wulkanowy.BuildConfig.APPLICATION_ID
@ColorInt
fun Context.getThemeAttrColor(@AttrRes colorAttr: Int): Int {
@@ -39,6 +39,12 @@ fun Context.openInternetBrowser(uri: String, onActivityNotFound: (uri: String) -
}
}
+fun Context.openAppInMarket(onActivityNotFound: (uri: String) -> Unit) {
+ openInternetBrowser("market://details?id=${APPLICATION_ID}") {
+ openInternetBrowser("https://github.com/wulkanowy/wulkanowy/releases", onActivityNotFound)
+ }
+}
+
fun Context.openEmailClient(chooserTitle: String, email: String, subject: String, body: String, onActivityNotFound: () -> Unit = {}) {
val intent = Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:")).apply {
putExtra(Intent.EXTRA_EMAIL, arrayOf(email))
diff --git a/app/src/main/java/io/github/wulkanowy/utils/FragNavControlerExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/FragNavControlerExtension.kt
index 9cec331f..9dc1e18a 100644
--- a/app/src/main/java/io/github/wulkanowy/utils/FragNavControlerExtension.kt
+++ b/app/src/main/java/io/github/wulkanowy/utils/FragNavControlerExtension.kt
@@ -4,14 +4,14 @@ import androidx.fragment.app.Fragment
import com.ncapdevi.fragnav.FragNavController
import io.github.wulkanowy.ui.modules.main.MainView
-inline fun FragNavController.setOnViewChangeListener(crossinline listener: (section: MainView.Section?) -> Unit) {
+inline fun FragNavController.setOnViewChangeListener(crossinline listener: (section: MainView.Section?, name: String?) -> Unit) {
transactionListener = object : FragNavController.TransactionListener {
override fun onFragmentTransaction(fragment: Fragment?, transactionType: FragNavController.TransactionType) {
- listener(fragment?.toSection())
+ listener(fragment?.toSection(), fragment?.let { it::class.java.simpleName })
}
override fun onTabTransaction(fragment: Fragment?, index: Int) {
- listener(fragment?.toSection())
+ listener(fragment?.toSection(), fragment?.let { it::class.java.simpleName })
}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/utils/SchooldaysRangeLimiter.kt b/app/src/main/java/io/github/wulkanowy/utils/SchooldaysRangeLimiter.kt
index 922aafbd..46a707ab 100644
--- a/app/src/main/java/io/github/wulkanowy/utils/SchooldaysRangeLimiter.kt
+++ b/app/src/main/java/io/github/wulkanowy/utils/SchooldaysRangeLimiter.kt
@@ -17,7 +17,7 @@ class SchooldaysRangeLimiter : DateRangeLimiter {
override fun isOutOfRange(year: Int, month: Int, day: Int): Boolean {
val date = LocalDate.of(year, month + 1, day)
val dayOfWeek = date.dayOfWeek
- return dayOfWeek == DayOfWeek.SUNDAY || dayOfWeek == DayOfWeek.SATURDAY || date.isHolidays
+ return dayOfWeek == DayOfWeek.SUNDAY || date.isHolidays
}
override fun getStartDate(): Calendar {
diff --git a/app/src/main/java/io/github/wulkanowy/utils/TimeExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/TimeExtension.kt
index 8d022fc5..802b2ee0 100644
--- a/app/src/main/java/io/github/wulkanowy/utils/TimeExtension.kt
+++ b/app/src/main/java/io/github/wulkanowy/utils/TimeExtension.kt
@@ -92,8 +92,8 @@ inline val LocalDate.weekDayName: String
inline val LocalDate.monday: LocalDate
get() = with(MONDAY)
-inline val LocalDate.friday: LocalDate
- get() = with(FRIDAY)
+inline val LocalDate.sunday: LocalDate
+ get() = with(SUNDAY)
/**
* [Dz.U. 2016 poz. 1335](http://prawo.sejm.gov.pl/isap.nsf/DocDetails.xsp?id=WDU20160001335)
diff --git a/app/src/main/play/release-notes/pl-PL/default.txt b/app/src/main/play/release-notes/pl-PL/default.txt
index 427ad4dc..d61f1b97 100644
--- a/app/src/main/play/release-notes/pl-PL/default.txt
+++ b/app/src/main/play/release-notes/pl-PL/default.txt
@@ -1,10 +1,8 @@
-Wersja 0.18.0
-- naprawiliśmy odświeżanie zadań domowych
-- naprawiliśmy powiadomienia na androidzie 8.0
-- oceny powinny się teraz odświeżać trochę szybciej
-- dodaliśmy tryb pełnoekranowy w zadaniach
-- dodaliśmy wyszukiwanie w wiadomościach
-- dodaliśmy opcje oznaczania bieżącej lekcji na planie/w powiadomieniu (domyślnie wyłączone)
-- dodaliśmy testową opcję naprawy powiadomień na np. Huawei, Xiaomi (znajdziesz ją w ustawieniach)
+Wersja 0.18.1
+- naprawiliśmy sortowanie w ocenach
+- naprawilismy wiele problemów ze stabilnością
+- nazwy opcji w ustawieniach nie są już ucięte
+- w zadaniach domowych wyświetlają się teraz pozycje na weekend
+- wyłączyliśmy logowanie przez token (bo nie działa i nie wiadomo kiedy będzie działać)
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases
diff --git a/app/src/main/res/layout/fragment_attendance.xml b/app/src/main/res/layout/fragment_attendance.xml
index cd8b6036..39b00d30 100644
--- a/app/src/main/res/layout/fragment_attendance.xml
+++ b/app/src/main/res/layout/fragment_attendance.xml
@@ -153,8 +153,8 @@
android:background="?selectableItemBackgroundBorderless"
android:fontFamily="sans-serif"
android:gravity="center"
- android:text="@string/app_name"
- android:textSize="16sp" />
+ android:textSize="16sp"
+ tools:text="@tools:sample/date/ddmmyy" />
+ android:textSize="16sp"
+ tools:text="@tools:sample/date/ddmmyy" />
+ android:textSize="16sp"
+ tools:text="@tools:sample/date/ddmmyy" />
@@ -78,7 +77,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
- android:layout_marginLeft="8dp"
android:layout_weight="1"
android:text="@string/about_faq"
app:icon="@drawable/ic_about_faq" />
@@ -182,7 +180,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
- android:layout_marginRight="24dp"
android:text="@string/login_recover_button"
android:textAppearance="?android:textAppearance"
app:backgroundTint="?android:windowBackground"
@@ -223,9 +220,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
- android:layout_marginRight="16dp"
android:text="@string/login_advanced"
android:textAppearance="?android:textAppearance"
+ android:visibility="gone"
app:backgroundTint="?android:windowBackground"
app:fontFamily="sans-serif-medium"
app:layout_constraintBottom_toBottomOf="@id/loginFormSignIn"
@@ -241,7 +238,6 @@
android:layout_gravity="center_vertical"
android:layout_marginTop="48dp"
android:layout_marginEnd="24dp"
- android:layout_marginRight="24dp"
android:layout_marginBottom="16dp"
android:text="@string/login_sign_in"
app:layout_constraintBottom_toBottomOf="parent"
diff --git a/app/src/main/res/layout/fragment_timetable.xml b/app/src/main/res/layout/fragment_timetable.xml
index 98ccabbf..533af2fa 100644
--- a/app/src/main/res/layout/fragment_timetable.xml
+++ b/app/src/main/res/layout/fragment_timetable.xml
@@ -139,8 +139,8 @@
android:background="?selectableItemBackgroundBorderless"
android:fontFamily="sans-serif"
android:gravity="center"
- android:text="@string/app_name"
- android:textSize="16sp" />
+ android:textSize="16sp"
+ tools:text="@tools:sample/date/ddmmyy" />
+ app:srcCompat="@drawable/ic_chevron_left" />
+ android:textSize="16sp"
+ tools:text="@tools:sample/date/ddmmyy" />
+ app:srcCompat="@drawable/ic_chevron_right" />
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index f92186c4..4b166937 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -1,6 +1,5 @@
- Wulkanowy
Anmelden
Wulkanowy
@@ -270,6 +269,9 @@
Logs teilen
Aktualisieren
+
+ Check for updates
+ Before reporting a bug, check first if an update with the bug fix is available
Inhalt
Wiederhol
diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
index 6bf0c324..7f25d8a6 100644
--- a/app/src/main/res/values-pl/strings.xml
+++ b/app/src/main/res/values-pl/strings.xml
@@ -1,6 +1,5 @@
- Wulkanowy
Logowanie
Wulkanowy
@@ -48,7 +47,7 @@
Nie znaleziono ucznia. Sprawdź symbol
To pole jest wymagane
Wybrany uczeń jest już zalogowany
- Symbol znajdziesz na stronie dziennika w Uczeń → Dostęp Mobilny → Zarejestruj urządzenie mobilne
+ Symbol znajdziesz na stronie dziennika w Uczeń → Dostęp Mobilny → Zarejestruj urządzenie mobilne.\n\nUpewnij się, że w polu Dziennik UONET+ na poprzednim ekranie został ustawiony odpowiedni dziennik
Wybierz uczniów do zalogowania w aplikacji
Inne opcje
W tym trybie nie działa szczęśliwy numerek, uczeń na tle klasy, podsumowanie frekwencji, usprawiedliwianie nieobecności, lekcje zrealizowane, informacje o szkole i podgląd listy zarejestrowanych urządzeń
@@ -290,6 +289,9 @@
Udostępnij logi
Odśwież
+
+ Sprawdź dostępność aktualizacji
+ Przed zgłoszeniem błędu sprawdź wcześniej, czy dostępna jest już aktualizacja z poprawką błędu
Treść
Ponów
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index c0666e2c..c0c75196 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -1,6 +1,5 @@
- Wulkanowy
Авторизация
Wulkanowy
@@ -121,14 +120,14 @@
Часы
Изменения
Нет уроков в данный день
- %s min
- %s sec
- %1$s left
- in %1$s
- Finished
- Now: %s
- Next: %s
- Later: %s
+ %s мин
+ %s сек
+ %1$s осталось
+ через %1$s
+ Окончен
+ Сейчас: %s
+ Следующий: %s
+ Позже: %s
Проведённые уроки
Просмотреть проведённые уроки
@@ -290,6 +289,9 @@
Поделиться логами
Обновить
+
+ Check for updates
+ Before reporting a bug, check first if an update with the bug fix is available
Содержание
Повторить
@@ -306,8 +308,8 @@
Предмет
Предыдущий
Следующий
- Search
- Search...
+ Поиск
+ Поиск...
Нет уроков
Выбрать тему
@@ -322,17 +324,17 @@
Показывать присутствия в посещаемости
Тема приложения
Больше оценок
- Mark current lesson in timetable
- Show chart list in class grades
+ Отмечать текущий урок в расписании
+ Показывать диаграммы в оценках класса
Показать уроки всего класса
Схема цветов оценок
Язык приложения
Уведомления
Показывать уведомления
- Show upcoming lesson notifications
- Fix synchronization & notifications issues
- Your device may have data synchronization issues and with notifications.\n\nTo fix them, you need to add Wulkanowy to the autostart and turn off battery optimization/saving in the phone settings.
- Go to settings
+ Показывать уведомления о будущих уроках
+ Исправить проблемы с синхронизацией и уведомлениями
+ На вашем устройстве могут быть проблемы с синхронизацией данных и уведомлениями.\n\nЧтобы их исправить, вам необходимо добавить Wulkanowy в авто-старт и выключить оптимизацию/экономию батареи в настройках устройства.
+ Перейти в настройски
Показывать дебаг-уведомления
Синхронизация
Автоматическая синхронизация
@@ -358,7 +360,7 @@
Новые сообщения
Новые заметки
Показывать push-уведомления
- Upcoming lessons
+ Будущие уроки
Дебаг
Чёрный
diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml
index 8a991812..a63e5682 100644
--- a/app/src/main/res/values-uk/strings.xml
+++ b/app/src/main/res/values-uk/strings.xml
@@ -1,6 +1,5 @@
- Wulkanowy
Авторизація
Wulkanowy
@@ -290,6 +289,9 @@
Поділитися логами
Оновити
+
+ Check for updates
+ Before reporting a bug, check first if an update with the bug fix is available
Зміст
Повторити
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6e08fded..7793cd9c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,9 +1,5 @@
-
- Wulkanowy
-
-
Login
Wulkanowy
@@ -321,6 +317,11 @@
Refresh
+
+ Check for updates
+ Before reporting a bug, check first if an update with the bug fix is available
+
+
Content
Retry
diff --git a/app/src/main/res/xml/scheme_preferences.xml b/app/src/main/res/xml/scheme_preferences.xml
index c05910f9..4cdb989c 100644
--- a/app/src/main/res/xml/scheme_preferences.xml
+++ b/app/src/main/res/xml/scheme_preferences.xml
@@ -38,6 +38,7 @@
app:defaultValue="@bool/pref_default_grade_statistics_list"
app:iconSpaceReserved="false"
app:key="@string/pref_key_grade_statistics_list"
+ app:singleLineTitle="false"
app:title="@string/pref_view_grade_statistics_list" />
diff --git a/app/src/play/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt b/app/src/play/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
index e374577d..e87177c1 100644
--- a/app/src/play/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
+++ b/app/src/play/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
@@ -6,20 +6,14 @@ import fr.bipi.tressence.base.FormatterPriorityTree
import fr.bipi.tressence.common.StackTraceRecorder
import io.github.wulkanowy.sdk.exception.FeatureDisabledException
import io.github.wulkanowy.sdk.exception.FeatureNotAvailableException
+import java.io.InterruptedIOException
+import java.net.SocketTimeoutException
import java.net.UnknownHostException
class CrashlyticsTree : FormatterPriorityTree(Log.VERBOSE) {
private val crashlytics by lazy { FirebaseCrashlytics.getInstance() }
- override fun skipLog(priority: Int, tag: String?, message: String, t: Throwable?): Boolean {
- if (t is FeatureDisabledException || t is FeatureNotAvailableException || t is UnknownHostException) {
- return true
- }
-
- return super.skipLog(priority, tag, message, t)
- }
-
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (skipLog(priority, tag, message, t)) return
@@ -31,6 +25,14 @@ class CrashlyticsExceptionTree : FormatterPriorityTree(Log.ERROR) {
private val crashlytics by lazy { FirebaseCrashlytics.getInstance() }
+ override fun skipLog(priority: Int, tag: String?, message: String, t: Throwable?): Boolean {
+ if (t is FeatureDisabledException || t is FeatureNotAvailableException || t is UnknownHostException || t is SocketTimeoutException || t is InterruptedIOException) {
+ return true
+ }
+
+ return super.skipLog(priority, tag, message, t)
+ }
+
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (skipLog(priority, tag, message, t)) return
diff --git a/app/src/play/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt b/app/src/play/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
index 6810e66a..b0b2fda4 100644
--- a/app/src/play/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
+++ b/app/src/play/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
@@ -1,5 +1,6 @@
package io.github.wulkanowy.utils
+import android.app.Activity
import android.content.Context
import android.os.Bundle
import com.google.firebase.analytics.FirebaseAnalytics
@@ -24,4 +25,8 @@ class FirebaseAnalyticsHelper @Inject constructor(private val context: Context)
analytics.logEvent(name, this)
}
}
+
+ fun setCurrentScreen(activity: Activity, name: String?) {
+ analytics.setCurrentScreen(activity, name, null)
+ }
}
diff --git a/app/src/test/java/io/github/wulkanowy/utils/TimeExtensionTest.kt b/app/src/test/java/io/github/wulkanowy/utils/TimeExtensionTest.kt
index 024b4727..72d08c41 100644
--- a/app/src/test/java/io/github/wulkanowy/utils/TimeExtensionTest.kt
+++ b/app/src/test/java/io/github/wulkanowy/utils/TimeExtensionTest.kt
@@ -38,12 +38,12 @@ class TimeExtensionTest {
}
@Test
- fun fridayTest() {
- assertEquals(of(2018, 10, 5), of(2018, 10, 2).friday)
- assertEquals(of(2018, 10, 5), of(2018, 10, 5).friday)
- assertEquals(of(2018, 10, 5), of(2018, 10, 6).friday)
- assertEquals(of(2018, 10, 5), of(2018, 10, 7).friday)
- assertEquals(of(2018, 10, 12), of(2018, 10, 8).friday)
+ fun sundayTestTest() {
+ assertEquals(of(2018, 10, 7), of(2018, 10, 2).sunday)
+ assertEquals(of(2018, 10, 7), of(2018, 10, 5).sunday)
+ assertEquals(of(2018, 10, 7), of(2018, 10, 6).sunday)
+ assertEquals(of(2018, 10, 7), of(2018, 10, 7).sunday)
+ assertEquals(of(2018, 10, 14), of(2018, 10, 8).sunday)
}
@Test
diff --git a/build.gradle b/build.gradle
index 2b92bc7d..696e778f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,6 @@
buildscript {
ext.kotlin_version = '1.3.72'
- ext.about_libraries = '8.1.2'
+ ext.about_libraries = '8.1.3'
repositories {
mavenCentral()
google()
@@ -11,7 +11,7 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.3.3'
- classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.0'
+ classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
classpath "com.github.triplet.gradle:play-publisher:2.7.5"
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8"
classpath "gradle.plugin.com.star-zero.gradle:githook:1.2.0"