Skip to content

Commit

Permalink
add locationComponent#getLastLocation (#922)
Browse files Browse the repository at this point in the history
* add  locationComponent#getLastLocation

* format files

* fixed formatting

Co-authored-by: Felix Horvat <felix.horvat@ocell.aero>
  • Loading branch information
samderlust and felix-ht authored Mar 15, 2022
1 parent 4867ed7 commit 7075c3b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ios/Classes/MapboxMapController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ class MapboxMapController: NSObject, FlutterPlatformView, MGLMapViewDelegate, Ma
} else {
result(nil)
}
case "locationComponent#getLastLocation":
var reply = [String: NSObject]()
if let loc = mapView.userLocation?.location?.coordinate {
reply["latitude"] = loc.latitude as NSObject
reply["longitude"] = loc.longitude as NSObject
result(reply)
} else {
result(nil)
}
case "map#setMapLanguage":
guard let arguments = methodCall.arguments as? [String: Any] else { return }
if let localIdentifier = arguments["language"] as? String, let style = mapView.style {
Expand Down

0 comments on commit 7075c3b

Please sign in to comment.