Bimba.git

commit 118fb95eb806a29411087d5bfa5b04f1fc60b12a

Author: Adam <git@apiote.xyz>

QR codes in Metropolis GZM

%!v(PANIC=String method: strings: negative Repeat count)


diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c855f7175173759dca78492b0ca2b6553d7506e4..f59bf39163d2835d898792459c0746d7fb5424b2 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -55,6 +55,17 @@ 				
 				<data android:host="www.peka.poznan.pl" />
 				<data android:pathPrefix="/vm" />
 			</intent-filter>
+			<intent-filter>
+				<action android:name="android.intent.action.VIEW" />
+
+				<category android:name="android.intent.category.DEFAULT" />
+				<category android:name="android.intent.category.BROWSABLE" />
+
+				<data android:scheme="http" />
+				<data android:scheme="https" />
+				<data android:host="rj.metropoliaztm.pl" />
+				<data android:pathPrefix="/redir/stop" />
+			</intent-filter>
 		</activity>
 		<activity
 			android:name=".search.ResultsActivity"




diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/departures/DeparturesActivity.kt b/app/src/main/java/xyz/apiote/bimba/czwek/departures/DeparturesActivity.kt
index dcc35603de637a86aafa0e1d0890ca3283b3912a..a991106dd7b82f9ddb37b15f450b127c75cddbdc 100644
--- a/app/src/main/java/xyz/apiote/bimba/czwek/departures/DeparturesActivity.kt
+++ b/app/src/main/java/xyz/apiote/bimba/czwek/departures/DeparturesActivity.kt
@@ -77,7 +77,15 @@ 	}
 
 	private fun getCode(): String {
 		@Suppress("SpellCheckingInspection") return when (intent?.action) {
-			Intent.ACTION_VIEW -> intent?.data?.getQueryParameter("przystanek") ?: ""
+			Intent.ACTION_VIEW -> {
+				when (intent?.data?.host) {
+					"www.peka.poznan.pl" -> intent?.data?.getQueryParameter("przystanek") ?: ""
+					"rj.metropoliaztm.pl" -> intent?.data?.lastPathSegment ?: ""
+					else -> ""
+				}
+
+			}
+
 			null -> intent?.extras?.getString("code") ?: ""
 			else -> ""
 		}
@@ -88,6 +96,7 @@ 		return when (intent?.action) {
 			Intent.ACTION_VIEW -> {
 				return when (intent?.data?.host) {
 					"www.peka.poznan.pl" -> "poznan_ztm"
+					"rj.metropoliaztm.pl" -> "gzm_ztm"
 					else -> ""
 				}
 			}