20260111-01

This commit is contained in:
wengki81 2026-01-11 15:09:58 +08:00
parent dcff5247bc
commit f553ff9e53
7 changed files with 69 additions and 46 deletions

View File

@ -10,7 +10,7 @@ let package = Package(
targets: ["DumonGeolocationPlugin"]) targets: ["DumonGeolocationPlugin"])
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0") .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
], ],
targets: [ targets: [
.target( .target(
@ -25,4 +25,4 @@ let package = Package(
dependencies: ["DumonGeolocationPlugin"], dependencies: ["DumonGeolocationPlugin"],
path: "ios/Tests/DumonGeolocationPluginTests") path: "ios/Tests/DumonGeolocationPluginTests")
] ]
) )

2
dist/docs.json vendored
View File

@ -392,7 +392,7 @@
"tags": [], "tags": [],
"docs": "", "docs": "",
"complexTypes": [], "complexTypes": [],
"type": "'GNSS' | 'IMU' | 'DELTA' | 'NONE' | undefined" "type": "'NONE' | 'GNSS' | 'IMU' | 'DELTA' | undefined"
}, },
{ {
"name": "speedGnss", "name": "speedGnss",

View File

@ -0,0 +1,34 @@
# iOS Location Flow (Dumon Client)
Tujuan: memastikan `getLatestPosition()` tidak mengembalikan default (lat/lon 0, accuracy 999) di iOS.
## Aturan utama
- `getLatestPosition()` hanya mengembalikan snapshot terakhir dari `didUpdateLocations`.
- Jika belum ada update lokasi, hasilnya akan default.
- Jadi, `startPositioning()` wajib dipanggil dan update pertama harus diterima sebelum `getLatestPosition()` dipakai sebagai sumber data utama.
## Urutan yang benar
1. `checkAndRequestPermissions()` dipanggil saat aplikasi siap meminta lokasi.
2. Jika `location: granted`, lanjut; jika `denied`, hentikan flow dan minta user aktifkan izin.
3. Panggil `startPositioning()` sekali.
4. Tunggu event `onPositionUpdate` pertama.
5. Gunakan data dari event pertama sebagai sumber posisi awal.
6. `getLatestPosition()` baru dipakai setelah event pertama (sebagai snapshot tambahan/fallback).
## Contoh urutan (pseudo)
```ts
await checkPermission(); // harus granted
await continuousWatchPosition(); // startPositioning
await waitForFirstOnPositionUpdate(); // resolve saat listener pertama
const pos = await getGeoloc(); // sekarang safe
```
## Checklist debugging
- Pastikan `initiateLocationState()` dipanggil sebelum flow yang butuh posisi.
- Pastikan `checkPermission()` sukses sebelum `continuousWatchPosition()`.
- Pastikan ada log yang membuktikan `onPositionUpdate` terpanggil.
- Jangan panggil `getLatestPosition()` terlalu awal (sebelum update pertama).

View File

@ -13,9 +13,9 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@capacitor/android": "^6.0.0", "@capacitor/android": "^8.0.0",
"@capacitor/core": "^6.0.0", "@capacitor/core": "^8.0.0",
"@capacitor/ios": "^6.0.0", "@capacitor/ios": "^8.0.0",
"dumon-geolocation": "file:.." "dumon-geolocation": "file:.."
}, },
"devDependencies": { "devDependencies": {

56
package-lock.json generated
View File

@ -1,18 +1,18 @@
{ {
"name": "dumon-geolocation", "name": "dumon-geolocation",
"version": "1.1.0", "version": "1.1.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "dumon-geolocation", "name": "dumon-geolocation",
"version": "1.1.0", "version": "1.1.1",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@capacitor/android": "^6.0.0", "@capacitor/android": "^8.0.0",
"@capacitor/core": "^6.0.0", "@capacitor/core": "^8.0.0",
"@capacitor/docgen": "^0.3.0", "@capacitor/docgen": "^0.3.0",
"@capacitor/ios": "^6.0.0", "@capacitor/ios": "^8.0.0",
"@ionic/eslint-config": "^0.4.0", "@ionic/eslint-config": "^0.4.0",
"@ionic/prettier-config": "^4.0.0", "@ionic/prettier-config": "^4.0.0",
"@ionic/swiftlint-config": "^2.0.0", "@ionic/swiftlint-config": "^2.0.0",
@ -22,10 +22,10 @@
"rimraf": "^6.0.1", "rimraf": "^6.0.1",
"rollup": "^4.30.1", "rollup": "^4.30.1",
"swiftlint": "^2.0.0", "swiftlint": "^2.0.0",
"typescript": "~4.1.5" "typescript": "~5.8.3"
}, },
"peerDependencies": { "peerDependencies": {
"@capacitor/core": ">=6.0.0 <8" "@capacitor/core": ">=8.0.0 <9"
} }
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
@ -50,19 +50,19 @@
} }
}, },
"node_modules/@capacitor/android": { "node_modules/@capacitor/android": {
"version": "6.2.1", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/@capacitor/android/-/android-6.2.1.tgz", "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-8.0.0.tgz",
"integrity": "sha512-8gd4CIiQO5LAIlPIfd5mCuodBRxMMdZZEdj8qG8m+dQ1sQ2xyemVpzHmRK8qSCHorsBUCg3D62j2cp6bEBAkdw==", "integrity": "sha512-FrBSvVAC5JuLaYHNyDnwQny0/SYnP+xDQbc/KA4wInmRkMXLDv22fkx9aBJIDrxjuUVd+jsRih4SAt8FgMEzCw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"@capacitor/core": "^6.2.0" "@capacitor/core": "^8.0.0"
} }
}, },
"node_modules/@capacitor/core": { "node_modules/@capacitor/core": {
"version": "6.2.1", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/@capacitor/core/-/core-6.2.1.tgz", "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-8.0.0.tgz",
"integrity": "sha512-urZwxa7hVE/BnA18oCFAdizXPse6fCKanQyEqpmz6cBJ2vObwMpyJDG5jBeoSsgocS9+Ax+9vb4ducWJn0y2qQ==", "integrity": "sha512-250HTVd/W/KdMygoqaedisvNbHbpbQTN2Hy/8ZYGm1nAqE0Fx7sGss4l0nDg33STxEdDhtVRoL2fIaaiukKseA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -100,13 +100,13 @@
} }
}, },
"node_modules/@capacitor/ios": { "node_modules/@capacitor/ios": {
"version": "6.2.1", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/@capacitor/ios/-/ios-6.2.1.tgz", "resolved": "https://registry.npmjs.org/@capacitor/ios/-/ios-8.0.0.tgz",
"integrity": "sha512-tbMlQdQjxe1wyaBvYVU1yTojKJjgluZQsJkALuJxv/6F8QTw5b6vd7X785O/O7cMpIAZfUWo/vtAHzFkRV+kXw==", "integrity": "sha512-gwSn6X4uHYNHlM8zZmVmM1zjEhexxbHpPSSnH1DZkp8o3zdK/RmH8tmDma+3zPZrhhTSrMC7sT24dKTOvV8www==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"@capacitor/core": "^6.2.0" "@capacitor/core": "^8.0.0"
} }
}, },
"node_modules/@chevrotain/cst-dts-gen": { "node_modules/@chevrotain/cst-dts-gen": {
@ -3742,20 +3742,6 @@
} }
} }
}, },
"node_modules/swiftlint/node_modules/typescript": {
"version": "5.8.3",
"dev": true,
"license": "Apache-2.0",
"optional": true,
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/text-table": { "node_modules/text-table": {
"version": "0.2.0", "version": "0.2.0",
"dev": true, "dev": true,
@ -3908,7 +3894,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "4.1.6", "version": "5.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
@ -3916,7 +3904,7 @@
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"
}, },
"engines": { "engines": {
"node": ">=4.2.0" "node": ">=14.17"
} }
}, },
"node_modules/unbox-primitive": { "node_modules/unbox-primitive": {

View File

@ -1,6 +1,6 @@
{ {
"name": "dumon-geolocation", "name": "dumon-geolocation",
"version": "1.1.0", "version": "1.1.1",
"description": "Implement manager GNSS, WiFi RTT, IMU, Kalman fusion, event emitter", "description": "Implement manager GNSS, WiFi RTT, IMU, Kalman fusion, event emitter",
"main": "dist/plugin.cjs.js", "main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js", "module": "dist/esm/index.js",
@ -46,10 +46,10 @@
"prepublishOnly": "npm run build" "prepublishOnly": "npm run build"
}, },
"devDependencies": { "devDependencies": {
"@capacitor/android": "^6.0.0", "@capacitor/android": "^8.0.0",
"@capacitor/core": "^6.0.0", "@capacitor/core": "^8.0.0",
"@capacitor/docgen": "^0.3.0", "@capacitor/docgen": "^0.3.0",
"@capacitor/ios": "^6.0.0", "@capacitor/ios": "^8.0.0",
"@ionic/eslint-config": "^0.4.0", "@ionic/eslint-config": "^0.4.0",
"@ionic/prettier-config": "^4.0.0", "@ionic/prettier-config": "^4.0.0",
"@ionic/swiftlint-config": "^2.0.0", "@ionic/swiftlint-config": "^2.0.0",
@ -59,10 +59,10 @@
"rimraf": "^6.0.1", "rimraf": "^6.0.1",
"rollup": "^4.30.1", "rollup": "^4.30.1",
"swiftlint": "^2.0.0", "swiftlint": "^2.0.0",
"typescript": "~4.1.5" "typescript": "~5.8.3"
}, },
"peerDependencies": { "peerDependencies": {
"@capacitor/core": ">=6.0.0 <8" "@capacitor/core": ">=8.0.0 <9"
}, },
"prettier": "@ionic/prettier-config", "prettier": "@ionic/prettier-config",
"swiftlint": "@ionic/swiftlint-config", "swiftlint": "@ionic/swiftlint-config",

View File

@ -16,6 +16,7 @@
"strict": true, "strict": true,
"target": "es2017", "target": "es2017",
"baseUrl": "./", "baseUrl": "./",
"types": [],
"paths": { "paths": {
"dumon-geolocation": ["node_modules/dumon-geolocation/dist/esm"] "dumon-geolocation": ["node_modules/dumon-geolocation/dist/esm"]
} }