@tokamakdev/plugin-location 0.1.0-beta.155 → 0.1.0-beta.157
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/android/build.gradle.kts +20 -0
- package/android/gradle.properties +1 -0
- package/android/settings.gradle.kts +24 -0
- package/apple/Package.swift +15 -0
- package/apple/{Exports.generated.swift → Sources/TokamakLocation/Exports.generated.swift} +6 -5
- package/apple/{Exports.swift → Sources/TokamakLocation/Exports.swift} +3 -1
- package/apple/{LocationEvents.swift → Sources/TokamakLocation/LocationEvents.swift} +1 -0
- package/apple/{LocationPlugin.swift → Sources/TokamakLocation/LocationPlugin.swift} +9 -8
- package/apple/{LocationPositions.swift → Sources/TokamakLocation/LocationPositions.swift} +1 -0
- package/apple/{LocationRegions.swift → Sources/TokamakLocation/LocationRegions.swift} +1 -0
- package/apple/{LocationTypes.swift → Sources/TokamakLocation/LocationTypes.swift} +1 -0
- package/apple/{LocationUpdates.swift → Sources/TokamakLocation/LocationUpdates.swift} +1 -0
- package/package.json +2 -2
- package/tokamak-plugin.json +2 -2
- /package/android/{Exports.generated.kt → src/main/kotlin/Exports.generated.kt} +0 -0
- /package/android/{Exports.kt → src/main/kotlin/Exports.kt} +0 -0
- /package/android/{LocationEvents.kt → src/main/kotlin/LocationEvents.kt} +0 -0
- /package/android/{LocationPlugin.kt → src/main/kotlin/LocationPlugin.kt} +0 -0
- /package/android/{LocationPositions.kt → src/main/kotlin/LocationPositions.kt} +0 -0
- /package/android/{LocationReceiver.kt → src/main/kotlin/LocationReceiver.kt} +0 -0
- /package/android/{LocationRegions.kt → src/main/kotlin/LocationRegions.kt} +0 -0
- /package/android/{LocationService.kt → src/main/kotlin/LocationService.kt} +0 -0
- /package/android/{LocationTypes.kt → src/main/kotlin/LocationTypes.kt} +0 -0
- /package/android/{LocationUpdates.kt → src/main/kotlin/LocationUpdates.kt} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
plugins {
|
|
2
|
+
id("com.android.library")
|
|
3
|
+
id("org.jetbrains.kotlin.android")
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
android {
|
|
7
|
+
namespace = "com.tokamak.plugins.location"
|
|
8
|
+
compileSdk = 35
|
|
9
|
+
defaultConfig {
|
|
10
|
+
minSdk = 31
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
kotlin {
|
|
15
|
+
jvmToolchain(17)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
dependencies {
|
|
19
|
+
implementation(project(":tokamak-plugin"))
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
android.useAndroidX=true
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The plugin's module on its own, with the plugin API it depends on, for an IDE and Gradle. Apps
|
|
2
|
+
// build it with their own settings and the pack's versions of these build tools.
|
|
3
|
+
pluginManagement {
|
|
4
|
+
repositories {
|
|
5
|
+
google()
|
|
6
|
+
mavenCentral()
|
|
7
|
+
gradlePluginPortal()
|
|
8
|
+
}
|
|
9
|
+
plugins {
|
|
10
|
+
id("com.android.library") version "8.7.3"
|
|
11
|
+
id("org.jetbrains.kotlin.android") version "2.1.0"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
dependencyResolutionManagement {
|
|
16
|
+
repositories {
|
|
17
|
+
google()
|
|
18
|
+
mavenCentral()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
rootProject.name = "location"
|
|
23
|
+
include(":tokamak-plugin")
|
|
24
|
+
project(":tokamak-plugin").projectDir = file("../node_modules/@tokamakdev/plugin/android")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
|
|
3
|
+
import PackageDescription
|
|
4
|
+
|
|
5
|
+
let package = Package(
|
|
6
|
+
name: "TokamakLocation",
|
|
7
|
+
platforms: [.iOS("17.0"), .macOS("14.0")],
|
|
8
|
+
products: [.library(name: "TokamakLocation", targets: ["TokamakLocation"])],
|
|
9
|
+
dependencies: [.package(path: "../node_modules/@tokamakdev/plugin/apple/TokamakPlugin")],
|
|
10
|
+
targets: [
|
|
11
|
+
.target(
|
|
12
|
+
name: "TokamakLocation",
|
|
13
|
+
dependencies: [.product(name: "TokamakPlugin", package: "TokamakPlugin")])
|
|
14
|
+
]
|
|
15
|
+
)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Generated by `tok plugin generate apple`. Do not edit.
|
|
2
2
|
|
|
3
3
|
import Foundation
|
|
4
|
+
import TokamakPlugin
|
|
4
5
|
|
|
5
6
|
extension TokamakLocationPlugin {
|
|
6
|
-
func callBytes(method: String, payload: Data, reply: @escaping TokamakPluginBytesReply)
|
|
7
|
+
public func callBytes(method: String, payload: Data, reply: @escaping TokamakPluginBytesReply)
|
|
7
8
|
throws(TokamakPluginError) -> (() -> Void)?
|
|
8
9
|
{
|
|
9
10
|
switch method {
|
|
@@ -88,9 +89,9 @@ extension TokamakLocationPlugin {
|
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
func subscribeBytes(
|
|
92
|
-
|
|
93
|
-
{
|
|
92
|
+
public func subscribeBytes(
|
|
93
|
+
method: String, payload: Data, reply: @escaping TokamakPluginBytesReply
|
|
94
|
+
) throws(TokamakPluginError) -> (() -> Void) {
|
|
94
95
|
switch method {
|
|
95
96
|
case "watchPosition":
|
|
96
97
|
return try tokamakStream(reply) {
|
|
@@ -117,7 +118,7 @@ extension TokamakLocationPlugin {
|
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
func eventPayload(_ name: String, _ event: Any) throws(TokamakPluginError) -> Data {
|
|
121
|
+
public func eventPayload(_ name: String, _ event: Any) throws(TokamakPluginError) -> Data {
|
|
121
122
|
switch name {
|
|
122
123
|
case "update":
|
|
123
124
|
return try tokamakEvent(name, event, as: LocationUpdate.self)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import TokamakPlugin
|
|
2
|
+
|
|
1
3
|
extension TokamakLocationPlugin: TokamakExports {
|
|
2
|
-
static func exports(_ e: inout TokamakExporter<TokamakLocationPlugin>) {
|
|
4
|
+
public static func exports(_ e: inout TokamakExporter<TokamakLocationPlugin>) {
|
|
3
5
|
e.call(
|
|
4
6
|
setup, doc: "Applies long-term location awareness, replacing the previous configuration.")
|
|
5
7
|
e.call(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import CoreLocation
|
|
2
2
|
import Foundation
|
|
3
|
+
import TokamakPlugin
|
|
3
4
|
|
|
4
5
|
#if os(iOS)
|
|
5
6
|
import UIKit
|
|
@@ -14,11 +15,11 @@ private let askedForAlwaysKey = "tokamak.location.askedForAlways"
|
|
|
14
15
|
/// How long an authorization change may take to arrive after the app is active again.
|
|
15
16
|
private let authorizationChangeDelay: TimeInterval = 1
|
|
16
17
|
|
|
17
|
-
final class TokamakLocationPlugin: NSObject, TokamakPlugin,
|
|
18
|
+
public final class TokamakLocationPlugin: NSObject, TokamakPlugin,
|
|
18
19
|
CLLocationManagerDelegate
|
|
19
20
|
{
|
|
20
|
-
let id = "location"
|
|
21
|
-
let host: TokamakHost
|
|
21
|
+
public let id = "location"
|
|
22
|
+
public let host: TokamakHost
|
|
22
23
|
|
|
23
24
|
/// A `requestPermission` waiting for the user to answer a prompt.
|
|
24
25
|
private struct Prompt {
|
|
@@ -46,7 +47,7 @@ final class TokamakLocationPlugin: NSObject, TokamakPlugin,
|
|
|
46
47
|
#endif
|
|
47
48
|
|
|
48
49
|
/// Resumes what ran when the app last ended, before launch finishes.
|
|
49
|
-
init(host: TokamakHost) {
|
|
50
|
+
public init(host: TokamakHost) {
|
|
50
51
|
self.host = host
|
|
51
52
|
events = TokamakLocationEvents(host: host)
|
|
52
53
|
updates = TokamakLocationUpdates(events: events)
|
|
@@ -223,7 +224,7 @@ final class TokamakLocationPlugin: NSObject, TokamakPlugin,
|
|
|
223
224
|
|
|
224
225
|
/// Also called when each manager is created. Every manager reports the
|
|
225
226
|
/// app's one authorization, which `authorization`'s calls handle.
|
|
226
|
-
func locationManagerDidChangeAuthorization(
|
|
227
|
+
public func locationManagerDidChangeAuthorization(
|
|
227
228
|
_ manager: CLLocationManager
|
|
228
229
|
) {
|
|
229
230
|
guard manager === authorization else { return }
|
|
@@ -232,7 +233,7 @@ final class TokamakLocationPlugin: NSObject, TokamakPlugin,
|
|
|
232
233
|
answer(Array(prompts.keys))
|
|
233
234
|
}
|
|
234
235
|
|
|
235
|
-
func locationManager(
|
|
236
|
+
public func locationManager(
|
|
236
237
|
_ manager: CLLocationManager,
|
|
237
238
|
didUpdateLocations locations: [CLLocation]
|
|
238
239
|
) {
|
|
@@ -243,7 +244,7 @@ final class TokamakLocationPlugin: NSObject, TokamakPlugin,
|
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
/// Monitoring continues while the position is not yet known.
|
|
246
|
-
func locationManager(
|
|
247
|
+
public func locationManager(
|
|
247
248
|
_ manager: CLLocationManager,
|
|
248
249
|
didFailWithError error: Error
|
|
249
250
|
) {
|
|
@@ -253,7 +254,7 @@ final class TokamakLocationPlugin: NSObject, TokamakPlugin,
|
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
/// Core Location delivers each visit to every manager's delegate.
|
|
256
|
-
func locationManager(_ manager: CLLocationManager, didVisit visit: CLVisit) {
|
|
257
|
+
public func locationManager(_ manager: CLLocationManager, didVisit visit: CLVisit) {
|
|
257
258
|
if manager === monitoring {
|
|
258
259
|
events.visit(visit)
|
|
259
260
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokamakdev/plugin-location",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.157",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/mantty/tokamak.git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"./events": "./src/events.ts"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@tokamakdev/plugin": "0.1.0-beta.
|
|
17
|
+
"@tokamakdev/plugin": "0.1.0-beta.157"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"android",
|
package/tokamak-plugin.json
CHANGED
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"build": "build/index.mjs",
|
|
39
39
|
"platforms": {
|
|
40
40
|
"macos": {
|
|
41
|
-
"class": "TokamakLocationPlugin"
|
|
41
|
+
"class": "TokamakLocation.TokamakLocationPlugin"
|
|
42
42
|
},
|
|
43
43
|
"ios": {
|
|
44
|
-
"class": "TokamakLocationPlugin"
|
|
44
|
+
"class": "TokamakLocation.TokamakLocationPlugin"
|
|
45
45
|
},
|
|
46
46
|
"android": {
|
|
47
47
|
"class": "com.tokamak.plugins.location.TokamakLocationPlugin"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|