diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/api/Api.kt b/app/src/main/java/xyz/apiote/bimba/czwek/api/Api.kt
index ab41284587c6f57fb0ba39a013e76f8ccf190389..35ba1348dcc65e4da149fabe8ca54732cbf3f998 100644
--- a/app/src/main/java/xyz/apiote/bimba/czwek/api/Api.kt
+++ b/app/src/main/java/xyz/apiote/bimba/czwek/api/Api.kt
@@ -65,29 +65,34 @@ val params = mutableMapOf("q" to query)
if (limit != null) {
params["limit"] = limit.toString()
}
- return request(server, "queryables", params, cm, arrayOf(1u))
+ return request(server, "queryables", params, cm, arrayOf(1u), null)
}
suspend fun locateQueryables(cm: ConnectivityManager, server: Server, near: PositionV1): Result {
- return request(server, "queryables", mapOf("near" to near.toString()), cm, arrayOf(1u))
+ return request(server, "queryables", mapOf("near" to near.toString()), cm, arrayOf(1u), null)
}
suspend fun getLocatablesIn(
cm: ConnectivityManager, server: Server, bl: PositionV1, tr: PositionV1
): Result {
return request(
- server, "locatables", mapOf("lb" to bl.toString(), "rt" to tr.toString()), cm, arrayOf(1u)
+ server,
+ "locatables",
+ mapOf("lb" to bl.toString(), "rt" to tr.toString()),
+ cm,
+ arrayOf(1u),
+ null
)
}
suspend fun getDepartures(
- cm: ConnectivityManager, server: Server, stop: String, line: String? = null
+ cm: ConnectivityManager, server: Server, feedID: String, stop: String, line: String? = null
): Result {
val params = mutableMapOf("code" to stop)
if (line != null) {
params["line"] = line
}
- return request(server, "departures", params, cm, arrayOf(1u))
+ return request(server, "departures", params, cm, arrayOf(1u), feedID)
}
suspend fun rawRequest(
@@ -131,11 +136,12 @@ server: Server,
resource: String,
params: Map<String, String>,
cm: ConnectivityManager,
- responseVersion: Array<UInt>
+ responseVersion: Array<UInt>,
+ feeds: String?
): Result {
return withContext(Dispatchers.IO) {
val url = URL( // todo [3.1] scheme, host, path, constructed query
- "${server.apiPath}/${server.feeds}/$resource${
+ "${server.apiPath}/${feeds?.ifEmpty { server.feeds } ?: server.feeds}/$resource${
params.map {
"${it.key}=${
URLEncoder.encode(
diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/home/HomeFragment.kt b/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/home/HomeFragment.kt
index e52278a89138a79ec2e541347f421c6af6000ea8..fc0fb193b4865bb66654a39eebbce989761c97d4 100644
--- a/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/home/HomeFragment.kt
+++ b/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/home/HomeFragment.kt
@@ -77,6 +77,7 @@ is Stop -> {
val intent = Intent(activity, DeparturesActivity::class.java).apply {
putExtra("code", it.code)
putExtra("name", it.name)
+ putExtra("feedID", it.feedID)
}
startActivity(intent)
}
diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/map/MapViewModel.kt b/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/map/MapViewModel.kt
index 87e4c42fd45e211bd5c8a54c700a5cd63fea54fb..87c96df07b95db0132b064943c29da4937b52df5 100644
--- a/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/map/MapViewModel.kt
+++ b/app/src/main/java/xyz/apiote/bimba/czwek/dashboard/ui/map/MapViewModel.kt
@@ -115,6 +115,7 @@ content.findViewById