Skip to content

Commit

Permalink
Add coordinate location sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasman committed Mar 8, 2024
1 parent 71b8e0e commit c4119f9
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Sources/TeslaSwift/Model/ShareToVehicleOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import CoreLocation

open class ShareToVehicleOptions: Codable {

Expand All @@ -15,12 +16,19 @@ open class ShareToVehicleOptions: Codable {
public let timestamp_ms: String

public init(address: String) {
self.value = ShareToVehicleValue.init(address: address)
self.value = ShareToVehicleValue(address: address)
self.type = "share_ext_content_raw"
self.locale = "en-US"
self.timestamp_ms = "12345"
}


public init(coordinate: CLLocationCoordinate2D) {
self.value = ShareToVehicleValue(coordinate: coordinate)
self.type = "share_ext_content_raw"
self.locale = "en-US"
self.timestamp_ms = "12345"
}

public class ShareToVehicleValue: Codable {
public let intentAction: String
public let intentType: String
Expand All @@ -31,7 +39,13 @@ open class ShareToVehicleOptions: Codable {
self.intentAction = "android.intent.action.SEND"
self.intentType = "text%2F%0Aplain"
}


init(coordinate: CLLocationCoordinate2D) {
self.intentText = "\(coordinate.latitude),\(coordinate.longitude)"
self.intentAction = "android.intent.action.SEND"
self.intentType = "text%2F%0Aplain"
}

enum CodingKeys: String, CodingKey {
case intentAction = "android.intent.ACTION"
case intentType = "android.intent.TYPE"
Expand Down

0 comments on commit c4119f9

Please sign in to comment.