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)
+1
View File
@@ -161,4 +161,5 @@
<string name="ordering_systems_dialog_title">Informationen über Sortierweisen</string>
<string name="ordering_systems_dialog_text">Du kannst zwischen zwei Sortierweisen auswählen, welche die Reihenfolge der Einträge auf dem Vertretungsplan bestimmen.\n\nStandardmäßig ist \'App-spezifisch\' ausgewählt; dies bietet einen konsistenten Plan sortiert nach Klassen, dann nach Stunden.\n\n\'Website-Original\' bietet die Original-Reihenfolge der Website. Diese ist jedoch nicht konsistent, weswegen \'App-spezifisch\' standardmäßig ausgewählt ist.</string>
<string name="error_please_try_again">Ein Fehler ist aufgetreten, bitte versuche es erneut</string>
<string name="thanks_for_using">Danke, dass du die App nutzt!</string>
</resources>
+1
View File
@@ -173,4 +173,5 @@
<string name="ordering_systems_dialog_title">Information on ordering systems</string>
<string name="ordering_systems_dialog_text">You may pick between two ordering systems that dictate the order in which the items on the substitution plan will appear in.\n\nThe default \'app-specific\' is an algorithm implemented in this app that provides a consistently-sorted substitution plan ordered just like the substitution plan on the website used to; sorted by classes, then by time.\n\n\'Website original\' offers the items on the substitution plan just like they\'re presented on the school website, but since these are not guaranteed to be consistent, \'app-specific\' is picked by default.</string>
<string name="error_please_try_again">An error occurred, please try again</string>
<string name="thanks_for_using">Thanks for using the app!</string>
</resources>