forked from github/wulkanowy-mirror
Change default symbol for standard register variant (#2421)
This commit is contained in:
parent
3f199cb610
commit
8183d7d5a0
@ -195,7 +195,7 @@ ext {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'io.github.wulkanowy:sdk:2.3.7'
|
||||
implementation 'io.github.wulkanowy:sdk:2.3.8-SNAPSHOT'
|
||||
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
||||
|
||||
|
@ -7,5 +7,6 @@ data class LoginData(
|
||||
val password: String,
|
||||
val baseUrl: String,
|
||||
val domainSuffix: String,
|
||||
val symbol: String?,
|
||||
val defaultSymbol: String,
|
||||
val userEnteredSymbol: String? = null,
|
||||
) : Serializable
|
||||
|
@ -155,7 +155,7 @@ class LoginAdvancedPresenter @Inject constructor(
|
||||
password = view?.formPassValue.orEmpty().trim(),
|
||||
baseUrl = view?.formHostValue.orEmpty().trim(),
|
||||
domainSuffix = view?.formDomainSuffix.orEmpty().trim(),
|
||||
symbol = view?.formSymbolValue.orEmpty().trim().getNormalizedSymbol(),
|
||||
defaultSymbol = view?.formSymbolValue.orEmpty().trim().getNormalizedSymbol(),
|
||||
)
|
||||
when (it.data.symbols.size) {
|
||||
0 -> view?.navigateToSymbol(loginData)
|
||||
|
@ -148,7 +148,7 @@ class LoginFormPresenter @Inject constructor(
|
||||
password = password,
|
||||
baseUrl = host,
|
||||
domainSuffix = domainSuffix,
|
||||
symbol = symbol
|
||||
defaultSymbol = symbol
|
||||
)
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ class LoginFormPresenter @Inject constructor(
|
||||
password = loginData.password,
|
||||
scrapperBaseUrl = loginData.baseUrl,
|
||||
domainSuffix = loginData.domainSuffix,
|
||||
symbol = loginData.symbol.orEmpty(),
|
||||
symbol = loginData.defaultSymbol,
|
||||
)
|
||||
}
|
||||
.logResourceStatus("login")
|
||||
|
@ -60,7 +60,7 @@ class LoginRecoverPresenter @Inject constructor(
|
||||
resourceFlow {
|
||||
recoverRepository.getReCaptchaSiteKey(
|
||||
host,
|
||||
symbol.ifBlank { "Default" })
|
||||
symbol.ifBlank { "default" })
|
||||
}.onEach {
|
||||
when (it) {
|
||||
is Resource.Loading -> view?.run {
|
||||
@ -103,7 +103,7 @@ class LoginRecoverPresenter @Inject constructor(
|
||||
fun onReCaptchaVerified(reCaptchaResponse: String) {
|
||||
val username = view?.recoverNameValue.orEmpty()
|
||||
val host = view?.recoverHostValue.orEmpty()
|
||||
val symbol = view?.formHostSymbol.ifNullOrBlank { "Default" }
|
||||
val symbol = view?.formHostSymbol.ifNullOrBlank { "default" }
|
||||
|
||||
resourceFlow {
|
||||
recoverRepository.sendRecoverRequest(
|
||||
|
@ -10,13 +10,11 @@ import io.github.wulkanowy.data.pojos.RegisterUser
|
||||
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
||||
import io.github.wulkanowy.databinding.FragmentLoginStudentSelectBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.auth.AuthDialog
|
||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||
import io.github.wulkanowy.ui.modules.login.LoginData
|
||||
import io.github.wulkanowy.ui.modules.login.support.LoginSupportDialog
|
||||
import io.github.wulkanowy.ui.modules.login.support.LoginSupportInfo
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
import io.github.wulkanowy.utils.openEmailClient
|
||||
import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import io.github.wulkanowy.utils.serializable
|
||||
import javax.inject.Inject
|
||||
|
@ -111,8 +111,8 @@ class LoginStudentSelectPresenter @Inject constructor(
|
||||
val notEmptySymbols = registerUser.symbols.filter { it.schools.isNotEmpty() }
|
||||
val emptySymbols = registerUser.symbols.filter { it.schools.isEmpty() }
|
||||
|
||||
if (emptySymbols.isNotEmpty() && notEmptySymbols.isNotEmpty() && emptySymbols.any { it.symbol == loginData.symbol }) {
|
||||
add(createEmptySymbolItem(emptySymbols.first { it.symbol == loginData.symbol }))
|
||||
if (emptySymbols.isNotEmpty() && notEmptySymbols.isNotEmpty() && emptySymbols.any { it.symbol == loginData.userEnteredSymbol }) {
|
||||
add(createEmptySymbolItem(emptySymbols.first { it.symbol == loginData.userEnteredSymbol }))
|
||||
}
|
||||
|
||||
addAll(createNotEmptySymbolItems(notEmptySymbols, students))
|
||||
@ -317,7 +317,7 @@ class LoginStudentSelectPresenter @Inject constructor(
|
||||
loginData = loginData,
|
||||
registerUser = registerUser,
|
||||
lastErrorMessage = lastError?.message,
|
||||
enteredSymbol = loginData.symbol,
|
||||
enteredSymbol = loginData.userEnteredSymbol,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ class LoginSupportDialog : BaseDialogFragment<DialogLoginSupportBinding>() {
|
||||
"${appInfo.systemManufacturer} ${appInfo.systemModel}",
|
||||
appInfo.systemVersion.toString(),
|
||||
"${appInfo.versionName}-${appInfo.buildFlavor}",
|
||||
supportInfo.loginData.baseUrl + "/" + supportInfo.loginData.symbol,
|
||||
supportInfo.loginData.let { "${it.baseUrl}/${it.defaultSymbol}/${it.userEnteredSymbol}" },
|
||||
preferencesRepository.installationId,
|
||||
getLastErrorFromStudentSelectScreen(),
|
||||
dialogLoginSupportSchoolInput.text.takeIf { !it.isNullOrBlank() }
|
||||
|
@ -60,7 +60,7 @@ class LoginSymbolPresenter @Inject constructor(
|
||||
}
|
||||
|
||||
loginData = loginData.copy(
|
||||
symbol = view?.symbolValue?.getNormalizedSymbol(),
|
||||
userEnteredSymbol = view?.symbolValue?.getNormalizedSymbol(),
|
||||
)
|
||||
resourceFlow {
|
||||
studentRepository.getUserSubjectsFromScrapper(
|
||||
@ -68,7 +68,7 @@ class LoginSymbolPresenter @Inject constructor(
|
||||
password = loginData.password,
|
||||
scrapperBaseUrl = loginData.baseUrl,
|
||||
domainSuffix = loginData.domainSuffix,
|
||||
symbol = loginData.symbol.orEmpty(),
|
||||
symbol = loginData.userEnteredSymbol.orEmpty(),
|
||||
)
|
||||
}.onEach { user ->
|
||||
registerUser = user.dataOrNull
|
||||
@ -93,7 +93,7 @@ class LoginSymbolPresenter @Inject constructor(
|
||||
else -> {
|
||||
val enteredSymbolDetails = user.data.symbols
|
||||
.firstOrNull()
|
||||
?.takeIf { it.symbol == loginData.symbol }
|
||||
?.takeIf { it.symbol == loginData.userEnteredSymbol }
|
||||
|
||||
if (enteredSymbolDetails?.error is InvalidSymbolException) {
|
||||
view?.run {
|
||||
|
@ -47,7 +47,7 @@
|
||||
<item>https://wulkanowy.net.pl/?email</item>
|
||||
</string-array>
|
||||
<string-array name="hosts_symbols">
|
||||
<item>Default</item>
|
||||
<item>warszawa</item>
|
||||
<item>opole</item>
|
||||
<item>gdansk</item>
|
||||
<item>lublin</item>
|
||||
@ -66,7 +66,7 @@
|
||||
<item>gminaulanmajorat</item>
|
||||
<item>gminaozorkow</item>
|
||||
<item>gminalopiennikgorny</item>
|
||||
<item>Default</item>
|
||||
<item>warszawa</item>
|
||||
<item>powiatwulkanowy</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
@ -42,6 +42,7 @@ fun getSemesterPojo(diaryId: Int, semesterId: Int, start: LocalDate, end: LocalD
|
||||
diaryName = "$semesterId",
|
||||
schoolYear = 1970,
|
||||
classId = 0,
|
||||
className = "Ti",
|
||||
semesterNumber = semesterName,
|
||||
unitId = 1,
|
||||
start = start,
|
||||
|
@ -58,7 +58,7 @@ class LoginStudentSelectPresenterTest {
|
||||
login = "",
|
||||
password = "",
|
||||
baseUrl = "",
|
||||
symbol = null,
|
||||
defaultSymbol = "warszawa",
|
||||
domainSuffix = "",
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user