Compare commits
13 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c4672b8de9 | ||
![]() |
1b40e339b7 | ||
![]() |
ee5ac46493 | ||
![]() |
ef398f7409 | ||
![]() |
5331bf90cd | ||
![]() |
a495fcbc5f | ||
![]() |
f11354dd35 | ||
![]() |
4bb1198735 | ||
![]() |
3eb74da945 | ||
![]() |
5161fdd543 | ||
![]() |
377e0c3a0d | ||
![]() |
1c9860091a | ||
![]() |
a383f7409d |
21 changed files with 2613 additions and 45 deletions
|
@ -23,8 +23,8 @@ android {
|
|||
testApplicationId "io.github.tests.wulkanowy"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
versionCode 119
|
||||
versionName "1.9.0"
|
||||
versionCode 121
|
||||
versionName "1.9.2"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
resValue "string", "app_name", "Wulkanowy"
|
||||
|
@ -161,8 +161,8 @@ play {
|
|||
defaultToAppBundles = false
|
||||
track = 'production'
|
||||
releaseStatus = com.github.triplet.gradle.androidpublisher.ReleaseStatus.IN_PROGRESS
|
||||
userFraction = 0.10d
|
||||
updatePriority = 1
|
||||
userFraction = 0.50d
|
||||
updatePriority = 2
|
||||
enabled.set(false)
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation "io.github.wulkanowy:sdk:1.9.0"
|
||||
implementation "io.github.wulkanowy:sdk:1.9.2"
|
||||
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.8'
|
||||
|
||||
|
@ -246,6 +246,7 @@ dependencies {
|
|||
playImplementation 'com.google.firebase:firebase-analytics-ktx'
|
||||
playImplementation 'com.google.firebase:firebase-messaging:'
|
||||
playImplementation 'com.google.firebase:firebase-crashlytics:'
|
||||
playImplementation 'com.google.firebase:firebase-config-ktx'
|
||||
playImplementation 'com.google.android.play:core:1.10.3'
|
||||
playImplementation 'com.google.android.play:core-ktx:1.8.1'
|
||||
playImplementation 'com.google.android.gms:play-services-ads:21.4.0'
|
||||
|
@ -264,7 +265,7 @@ dependencies {
|
|||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines"
|
||||
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
||||
|
||||
testImplementation 'org.robolectric:robolectric:4.9.1'
|
||||
testImplementation 'org.robolectric:robolectric:4.9.2'
|
||||
testImplementation "androidx.test:runner:1.5.1"
|
||||
testImplementation "androidx.test.ext:junit:1.1.4"
|
||||
testImplementation "androidx.test:core:1.5.0"
|
||||
|
|
2435
app/schemas/io.github.wulkanowy.data.db.AppDatabase/55.json
Normal file
2435
app/schemas/io.github.wulkanowy.data.db.AppDatabase/55.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,7 @@
|
|||
package io.github.wulkanowy.utils
|
||||
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class RemoteConfigHelper @Inject constructor() : BaseRemoteConfigHelper()
|
|
@ -0,0 +1,7 @@
|
|||
package io.github.wulkanowy.utils
|
||||
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class RemoteConfigHelper @Inject constructor() : BaseRemoteConfigHelper()
|
|
@ -34,11 +34,15 @@ class WulkanowyApp : Application(), Configuration.Provider {
|
|||
@Inject
|
||||
lateinit var adsHelper: AdsHelper
|
||||
|
||||
@Inject
|
||||
lateinit var remoteConfigHelper: RemoteConfigHelper
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
initializeAppLanguage()
|
||||
themeManager.applyDefaultTheme()
|
||||
adsHelper.initialize()
|
||||
remoteConfigHelper.initialize()
|
||||
initLogging()
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import io.github.wulkanowy.data.db.SharedPrefProvider
|
|||
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
||||
import io.github.wulkanowy.sdk.Sdk
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
import io.github.wulkanowy.utils.RemoteConfigHelper
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.json.Json
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
|
@ -36,10 +37,11 @@ internal class DataModule {
|
|||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideSdk(chuckerInterceptor: ChuckerInterceptor) =
|
||||
fun provideSdk(chuckerInterceptor: ChuckerInterceptor, remoteConfig: RemoteConfigHelper) =
|
||||
Sdk().apply {
|
||||
androidVersion = android.os.Build.VERSION.RELEASE
|
||||
buildTag = android.os.Build.MODEL
|
||||
userAgentTemplate = remoteConfig.userAgentTemplate
|
||||
setSimpleHttpLogger { Timber.d(it) }
|
||||
|
||||
// for debug only
|
||||
|
|
|
@ -48,6 +48,7 @@ import javax.inject.Singleton
|
|||
AutoMigration(from = 46, to = 47),
|
||||
AutoMigration(from = 47, to = 48),
|
||||
AutoMigration(from = 51, to = 52),
|
||||
AutoMigration(from = 54, to = 55, spec = Migration55::class),
|
||||
],
|
||||
version = AppDatabase.VERSION_SCHEMA,
|
||||
exportSchema = true
|
||||
|
@ -56,7 +57,7 @@ import javax.inject.Singleton
|
|||
abstract class AppDatabase : RoomDatabase() {
|
||||
|
||||
companion object {
|
||||
const val VERSION_SCHEMA = 54
|
||||
const val VERSION_SCHEMA = 55
|
||||
|
||||
fun getMigrations(sharedPrefProvider: SharedPrefProvider, appInfo: AppInfo) = arrayOf(
|
||||
Migration2(),
|
||||
|
|
|
@ -2,16 +2,14 @@ package io.github.wulkanowy.data.db.entities
|
|||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import java.io.Serializable
|
||||
|
||||
@Entity(tableName = "MessageAttachments")
|
||||
@Entity(
|
||||
tableName = "MessageAttachments",
|
||||
primaryKeys = ["message_global_key", "url", "filename"],
|
||||
)
|
||||
data class MessageAttachment(
|
||||
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "real_id")
|
||||
val realId: Int,
|
||||
|
||||
@ColumnInfo(name = "message_global_key")
|
||||
val messageGlobalKey: String,
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package io.github.wulkanowy.data.db.migrations
|
||||
|
||||
import androidx.room.DeleteColumn
|
||||
import androidx.room.migration.AutoMigrationSpec
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
@DeleteColumn(
|
||||
tableName = "MessageAttachments",
|
||||
columnName = "real_id",
|
||||
)
|
||||
class Migration55 : AutoMigrationSpec {
|
||||
|
||||
override fun onPostMigrate(db: SupportSQLiteDatabase) {
|
||||
db.execSQL("DELETE FROM Messages")
|
||||
db.execSQL("DELETE FROM MessageAttachments")
|
||||
}
|
||||
}
|
|
@ -40,7 +40,6 @@ fun List<SdkMessage>.mapToEntities(
|
|||
fun List<SdkMessageAttachment>.mapToEntities(messageGlobalKey: String) = map {
|
||||
MessageAttachment(
|
||||
messageGlobalKey = messageGlobalKey,
|
||||
realId = it.url.hashCode(),
|
||||
url = it.url,
|
||||
filename = it.filename
|
||||
)
|
||||
|
|
|
@ -103,7 +103,10 @@ class MessageRepository @Inject constructor(
|
|||
messagesDb.loadMessageWithAttachment(message.messageGlobalKey)
|
||||
},
|
||||
fetch = {
|
||||
sdk.init(student).getMessageDetails(it!!.message.messageGlobalKey, markAsRead)
|
||||
sdk.init(student).getMessageDetails(
|
||||
messageKey = it!!.message.messageGlobalKey,
|
||||
markAsRead = message.unread && markAsRead,
|
||||
)
|
||||
},
|
||||
saveFetchResult = { old, new ->
|
||||
checkNotNull(old) { "Fetched message no longer exist!" }
|
||||
|
|
|
@ -12,6 +12,7 @@ import io.github.wulkanowy.data.pojos.RegisterUser
|
|||
import io.github.wulkanowy.data.repositories.StudentRepository
|
||||
import io.github.wulkanowy.data.resourceFlow
|
||||
import io.github.wulkanowy.sdk.scrapper.login.AccountPermissionException
|
||||
import io.github.wulkanowy.sdk.scrapper.login.InvalidSymbolException
|
||||
import io.github.wulkanowy.services.sync.SyncManager
|
||||
import io.github.wulkanowy.ui.base.BasePresenter
|
||||
import io.github.wulkanowy.ui.modules.login.LoginData
|
||||
|
@ -158,7 +159,7 @@ class LoginStudentSelectPresenter @Inject constructor(
|
|||
isNotEmptySymbolsExist: Boolean,
|
||||
) = buildList {
|
||||
val filteredEmptySymbols = emptySymbols.filter {
|
||||
it.error !is AccountPermissionException
|
||||
it.error !is InvalidSymbolException
|
||||
}.ifEmpty { emptySymbols.takeIf { !isNotEmptySymbolsExist }.orEmpty() }
|
||||
|
||||
if (filteredEmptySymbols.isNotEmpty() && isNotEmptySymbolsExist) {
|
||||
|
@ -280,11 +281,26 @@ class LoginStudentSelectPresenter @Inject constructor(
|
|||
|
||||
private fun onEmailClick() {
|
||||
view?.openEmail(lastError?.message.ifNullOrBlank {
|
||||
registerUser.symbols.flatMap { symbol ->
|
||||
symbol.schools.map { it.error?.message } + symbol.error?.message
|
||||
}.filterNotNull().distinct().joinToString("; ") {
|
||||
it.take(46) + "..."
|
||||
}.ifEmpty { "blank" }
|
||||
loginData.baseUrl + "/" + loginData.symbol + "\n" + registerUser.symbols.filterNot {
|
||||
(it.error is AccountPermissionException || it.error is InvalidSymbolException) && it.symbol != loginData.symbol
|
||||
}.joinToString(";\n") { symbol ->
|
||||
buildString {
|
||||
append(" -")
|
||||
append(symbol.symbol)
|
||||
append("(${symbol.error?.message?.let { it.take(46) + "..." } ?: symbol.schools.size})")
|
||||
if (symbol.schools.isNotEmpty()) {
|
||||
append(": ")
|
||||
}
|
||||
append(symbol.schools.joinToString(", ") { unit ->
|
||||
buildString {
|
||||
append(unit.schoolShortName)
|
||||
append("(${unit.error?.message?.let { it.take(46) + "..." } ?: unit.students.size})")
|
||||
}
|
||||
})
|
||||
}
|
||||
} + "\nPozostałe: " + registerUser.symbols.filter {
|
||||
it.error is AccountPermissionException || it.error is InvalidSymbolException
|
||||
}.joinToString(", ") { it.symbol }
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -93,6 +93,13 @@ class LoginSymbolFragment :
|
|||
}
|
||||
}
|
||||
|
||||
override fun setErrorSymbolInvalid() {
|
||||
with(binding.loginSymbolNameLayout) {
|
||||
requestFocus()
|
||||
error = getString(R.string.login_invalid_symbol)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setErrorSymbolRequire() {
|
||||
setErrorSymbol(getString(R.string.error_field_required))
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.github.wulkanowy.data.pojos.RegisterUser
|
|||
import io.github.wulkanowy.data.repositories.StudentRepository
|
||||
import io.github.wulkanowy.data.resourceFlow
|
||||
import io.github.wulkanowy.sdk.scrapper.getNormalizedSymbol
|
||||
import io.github.wulkanowy.sdk.scrapper.login.InvalidSymbolException
|
||||
import io.github.wulkanowy.ui.base.BasePresenter
|
||||
import io.github.wulkanowy.ui.modules.login.LoginData
|
||||
import io.github.wulkanowy.ui.modules.login.LoginErrorHandler
|
||||
|
@ -61,11 +62,11 @@ class LoginSymbolPresenter @Inject constructor(
|
|||
email = loginData.login,
|
||||
password = loginData.password,
|
||||
scrapperBaseUrl = loginData.baseUrl,
|
||||
symbol = view?.symbolValue.orEmpty(),
|
||||
symbol = loginData.symbol.orEmpty(),
|
||||
)
|
||||
}.onEach {
|
||||
registerUser = it.dataOrNull
|
||||
when (it) {
|
||||
}.onEach { user ->
|
||||
registerUser = user.dataOrNull
|
||||
when (user) {
|
||||
is Resource.Loading -> view?.run {
|
||||
Timber.i("Login with symbol started")
|
||||
hideSoftKeyboard()
|
||||
|
@ -73,7 +74,7 @@ class LoginSymbolPresenter @Inject constructor(
|
|||
showContent(false)
|
||||
}
|
||||
is Resource.Success -> {
|
||||
when (it.data.symbols.size) {
|
||||
when (user.data.symbols.size) {
|
||||
0 -> {
|
||||
Timber.i("Login with symbol result: Empty student list")
|
||||
view?.run {
|
||||
|
@ -82,8 +83,19 @@ class LoginSymbolPresenter @Inject constructor(
|
|||
}
|
||||
}
|
||||
else -> {
|
||||
Timber.i("Login with symbol result: Success")
|
||||
view?.navigateToStudentSelect(loginData, requireNotNull(it.data))
|
||||
val enteredSymbolDetails = user.data.symbols
|
||||
.firstOrNull()
|
||||
?.takeIf { it.symbol == loginData.symbol }
|
||||
|
||||
if (enteredSymbolDetails?.error is InvalidSymbolException) {
|
||||
view?.run {
|
||||
setErrorSymbolInvalid()
|
||||
showContact(true)
|
||||
}
|
||||
} else {
|
||||
Timber.i("Login with symbol result: Success")
|
||||
view?.navigateToStudentSelect(loginData, requireNotNull(user.data))
|
||||
}
|
||||
}
|
||||
}
|
||||
analytics.logEvent(
|
||||
|
@ -102,10 +114,10 @@ class LoginSymbolPresenter @Inject constructor(
|
|||
"students" to -1,
|
||||
"scrapperBaseUrl" to loginData.baseUrl,
|
||||
"symbol" to view?.symbolValue,
|
||||
"error" to it.error.message.ifNullOrBlank { "No message" }
|
||||
"error" to user.error.message.ifNullOrBlank { "No message" }
|
||||
)
|
||||
loginErrorHandler.dispatch(it.error)
|
||||
lastError = it.error
|
||||
loginErrorHandler.dispatch(user.error)
|
||||
lastError = user.error
|
||||
view?.showContact(true)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ interface LoginSymbolView : BaseView {
|
|||
|
||||
fun setErrorSymbolIncorrect()
|
||||
|
||||
fun setErrorSymbolInvalid()
|
||||
|
||||
fun setErrorSymbolRequire()
|
||||
|
||||
fun setErrorSymbol(message: String)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package io.github.wulkanowy.utils
|
||||
|
||||
abstract class BaseRemoteConfigHelper {
|
||||
|
||||
open fun initialize() = Unit
|
||||
|
||||
open val userAgentTemplate: String
|
||||
get() = RemoteConfigDefaults.USER_AGENT_TEMPLATE.value as String
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package io.github.wulkanowy.utils
|
||||
|
||||
enum class RemoteConfigDefaults(val value: Any) {
|
||||
USER_AGENT_TEMPLATE(""),
|
||||
;
|
||||
|
||||
val key get() = name.lowercase()
|
||||
}
|
|
@ -1,10 +1,7 @@
|
|||
Wersja 1.9.0
|
||||
Wersja 1.9.2
|
||||
|
||||
- dodaliśmy obsługę Androida 13 (w tym ikona aplikacji obsługująca Material You)
|
||||
- przerobiliśmy ekran wyboru ucznia przy pierwszym logowaniu
|
||||
- naprawiliśmy usuwanie wiadomości w niektórych przypadkach
|
||||
- naprawiliśmy błąd występujący przy resecie hasła
|
||||
- naprawiliśmy literówkę w tytule domyślnej treści wiadomości usprawiedliwiania
|
||||
- naprawiliśmy nazwę aplikacji przy ustawionym w telefonie jezyku francuskim
|
||||
- naprawiliśmy oznaczanie wiadomości jako odczytanych (problem dotyczył głównie kont rodziców z wieloma dziećmi w tej samej szkole)
|
||||
- naprawiliśmy zapisywanie załączników do wiadomości w sytuacji, gdy ten sam załącznik był dodany do więcej niż jednej wiadomości
|
||||
- usprawniliśmy ekran z wyborem uczniów i wpisywaniem symbolu przy pierwszym logowaniu
|
||||
|
||||
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases
|
||||
|
|
|
@ -111,9 +111,11 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/accountDetailsName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -122,9 +124,11 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/accountDetailsSchool"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -26,27 +26,31 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/dashboard_account_item_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/dashboard_account_item_avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="John Smith" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashboard_account_item_school_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/dashboard_account_item_avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/dashboard_account_item_name"
|
||||
tools:text="Szkoła Wulkanowego " />
|
||||
tools:text="Szkoła Wulkanowego" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
|
@ -56,4 +60,4 @@
|
|||
android:layout_gravity="center"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package io.github.wulkanowy.utils
|
||||
|
||||
import android.content.Context
|
||||
import com.google.firebase.FirebaseApp
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.google.firebase.remoteconfig.ktx.remoteConfig
|
||||
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class RemoteConfigHelper @Inject constructor(
|
||||
@ApplicationContext private val context: Context,
|
||||
private val appInfo: AppInfo,
|
||||
) : BaseRemoteConfigHelper() {
|
||||
|
||||
override fun initialize() {
|
||||
FirebaseApp.initializeApp(context)
|
||||
|
||||
Firebase.remoteConfig.setConfigSettingsAsync(remoteConfigSettings {
|
||||
fetchTimeoutInSeconds = 3
|
||||
if (appInfo.isDebug) {
|
||||
minimumFetchIntervalInSeconds = 0
|
||||
}
|
||||
})
|
||||
Firebase.remoteConfig.setDefaultsAsync(RemoteConfigDefaults.values().associate {
|
||||
it.key to it.value
|
||||
})
|
||||
Firebase.remoteConfig.fetchAndActivate()
|
||||
}
|
||||
|
||||
override val userAgentTemplate: String
|
||||
get() = Firebase.remoteConfig.getString(RemoteConfigDefaults.USER_AGENT_TEMPLATE.key)
|
||||
}
|
Reference in a new issue