mirror of
https://github.com/ev-map/EVMap.git
synced 2025-12-26 00:27:45 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06801c1898 | ||
|
|
c946b0fcd3 | ||
|
|
dd4fcc7550 | ||
|
|
2ce82b961b | ||
|
|
1be519b1ee | ||
|
|
01737f21d2 | ||
|
|
17ce9f420b | ||
|
|
6eb90498eb |
@@ -21,8 +21,8 @@ android {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
// NOTE: always increase versionCode by 2 since automotive flavor uses versionCode + 1
|
||||
versionCode 184
|
||||
versionName "1.6.2"
|
||||
versionCode 188
|
||||
versionName "1.6.4"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
resConfigs supportedLocales.split(',')
|
||||
|
||||
@@ -281,7 +281,7 @@ interface TeslaGraphQlApi {
|
||||
val siteDynamic: SiteDynamic,
|
||||
val siteStatic: SiteStatic,
|
||||
val pricing: Pricing,
|
||||
val congestionPriceHistogram: CongestionPriceHistogram,
|
||||
val congestionPriceHistogram: CongestionPriceHistogram?,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
@@ -540,6 +540,9 @@ class TeslaAvailabilityDetector(
|
||||
Chargepoint.CCS_UNKNOWN
|
||||
) && it.power != null && it.power <= 150
|
||||
}
|
||||
if (scV2CCSConnectors.sumOf { it.count } != 0 && scV2CCSConnectors.sumOf { it.count } != scV2Connectors.sumOf { it.count }) {
|
||||
throw AvailabilityDetectorException("number of V2 connectors does not match number of V2 CCS connectors")
|
||||
}
|
||||
val scV3Connectors = location.chargepoints.filter {
|
||||
it.type in listOf(
|
||||
Chargepoint.CCS_TYPE_2,
|
||||
@@ -550,36 +553,49 @@ class TeslaAvailabilityDetector(
|
||||
"charger has unknown connectors"
|
||||
)
|
||||
|
||||
val statusSorted = details.siteDynamic.chargerDetails.sortedBy { it.charger.labelLetter }
|
||||
.sortedBy { it.charger.labelNumber }
|
||||
var statusSorted = details.siteDynamic.chargerDetails.sortedBy { it.charger.labelLetter }
|
||||
.sortedBy { it.charger.labelNumber }.map { it.availability }
|
||||
if (statusSorted.size != scV2Connectors.sumOf { it.count } + scV3Connectors.sumOf { it.count }) {
|
||||
// apparently some connectors are missing in Tesla data
|
||||
// If we have just one type of charger, we can still match
|
||||
val numMissing =
|
||||
scV2Connectors.sumOf { it.count } + scV3Connectors.sumOf { it.count } - statusSorted.size
|
||||
if (scV2Connectors.isEmpty() || scV3Connectors.isEmpty() && numMissing > 0) {
|
||||
statusSorted =
|
||||
statusSorted + List(numMissing) { TeslaGraphQlApi.ChargerAvailability.UNKNOWN }
|
||||
} else {
|
||||
throw AvailabilityDetectorException("Tesla API chargepoints do not match data source")
|
||||
}
|
||||
}
|
||||
|
||||
val statusMap = emptyMap<Chargepoint, List<ChargepointStatus>>().toMutableMap()
|
||||
var i = 0
|
||||
for (connector in scV2Connectors) {
|
||||
statusMap[connector] =
|
||||
statusSorted.subList(i, i + connector.count).map { it.availability.toStatus() }
|
||||
statusSorted.subList(i, i + connector.count).map { it.toStatus() }
|
||||
i += connector.count
|
||||
}
|
||||
if (scV2CCSConnectors.isNotEmpty()) {
|
||||
i = 0
|
||||
for (connector in scV2CCSConnectors) {
|
||||
statusMap[connector] =
|
||||
statusSorted.subList(i, i + connector.count).map { it.availability.toStatus() }
|
||||
statusSorted.subList(i, i + connector.count).map { it.toStatus() }
|
||||
i += connector.count
|
||||
}
|
||||
}
|
||||
for (connector in scV3Connectors) {
|
||||
statusMap[connector] =
|
||||
statusSorted.subList(i, i + connector.count).map { it.availability.toStatus() }
|
||||
statusSorted.subList(i, i + connector.count).map { it.toStatus() }
|
||||
i += connector.count
|
||||
}
|
||||
|
||||
val indexOfMidnight =
|
||||
details.congestionPriceHistogram.dataAttributes.indexOfFirst { it.label == "12AM" }
|
||||
val congestionHistogram = indexOfMidnight.takeIf { it >= 0 }?.let { index ->
|
||||
val data = details.congestionPriceHistogram.data.toMutableList()
|
||||
Collections.rotate(data, -index)
|
||||
data
|
||||
val congestionHistogram = details.congestionPriceHistogram?.let { cph ->
|
||||
val indexOfMidnight = cph.dataAttributes.indexOfFirst { it.label == "12AM" }
|
||||
indexOfMidnight.takeIf { it >= 0 }?.let { index ->
|
||||
val data = cph.data.toMutableList()
|
||||
Collections.rotate(data, -index)
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
return ChargeLocationStatus(
|
||||
|
||||
@@ -324,6 +324,8 @@ class GoingElectricApiWrapper(
|
||||
val freeparking = filters?.getBooleanValue("freeparking")
|
||||
val open247 = filters?.getBooleanValue("open_247")
|
||||
val barrierfree = filters?.getBooleanValue("barrierfree")
|
||||
val networks = filters?.getMultipleChoiceValue("networks")
|
||||
val chargecards = filters?.getMultipleChoiceValue("chargecards")
|
||||
|
||||
return chargers.filter { it ->
|
||||
// apply filters which GoingElectric does not support natively
|
||||
@@ -356,7 +358,13 @@ class GoingElectricApiWrapper(
|
||||
?: GEOpeningHours(twentyfourSeven = true)
|
||||
)
|
||||
}
|
||||
if (barrierfree == true) {
|
||||
if (barrierfree == true
|
||||
&& (networks == null || networks.all || it.network !in networks.values)
|
||||
&& (chargecards == null || chargecards.all)
|
||||
) {
|
||||
/* barrierfree, networks and chargecards are combined with OR - so we can only
|
||||
* be sure that the charger is barrierFree if the other filters are not active
|
||||
* or the charger does not match the other filters */
|
||||
inferred = inferred.copy(barrierFree = true)
|
||||
}
|
||||
inferred
|
||||
@@ -522,9 +530,6 @@ class GoingElectricApiWrapper(
|
||||
if (filters.getBooleanValue("open_247") == true) {
|
||||
result.append(" AND twentyfourSeven IS 1")
|
||||
}
|
||||
if (filters.getBooleanValue("barrierfree") == true) {
|
||||
result.append(" AND barrierFree IS 1")
|
||||
}
|
||||
if (filters.getBooleanValue("exclude_faults") == true) {
|
||||
result.append(" AND fault_report_description IS NULL AND fault_report_created IS NULL")
|
||||
}
|
||||
@@ -552,25 +557,34 @@ class GoingElectricApiWrapper(
|
||||
requiresChargepointQuery = true
|
||||
}
|
||||
|
||||
// networks, chargecards and barrierFree filters are combined with OR in the GE API
|
||||
val networks = filters.getMultipleChoiceValue("networks")
|
||||
if (networks != null && !networks.all) {
|
||||
val networksList = if (networks.values.size == 0) {
|
||||
""
|
||||
} else {
|
||||
networks.values.joinToString(",") { DatabaseUtils.sqlEscapeString(it) }
|
||||
}
|
||||
result.append(" AND network IN (${networksList})")
|
||||
}
|
||||
|
||||
val chargecards = filters.getMultipleChoiceValue("chargecards")
|
||||
if (chargecards != null && !chargecards.all) {
|
||||
val chargecardsList = if (chargecards.values.size == 0) {
|
||||
""
|
||||
} else {
|
||||
chargecards.values.joinToString(",")
|
||||
val barrierFree = filters.getBooleanValue("barrierfree")
|
||||
|
||||
if ((networks != null && !networks.all) || barrierFree == true || (chargecards != null && !chargecards.all)) {
|
||||
val queries = mutableListOf<String>()
|
||||
if (networks != null && !networks.all) {
|
||||
val networksList = if (networks.values.size == 0) {
|
||||
""
|
||||
} else {
|
||||
networks.values.joinToString(",") { DatabaseUtils.sqlEscapeString(it) }
|
||||
}
|
||||
queries.add("network IN (${networksList})")
|
||||
}
|
||||
result.append(" AND json_extract(cc.value, '$.id') IN (${chargecardsList})")
|
||||
requiresChargeCardQuery = true
|
||||
if (barrierFree == true) {
|
||||
queries.add("barrierFree IS 1")
|
||||
}
|
||||
if (chargecards != null && !chargecards.all) {
|
||||
val chargecardsList = if (chargecards.values.size == 0) {
|
||||
""
|
||||
} else {
|
||||
chargecards.values.joinToString(",")
|
||||
}
|
||||
queries.add("json_extract(cc.value, '$.id') IN (${chargecardsList})")
|
||||
requiresChargeCardQuery = true
|
||||
}
|
||||
result.append(" AND (${queries.joinToString(" OR ")})")
|
||||
}
|
||||
|
||||
val categories = filters.getMultipleChoiceValue("categories")
|
||||
|
||||
@@ -867,7 +867,7 @@ class MapFragment : Fragment(), OnMapReadyCallback, MapsActivity.FragmentCallbac
|
||||
if (BuildConfig.FLAVOR.contains("google") && mapFragment!!.priority[0] == MapFragment.GOOGLE) {
|
||||
// Google Maps: icons can be generated in background thread
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
withContext(Dispatchers.Default) {
|
||||
chargerIconGenerator.preloadCache()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,10 +290,14 @@ class ChargeLocationsRepository(
|
||||
chargers: List<ChargeLocation>,
|
||||
zoom: Float
|
||||
): List<ChargepointListItem> {
|
||||
/* in very crowded places (good example: central London on OpenChargeMap without filters)
|
||||
we have to cluster even at pretty high zoom levels to make sure the map does not get
|
||||
laggy. Otherwise, only cluster at zoom levels <= 11. */
|
||||
val useClustering = chargers.size > 500 || zoom <= 11f
|
||||
val clusterDistance = getClusterDistance(zoom)
|
||||
|
||||
val chargersClustered = if (clusterDistance != null) {
|
||||
Dispatchers.IO.run {
|
||||
val chargersClustered = if (useClustering && clusterDistance != null) {
|
||||
Dispatchers.Default.run {
|
||||
cluster(chargers, zoom, clusterDistance)
|
||||
}
|
||||
} else chargers
|
||||
|
||||
@@ -53,6 +53,7 @@ internal fun getClusterDistance(zoom: Float): Int? {
|
||||
return when (zoom) {
|
||||
in 0.0..7.0 -> 100
|
||||
in 7.0..11.0 -> 75
|
||||
in 11.0..15.0 -> 75
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
<string name="save_as_profile">Guardar como perfil</string>
|
||||
<string name="filterprofiles_empty_state">Não existem filtros guardados</string>
|
||||
<string name="welcome_2">Cada cor corresponde a potência máxima do carregador</string>
|
||||
<string name="welcome_to_evmap">Bem-vindo ao EVMap</string>
|
||||
<string name="welcome_to_evmap">Bem-vindo(a) ao EVMap</string>
|
||||
<string name="pref_darkmode_always_off">Sempre desligado</string>
|
||||
<string name="welcome_2_title">Escolha a potência</string>
|
||||
<string name="navigate">Navegar</string>
|
||||
|
||||
3
fastlane/metadata/android/de-DE/changelogs/186.txt
Normal file
3
fastlane/metadata/android/de-DE/changelogs/186.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Fehler behoben:
|
||||
- Fehler im Caching-Algorithmus im Zusammenspiel mit bestimmten Filtern behoben
|
||||
- Abstürze behoben
|
||||
5
fastlane/metadata/android/de-DE/changelogs/188.txt
Normal file
5
fastlane/metadata/android/de-DE/changelogs/188.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Verbesserungen:
|
||||
- Clustering an Orten mit extrem hoher Ladestationsdichte verstärkt
|
||||
|
||||
Fehler behoben:
|
||||
- Abstürze behoben
|
||||
3
fastlane/metadata/android/en-US/changelogs/186.txt
Normal file
3
fastlane/metadata/android/en-US/changelogs/186.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Bugfixes:
|
||||
- Fixed error in caching algorithm when some filters are active
|
||||
- Fixed crashes
|
||||
5
fastlane/metadata/android/en-US/changelogs/188.txt
Normal file
5
fastlane/metadata/android/en-US/changelogs/188.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Improvements:
|
||||
- Increased clustering in places with extremely high charger density
|
||||
|
||||
Bugfixes:
|
||||
- Fixed crashes
|
||||
Reference in New Issue
Block a user