@aguacerowx/react-native 0.0.51 → 0.0.53
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/src/main/cpp/satellite_ktx_jni.cpp +6 -1
- package/android/src/main/java/com/aguacerowx/reactnative/SatelliteLayer.java +121 -1
- package/android/src/main/java/com/aguacerowx/reactnative/SatelliteLayerView.java +556 -384
- package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +315 -311
- package/ios/SatelliteLayerView.swift +517 -510
- package/ios/WeatherFrameProcessorModule.swift +222 -219
- package/lib/commonjs/WeatherLayerManager.js +82 -46
- package/lib/commonjs/WeatherLayerManager.js.map +1 -1
- package/lib/commonjs/aguaceroRnDebug.js +9 -1
- package/lib/commonjs/aguaceroRnDebug.js.map +1 -1
- package/lib/commonjs/gridCdnAuth.js +64 -0
- package/lib/commonjs/gridCdnAuth.js.map +1 -0
- package/lib/commonjs/index.js +50 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nexrad/nexradAndroidController.js +25 -25
- package/lib/commonjs/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/commonjs/nexrad/nexradDiag.js +24 -24
- package/lib/commonjs/satellite/satelliteAndroidController.js +32 -24
- package/lib/commonjs/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/commonjs/satelliteRnDebug.js +261 -0
- package/lib/commonjs/satelliteRnDebug.js.map +1 -0
- package/lib/module/WeatherLayerManager.js +82 -46
- package/lib/module/WeatherLayerManager.js.map +1 -1
- package/lib/module/aguaceroRnDebug.js +9 -1
- package/lib/module/aguaceroRnDebug.js.map +1 -1
- package/lib/module/gridCdnAuth.js +56 -0
- package/lib/module/gridCdnAuth.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/nexrad/nexradAndroidController.js +25 -25
- package/lib/module/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/module/nexrad/nexradDiag.js +24 -24
- package/lib/module/satellite/satelliteAndroidController.js +32 -24
- package/lib/module/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/module/satelliteRnDebug.js +248 -0
- package/lib/module/satelliteRnDebug.js.map +1 -0
- package/lib/typescript/WeatherLayerManager.d.ts.map +1 -1
- package/lib/typescript/aguaceroRnDebug.d.ts.map +1 -1
- package/lib/typescript/gridCdnAuth.d.ts +24 -0
- package/lib/typescript/gridCdnAuth.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/satellite/satelliteAndroidController.d.ts.map +1 -1
- package/lib/typescript/satelliteRnDebug.d.ts +81 -0
- package/lib/typescript/satelliteRnDebug.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/WeatherLayerManager.js +2044 -2004
- package/src/aguaceroRnDebug.js +9 -1
- package/src/gridCdnAuth.js +56 -0
- package/src/index.js +27 -15
- package/src/nexrad/nexradAndroidController.js +1078 -1078
- package/src/nexrad/nexradDiag.js +150 -150
- package/src/satellite/satelliteAndroidController.js +257 -245
- package/src/satelliteRnDebug.js +269 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Satellite-specific RN diagnostics (Metro + native events → Metro when `debug` is on).
|
|
3
|
+
*
|
|
4
|
+
* Filter Metro: `[AguaceroRN][satellite]`
|
|
5
|
+
* Filter logcat: `AguaceroRN`, `AguaceroSatelliteView`, `AguaceroSatellite`, `AguaceroSatKtx`
|
|
6
|
+
*/
|
|
7
|
+
import { NativeEventEmitter, NativeModules, Platform, UIManager } from 'react-native';
|
|
8
|
+
import { aguaceroDebug, aguaceroDebugWarn, getAguaceroAuthDiagnosticSnapshot, isAguaceroRnDebugEnabled, redactApiKeyFromUrl } from './aguaceroRnDebug';
|
|
9
|
+
|
|
10
|
+
export const SATELLITE_DIAGNOSTIC_EVENT = 'AguaceroSatelliteDiagnostic';
|
|
11
|
+
|
|
12
|
+
const LOG = '[AguaceroRN][satellite]';
|
|
13
|
+
|
|
14
|
+
/** @type {import('react-native').EmitterSubscription | null} */
|
|
15
|
+
let diagSubscription = null;
|
|
16
|
+
|
|
17
|
+
const BASIS_FORMAT_NAMES = {
|
|
18
|
+
1: 'ETC2_RGBA (preferred Android)',
|
|
19
|
+
10: 'ASTC_LDR_4x4 (black tiles if GPU cannot sample ASTC)',
|
|
20
|
+
13: 'RGBA32 (universal fallback)',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {number | undefined} ordinal
|
|
25
|
+
*/
|
|
26
|
+
export function basisFormatLabel(ordinal) {
|
|
27
|
+
if (ordinal == null || Number.isNaN(Number(ordinal))) return 'unknown';
|
|
28
|
+
return BASIS_FORMAT_NAMES[Number(ordinal)] ?? `ordinal_${ordinal}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Actionable hints when imagery is black but JS sync looks healthy.
|
|
33
|
+
* @param {Record<string, unknown>} ctx
|
|
34
|
+
*/
|
|
35
|
+
export function interpretSatelliteBlackScreenHints(ctx) {
|
|
36
|
+
const hints = [];
|
|
37
|
+
const frameCount = Number(ctx.frameCount ?? 0);
|
|
38
|
+
const nativeCached = Number(ctx.nativeCachedFrames ?? ctx.cachedFrameCount ?? NaN);
|
|
39
|
+
const targetUnix = ctx.targetUnix;
|
|
40
|
+
const activeUnix = ctx.activeUnix;
|
|
41
|
+
const visible = ctx.visible;
|
|
42
|
+
const opacity = ctx.opacity;
|
|
43
|
+
const basisFormat = ctx.basisFormatOrdinal ?? ctx.transcodeFormatOrdinal;
|
|
44
|
+
|
|
45
|
+
if (frameCount === 0) {
|
|
46
|
+
hints.push('JS built zero frame URLs — check satellite listing, channel (geocolor), and sector.');
|
|
47
|
+
}
|
|
48
|
+
if (visible === false) {
|
|
49
|
+
hints.push('Layer visible=false — imagery is hidden by state/UI.');
|
|
50
|
+
}
|
|
51
|
+
if (typeof opacity === 'number' && opacity <= 0) {
|
|
52
|
+
hints.push('Layer opacity=0 — increase opacity in WeatherLayerManager state.');
|
|
53
|
+
}
|
|
54
|
+
if (targetUnix != null && nativeCached === 0 && !Number.isNaN(nativeCached)) {
|
|
55
|
+
hints.push(
|
|
56
|
+
'targetUnix is set but native GPU cache is empty — KTX fetch/decode/upload failed; check native diagnostic events or logcat (AguaceroSatelliteView).',
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (activeUnix == null && targetUnix != null) {
|
|
60
|
+
hints.push(
|
|
61
|
+
'targetUnix set but no active frame on GPU yet — wait for decode or prior frame failed upload (ASTC on unsupported GPU is common).',
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
if (Number(basisFormat) === 10) {
|
|
65
|
+
hints.push(
|
|
66
|
+
'Transcoded to ASTC — if the map footprint is black, rebuild SDK with ETC2-first transcode or check AguaceroSatellite for GPU upload GL errors.',
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (ctx.bundleIdPresent === false) {
|
|
70
|
+
hints.push(
|
|
71
|
+
'bundleId missing — install react-native-device-info; some keys require x-app-identifier (usually 403, not black tiles).',
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
if (ctx.mapLayerAdded === false) {
|
|
75
|
+
hints.push('Mapbox custom satellite layer not attached — ensure WeatherLayerManager is a child of MapManager.');
|
|
76
|
+
}
|
|
77
|
+
if (ctx.satelliteNativeMissing === true) {
|
|
78
|
+
hints.push('SatelliteLayer native view manager not registered — rebuild app / link @aguacerowx/react-native android.');
|
|
79
|
+
}
|
|
80
|
+
if (hints.length === 0) {
|
|
81
|
+
hints.push(
|
|
82
|
+
'JS pipeline looks healthy — inspect native events below (fetch bytes, transcode format, GPU upload). Filter logcat: AguaceroSatelliteView AguaceroSatellite AguaceroSatKtx',
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return hints;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* One-shot integration audit (call when WeatherLayerManager mounts with debug).
|
|
90
|
+
* @param {{ core?: import('@aguacerowx/javascript-sdk').AguaceroCore; satelliteLayerRef?: React.RefObject<unknown> }} opts
|
|
91
|
+
*/
|
|
92
|
+
export function auditSatelliteIntegration(opts = {}) {
|
|
93
|
+
if (!isAguaceroRnDebugEnabled()) return;
|
|
94
|
+
const { core, satelliteLayerRef } = opts;
|
|
95
|
+
let satCmdKeys = [];
|
|
96
|
+
let gridCmdKeys = [];
|
|
97
|
+
let satManagerError = null;
|
|
98
|
+
try {
|
|
99
|
+
satCmdKeys = Object.keys(UIManager.getViewManagerConfig?.('SatelliteLayer')?.Commands ?? {});
|
|
100
|
+
} catch (e) {
|
|
101
|
+
satManagerError = String(e?.message ?? e);
|
|
102
|
+
satCmdKeys = [];
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
gridCmdKeys = Object.keys(UIManager.getViewManagerConfig?.('GridRenderLayer')?.Commands ?? {});
|
|
106
|
+
} catch {
|
|
107
|
+
gridCmdKeys = [];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let deviceInfoOk = false;
|
|
111
|
+
let deviceInfoBundleId = null;
|
|
112
|
+
try {
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
|
|
114
|
+
const DeviceInfo = require('react-native-device-info');
|
|
115
|
+
deviceInfoOk = true;
|
|
116
|
+
try {
|
|
117
|
+
deviceInfoBundleId = DeviceInfo.getBundleId?.() ?? null;
|
|
118
|
+
} catch {
|
|
119
|
+
deviceInfoBundleId = null;
|
|
120
|
+
}
|
|
121
|
+
} catch {
|
|
122
|
+
deviceInfoOk = false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const snapshot = {
|
|
126
|
+
platform: Platform.OS,
|
|
127
|
+
satelliteNativeCommands: satCmdKeys,
|
|
128
|
+
satelliteNativeMissing: satCmdKeys.length === 0,
|
|
129
|
+
satelliteManagerError: satManagerError,
|
|
130
|
+
gridNativeCommands: gridCmdKeys,
|
|
131
|
+
satelliteRefAttached: Boolean(satelliteLayerRef?.current),
|
|
132
|
+
satelliteRefMethods: satelliteLayerRef?.current ? Object.keys(satelliteLayerRef.current) : [],
|
|
133
|
+
reactNativeDeviceInfo: deviceInfoOk
|
|
134
|
+
? { installed: true, bundleId: deviceInfoBundleId }
|
|
135
|
+
: {
|
|
136
|
+
installed: false,
|
|
137
|
+
hint: 'npm install react-native-device-info — required for core.bundleId / x-app-identifier',
|
|
138
|
+
},
|
|
139
|
+
mapboxNote: 'Requires @rnmapbox/maps v11; WeatherLayerManager must be nested inside MapManager',
|
|
140
|
+
nativeLibraries: ['aguacero_satellite_ktx (KTX2 Basis transcoder JNI)'],
|
|
141
|
+
auth: core ? getAguaceroAuthDiagnosticSnapshot(core) : undefined,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
aguaceroDebug('integration.audit', snapshot);
|
|
145
|
+
|
|
146
|
+
if (satCmdKeys.length === 0) {
|
|
147
|
+
aguaceroDebugWarn('integration.satelliteNativeMissing', {
|
|
148
|
+
hint: 'SatelliteLayer ViewManager has no commands — satellite will never render on Android.',
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
if (core && !core.bundleId && Platform.OS !== 'web') {
|
|
152
|
+
aguaceroDebugWarn('integration.bundleIdMissing', {
|
|
153
|
+
hint: 'core.bundleId is null — CDN may still work; some API keys require react-native-device-info.',
|
|
154
|
+
deviceInfoInstalled: deviceInfoOk,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return snapshot;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @param {object} params
|
|
163
|
+
*/
|
|
164
|
+
export function logSatelliteSyncReport(params) {
|
|
165
|
+
if (!isAguaceroRnDebugEnabled()) return;
|
|
166
|
+
const {
|
|
167
|
+
state,
|
|
168
|
+
core,
|
|
169
|
+
frames,
|
|
170
|
+
targetUnix,
|
|
171
|
+
runKey,
|
|
172
|
+
timelineKeyCount,
|
|
173
|
+
runKeyChanged,
|
|
174
|
+
timelineChanged,
|
|
175
|
+
stylePayload,
|
|
176
|
+
} = params;
|
|
177
|
+
|
|
178
|
+
const first = frames?.[0];
|
|
179
|
+
const last = frames?.length ? frames[frames.length - 1] : null;
|
|
180
|
+
|
|
181
|
+
const report = {
|
|
182
|
+
runKey,
|
|
183
|
+
runKeyChanged,
|
|
184
|
+
timelineChanged,
|
|
185
|
+
timelineKeyCount,
|
|
186
|
+
builtFrameCount: frames?.length ?? 0,
|
|
187
|
+
targetUnix,
|
|
188
|
+
satelliteTimestamp: state?.satelliteTimestamp ?? null,
|
|
189
|
+
style: stylePayload,
|
|
190
|
+
instrument: state?.satelliteInstrumentId,
|
|
191
|
+
sector: state?.satelliteSectorLabel,
|
|
192
|
+
channel: state?.satelliteChannel,
|
|
193
|
+
availableSatelliteTimestamps: state?.availableSatelliteTimestamps?.length ?? 0,
|
|
194
|
+
sampleShaderFileName: first?.shaderFileName ?? null,
|
|
195
|
+
sampleFrameUrl: first?.url ? redactApiKeyFromUrl(first.url) : null,
|
|
196
|
+
firstUnix: first?.unix ?? null,
|
|
197
|
+
lastUnix: last?.unix ?? null,
|
|
198
|
+
auth: core ? getAguaceroAuthDiagnosticSnapshot(core) : undefined,
|
|
199
|
+
blackScreenHints: interpretSatelliteBlackScreenHints({
|
|
200
|
+
frameCount: frames?.length ?? 0,
|
|
201
|
+
targetUnix,
|
|
202
|
+
visible: stylePayload?.visible,
|
|
203
|
+
opacity: stylePayload?.opacity,
|
|
204
|
+
bundleIdPresent: Boolean(core?.bundleId),
|
|
205
|
+
}),
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
aguaceroDebug('sync.report', report);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Subscribe to native → JS diagnostic events (Android). Returns unsubscribe.
|
|
213
|
+
* @returns {() => void}
|
|
214
|
+
*/
|
|
215
|
+
export function installSatelliteDiagnosticListener() {
|
|
216
|
+
if (!isAguaceroRnDebugEnabled()) return () => {};
|
|
217
|
+
if (Platform.OS !== 'android') {
|
|
218
|
+
aguaceroDebug('nativeEvents.skipped', { reason: 'only Android emits AguaceroSatelliteDiagnostic today' });
|
|
219
|
+
return () => {};
|
|
220
|
+
}
|
|
221
|
+
if (diagSubscription) {
|
|
222
|
+
diagSubscription.remove();
|
|
223
|
+
diagSubscription = null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const emitter = new NativeEventEmitter();
|
|
227
|
+
diagSubscription = emitter.addListener(SATELLITE_DIAGNOSTIC_EVENT, (payload) => {
|
|
228
|
+
if (!payload || typeof payload !== 'object') return;
|
|
229
|
+
const phase = payload.phase ?? 'unknown';
|
|
230
|
+
const detail = { ...payload };
|
|
231
|
+
delete detail.phase;
|
|
232
|
+
if (detail.basisFormatOrdinal != null) {
|
|
233
|
+
detail.basisFormat = basisFormatLabel(detail.basisFormatOrdinal);
|
|
234
|
+
}
|
|
235
|
+
if (detail.transcodeFormatOrdinal != null) {
|
|
236
|
+
detail.transcodeFormat = basisFormatLabel(detail.transcodeFormatOrdinal);
|
|
237
|
+
}
|
|
238
|
+
if (
|
|
239
|
+
phase.includes('fail') ||
|
|
240
|
+
phase.includes('error') ||
|
|
241
|
+
phase === 'render.noDraw' ||
|
|
242
|
+
(phase === 'render.poll' && (detail.cachedFrameCount === 0 || detail.activeUnix == null))
|
|
243
|
+
) {
|
|
244
|
+
detail.blackScreenHints = interpretSatelliteBlackScreenHints(detail);
|
|
245
|
+
aguaceroDebugWarn(`native.${phase}`, detail);
|
|
246
|
+
} else {
|
|
247
|
+
aguaceroDebug(`native.${phase}`, detail);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
aguaceroDebug('nativeEvents.installed', {
|
|
252
|
+
event: SATELLITE_DIAGNOSTIC_EVENT,
|
|
253
|
+
hint: 'Native fetch/decode/GPU logs will appear here when debug=true on WeatherLayerManager',
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
return () => {
|
|
257
|
+
diagSubscription?.remove();
|
|
258
|
+
diagSubscription = null;
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* @param {Record<string, unknown>} nativePayload
|
|
264
|
+
*/
|
|
265
|
+
export function logSatelliteNativeDiagnostic(nativePayload) {
|
|
266
|
+
if (!isAguaceroRnDebugEnabled() || !nativePayload) return;
|
|
267
|
+
const phase = nativePayload.phase ?? 'event';
|
|
268
|
+
aguaceroDebug(`native.${phase}`, nativePayload);
|
|
269
|
+
}
|