Fixed a bug that would stop the fetch when a date field is empty; version bump to 2.3.2

This commit is contained in:
Deniz Düzgören
2019-10-02 11:16:00 +02:00
parent f6283c8221
commit f5666a20c6
6 changed files with 11 additions and 6 deletions
@@ -341,20 +341,23 @@ internal object HelperFunctions {
/**
* Assigns a date priority to circumvent the event of the 1.12. being shown before the
* 31.11., essentially
* 31.11., essentially. Return value is based on the month, not the day
*
* @param date the date to be analysed
*
* @return an integer value to determine the ranking in the database
*/
fun assignDatePriority(date: String): Int {
val periodIndex = date.indexOf('.', 0, true)
if (date.isEmpty()) return 13
return try {
val periodIndex = date.indexOf('.', 0, true)
date.substring(periodIndex + 1, date.length - 1).toInt()
} catch (e: StringIndexOutOfBoundsException) {
0
} catch (n: NumberFormatException) {
-1
} catch (e: Exception) {
13
}
}
@@ -26,7 +26,7 @@ internal class LoginWebViewClient(private val successListener: OnLoginSuccessLis
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
super.onPageStarted(view, url, favicon)
if (!HelperFunctions.checkStringForArray(url.toString(), schoolUrls)) {
if (!HelperFunctions.checkStringForArray(url.toString(), schoolUrls, false)) {
reloadLoginPage(webView = view)
}
}
@@ -93,7 +93,7 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
colourCustomisationButton.setOnLongClickListener {
if (!longPressed) {
colourTextTitle.text = getString(R.string.made_by_deniz)
colourTextDesc.text = "---"
colourTextDesc.text = getString(R.string.thanks_for_using)
} else {
colourTextTitle.text = getString(R.string.customise_colours_title)
colourTextDesc.text = getString(R.string.customise_colours_desc)