@castelio-it/capacitor-mapboxnav 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorMapboxnav.podspec +17 -0
- package/Package.swift +28 -0
- package/README.md +146 -0
- package/android/build.gradle +92 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +22 -0
- package/android/gradlew +251 -0
- package/android/gradlew.bat +94 -0
- package/android/proguard-rules.pro +17 -0
- package/android/settings.gradle +2 -0
- package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +26 -0
- package/android/src/main/AndroidManifest.xml +24 -0
- package/android/src/main/java/com/castelioit/capacitormapboxnav/FreeDriveActivity.kt +126 -0
- package/android/src/main/java/com/castelioit/capacitormapboxnav/NavigationActivity.kt +276 -0
- package/android/src/main/java/com/castelioit/capacitormapboxnav/TurnByTurnExperienceActivity.kt +683 -0
- package/android/src/main/java/com/castelioit/capacitormapboxnav/capacitormapboxnav.kt +51 -0
- package/android/src/main/java/com/castelioit/capacitormapboxnav/capacitormapboxnavPlugin.java +142 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/android/src/main/res/layout/mapbox_activity_free_drive.xml +25 -0
- package/android/src/main/res/layout/mapbox_activity_turn_by_turn_experience.xml +80 -0
- package/android/src/test/java/com/castelioit/capacitormapboxnav/capacitormapboxnavTest.kt +15 -0
- package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +18 -0
- package/dist/docs.json +89 -0
- package/dist/esm/definitions.d.ts +58 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +35 -0
- package/dist/esm/web.js +20 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +34 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +37 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/capacitormapboxnavPlugin/capacitormapboxnav.swift +8 -0
- package/ios/Sources/capacitormapboxnavPlugin/capacitormapboxnavPlugin.swift +33 -0
- package/ios/Tests/capacitormapboxnavPluginTests/capacitormapboxnavTests.swift +23 -0
- package/package.json +93 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
package com.castelioit.capacitormapboxnav
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.content.Intent
|
|
6
|
+
import com.getcapacitor.Logger
|
|
7
|
+
import com.mapbox.common.MapboxOptions
|
|
8
|
+
import com.mapbox.navigation.core.lifecycle.MapboxNavigationApp
|
|
9
|
+
import com.mapbox.navigation.base.options.NavigationOptions
|
|
10
|
+
|
|
11
|
+
class capacitormapboxnav {
|
|
12
|
+
|
|
13
|
+
fun echo(value: String): String {
|
|
14
|
+
Logger.info("Echo", value)
|
|
15
|
+
return value
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
fun initialize(context: Context, accessToken: String) {
|
|
19
|
+
MapboxOptions.accessToken = accessToken
|
|
20
|
+
if (!MapboxNavigationApp.isSetup()) {
|
|
21
|
+
MapboxNavigationApp.setup(NavigationOptions.Builder(context).build())
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fun startNavigation(activity: Activity, originLat: Double, originLng: Double, destLat: Double, destLng: Double, simulateRoute: Boolean) {
|
|
26
|
+
val intent = Intent(activity, NavigationActivity::class.java).apply {
|
|
27
|
+
putExtra("originLat", originLat)
|
|
28
|
+
putExtra("originLng", originLng)
|
|
29
|
+
putExtra("destLat", destLat)
|
|
30
|
+
putExtra("destLng", destLng)
|
|
31
|
+
putExtra("simulateRoute", simulateRoute)
|
|
32
|
+
}
|
|
33
|
+
activity.startActivity(intent)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fun startTurnByTurnExperience(activity: Activity, originLat: Double, originLng: Double, destLat: Double, destLng: Double, simulateRoute: Boolean) {
|
|
37
|
+
val intent = Intent(activity, TurnByTurnExperienceActivity::class.java).apply {
|
|
38
|
+
putExtra("originLat", originLat)
|
|
39
|
+
putExtra("originLng", originLng)
|
|
40
|
+
putExtra("destLat", destLat)
|
|
41
|
+
putExtra("destLng", destLng)
|
|
42
|
+
putExtra("simulateRoute", simulateRoute)
|
|
43
|
+
}
|
|
44
|
+
activity.startActivity(intent)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fun startFreeDrive(activity: Activity) {
|
|
48
|
+
val intent = Intent(activity, FreeDriveActivity::class.java)
|
|
49
|
+
activity.startActivity(intent)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
package com.castelioit.capacitormapboxnav;
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.JSObject;
|
|
4
|
+
import com.getcapacitor.Plugin;
|
|
5
|
+
import com.getcapacitor.PluginCall;
|
|
6
|
+
import com.getcapacitor.PluginMethod;
|
|
7
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
8
|
+
import org.json.JSONException;
|
|
9
|
+
|
|
10
|
+
@CapacitorPlugin(name = "capacitormapboxnav")
|
|
11
|
+
public class capacitormapboxnavPlugin extends Plugin {
|
|
12
|
+
|
|
13
|
+
private capacitormapboxnav implementation = new capacitormapboxnav();
|
|
14
|
+
|
|
15
|
+
@PluginMethod
|
|
16
|
+
public void echo(PluginCall call) {
|
|
17
|
+
String value = call.getString("value");
|
|
18
|
+
|
|
19
|
+
JSObject ret = new JSObject();
|
|
20
|
+
ret.put("value", implementation.echo(value));
|
|
21
|
+
call.resolve(ret);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@PluginMethod
|
|
25
|
+
public void initialize(PluginCall call) {
|
|
26
|
+
String accessToken = call.getString("accessToken");
|
|
27
|
+
if (accessToken == null) {
|
|
28
|
+
call.reject("AccessToken is required");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
getActivity().runOnUiThread(() -> {
|
|
32
|
+
try {
|
|
33
|
+
implementation.initialize(getContext(), accessToken);
|
|
34
|
+
call.resolve();
|
|
35
|
+
} catch (Exception e) {
|
|
36
|
+
call.reject("Initialization failed: " + e.getMessage());
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@PluginMethod
|
|
42
|
+
public void startNavigation(PluginCall call) throws JSONException {
|
|
43
|
+
JSObject origin = call.getObject("origin");
|
|
44
|
+
JSObject destination = call.getObject("destination");
|
|
45
|
+
Boolean simulateRoute = call.getBoolean("simulateRoute", false);
|
|
46
|
+
|
|
47
|
+
if (origin == null || destination == null) {
|
|
48
|
+
call.reject("Origin and destination are required");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Double originLat = origin.getDouble("latitude");
|
|
53
|
+
Double originLng = origin.getDouble("longitude");
|
|
54
|
+
Double destLat = destination.getDouble("latitude");
|
|
55
|
+
Double destLng = destination.getDouble("longitude");
|
|
56
|
+
|
|
57
|
+
if (originLat == null || originLng == null || destLat == null || destLng == null) {
|
|
58
|
+
call.reject("Invalid origin or destination coordinates");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (
|
|
63
|
+
originLat < -90 ||
|
|
64
|
+
originLat > 90 ||
|
|
65
|
+
originLng < -180 ||
|
|
66
|
+
originLng > 180 ||
|
|
67
|
+
destLat < -90 ||
|
|
68
|
+
destLat > 90 ||
|
|
69
|
+
destLng < -180 ||
|
|
70
|
+
destLng > 180
|
|
71
|
+
) {
|
|
72
|
+
call.reject("Coordinates out of range");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
getActivity().runOnUiThread(() -> {
|
|
77
|
+
try {
|
|
78
|
+
implementation.startNavigation(getActivity(), originLat, originLng, destLat, destLng, simulateRoute);
|
|
79
|
+
call.resolve();
|
|
80
|
+
} catch (Exception e) {
|
|
81
|
+
call.reject("Failed to start navigation: " + e.getMessage());
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@PluginMethod
|
|
87
|
+
public void startTurnByTurnExperience(PluginCall call) throws JSONException {
|
|
88
|
+
JSObject origin = call.getObject("origin");
|
|
89
|
+
JSObject destination = call.getObject("destination");
|
|
90
|
+
Boolean simulateRoute = call.getBoolean("simulateRoute", false);
|
|
91
|
+
|
|
92
|
+
if (origin == null || destination == null) {
|
|
93
|
+
call.reject("Origin and destination are required");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
Double originLat = origin.getDouble("latitude");
|
|
98
|
+
Double originLng = origin.getDouble("longitude");
|
|
99
|
+
Double destLat = destination.getDouble("latitude");
|
|
100
|
+
Double destLng = destination.getDouble("longitude");
|
|
101
|
+
|
|
102
|
+
if (originLat == null || originLng == null || destLat == null || destLng == null) {
|
|
103
|
+
call.reject("Invalid origin or destination coordinates");
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (
|
|
108
|
+
originLat < -90 ||
|
|
109
|
+
originLat > 90 ||
|
|
110
|
+
originLng < -180 ||
|
|
111
|
+
originLng > 180 ||
|
|
112
|
+
destLat < -90 ||
|
|
113
|
+
destLat > 90 ||
|
|
114
|
+
destLng < -180 ||
|
|
115
|
+
destLng > 180
|
|
116
|
+
) {
|
|
117
|
+
call.reject("Coordinates out of range");
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
getActivity().runOnUiThread(() -> {
|
|
122
|
+
try {
|
|
123
|
+
implementation.startTurnByTurnExperience(getActivity(), originLat, originLng, destLat, destLng, simulateRoute);
|
|
124
|
+
call.resolve();
|
|
125
|
+
} catch (Exception e) {
|
|
126
|
+
call.reject("Failed to start turn-by-turn experience: " + e.getMessage());
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@PluginMethod
|
|
132
|
+
public void startFreeDrive(PluginCall call) {
|
|
133
|
+
getActivity().runOnUiThread(() -> {
|
|
134
|
+
try {
|
|
135
|
+
implementation.startFreeDrive(getActivity());
|
|
136
|
+
call.resolve();
|
|
137
|
+
} catch (Exception e) {
|
|
138
|
+
call.reject("Failed to start free drive: " + e.getMessage());
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
4
|
+
android:layout_width="match_parent"
|
|
5
|
+
android:layout_height="match_parent">
|
|
6
|
+
|
|
7
|
+
<com.mapbox.maps.MapView
|
|
8
|
+
android:id="@+id/mapView"
|
|
9
|
+
android:layout_width="0dp"
|
|
10
|
+
android:layout_height="0dp"
|
|
11
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
|
12
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
13
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
14
|
+
app:layout_constraintTop_toTopOf="parent" />
|
|
15
|
+
|
|
16
|
+
<com.mapbox.navigation.ui.components.maps.camera.view.MapboxRecenterButton
|
|
17
|
+
android:id="@+id/recenter"
|
|
18
|
+
android:layout_width="wrap_content"
|
|
19
|
+
android:layout_height="wrap_content"
|
|
20
|
+
android:layout_marginEnd="16dp"
|
|
21
|
+
android:layout_marginBottom="16dp"
|
|
22
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
|
23
|
+
app:layout_constraintEnd_toEndOf="parent" />
|
|
24
|
+
|
|
25
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
4
|
+
android:layout_width="match_parent"
|
|
5
|
+
android:layout_height="match_parent">
|
|
6
|
+
|
|
7
|
+
<com.mapbox.maps.MapView
|
|
8
|
+
android:id="@+id/mapView"
|
|
9
|
+
android:layout_width="0dp"
|
|
10
|
+
android:layout_height="0dp"
|
|
11
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
|
12
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
13
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
14
|
+
app:layout_constraintTop_toTopOf="parent" />
|
|
15
|
+
|
|
16
|
+
<androidx.cardview.widget.CardView
|
|
17
|
+
android:id="@+id/tripProgressCard"
|
|
18
|
+
android:layout_width="0dp"
|
|
19
|
+
android:layout_height="wrap_content"
|
|
20
|
+
android:visibility="invisible"
|
|
21
|
+
app:cardElevation="8dp"
|
|
22
|
+
app:cardUseCompatPadding="false"
|
|
23
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
|
24
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
25
|
+
app:layout_constraintStart_toStartOf="parent">
|
|
26
|
+
|
|
27
|
+
<com.mapbox.navigation.ui.components.tripprogress.view.MapboxTripProgressView
|
|
28
|
+
android:id="@+id/tripProgressView"
|
|
29
|
+
android:layout_width="match_parent"
|
|
30
|
+
android:layout_height="wrap_content" />
|
|
31
|
+
|
|
32
|
+
<ImageView
|
|
33
|
+
android:id="@+id/stop"
|
|
34
|
+
android:layout_width="48dp"
|
|
35
|
+
android:layout_height="48dp"
|
|
36
|
+
android:layout_gravity="end|center_vertical"
|
|
37
|
+
android:layout_marginEnd="12dp"
|
|
38
|
+
app:srcCompat="@android:drawable/ic_delete" />
|
|
39
|
+
</androidx.cardview.widget.CardView>
|
|
40
|
+
|
|
41
|
+
<com.mapbox.navigation.ui.components.maneuver.view.MapboxManeuverView
|
|
42
|
+
android:id="@+id/maneuverView"
|
|
43
|
+
android:layout_width="0dp"
|
|
44
|
+
android:layout_height="wrap_content"
|
|
45
|
+
android:layout_margin="4dp"
|
|
46
|
+
android:visibility="invisible"
|
|
47
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
48
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
49
|
+
app:layout_constraintTop_toTopOf="parent" />
|
|
50
|
+
|
|
51
|
+
<com.mapbox.navigation.ui.components.voice.view.MapboxSoundButton
|
|
52
|
+
android:id="@+id/soundButton"
|
|
53
|
+
android:layout_width="wrap_content"
|
|
54
|
+
android:layout_height="wrap_content"
|
|
55
|
+
android:layout_marginTop="8dp"
|
|
56
|
+
android:layout_marginEnd="16dp"
|
|
57
|
+
android:visibility="invisible"
|
|
58
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
59
|
+
app:layout_constraintTop_toBottomOf="@id/maneuverView" />
|
|
60
|
+
|
|
61
|
+
<com.mapbox.navigation.ui.components.maps.camera.view.MapboxRouteOverviewButton
|
|
62
|
+
android:id="@+id/routeOverview"
|
|
63
|
+
android:layout_width="wrap_content"
|
|
64
|
+
android:layout_height="wrap_content"
|
|
65
|
+
android:layout_marginTop="8dp"
|
|
66
|
+
android:layout_marginEnd="16dp"
|
|
67
|
+
android:visibility="invisible"
|
|
68
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
69
|
+
app:layout_constraintTop_toBottomOf="@id/soundButton" />
|
|
70
|
+
|
|
71
|
+
<com.mapbox.navigation.ui.components.maps.camera.view.MapboxRecenterButton
|
|
72
|
+
android:id="@+id/recenter"
|
|
73
|
+
android:layout_width="wrap_content"
|
|
74
|
+
android:layout_height="wrap_content"
|
|
75
|
+
android:layout_marginTop="8dp"
|
|
76
|
+
android:layout_marginEnd="16dp"
|
|
77
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
78
|
+
app:layout_constraintTop_toBottomOf="@id/routeOverview" />
|
|
79
|
+
|
|
80
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package com.castelioit.capacitormapboxnav
|
|
2
|
+
|
|
3
|
+
import org.junit.Assert.assertEquals
|
|
4
|
+
import org.junit.Test
|
|
5
|
+
|
|
6
|
+
class capacitormapboxnavTest {
|
|
7
|
+
|
|
8
|
+
@Test
|
|
9
|
+
fun echo_isCorrect() {
|
|
10
|
+
val implementation = capacitormapboxnav()
|
|
11
|
+
val value = "Hello, World!"
|
|
12
|
+
val result = implementation.echo(value)
|
|
13
|
+
assertEquals(value, result)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package com.getcapacitor;
|
|
2
|
+
|
|
3
|
+
import static org.junit.Assert.*;
|
|
4
|
+
|
|
5
|
+
import org.junit.Test;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Example local unit test, which will execute on the development machine (host).
|
|
9
|
+
*
|
|
10
|
+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
11
|
+
*/
|
|
12
|
+
public class ExampleUnitTest {
|
|
13
|
+
|
|
14
|
+
@Test
|
|
15
|
+
public void addition_isCorrect() throws Exception {
|
|
16
|
+
assertEquals(4, 2 + 2);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "capacitormapboxnavPlugin",
|
|
4
|
+
"slug": "capacitormapboxnavplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "echo",
|
|
10
|
+
"signature": "(options: { value: string; }) => Promise<{ value: string; }>",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"name": "options",
|
|
14
|
+
"docs": "",
|
|
15
|
+
"type": "{ value: string; }"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"returns": "Promise<{ value: string; }>",
|
|
19
|
+
"tags": [],
|
|
20
|
+
"docs": "Echo back the provided value.",
|
|
21
|
+
"complexTypes": [],
|
|
22
|
+
"slug": "echo"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "initialize",
|
|
26
|
+
"signature": "(options: { accessToken: string; }) => Promise<void>",
|
|
27
|
+
"parameters": [
|
|
28
|
+
{
|
|
29
|
+
"name": "options",
|
|
30
|
+
"docs": "",
|
|
31
|
+
"type": "{ accessToken: string; }"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"returns": "Promise<void>",
|
|
35
|
+
"tags": [],
|
|
36
|
+
"docs": "Initialize the Mapbox Navigation SDK with your public access token.\nThis must be called before any navigation activity.",
|
|
37
|
+
"complexTypes": [],
|
|
38
|
+
"slug": "initialize"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "startNavigation",
|
|
42
|
+
"signature": "(options: { origin: { latitude: number; longitude: number; }; destination: { latitude: number; longitude: number; }; simulateRoute?: boolean; }) => Promise<void>",
|
|
43
|
+
"parameters": [
|
|
44
|
+
{
|
|
45
|
+
"name": "options",
|
|
46
|
+
"docs": "",
|
|
47
|
+
"type": "{ origin: { latitude: number; longitude: number; }; destination: { latitude: number; longitude: number; }; simulateRoute?: boolean | undefined; }"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"returns": "Promise<void>",
|
|
51
|
+
"tags": [],
|
|
52
|
+
"docs": "Start a basic navigation session with a simple map overview.\nUseful for background navigation or lightweight tracking.",
|
|
53
|
+
"complexTypes": [],
|
|
54
|
+
"slug": "startnavigation"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "startTurnByTurnExperience",
|
|
58
|
+
"signature": "(options: { origin: { latitude: number; longitude: number; }; destination: { latitude: number; longitude: number; }; simulateRoute?: boolean; }) => Promise<void>",
|
|
59
|
+
"parameters": [
|
|
60
|
+
{
|
|
61
|
+
"name": "options",
|
|
62
|
+
"docs": "",
|
|
63
|
+
"type": "{ origin: { latitude: number; longitude: number; }; destination: { latitude: number; longitude: number; }; simulateRoute?: boolean | undefined; }"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"returns": "Promise<void>",
|
|
67
|
+
"tags": [],
|
|
68
|
+
"docs": "Start a full Turn-by-Turn navigation experience.\nIncludes instruction banners, maneuvers, speed limits, and total trip progress.",
|
|
69
|
+
"complexTypes": [],
|
|
70
|
+
"slug": "startturnbyturnexperience"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "startFreeDrive",
|
|
74
|
+
"signature": "() => Promise<void>",
|
|
75
|
+
"parameters": [],
|
|
76
|
+
"returns": "Promise<void>",
|
|
77
|
+
"tags": [],
|
|
78
|
+
"docs": "Start a Free Drive session (Position tracking).\nShows the map centered on the user with no active route or destination.",
|
|
79
|
+
"complexTypes": [],
|
|
80
|
+
"slug": "startfreedrive"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"properties": []
|
|
84
|
+
},
|
|
85
|
+
"interfaces": [],
|
|
86
|
+
"enums": [],
|
|
87
|
+
"typeAliases": [],
|
|
88
|
+
"pluginConfigs": []
|
|
89
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface capacitormapboxnavPlugin {
|
|
2
|
+
/**
|
|
3
|
+
* Echo back the provided value.
|
|
4
|
+
*/
|
|
5
|
+
echo(options: {
|
|
6
|
+
value: string;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
value: string;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Initialize the Mapbox Navigation SDK with your public access token.
|
|
12
|
+
* This must be called before any navigation activity.
|
|
13
|
+
*/
|
|
14
|
+
initialize(options: {
|
|
15
|
+
accessToken: string;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Start a basic navigation session with a simple map overview.
|
|
19
|
+
* Useful for background navigation or lightweight tracking.
|
|
20
|
+
*/
|
|
21
|
+
startNavigation(options: {
|
|
22
|
+
/** The starting coordinates. */
|
|
23
|
+
origin: {
|
|
24
|
+
latitude: number;
|
|
25
|
+
longitude: number;
|
|
26
|
+
};
|
|
27
|
+
/** The target destination coordinates. */
|
|
28
|
+
destination: {
|
|
29
|
+
latitude: number;
|
|
30
|
+
longitude: number;
|
|
31
|
+
};
|
|
32
|
+
/** Whether to simulate the movement along the route (true for testing). */
|
|
33
|
+
simulateRoute?: boolean;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Start a full Turn-by-Turn navigation experience.
|
|
37
|
+
* Includes instruction banners, maneuvers, speed limits, and total trip progress.
|
|
38
|
+
*/
|
|
39
|
+
startTurnByTurnExperience(options: {
|
|
40
|
+
/** The starting coordinates. */
|
|
41
|
+
origin: {
|
|
42
|
+
latitude: number;
|
|
43
|
+
longitude: number;
|
|
44
|
+
};
|
|
45
|
+
/** The target destination coordinates. */
|
|
46
|
+
destination: {
|
|
47
|
+
latitude: number;
|
|
48
|
+
longitude: number;
|
|
49
|
+
};
|
|
50
|
+
/** Whether to simulate the movement along the route (true for testing). */
|
|
51
|
+
simulateRoute?: boolean;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Start a Free Drive session (Position tracking).
|
|
55
|
+
* Shows the map centered on the user with no active route or destination.
|
|
56
|
+
*/
|
|
57
|
+
startFreeDrive(): Promise<void>;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface capacitormapboxnavPlugin {\n /**\n * Echo back the provided value.\n */\n echo(options: { value: string }): Promise<{ value: string }>;\n\n /**\n * Initialize the Mapbox Navigation SDK with your public access token.\n * This must be called before any navigation activity.\n */\n initialize(options: { accessToken: string }): Promise<void>;\n\n /**\n * Start a basic navigation session with a simple map overview.\n * Useful for background navigation or lightweight tracking.\n */\n startNavigation(options: {\n /** The starting coordinates. */\n origin: { latitude: number; longitude: number };\n /** The target destination coordinates. */\n destination: { latitude: number; longitude: number };\n /** Whether to simulate the movement along the route (true for testing). */\n simulateRoute?: boolean;\n }): Promise<void>;\n\n /**\n * Start a full Turn-by-Turn navigation experience.\n * Includes instruction banners, maneuvers, speed limits, and total trip progress.\n */\n startTurnByTurnExperience(options: {\n /** The starting coordinates. */\n origin: { latitude: number; longitude: number };\n /** The target destination coordinates. */\n destination: { latitude: number; longitude: number };\n /** Whether to simulate the movement along the route (true for testing). */\n simulateRoute?: boolean;\n }): Promise<void>;\n\n /**\n * Start a Free Drive session (Position tracking).\n * Shows the map centered on the user with no active route or destination.\n */\n startFreeDrive(): Promise<void>;\n}\n\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const capacitormapboxnav = registerPlugin('capacitormapboxnav', {
|
|
3
|
+
web: () => import('./web').then((m) => new m.capacitormapboxnavWeb()),
|
|
4
|
+
});
|
|
5
|
+
export * from './definitions';
|
|
6
|
+
export { capacitormapboxnav };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,kBAAkB,GAAG,cAAc,CAA2B,oBAAoB,EAAE;IACxF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;CACtE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { capacitormapboxnavPlugin } from './definitions';\n\nconst capacitormapboxnav = registerPlugin<capacitormapboxnavPlugin>('capacitormapboxnav', {\n web: () => import('./web').then((m) => new m.capacitormapboxnavWeb()),\n});\n\nexport * from './definitions';\nexport { capacitormapboxnav };\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { capacitormapboxnavPlugin } from './definitions';
|
|
3
|
+
export declare class capacitormapboxnavWeb extends WebPlugin implements capacitormapboxnavPlugin {
|
|
4
|
+
echo(options: {
|
|
5
|
+
value: string;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
value: string;
|
|
8
|
+
}>;
|
|
9
|
+
initialize(options: {
|
|
10
|
+
accessToken: string;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
startNavigation(options: {
|
|
13
|
+
origin: {
|
|
14
|
+
latitude: number;
|
|
15
|
+
longitude: number;
|
|
16
|
+
};
|
|
17
|
+
destination: {
|
|
18
|
+
latitude: number;
|
|
19
|
+
longitude: number;
|
|
20
|
+
};
|
|
21
|
+
simulateRoute?: boolean;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
startTurnByTurnExperience(options: {
|
|
24
|
+
origin: {
|
|
25
|
+
latitude: number;
|
|
26
|
+
longitude: number;
|
|
27
|
+
};
|
|
28
|
+
destination: {
|
|
29
|
+
latitude: number;
|
|
30
|
+
longitude: number;
|
|
31
|
+
};
|
|
32
|
+
simulateRoute?: boolean;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
startFreeDrive(): Promise<void>;
|
|
35
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class capacitormapboxnavWeb extends WebPlugin {
|
|
3
|
+
async echo(options) {
|
|
4
|
+
console.log('ECHO', options);
|
|
5
|
+
return options;
|
|
6
|
+
}
|
|
7
|
+
async initialize(options) {
|
|
8
|
+
console.log('INITIALIZE', options);
|
|
9
|
+
}
|
|
10
|
+
async startNavigation(options) {
|
|
11
|
+
console.log('START_NAVIGATION', options);
|
|
12
|
+
}
|
|
13
|
+
async startTurnByTurnExperience(options) {
|
|
14
|
+
console.log('START_TURN_BY_TURN_EXPERIENCE', options);
|
|
15
|
+
}
|
|
16
|
+
async startFreeDrive() {
|
|
17
|
+
console.log('START_FREE_DRIVE');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAgC;QAC/C,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAIrB;QACC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,OAI/B;QACC,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { capacitormapboxnavPlugin } from './definitions';\n\nexport class capacitormapboxnavWeb extends WebPlugin implements capacitormapboxnavPlugin {\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n\n async initialize(options: { accessToken: string }): Promise<void> {\n console.log('INITIALIZE', options);\n }\n\n async startNavigation(options: {\n origin: { latitude: number; longitude: number };\n destination: { latitude: number; longitude: number };\n simulateRoute?: boolean;\n }): Promise<void> {\n console.log('START_NAVIGATION', options);\n }\n\n async startTurnByTurnExperience(options: {\n origin: { latitude: number; longitude: number };\n destination: { latitude: number; longitude: number };\n simulateRoute?: boolean;\n }): Promise<void> {\n console.log('START_TURN_BY_TURN_EXPERIENCE', options);\n }\n\n async startFreeDrive(): Promise<void> {\n console.log('START_FREE_DRIVE');\n }\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const capacitormapboxnav = core.registerPlugin('capacitormapboxnav', {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.capacitormapboxnavWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
class capacitormapboxnavWeb extends core.WebPlugin {
|
|
10
|
+
async echo(options) {
|
|
11
|
+
console.log('ECHO', options);
|
|
12
|
+
return options;
|
|
13
|
+
}
|
|
14
|
+
async initialize(options) {
|
|
15
|
+
console.log('INITIALIZE', options);
|
|
16
|
+
}
|
|
17
|
+
async startNavigation(options) {
|
|
18
|
+
console.log('START_NAVIGATION', options);
|
|
19
|
+
}
|
|
20
|
+
async startTurnByTurnExperience(options) {
|
|
21
|
+
console.log('START_TURN_BY_TURN_EXPERIENCE', options);
|
|
22
|
+
}
|
|
23
|
+
async startFreeDrive() {
|
|
24
|
+
console.log('START_FREE_DRIVE');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
29
|
+
__proto__: null,
|
|
30
|
+
capacitormapboxnavWeb: capacitormapboxnavWeb
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
exports.capacitormapboxnav = capacitormapboxnav;
|
|
34
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst capacitormapboxnav = registerPlugin('capacitormapboxnav', {\n web: () => import('./web').then((m) => new m.capacitormapboxnavWeb()),\n});\nexport * from './definitions';\nexport { capacitormapboxnav };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class capacitormapboxnavWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async initialize(options) {\n console.log('INITIALIZE', options);\n }\n async startNavigation(options) {\n console.log('START_NAVIGATION', options);\n }\n async startTurnByTurnExperience(options) {\n console.log('START_TURN_BY_TURN_EXPERIENCE', options);\n }\n async startFreeDrive() {\n console.log('START_FREE_DRIVE');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;AAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACzE,CAAC;;ACFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;AACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC;AAC1C,IAAI;AACJ,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;AACnC,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC;AAChD,IAAI;AACJ,IAAI,MAAM,yBAAyB,CAAC,OAAO,EAAE;AAC7C,QAAQ,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,OAAO,CAAC;AAC7D,IAAI;AACJ,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;AACvC,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var capacitorcapacitormapboxnav = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const capacitormapboxnav = core.registerPlugin('capacitormapboxnav', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.capacitormapboxnavWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
class capacitormapboxnavWeb extends core.WebPlugin {
|
|
9
|
+
async echo(options) {
|
|
10
|
+
console.log('ECHO', options);
|
|
11
|
+
return options;
|
|
12
|
+
}
|
|
13
|
+
async initialize(options) {
|
|
14
|
+
console.log('INITIALIZE', options);
|
|
15
|
+
}
|
|
16
|
+
async startNavigation(options) {
|
|
17
|
+
console.log('START_NAVIGATION', options);
|
|
18
|
+
}
|
|
19
|
+
async startTurnByTurnExperience(options) {
|
|
20
|
+
console.log('START_TURN_BY_TURN_EXPERIENCE', options);
|
|
21
|
+
}
|
|
22
|
+
async startFreeDrive() {
|
|
23
|
+
console.log('START_FREE_DRIVE');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
28
|
+
__proto__: null,
|
|
29
|
+
capacitormapboxnavWeb: capacitormapboxnavWeb
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
exports.capacitormapboxnav = capacitormapboxnav;
|
|
33
|
+
|
|
34
|
+
return exports;
|
|
35
|
+
|
|
36
|
+
})({}, capacitorExports);
|
|
37
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst capacitormapboxnav = registerPlugin('capacitormapboxnav', {\n web: () => import('./web').then((m) => new m.capacitormapboxnavWeb()),\n});\nexport * from './definitions';\nexport { capacitormapboxnav };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class capacitormapboxnavWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async initialize(options) {\n console.log('INITIALIZE', options);\n }\n async startNavigation(options) {\n console.log('START_NAVIGATION', options);\n }\n async startTurnByTurnExperience(options) {\n console.log('START_TURN_BY_TURN_EXPERIENCE', options);\n }\n async startFreeDrive() {\n console.log('START_FREE_DRIVE');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;IAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;IACzE,CAAC;;ICFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;IACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC;IAC1C,IAAI;IACJ,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;IACnC,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAChD,IAAI;IACJ,IAAI,MAAM,yBAAyB,CAAC,OAAO,EAAE;IAC7C,QAAQ,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,OAAO,CAAC;IAC7D,IAAI;IACJ,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IACvC,IAAI;IACJ;;;;;;;;;;;;;;;"}
|