Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Basic NOBIL implementation #363

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6a6926c
Basic NOBIL implementation
robho Nov 5, 2024
126d640
Throw an exception if a nobil coordinate fails to parse
robho Nov 10, 2024
5edfed8
Remove unused OkHttp interceptor
robho Nov 10, 2024
c8fadf8
Parse and show connector voltage and current
robho Nov 10, 2024
8daced3
Parse "Parking fee = yes" into "Paid parking"
robho Nov 10, 2024
e66610e
Add data license info to ChargeLocation
robho Nov 11, 2024
e372761
Add data provider from received data to ChargeLocation
robho Nov 11, 2024
9d7eaf7
Revert "Add data provider from received data to ChargeLocation"
robho Nov 11, 2024
8db7ae3
Ignore charge locations with no EV chargers
robho Nov 11, 2024
c543475
Add basic filters
robho Nov 19, 2024
d65ec9a
Add URLs to edit nobil chargers
robho Nov 19, 2024
0f8efe0
Set charger url to nobil.no
robho Nov 19, 2024
5d0bc87
Simplification
robho Nov 21, 2024
ca59d35
Add evseId to class Chargepoint
robho Nov 21, 2024
f793c62
Use null to mean "no evseIds" instead of an empty list
robho Dec 1, 2024
5cc8322
Add Chargelocation.dataSourceUrl and make ChargeLocation.url optional
robho Dec 1, 2024
6c15446
Replace URLEncoder.encode() with Uri.encode()
robho Dec 1, 2024
1f8d75f
Hide share-charge-location-button if there's no URL for the location
robho Dec 4, 2024
5da9389
Consistent handling of charger detail menu items
robho Dec 4, 2024
0d5d0a9
Add nobil api key handling in build.gradle.kts
robho Dec 6, 2024
2077e09
Improve nobil image file name handling
robho Dec 9, 2024
70953af
Add charge location availability to ChargeLocation and as filter
robho Dec 9, 2024
411dbb4
Add connector type filter
robho Dec 11, 2024
197cf58
Parse payment methods into Cost object description
robho Dec 12, 2024
0389a30
Handle "Type 2 + Schuko" connector type as "Type 2"
robho Dec 13, 2024
64c0ff1
Use EnBw realtime data for nobil
robho Dec 17, 2024
6560752
Fix operator<->owned_by mixup
robho Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/src/main/java/net/vonforst/evmap/api/nobil/NobilModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import net.vonforst.evmap.model.OpeningHours
import net.vonforst.evmap.model.ReferenceData
import net.vonforst.evmap.model.getBooleanValue
import net.vonforst.evmap.model.getSliderValue
import java.net.URLEncoder
import java.time.Instant
import java.time.LocalDateTime

Expand Down Expand Up @@ -111,7 +112,10 @@ data class NobilChargerStation(
chargepoints,
null,
"",
null,
when (chargerStationData.landCode) {
"SWE" -> "https://www.energimyndigheten.se/klimat/transporter/laddinfrastruktur/registrera-din-laddstation/elbilsagare/"
else -> "mailto:[email protected]?subject=" + URLEncoder.encode("Regarding charging station " + chargerStationData.internationalId, "UTF-8").replace("+", "%20")
robho marked this conversation as resolved.
Show resolved Hide resolved
},
null,
chargerStationData.ocpiId != null ||
chargerStationData.updated.isAfter(LocalDateTime.now().minusMonths(6)),
Expand Down
21 changes: 20 additions & 1 deletion app/src/main/java/net/vonforst/evmap/fragment/MapFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package net.vonforst.evmap.fragment
import android.Manifest.permission.ACCESS_COARSE_LOCATION
import android.Manifest.permission.ACCESS_FINE_LOCATION
import android.annotation.SuppressLint
import android.content.ActivityNotFoundException
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.text.method.KeyListener
Expand Down Expand Up @@ -478,7 +481,23 @@ class MapFragment : Fragment(), OnMapReadyCallback, MenuProvider {
R.id.menu_edit -> {
val charger = vm.charger.value?.data
if (charger?.editUrl != null) {
(activity as? MapsActivity)?.openUrl(charger.editUrl, binding.root, true)
val uri = Uri.parse(charger.editUrl)
if (uri.getScheme() == "mailto") {
val intent = Intent(Intent.ACTION_SENDTO, uri)
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
Toast.makeText(
requireContext(),
R.string.no_email_app_found,
Toast.LENGTH_LONG
).show()
}
}
else {
(activity as? MapsActivity)?.openUrl(charger.editUrl, binding.root, true)
}

if (vm.apiId.value == "goingelectric") {
// instructions specific to GoingElectric
Toast.makeText(
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<string name="connectors">Connectors</string>
<string name="no_maps_app_found">Install a navigation app first</string>
<string name="no_browser_app_found">Install a web browser first</string>
<string name="no_email_app_found">Install an email app first</string>
<string name="address">Address</string>
<string name="operator">Operator</string>
<string name="network">Network</string>
Expand Down