@tileflow/react-native 0.1.0-alpha.7 → 0.1.0-alpha.9
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/README.md +19 -17
- package/dist/{contract-BaK24QZD.d.ts → contract-BWCbfMOx.d.ts} +19 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +444 -75
- package/dist/internal/camera.d.ts +1 -1
- package/dist/internal/initial-view.d.ts +1 -1
- package/dist/internal/interactions.js +1 -0
- package/dist/internal/native-admission.d.ts +1 -0
- package/dist/internal/native-admission.js +47 -21
- package/dist/internal/native-appearance.d.ts +1 -1
- package/dist/internal/session.d.ts +4 -1
- package/dist/internal/session.js +46 -20
- package/dist/internal/source-state.d.ts +1 -1
- package/package.json +3 -4
- package/docs/native-admission.md +0 -124
- package/docs/native-configuration.md +0 -210
- package/docs/native-interactions.md +0 -161
- package/docs/native-location.md +0 -148
package/docs/native-location.md
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
# Application-owned foreground location
|
|
2
|
-
|
|
3
|
-
`@tileflow/react-native` does not own device location. A Tileflow `Map` renders normally without a
|
|
4
|
-
location permission, provider, hook or native location module. The application decides whether to
|
|
5
|
-
request foreground permission, which provider to use, when observation starts and stops, what fix is
|
|
6
|
-
displayed, whether recentering is offered, and what status or error UI is appropriate.
|
|
7
|
-
|
|
8
|
-
This guide describes a source-checkout recipe built only from the existing public `Map`, controlled
|
|
9
|
-
camera and annotation contracts. It is not a new Tileflow runtime API and it does not add a location
|
|
10
|
-
provider to the package.
|
|
11
|
-
|
|
12
|
-
## Boundary
|
|
13
|
-
|
|
14
|
-
The package deliberately does not provide any of the following:
|
|
15
|
-
|
|
16
|
-
- a Tileflow location component, hook, provider or permission API;
|
|
17
|
-
- an iOS or Android location permission declaration;
|
|
18
|
-
- a dependency on Expo Location, a geolocation package or another location provider;
|
|
19
|
-
- a background task, background permission or location-history store;
|
|
20
|
-
- a credential/session field for device location;
|
|
21
|
-
- a location analytics event or precise-coordinate telemetry path;
|
|
22
|
-
- a GeoIP fallback for device location;
|
|
23
|
-
- implicit permission requests or tracking when `Map` mounts.
|
|
24
|
-
|
|
25
|
-
The application must configure any native permission strings, manifest entries and provider setup
|
|
26
|
-
required by the provider it chooses. Those application settings are separate from Tileflow's native
|
|
27
|
-
Hosted credential configuration.
|
|
28
|
-
|
|
29
|
-
## Source-checkout recipe
|
|
30
|
-
|
|
31
|
-
`../harness/ForegroundLocationExample.tsx` is a compile-only example owned by this package. Its
|
|
32
|
-
provider boundary is injected:
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
export type ApplicationForegroundLocationAdapter = Readonly<{
|
|
36
|
-
requestPermission(): Promise<
|
|
37
|
-
'granted-precise' | 'granted-approximate' | 'denied' | 'unavailable'
|
|
38
|
-
>;
|
|
39
|
-
observe(listener: (update: ApplicationLocationObservation) => void): () => void;
|
|
40
|
-
}>;
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
No concrete provider is imported. The adapter is application code: it translates the provider's
|
|
44
|
-
permission and foreground observation APIs into this small recipe-specific shape. The example and
|
|
45
|
-
its state helper live under `harness/`, are absent from package exports, and are excluded from
|
|
46
|
-
packed runtime files.
|
|
47
|
-
|
|
48
|
-
## Explicit application state
|
|
49
|
-
|
|
50
|
-
The recipe models these states without unmounting the Map:
|
|
51
|
-
|
|
52
|
-
| State | Meaning | Location annotation |
|
|
53
|
-
| --------------------- | ------------------------------------------------------------ | ---------------------------- |
|
|
54
|
-
| `idle` | The application has not requested permission. | none |
|
|
55
|
-
| `requesting` | An explicit application action started a permission request. | none |
|
|
56
|
-
| `granted-precise` | Foreground policy allows precise observation. | one marker after a valid fix |
|
|
57
|
-
| `granted-approximate` | Foreground policy allows approximate observation. | one marker after a valid fix |
|
|
58
|
-
| `denied` | The permission request was denied. | none |
|
|
59
|
-
| `unavailable` | Permission/provider setup failed or emitted invalid data. | none |
|
|
60
|
-
| `revoked` | A previously granted observation reported revocation. | removed immediately |
|
|
61
|
-
|
|
62
|
-
Construction is inert: it neither requests permission nor starts observation. The example's **Use
|
|
63
|
-
my location** control is the only permission-request trigger. A rejected provider promise is reduced
|
|
64
|
-
to the application-level `unavailable` state; raw provider exceptions are not forwarded into Map
|
|
65
|
-
props or Tileflow callbacks.
|
|
66
|
-
|
|
67
|
-
## Validate before Map props
|
|
68
|
-
|
|
69
|
-
The adapter output is treated as untrusted runtime data even though the TypeScript adapter is typed.
|
|
70
|
-
The recipe accepts only a plain record with exactly `longitude`, `latitude` and `accuracy` data
|
|
71
|
-
properties. Longitude must be finite and within `[-180, 180]`, latitude finite and within
|
|
72
|
-
`[-90, 90]`, and accuracy finite and nonnegative. Accessors, extra provider fields, invalid
|
|
73
|
-
prototypes and non-finite values fail closed.
|
|
74
|
-
|
|
75
|
-
Only a validated fix is converted to an annotation:
|
|
76
|
-
|
|
77
|
-
```ts
|
|
78
|
-
{
|
|
79
|
-
id: 'application-foreground-location',
|
|
80
|
-
kind: 'marker',
|
|
81
|
-
ariaLabel: 'Current location',
|
|
82
|
-
coordinate: [longitude, latitude],
|
|
83
|
-
data: {accuracyMeters: accuracy, precision: 'precise'},
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Approximate permission uses the same stable ID and an `Approximate current location` label. The
|
|
88
|
-
stable ID lets the existing annotation reconciler update one marker host instead of recreating a
|
|
89
|
-
new marker for every fix. Revocation, denial or provider failure removes the annotation by returning
|
|
90
|
-
an empty annotation collection.
|
|
91
|
-
|
|
92
|
-
The marker uses the existing accessible Tileflow annotation wrapper. This recipe does not add a
|
|
93
|
-
location-specific native marker component.
|
|
94
|
-
|
|
95
|
-
## Foreground observation lifetime
|
|
96
|
-
|
|
97
|
-
Observation starts only when both conditions are true:
|
|
98
|
-
|
|
99
|
-
1. the application is in the foreground; and
|
|
100
|
-
2. its current permission state is `granted-precise` or `granted-approximate`.
|
|
101
|
-
|
|
102
|
-
`AppState` is application-side orchestration in the example. Moving to background synchronously
|
|
103
|
-
retires the current observation token and calls the provider cleanup. Returning to foreground
|
|
104
|
-
starts a new observation only if the last application permission policy still allows it. Denied,
|
|
105
|
-
revoked and unavailable states do not restart observation automatically.
|
|
106
|
-
|
|
107
|
-
The React effect owns a replayable `mount()` epoch. Its cleanup immediately retires the current
|
|
108
|
-
observation and any pending permission/provider callback without terminally disposing the
|
|
109
|
-
controller. A StrictMode setup replay may therefore mount the same controller again; if the retained
|
|
110
|
-
settled permission state is granted and the application is foregrounded, observation restarts
|
|
111
|
-
without another permission prompt. If cleanup interrupted an in-flight permission request, that
|
|
112
|
-
request is retired and the last settled application state is restored instead of accepting its late
|
|
113
|
-
result. A real unmount or adapter replacement uses the same cleanup boundary, so late callbacks are
|
|
114
|
-
inert even though no timing heuristic distinguishes them from a replay. The recipe does not persist
|
|
115
|
-
fixes or observation history.
|
|
116
|
-
|
|
117
|
-
`dispose()` remains a separate terminal operation for an owner that will never mount again. The
|
|
118
|
-
React example does not use terminal disposal for ordinary effect cleanup.
|
|
119
|
-
|
|
120
|
-
## Recenter is explicit
|
|
121
|
-
|
|
122
|
-
A new fix changes only the application-owned annotation. It does **not** change camera state.
|
|
123
|
-
|
|
124
|
-
The example keeps the existing complete controlled `Map` view. An explicit **Recenter** action copies
|
|
125
|
-
the latest validated coordinate into that controlled view while preserving zoom, bearing and pitch.
|
|
126
|
-
The recipe uses no camera animation API or duration, so it introduces no animated movement for
|
|
127
|
-
reduced-motion users. Applications that later add their own animated camera affordance must apply
|
|
128
|
-
their own reduced-motion policy before doing so.
|
|
129
|
-
|
|
130
|
-
Gestures continue to update the same controlled view through `onViewChange`; receiving another
|
|
131
|
-
location fix never overwrites that user-driven camera state.
|
|
132
|
-
|
|
133
|
-
## Privacy and product scope
|
|
134
|
-
|
|
135
|
-
The sample keeps only the latest in-memory fix needed for its marker. It does not store history,
|
|
136
|
-
send coordinates to analytics, derive a device fix from GeoIP, start background tracking or attach
|
|
137
|
-
location to Tileflow sessions/admission. Status and error presentation are application UI.
|
|
138
|
-
|
|
139
|
-
Location also does not change the interaction presentation boundary. Tileflow annotations and
|
|
140
|
-
semantic targets remain primitives and data; the application still owns any popup, callout,
|
|
141
|
-
tooltip, sheet, panel, modal or other selection presentation.
|
|
142
|
-
|
|
143
|
-
## Qualification
|
|
144
|
-
|
|
145
|
-
The source files describe the intended application contract; they are not evidence that a provider,
|
|
146
|
-
permission prompt, simulator/device scenario, native build, package publication or Hosted service
|
|
147
|
-
was executed. Typecheck the source-checkout harness and qualify the chosen provider in the
|
|
148
|
-
application that owns its permission and privacy policy.
|