@aguacerowx/react-native 0.0.53 → 0.0.54
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/LICENSE +21 -0
- package/android/src/main/java/com/aguacerowx/reactnative/NexradRadarLayerView.java +14 -2
- package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +77 -0
- package/index.js +1 -1
- package/ios/WeatherFrameProcessorModule.m +19 -15
- package/ios/WeatherFrameProcessorModule.swift +65 -0
- package/lib/commonjs/AguaceroContext.js +0 -4
- package/lib/commonjs/AguaceroContext.js.map +1 -1
- package/lib/commonjs/GridRenderLayer.js +62 -76
- package/lib/commonjs/GridRenderLayer.js.map +1 -1
- package/lib/commonjs/MapManager.js +110 -224
- package/lib/commonjs/MapManager.js.map +1 -1
- package/lib/commonjs/MapRegistry.js +21 -33
- package/lib/commonjs/MapRegistry.js.map +1 -1
- package/lib/commonjs/NexradRadarLayer.android.js +28 -100
- package/lib/commonjs/NexradRadarLayer.android.js.map +1 -1
- package/lib/commonjs/NexradRadarLayer.ios.js +26 -97
- package/lib/commonjs/NexradRadarLayer.ios.js.map +1 -1
- package/lib/commonjs/NexradSitesMapLayer.js +41 -61
- package/lib/commonjs/NexradSitesMapLayer.js.map +1 -1
- package/lib/commonjs/SatelliteLayer.android.js +26 -38
- package/lib/commonjs/SatelliteLayer.android.js.map +1 -1
- package/lib/commonjs/SatelliteLayer.ios.js +30 -42
- package/lib/commonjs/SatelliteLayer.ios.js.map +1 -1
- package/lib/commonjs/StyleApplicator.js +129 -175
- package/lib/commonjs/StyleApplicator.js.map +1 -1
- package/lib/commonjs/WeatherLayerManager.js +995 -1646
- package/lib/commonjs/WeatherLayerManager.js.map +1 -1
- package/lib/commonjs/aguaceroCoreDebugHooks.js +58 -130
- package/lib/commonjs/aguaceroCoreDebugHooks.js.map +1 -1
- package/lib/commonjs/aguaceroRnDebug.js +147 -288
- package/lib/commonjs/aguaceroRnDebug.js.map +1 -1
- package/lib/commonjs/cdnAuthenticatedFetch.js +104 -0
- package/lib/commonjs/cdnAuthenticatedFetch.js.map +1 -0
- package/lib/commonjs/dispatchViewManagerCommandCompat.js +51 -88
- package/lib/commonjs/dispatchViewManagerCommandCompat.js.map +1 -1
- package/lib/commonjs/gridCdnAuth.js +41 -50
- package/lib/commonjs/gridCdnAuth.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nexrad/nexradAndroidController.js +851 -863
- package/lib/commonjs/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
- package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/nexradDiag.js +32 -148
- package/lib/commonjs/nexrad/nexradDiag.js.map +1 -1
- package/lib/commonjs/nexrad/nexradLevel2Keys.js +261 -0
- package/lib/commonjs/nexrad/nexradLevel2Keys.js.map +1 -0
- package/lib/commonjs/nexrad/nexradLutBuild.js +64 -111
- package/lib/commonjs/nexrad/nexradLutBuild.js.map +1 -1
- package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js +136 -164
- package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/nexradSdkImports.js +51 -0
- package/lib/commonjs/nexrad/nexradSdkImports.js.map +1 -0
- package/lib/commonjs/nexrad/radarArchiveCore.bundled.js +2848 -4455
- package/lib/commonjs/nexrad/radarArchiveCore.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/radarDecode.worker.bundled.js +445 -648
- package/lib/commonjs/nexrad/radarDecode.worker.bundled.js.map +1 -1
- package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js +52 -68
- package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
- package/lib/commonjs/nexradNativeCommandIds.js +24 -0
- package/lib/commonjs/nexradNativeCommandIds.js.map +1 -0
- package/lib/commonjs/nws/NwsAlertsOverlay.android.js.map +1 -1
- package/lib/commonjs/nws/NwsAlertsOverlay.ios.js.map +1 -1
- package/lib/commonjs/nws/NwsAlertsOverlay.js +3 -3
- package/lib/commonjs/nws/NwsAlertsOverlay.js.map +1 -1
- package/lib/commonjs/nws/NwsAlertsOverlay.native.js +235 -361
- package/lib/commonjs/nws/NwsAlertsOverlay.native.js.map +1 -1
- package/lib/commonjs/nws/eventSourceRnPolyfill.js +92 -146
- package/lib/commonjs/nws/eventSourceRnPolyfill.js.map +1 -1
- package/lib/commonjs/nws/nwsAndroidConstants.js +2 -8
- package/lib/commonjs/nws/nwsAndroidConstants.js.map +1 -1
- package/lib/commonjs/satellite/satelliteAndroidController.js +117 -202
- package/lib/commonjs/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/commonjs/satelliteBridgeDiag.js +3 -13
- package/lib/commonjs/satelliteBridgeDiag.js.map +1 -1
- package/lib/commonjs/satelliteRnDebug.js +117 -218
- package/lib/commonjs/satelliteRnDebug.js.map +1 -1
- package/lib/module/AguaceroContext.js +2 -7
- package/lib/module/AguaceroContext.js.map +1 -1
- package/lib/module/GridRenderLayer.js +66 -80
- package/lib/module/GridRenderLayer.js.map +1 -1
- package/lib/module/MapManager.js +125 -239
- package/lib/module/MapManager.js.map +1 -1
- package/lib/module/MapRegistry.js +21 -33
- package/lib/module/MapRegistry.js.map +1 -1
- package/lib/module/NexradRadarLayer.android.js +32 -104
- package/lib/module/NexradRadarLayer.android.js.map +1 -1
- package/lib/module/NexradRadarLayer.ios.js +30 -101
- package/lib/module/NexradRadarLayer.ios.js.map +1 -1
- package/lib/module/NexradSitesMapLayer.js +44 -63
- package/lib/module/NexradSitesMapLayer.js.map +1 -1
- package/lib/module/SatelliteLayer.android.js +32 -44
- package/lib/module/SatelliteLayer.android.js.map +1 -1
- package/lib/module/SatelliteLayer.ios.js +36 -48
- package/lib/module/SatelliteLayer.ios.js.map +1 -1
- package/lib/module/StyleApplicator.js +144 -191
- package/lib/module/StyleApplicator.js.map +1 -1
- package/lib/module/WeatherLayerManager.js +1024 -1675
- package/lib/module/WeatherLayerManager.js.map +1 -1
- package/lib/module/aguaceroCoreDebugHooks.js +59 -130
- package/lib/module/aguaceroCoreDebugHooks.js.map +1 -1
- package/lib/module/aguaceroRnDebug.js +151 -292
- package/lib/module/aguaceroRnDebug.js.map +1 -1
- package/lib/module/cdnAuthenticatedFetch.js +97 -0
- package/lib/module/cdnAuthenticatedFetch.js.map +1 -0
- package/lib/module/dispatchViewManagerCommandCompat.js +52 -90
- package/lib/module/dispatchViewManagerCommandCompat.js.map +1 -1
- package/lib/module/gridCdnAuth.js +38 -50
- package/lib/module/gridCdnAuth.js.map +1 -1
- package/lib/module/index.js +9 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/nexrad/nexradAndroidController.js +865 -876
- package/lib/module/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
- package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
- package/lib/module/nexrad/nexradDiag.js +31 -145
- package/lib/module/nexrad/nexradDiag.js.map +1 -1
- package/lib/module/nexrad/nexradLevel2Keys.js +245 -0
- package/lib/module/nexrad/nexradLevel2Keys.js.map +1 -0
- package/lib/module/nexrad/nexradLutBuild.js +64 -110
- package/lib/module/nexrad/nexradLutBuild.js.map +1 -1
- package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js +136 -163
- package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
- package/lib/module/nexrad/nexradSdkImports.js +4 -0
- package/lib/module/nexrad/nexradSdkImports.js.map +1 -0
- package/lib/module/nexrad/radarArchiveCore.bundled.js +2839 -4448
- package/lib/module/nexrad/radarArchiveCore.bundled.js.map +1 -1
- package/lib/module/nexrad/radarDecode.worker.bundled.js +445 -648
- package/lib/module/nexrad/radarDecode.worker.bundled.js.map +1 -1
- package/lib/module/nexrad/radarFrameGpuMatch.bundled.js +50 -66
- package/lib/module/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
- package/lib/module/nexradNativeCommandIds.js +18 -0
- package/lib/module/nexradNativeCommandIds.js.map +1 -0
- package/lib/module/nws/NwsAlertsOverlay.android.js +1 -1
- package/lib/module/nws/NwsAlertsOverlay.android.js.map +1 -1
- package/lib/module/nws/NwsAlertsOverlay.ios.js +1 -1
- package/lib/module/nws/NwsAlertsOverlay.ios.js.map +1 -1
- package/lib/module/nws/NwsAlertsOverlay.js +5 -5
- package/lib/module/nws/NwsAlertsOverlay.js.map +1 -1
- package/lib/module/nws/NwsAlertsOverlay.native.js +248 -373
- package/lib/module/nws/NwsAlertsOverlay.native.js.map +1 -1
- package/lib/module/nws/eventSourceRnPolyfill.js +92 -146
- package/lib/module/nws/eventSourceRnPolyfill.js.map +1 -1
- package/lib/module/nws/nwsAndroidConstants.js +2 -8
- package/lib/module/nws/nwsAndroidConstants.js.map +1 -1
- package/lib/module/satellite/satelliteAndroidController.js +123 -208
- package/lib/module/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/module/satelliteBridgeDiag.js +3 -13
- package/lib/module/satelliteBridgeDiag.js.map +1 -1
- package/lib/module/satelliteRnDebug.js +123 -223
- package/lib/module/satelliteRnDebug.js.map +1 -1
- package/lib/typescript/AguaceroContext.d.ts +0 -4
- package/lib/typescript/AguaceroContext.d.ts.map +1 -1
- package/lib/typescript/GridRenderLayer.d.ts.map +1 -1
- package/lib/typescript/MapManager.d.ts +0 -12
- package/lib/typescript/MapManager.d.ts.map +1 -1
- package/lib/typescript/MapRegistry.d.ts +10 -12
- package/lib/typescript/MapRegistry.d.ts.map +1 -1
- package/lib/typescript/NexradRadarLayer.android.d.ts.map +1 -1
- package/lib/typescript/NexradRadarLayer.ios.d.ts.map +1 -1
- package/lib/typescript/NexradSitesMapLayer.d.ts +4 -10
- package/lib/typescript/NexradSitesMapLayer.d.ts.map +1 -1
- package/lib/typescript/SatelliteLayer.android.d.ts.map +1 -1
- package/lib/typescript/SatelliteLayer.ios.d.ts.map +1 -1
- package/lib/typescript/StyleApplicator.d.ts +1 -1
- package/lib/typescript/StyleApplicator.d.ts.map +1 -1
- package/lib/typescript/WeatherLayerManager.d.ts.map +1 -1
- package/lib/typescript/aguaceroCoreDebugHooks.d.ts +2 -9
- package/lib/typescript/aguaceroCoreDebugHooks.d.ts.map +1 -1
- package/lib/typescript/aguaceroRnDebug.d.ts +47 -66
- package/lib/typescript/aguaceroRnDebug.d.ts.map +1 -1
- package/lib/typescript/cdnAuthenticatedFetch.d.ts +10 -0
- package/lib/typescript/cdnAuthenticatedFetch.d.ts.map +1 -0
- package/lib/typescript/dispatchViewManagerCommandCompat.d.ts +1 -17
- package/lib/typescript/dispatchViewManagerCommandCompat.d.ts.map +1 -1
- package/lib/typescript/gridCdnAuth.d.ts +16 -21
- package/lib/typescript/gridCdnAuth.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/nexrad/nexradAndroidController.d.ts +39 -89
- package/lib/typescript/nexrad/nexradAndroidController.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts +2 -1
- package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradDiag.d.ts +13 -101
- package/lib/typescript/nexrad/nexradDiag.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradLevel2Keys.d.ts +36 -0
- package/lib/typescript/nexrad/nexradLevel2Keys.d.ts.map +1 -0
- package/lib/typescript/nexrad/nexradLutBuild.d.ts +3 -10
- package/lib/typescript/nexrad/nexradLutBuild.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts +4 -3
- package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradSdkImports.d.ts +2 -0
- package/lib/typescript/nexrad/nexradSdkImports.d.ts.map +1 -0
- package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts +12 -7
- package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts +20 -20
- package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts.map +1 -1
- package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts +4 -3
- package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts.map +1 -1
- package/lib/typescript/nexradNativeCommandIds.d.ts +2 -0
- package/lib/typescript/nexradNativeCommandIds.d.ts.map +1 -0
- package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts +6 -17
- package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts.map +1 -1
- package/lib/typescript/nws/eventSourceRnPolyfill.d.ts +0 -3
- package/lib/typescript/nws/eventSourceRnPolyfill.d.ts.map +1 -1
- package/lib/typescript/nws/nwsAndroidConstants.d.ts +0 -5
- package/lib/typescript/nws/nwsAndroidConstants.d.ts.map +1 -1
- package/lib/typescript/satellite/satelliteAndroidController.d.ts +9 -47
- package/lib/typescript/satellite/satelliteAndroidController.d.ts.map +1 -1
- package/lib/typescript/satelliteBridgeDiag.d.ts +1 -5
- package/lib/typescript/satelliteBridgeDiag.d.ts.map +1 -1
- package/lib/typescript/satelliteRnDebug.d.ts +24 -30
- package/lib/typescript/satelliteRnDebug.d.ts.map +1 -1
- package/package.json +75 -74
- package/src/AguaceroContext.js +1 -7
- package/src/GridRenderLayer.js +1 -128
- package/src/MapManager.js +1 -277
- package/src/MapRegistry.js +1 -56
- package/src/NexradRadarLayer.android.js +1 -121
- package/src/NexradRadarLayer.ios.js +1 -115
- package/src/NexradSitesMapLayer.js +1 -75
- package/src/SatelliteLayer.android.js +1 -63
- package/src/SatelliteLayer.ios.js +1 -70
- package/src/StyleApplicator.js +1 -241
- package/src/WeatherLayerManager.js +1 -2045
- package/src/aguaceroCoreDebugHooks.js +1 -142
- package/src/aguaceroRnDebug.js +1 -336
- package/src/cdnAuthenticatedFetch.js +1 -0
- package/src/dispatchViewManagerCommandCompat.js +1 -100
- package/src/gridCdnAuth.js +1 -56
- package/src/index.js +1 -27
- package/src/nexrad/nexradAndroidController.js +1 -1078
- package/src/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +1 -91
- package/src/nexrad/nexradDiag.js +1 -150
- package/src/nexrad/nexradLevel2Keys.js +1 -0
- package/src/nexrad/nexradLutBuild.js +1 -126
- package/src/nexrad/nexradMapboxFrameOpts.bundled.js +1 -245
- package/src/nexrad/nexradSdkImports.js +1 -0
- package/src/nexrad/radarArchiveCore.bundled.js +1 -7085
- package/src/nexrad/radarDecode.worker.bundled.js +1 -813
- package/src/nexrad/radarFrameGpuMatch.bundled.js +1 -79
- package/src/nexradNativeCommandIds.js +1 -0
- package/src/nws/NwsAlertsOverlay.android.js +1 -1
- package/src/nws/NwsAlertsOverlay.ios.js +1 -1
- package/src/nws/NwsAlertsOverlay.js +1 -7
- package/src/nws/NwsAlertsOverlay.native.js +1 -463
- package/src/nws/eventSourceRnPolyfill.js +7 -193
- package/src/nws/nwsAndroidConstants.js +1 -8
- package/src/satellite/satelliteAndroidController.js +1 -257
- package/src/satelliteBridgeDiag.js +1 -15
- package/src/satelliteRnDebug.js +1 -269
- package/lib/commonjs/nexrad/nexradNativeCommandIds.js +0 -51
- package/lib/commonjs/nexrad/nexradNativeCommandIds.js.map +0 -1
- package/lib/module/nexrad/nexradNativeCommandIds.js +0 -44
- package/lib/module/nexrad/nexradNativeCommandIds.js.map +0 -1
- package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts +0 -9
- package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts.map +0 -1
- package/src/nexrad/nexradNativeCommandIds.js +0 -44
- /package/lib/commonjs/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
- /package/lib/module/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
- /package/src/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
|
@@ -1,193 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let ImplClass;
|
|
9
|
-
|
|
10
|
-
function dispatch(es, type, dataStr) {
|
|
11
|
-
const ev = { type, data: dataStr };
|
|
12
|
-
const list = es._listeners.get(type);
|
|
13
|
-
if (!list) return;
|
|
14
|
-
for (const fn of list) {
|
|
15
|
-
try {
|
|
16
|
-
fn(ev);
|
|
17
|
-
} catch {
|
|
18
|
-
/* ignore */
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function parseBlocks(es, incoming) {
|
|
24
|
-
es._buf += incoming;
|
|
25
|
-
while (true) {
|
|
26
|
-
const sep = es._buf.indexOf('\n\n');
|
|
27
|
-
if (sep === -1) break;
|
|
28
|
-
const block = es._buf.slice(0, sep);
|
|
29
|
-
es._buf = es._buf.slice(sep + 2);
|
|
30
|
-
|
|
31
|
-
let eventName = 'message';
|
|
32
|
-
const dataLines = [];
|
|
33
|
-
for (const rawLine of block.split('\n')) {
|
|
34
|
-
const line = rawLine.replace(/\r$/, '');
|
|
35
|
-
if (line.startsWith(':') || line === '') continue;
|
|
36
|
-
if (line.startsWith('event:')) {
|
|
37
|
-
eventName = line.slice(6).trim() || 'message';
|
|
38
|
-
} else if (line.startsWith('data:')) {
|
|
39
|
-
dataLines.push(line.slice(5).startsWith(' ') ? line.slice(6) : line.slice(5));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const data = dataLines.join('\n');
|
|
43
|
-
if (data.length || block.includes('data:')) {
|
|
44
|
-
dispatch(es, eventName, data);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
class ReactNativeEventSource {
|
|
50
|
-
/** @param {string} url */
|
|
51
|
-
constructor(url) {
|
|
52
|
-
this.url = url;
|
|
53
|
-
this.readyState = ReactNativeEventSource.CONNECTING;
|
|
54
|
-
/** @type {Map<string, Set<(ev: { type: string; data: string }) => void>>} */
|
|
55
|
-
this._listeners = new Map();
|
|
56
|
-
this.onopen = null;
|
|
57
|
-
this.onerror = null;
|
|
58
|
-
this._buf = '';
|
|
59
|
-
/** @type {XMLHttpRequest | null} */
|
|
60
|
-
this._xhr = null;
|
|
61
|
-
this._opened = false;
|
|
62
|
-
this._closed = false;
|
|
63
|
-
|
|
64
|
-
const xhr = new XMLHttpRequest();
|
|
65
|
-
this._xhr = xhr;
|
|
66
|
-
xhr.open('GET', url);
|
|
67
|
-
xhr.setRequestHeader('Accept', 'text/event-stream');
|
|
68
|
-
xhr.responseType = 'text';
|
|
69
|
-
|
|
70
|
-
let lastLen = 0;
|
|
71
|
-
|
|
72
|
-
xhr.onreadystatechange = () => {
|
|
73
|
-
if (this._closed) return;
|
|
74
|
-
if (xhr.readyState >= XMLHttpRequest.HEADERS_RECEIVED && xhr.status >= 400) {
|
|
75
|
-
if (!this._opened) {
|
|
76
|
-
this._fail();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
xhr.onprogress = () => {
|
|
82
|
-
if (this._closed) return;
|
|
83
|
-
const t = xhr.responseText || '';
|
|
84
|
-
const chunk = t.slice(lastLen);
|
|
85
|
-
lastLen = t.length;
|
|
86
|
-
if (!chunk) return;
|
|
87
|
-
if (!this._opened && xhr.status === 200) {
|
|
88
|
-
this._opened = true;
|
|
89
|
-
this.readyState = ReactNativeEventSource.OPEN;
|
|
90
|
-
try {
|
|
91
|
-
if (typeof this.onopen === 'function') this.onopen();
|
|
92
|
-
} catch {
|
|
93
|
-
/* ignore */
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
parseBlocks(this, chunk);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
xhr.onload = () => {
|
|
100
|
-
if (this._closed) return;
|
|
101
|
-
const t = xhr.responseText || '';
|
|
102
|
-
const chunk = t.slice(lastLen);
|
|
103
|
-
lastLen = t.length;
|
|
104
|
-
if (chunk) parseBlocks(this, chunk);
|
|
105
|
-
if (this._buf.length) {
|
|
106
|
-
parseBlocks(this, '\n\n');
|
|
107
|
-
}
|
|
108
|
-
if (!this._opened && xhr.status === 200) {
|
|
109
|
-
this._opened = true;
|
|
110
|
-
this.readyState = ReactNativeEventSource.OPEN;
|
|
111
|
-
try {
|
|
112
|
-
if (typeof this.onopen === 'function') this.onopen();
|
|
113
|
-
} catch {
|
|
114
|
-
/* ignore */
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
this._close();
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
xhr.onerror = () => {
|
|
121
|
-
if (!this._closed) this._fail();
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
try {
|
|
125
|
-
xhr.send();
|
|
126
|
-
} catch {
|
|
127
|
-
this._fail();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
static CONNECTING = 0;
|
|
132
|
-
static OPEN = 1;
|
|
133
|
-
static CLOSED = 2;
|
|
134
|
-
|
|
135
|
-
addEventListener(type, fn) {
|
|
136
|
-
if (!this._listeners.has(type)) this._listeners.set(type, new Set());
|
|
137
|
-
this._listeners.get(type).add(fn);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
removeEventListener(type, fn) {
|
|
141
|
-
this._listeners.get(type)?.delete(fn);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
close() {
|
|
145
|
-
if (this._closed) return;
|
|
146
|
-
try {
|
|
147
|
-
this._xhr?.abort();
|
|
148
|
-
} catch {
|
|
149
|
-
/* ignore */
|
|
150
|
-
}
|
|
151
|
-
this._close();
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
_close() {
|
|
155
|
-
if (this._closed) return;
|
|
156
|
-
this._closed = true;
|
|
157
|
-
this.readyState = ReactNativeEventSource.CLOSED;
|
|
158
|
-
this._xhr = null;
|
|
159
|
-
try {
|
|
160
|
-
if (typeof this.onerror === 'function') this.onerror({});
|
|
161
|
-
} catch {
|
|
162
|
-
/* ignore */
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
_fail() {
|
|
167
|
-
if (this._closed) return;
|
|
168
|
-
try {
|
|
169
|
-
this._xhr?.abort();
|
|
170
|
-
} catch {
|
|
171
|
-
/* ignore */
|
|
172
|
-
}
|
|
173
|
-
this._closed = true;
|
|
174
|
-
this.readyState = ReactNativeEventSource.CLOSED;
|
|
175
|
-
try {
|
|
176
|
-
if (typeof this.onerror === 'function') this.onerror({});
|
|
177
|
-
} catch {
|
|
178
|
-
/* ignore */
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
ImplClass = ReactNativeEventSource;
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Install `global.EventSource` when missing (Hermes / RN).
|
|
187
|
-
*/
|
|
188
|
-
export function ensureReactNativeEventSource() {
|
|
189
|
-
if (typeof global.EventSource !== 'undefined') return;
|
|
190
|
-
global.EventSource = ImplClass;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
ensureReactNativeEventSource();
|
|
1
|
+
var _=Object.defineProperty,p=(s,e,t)=>e in s?_(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,a=(s,e,t)=>p(s,typeof e!="symbol"?e+"":e,t);let u;function y(s,e,t){const n={type:e,data:t},i=s._listeners.get(e);if(i)for(const o of i)try{o(n)}catch{}}function l(s,e){for(s._buf+=e;;){const t=s._buf.indexOf(`
|
|
2
|
+
|
|
3
|
+
`);if(t===-1)break;const n=s._buf.slice(0,t);s._buf=s._buf.slice(t+2);let i="message";const o=[];for(const d of n.split(`
|
|
4
|
+
`)){const r=d.replace(/\r$/,"");r.startsWith(":")||r===""||(r.startsWith("event:")?i=r.slice(6).trim()||"message":r.startsWith("data:")&&o.push(r.slice(5).startsWith(" ")?r.slice(6):r.slice(5)))}const f=o.join(`
|
|
5
|
+
`);(f.length||n.includes("data:"))&&y(s,i,f)}}const c=class h{constructor(e){this.url=e,this.readyState=h.CONNECTING,this._listeners=new Map,this.onopen=null,this.onerror=null,this._buf="",this._xhr=null,this._opened=!1,this._closed=!1;const t=new XMLHttpRequest;this._xhr=t,t.open("GET",e),t.setRequestHeader("Accept","text/event-stream"),t.responseType="text";let n=0;t.onreadystatechange=()=>{this._closed||t.readyState>=XMLHttpRequest.HEADERS_RECEIVED&&t.status>=400&&(this._opened||this._fail())},t.onprogress=()=>{if(this._closed)return;const i=t.responseText||"",o=i.slice(n);if(n=i.length,!!o){if(!this._opened&&t.status===200){this._opened=!0,this.readyState=h.OPEN;try{typeof this.onopen=="function"&&this.onopen()}catch{}}l(this,o)}},t.onload=()=>{if(this._closed)return;const i=t.responseText||"",o=i.slice(n);if(n=i.length,o&&l(this,o),this._buf.length&&l(this,`
|
|
6
|
+
|
|
7
|
+
`),!this._opened&&t.status===200){this._opened=!0,this.readyState=h.OPEN;try{typeof this.onopen=="function"&&this.onopen()}catch{}}this._close()},t.onerror=()=>{this._closed||this._fail()};try{t.send()}catch{this._fail()}}addEventListener(e,t){this._listeners.has(e)||this._listeners.set(e,new Set),this._listeners.get(e).add(t)}removeEventListener(e,t){this._listeners.get(e)?.delete(t)}close(){if(!this._closed){try{this._xhr?.abort()}catch{}this._close()}}_close(){if(!this._closed){this._closed=!0,this.readyState=h.CLOSED,this._xhr=null;try{typeof this.onerror=="function"&&this.onerror({})}catch{}}}_fail(){if(!this._closed){try{this._xhr?.abort()}catch{}this._closed=!0,this.readyState=h.CLOSED;try{typeof this.onerror=="function"&&this.onerror({})}catch{}}}};a(c,"CONNECTING",0),a(c,"OPEN",1),a(c,"CLOSED",2);let E=c;u=E;export function ensureReactNativeEventSource(){typeof global.EventSource<"u"||(global.EventSource=u)}ensureReactNativeEventSource();
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Stable Mapbox custom layer id for Android {@link NexradRadarLayerView} — must match Java
|
|
3
|
-
* {@code NexradRadarLayerView.NEXRAD_LAYER_ID} so NWS alert fill can anchor under radar like mapsgl.
|
|
4
|
-
*/
|
|
5
|
-
export const AGUACERO_NEXRAD_MAP_LAYER_ID = 'aguacero-nexrad-custom-layer';
|
|
6
|
-
|
|
7
|
-
/** Must match {@link AguaceroStyleLayerIds#SATELLITE_CUSTOM_LAYER} and mapsgl default satellite layer id. */
|
|
8
|
-
export const AGUACERO_SATELLITE_MAP_LAYER_ID = 'aguacero-satellite-layer';
|
|
1
|
+
export const AGUACERO_NEXRAD_MAP_LAYER_ID="aguacero-nexrad-custom-layer",AGUACERO_SATELLITE_MAP_LAYER_ID="aguacero-satellite-layer";
|
|
@@ -1,257 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* AguaceroCore satellite mode → Android native {@link SatelliteLayerView} (parity with mapsgl
|
|
3
|
-
* {@link WeatherLayerManager} satellite paths — preload timeline + scrub via {@code targetUnix}).
|
|
4
|
-
*/
|
|
5
|
-
import { resolveSatelliteS3FileName } from '@aguacerowx/javascript-sdk';
|
|
6
|
-
import { satBridgeWarn } from '../satelliteBridgeDiag';
|
|
7
|
-
import { aguaceroDebug, getAguaceroAuthDiagnosticSnapshot, isAguaceroRnDebugEnabled, redactApiKeyFromUrl } from '../aguaceroRnDebug';
|
|
8
|
-
import { logSatelliteSyncReport } from '../satelliteRnDebug';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Target frame first, then remaining frames by increasing temporal distance to {@code targetUnix}.
|
|
12
|
-
* @param {{ unix: number; url: string; shaderFileName: string }[]} frames
|
|
13
|
-
* @param {number | null} targetUnix
|
|
14
|
-
*/
|
|
15
|
-
export function sortFramesByTargetProximity(frames, targetUnix) {
|
|
16
|
-
if (!frames.length) return frames;
|
|
17
|
-
if (targetUnix == null || !Number.isFinite(targetUnix)) {
|
|
18
|
-
return frames;
|
|
19
|
-
}
|
|
20
|
-
const withDistance = frames.map((f) => ({
|
|
21
|
-
...f,
|
|
22
|
-
_d: Math.abs(f.unix - targetUnix),
|
|
23
|
-
}));
|
|
24
|
-
withDistance.sort((a, b) => {
|
|
25
|
-
if (a._d !== b._d) return a._d - b._d;
|
|
26
|
-
return a.unix - b.unix;
|
|
27
|
-
});
|
|
28
|
-
return withDistance.map(({ _d, ...rest }) => rest);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @param {import('@aguacerowx/javascript-sdk').AguaceroCoreState} state
|
|
33
|
-
* @param {number} satelliteTimestamp
|
|
34
|
-
*/
|
|
35
|
-
export function buildSatelliteFetchParts(state, satelliteTimestamp) {
|
|
36
|
-
const fileName = resolveSatelliteS3FileName(
|
|
37
|
-
state.satelliteChannel,
|
|
38
|
-
state.satelliteTimeToFileMap,
|
|
39
|
-
satelliteTimestamp,
|
|
40
|
-
);
|
|
41
|
-
if (!fileName) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
const channelName = state.satelliteChannel || state.variable;
|
|
45
|
-
const channelNameUpper = String(channelName).toUpperCase();
|
|
46
|
-
let s3FileName = fileName.replace('MULTI', channelNameUpper);
|
|
47
|
-
if (!s3FileName.endsWith('.ktx2')) {
|
|
48
|
-
s3FileName += '.ktx2';
|
|
49
|
-
}
|
|
50
|
-
let shaderFileName = s3FileName;
|
|
51
|
-
if (!channelNameUpper.startsWith('C') || channelNameUpper.length > 3) {
|
|
52
|
-
const token = channelNameUpper.toLowerCase().replace(/_/g, '');
|
|
53
|
-
shaderFileName = `${s3FileName}_${token}_`;
|
|
54
|
-
}
|
|
55
|
-
const apiKey = state.apiKey;
|
|
56
|
-
if (!apiKey) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
const url = `https://d3dc62msmxkrd7.cloudfront.net/satellite/${s3FileName}?userId=${encodeURIComponent('sdk-user')}&apiKey=${encodeURIComponent(apiKey)}`;
|
|
60
|
-
return { url, shaderFileName, frameKey: Number(satelliteTimestamp), apiKey };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export class SatelliteAndroidController {
|
|
64
|
-
/**
|
|
65
|
-
* @param {import('@aguacerowx/javascript-sdk').AguaceroCore} core
|
|
66
|
-
* @param {React.RefObject<{ syncSatellite?: (json: string) => void; clearSatellite?: () => void; activateSatelliteCachedUnix?: (unix: number) => void; updateSatelliteStyle?: (json: string) => void }>} satelliteLayerRef
|
|
67
|
-
*/
|
|
68
|
-
constructor(core, satelliteLayerRef) {
|
|
69
|
-
this.core = core;
|
|
70
|
-
this.satelliteLayerRef = satelliteLayerRef;
|
|
71
|
-
this._destroyed = false;
|
|
72
|
-
/** @type {string | undefined} */
|
|
73
|
-
this._cachedRunKey = undefined;
|
|
74
|
-
/** @type {string | undefined} */
|
|
75
|
-
this._cachedTimelineSig = undefined;
|
|
76
|
-
/** @type {number | null | undefined} */
|
|
77
|
-
this._lastTargetUnix = undefined;
|
|
78
|
-
/** @type {string | undefined} */
|
|
79
|
-
this._lastStyleJson = undefined;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
destroy() {
|
|
83
|
-
this._destroyed = true;
|
|
84
|
-
this._cachedRunKey = undefined;
|
|
85
|
-
this._cachedTimelineSig = undefined;
|
|
86
|
-
this._lastTargetUnix = undefined;
|
|
87
|
-
this._lastStyleJson = undefined;
|
|
88
|
-
const native = this.satelliteLayerRef?.current;
|
|
89
|
-
native?.clearSatellite?.();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @param {import('@aguacerowx/javascript-sdk').AguaceroCoreState} state
|
|
94
|
-
*/
|
|
95
|
-
sync(state) {
|
|
96
|
-
satBridgeWarn('SatelliteAndroidController.sync enter', {
|
|
97
|
-
destroyed: this._destroyed,
|
|
98
|
-
isSatellite: Boolean(state?.isSatellite),
|
|
99
|
-
instrumentId: state?.satelliteInstrumentId ?? null,
|
|
100
|
-
sector: state?.satelliteSectorLabel ?? null,
|
|
101
|
-
channel: state?.satelliteChannel ?? null,
|
|
102
|
-
tlMapSize:
|
|
103
|
-
state?.satelliteTimeToFileMap && typeof state.satelliteTimeToFileMap === 'object'
|
|
104
|
-
? Object.keys(state.satelliteTimeToFileMap).length
|
|
105
|
-
: 0,
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
if (this._destroyed || !state?.isSatellite) {
|
|
109
|
-
satBridgeWarn('SatelliteAndroidController.sync early-exit', {
|
|
110
|
-
destroyed: this._destroyed,
|
|
111
|
-
isSatellite: state?.isSatellite,
|
|
112
|
-
});
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const native = this.satelliteLayerRef?.current;
|
|
117
|
-
if (!native?.syncSatellite) {
|
|
118
|
-
satBridgeWarn('SatelliteAndroidController.sync abort: no native.syncSatellite', {
|
|
119
|
-
refExists: Boolean(this.satelliteLayerRef?.current),
|
|
120
|
-
keys: this.satelliteLayerRef?.current ? Object.keys(this.satelliteLayerRef.current) : [],
|
|
121
|
-
});
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const keys = Object.keys(state.satelliteTimeToFileMap || {}).sort((a, b) => Number(a) - Number(b));
|
|
126
|
-
const satRunKey = `${state.satelliteInstrumentId}|${state.satelliteSectorLabel}|${state.satelliteChannel}|${state.variable || ''}`;
|
|
127
|
-
const timelineSig = keys.join(',');
|
|
128
|
-
|
|
129
|
-
const mergedState = {
|
|
130
|
-
...state,
|
|
131
|
-
apiKey: state.apiKey || this.core.apiKey,
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const frames = [];
|
|
135
|
-
for (const k of keys) {
|
|
136
|
-
const ts = Number(k);
|
|
137
|
-
if (!Number.isFinite(ts)) continue;
|
|
138
|
-
const parts = buildSatelliteFetchParts(mergedState, ts);
|
|
139
|
-
if (!parts) continue;
|
|
140
|
-
frames.push({
|
|
141
|
-
unix: ts,
|
|
142
|
-
url: parts.url,
|
|
143
|
-
shaderFileName: parts.shaderFileName,
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (frames.length === 0) {
|
|
148
|
-
console.warn('[AguaceroWX][satellite][satelliteSyncNoFrames]', {
|
|
149
|
-
satRunKey,
|
|
150
|
-
timelineKeyCount: keys.length,
|
|
151
|
-
hasApiKey: Boolean(mergedState.apiKey),
|
|
152
|
-
satelliteChannel: mergedState.satelliteChannel,
|
|
153
|
-
gridRequestSiteOrigin:
|
|
154
|
-
mergedState.gridRequestSiteOrigin ?? this.core.gridRequestSiteOrigin ?? null,
|
|
155
|
-
bundleId: this.core.bundleId ?? null,
|
|
156
|
-
mapKeys:
|
|
157
|
-
mergedState.satelliteTimeToFileMap &&
|
|
158
|
-
typeof mergedState.satelliteTimeToFileMap === 'object'
|
|
159
|
-
? Object.keys(mergedState.satelliteTimeToFileMap).length
|
|
160
|
-
: 0,
|
|
161
|
-
hint:
|
|
162
|
-
keys.length === 0
|
|
163
|
-
? 'Timeline empty — wait for core.initialize / listing, or check satelliteId/sector/product.'
|
|
164
|
-
: 'Timeline has keys but no resolvable frame URLs — check satelliteChannel vs listing (e.g. geocolor needs MULTI on CONUS).',
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
let targetUnix =
|
|
169
|
-
state.satelliteTimestamp == null || state.satelliteTimestamp === undefined
|
|
170
|
-
? null
|
|
171
|
-
: Number(state.satelliteTimestamp);
|
|
172
|
-
|
|
173
|
-
// Core often omits satelliteTimestamp on the first satellite emit; without targetUnix the native
|
|
174
|
-
// layer never promotes uploads to activeUnix until a later activateSatelliteCachedUnix — blank map.
|
|
175
|
-
if (targetUnix == null || !Number.isFinite(targetUnix)) {
|
|
176
|
-
const nk = keys.map((k) => Number(k)).filter((n) => Number.isFinite(n));
|
|
177
|
-
if (nk.length > 0) {
|
|
178
|
-
targetUnix = Math.max(...nk);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const stylePayload = {
|
|
183
|
-
visible: state.visible !== false,
|
|
184
|
-
opacity: state.opacity ?? 1,
|
|
185
|
-
fillSmoothing: 0,
|
|
186
|
-
};
|
|
187
|
-
const styleJson = JSON.stringify(stylePayload);
|
|
188
|
-
|
|
189
|
-
const runKeyChanged = satRunKey !== this._cachedRunKey;
|
|
190
|
-
const timelineChanged = timelineSig !== this._cachedTimelineSig;
|
|
191
|
-
|
|
192
|
-
if (runKeyChanged || timelineChanged) {
|
|
193
|
-
const sortedFrames = sortFramesByTargetProximity(frames, targetUnix);
|
|
194
|
-
logSatelliteSyncReport({
|
|
195
|
-
state: mergedState,
|
|
196
|
-
core: this.core,
|
|
197
|
-
frames: sortedFrames,
|
|
198
|
-
targetUnix,
|
|
199
|
-
runKey: satRunKey,
|
|
200
|
-
timelineKeyCount: keys.length,
|
|
201
|
-
runKeyChanged,
|
|
202
|
-
timelineChanged,
|
|
203
|
-
stylePayload,
|
|
204
|
-
});
|
|
205
|
-
const payload = {
|
|
206
|
-
runKey: satRunKey,
|
|
207
|
-
// Must match query params on each frame URL (same merge as buildSatelliteFetchParts) and mapsgl fetch headers.
|
|
208
|
-
apiKey: mergedState.apiKey || '',
|
|
209
|
-
userId: 'sdk-user',
|
|
210
|
-
// RN has no browser default Origin; native satellite fetch must mirror WeatherFrameProcessor / AguaceroCore grid headers.
|
|
211
|
-
gridRequestSiteOrigin:
|
|
212
|
-
typeof this.core.gridRequestSiteOrigin === 'string' ? this.core.gridRequestSiteOrigin : '',
|
|
213
|
-
bundleId: this.core.bundleId || '',
|
|
214
|
-
visible: stylePayload.visible,
|
|
215
|
-
opacity: stylePayload.opacity,
|
|
216
|
-
fillSmoothing: stylePayload.fillSmoothing,
|
|
217
|
-
debug: isAguaceroRnDebugEnabled(),
|
|
218
|
-
frames: sortedFrames,
|
|
219
|
-
};
|
|
220
|
-
if (targetUnix != null && Number.isFinite(targetUnix)) {
|
|
221
|
-
payload.targetUnix = targetUnix;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
const payloadJson = JSON.stringify(payload);
|
|
225
|
-
native.syncSatellite(payloadJson);
|
|
226
|
-
satBridgeWarn('SatelliteAndroidController.sync full payload sent', {
|
|
227
|
-
runKey: satRunKey,
|
|
228
|
-
timelineChanged,
|
|
229
|
-
frameCount: sortedFrames.length,
|
|
230
|
-
targetUnix: payload.targetUnix ?? null,
|
|
231
|
-
jsonChars: payloadJson.length,
|
|
232
|
-
});
|
|
233
|
-
this._cachedRunKey = satRunKey;
|
|
234
|
-
this._cachedTimelineSig = timelineSig;
|
|
235
|
-
this._lastTargetUnix = targetUnix != null && Number.isFinite(targetUnix) ? targetUnix : null;
|
|
236
|
-
this._lastStyleJson = styleJson;
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// Same timeline: avoid large JSON over the bridge — scrub + style deltas only.
|
|
241
|
-
const finiteTarget =
|
|
242
|
-
targetUnix != null && Number.isFinite(targetUnix) ? targetUnix : null;
|
|
243
|
-
if (finiteTarget !== this._lastTargetUnix) {
|
|
244
|
-
if (finiteTarget != null && native.activateSatelliteCachedUnix) {
|
|
245
|
-
native.activateSatelliteCachedUnix(finiteTarget);
|
|
246
|
-
satBridgeWarn('SatelliteAndroidController.activateSatelliteCachedUnix', { unix: finiteTarget });
|
|
247
|
-
}
|
|
248
|
-
this._lastTargetUnix = finiteTarget;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (styleJson !== this._lastStyleJson && native.updateSatelliteStyle) {
|
|
252
|
-
native.updateSatelliteStyle(styleJson);
|
|
253
|
-
satBridgeWarn('SatelliteAndroidController.updateSatelliteStyle', { jsonChars: styleJson.length });
|
|
254
|
-
this._lastStyleJson = styleJson;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
1
|
+
import{resolveSatelliteS3FileName as f}from"@aguacerowx/javascript-sdk";import{satBridgeWarn as h}from"../satelliteBridgeDiag";import{isAguaceroRnDebugEnabled as b}from"../aguaceroRnDebug";import{logSatelliteSyncReport as T}from"../satelliteRnDebug";export function sortFramesByTargetProximity(r,e){if(!r.length||e==null||!Number.isFinite(e))return r;const n=r.map(i=>({...i,_d:Math.abs(i.unix-e)}));return n.sort((i,t)=>i._d!==t._d?i._d-t._d:i.unix-t.unix),n.map(({_d:i,...t})=>t)}export function buildSatelliteFetchParts(r,e){const n=f(r.satelliteChannel,r.satelliteTimeToFileMap,e);if(!n)return null;const i=r.satelliteChannel||r.variable,t=String(i).toUpperCase();let c=n.replace("MULTI",t);c.endsWith(".ktx2")||(c+=".ktx2");let a=c;if(!t.startsWith("C")||t.length>3){const l=t.toLowerCase().replace(/_/g,"");a=`${c}_${l}_`}const d=r.apiKey;return d?{url:`https://d3dc62msmxkrd7.cloudfront.net/satellite/${c}?userId=${encodeURIComponent("sdk-user")}&apiKey=${encodeURIComponent(d)}`,shaderFileName:a,frameKey:Number(e),apiKey:d}:null}export class SatelliteAndroidController{constructor(e,n){this.core=e,this.satelliteLayerRef=n,this._destroyed=!1,this._cachedRunKey=void 0,this._cachedTimelineSig=void 0,this._lastTargetUnix=void 0,this._lastStyleJson=void 0}destroy(){this._destroyed=!0,this._cachedRunKey=void 0,this._cachedTimelineSig=void 0,this._lastTargetUnix=void 0,this._lastStyleJson=void 0,this.satelliteLayerRef?.current?.clearSatellite?.()}sync(e){if(h("SatelliteAndroidController.sync enter",{destroyed:this._destroyed,isSatellite:!!e?.isSatellite,instrumentId:e?.satelliteInstrumentId??null,sector:e?.satelliteSectorLabel??null,channel:e?.satelliteChannel??null,tlMapSize:e?.satelliteTimeToFileMap&&typeof e.satelliteTimeToFileMap=="object"?Object.keys(e.satelliteTimeToFileMap).length:0}),this._destroyed||!e?.isSatellite){h("SatelliteAndroidController.sync early-exit",{destroyed:this._destroyed,isSatellite:e?.isSatellite});return}const n=this.satelliteLayerRef?.current;if(!n?.syncSatellite){h("SatelliteAndroidController.sync abort: no native.syncSatellite",{refExists:!!this.satelliteLayerRef?.current,keys:this.satelliteLayerRef?.current?Object.keys(this.satelliteLayerRef.current):[]});return}const i=Object.keys(e.satelliteTimeToFileMap||{}).sort((o,s)=>Number(o)-Number(s)),t=`${e.satelliteInstrumentId}|${e.satelliteSectorLabel}|${e.satelliteChannel}|${e.variable||""}`,c=i.join(","),a={...e,apiKey:e.apiKey||this.core.apiKey},d=[];for(const o of i){const s=Number(o);if(!Number.isFinite(s))continue;const u=buildSatelliteFetchParts(a,s);u&&d.push({unix:s,url:u.url,shaderFileName:u.shaderFileName})}d.length===0&&console.warn("[AguaceroWX][satellite][satelliteSyncNoFrames]",{satRunKey:t,timelineKeyCount:i.length,hasApiKey:!!a.apiKey,satelliteChannel:a.satelliteChannel,gridRequestSiteOrigin:a.gridRequestSiteOrigin??this.core.gridRequestSiteOrigin??null,bundleId:this.core.bundleId??null,mapKeys:a.satelliteTimeToFileMap&&typeof a.satelliteTimeToFileMap=="object"?Object.keys(a.satelliteTimeToFileMap).length:0,hint:i.length===0?"Timeline empty \u2014 wait for core.initialize / listing, or check satelliteId/sector/product.":"Timeline has keys but no resolvable frame URLs \u2014 check satelliteChannel vs listing (e.g. geocolor needs MULTI on CONUS)."});let l=e.satelliteTimestamp==null||e.satelliteTimestamp===void 0?null:Number(e.satelliteTimestamp);if(l==null||!Number.isFinite(l)){const o=i.map(s=>Number(s)).filter(s=>Number.isFinite(s));o.length>0&&(l=Math.max(...o))}const y={visible:e.visible!==!1,opacity:e.opacity??1,fillSmoothing:0},m=JSON.stringify(y),p=t!==this._cachedRunKey,S=c!==this._cachedTimelineSig;if(p||S){const o=sortFramesByTargetProximity(d,l);T({state:a,core:this.core,frames:o,targetUnix:l,runKey:t,timelineKeyCount:i.length,runKeyChanged:p,timelineChanged:S,stylePayload:y});const s={runKey:t,apiKey:a.apiKey||"",userId:"sdk-user",gridRequestSiteOrigin:typeof this.core.gridRequestSiteOrigin=="string"?this.core.gridRequestSiteOrigin:"",bundleId:this.core.bundleId||"",visible:y.visible,opacity:y.opacity,fillSmoothing:y.fillSmoothing,debug:b(),frames:o};l!=null&&Number.isFinite(l)&&(s.targetUnix=l);const u=JSON.stringify(s);n.syncSatellite(u),h("SatelliteAndroidController.sync full payload sent",{runKey:t,timelineChanged:S,frameCount:o.length,targetUnix:s.targetUnix??null,jsonChars:u.length}),this._cachedRunKey=t,this._cachedTimelineSig=c,this._lastTargetUnix=l!=null&&Number.isFinite(l)?l:null,this._lastStyleJson=m;return}const g=l!=null&&Number.isFinite(l)?l:null;g!==this._lastTargetUnix&&(g!=null&&n.activateSatelliteCachedUnix&&(n.activateSatelliteCachedUnix(g),h("SatelliteAndroidController.activateSatelliteCachedUnix",{unix:g})),this._lastTargetUnix=g),m!==this._lastStyleJson&&n.updateSatelliteStyle&&(n.updateSatelliteStyle(m),h("SatelliteAndroidController.updateSatelliteStyle",{jsonChars:m.length}),this._lastStyleJson=m)}}
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Always-on warnings for satellite bridge debugging (Metro + many device log sinks).
|
|
3
|
-
* Filter Xcode / Metro: `sat-bridge` or `AguaceroWX`.
|
|
4
|
-
*/
|
|
5
|
-
export function satBridgeWarn(tag, detail) {
|
|
6
|
-
try {
|
|
7
|
-
if (detail !== undefined) {
|
|
8
|
-
console.warn(`[AguaceroWX][sat-bridge] ${tag}`, detail);
|
|
9
|
-
} else {
|
|
10
|
-
console.warn(`[AguaceroWX][sat-bridge] ${tag}`);
|
|
11
|
-
}
|
|
12
|
-
} catch {
|
|
13
|
-
/* ignore */
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
export function satBridgeWarn(a,o){try{o!==void 0?console.warn(`[AguaceroWX][sat-bridge] ${a}`,o):console.warn(`[AguaceroWX][sat-bridge] ${a}`)}catch{}}
|