@aguacerowx/react-native 0.0.2 → 0.0.4
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/.transforms/78b892a9dae44f36e51ff0649e9c6e36/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/f4de14556a82e99f0d27ddcab762b219/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/WeatherFrameProcessorModule.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +44 -38
- package/package.json +5 -5
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Wed Nov 05 19:31:04 EST 2025
|
|
2
2
|
com.aguacerowx.reactnative.aguacerowx_react-native-main-6\:/raw/fragment_shader.glsl=C\:\\Users\\my41m\\aguacero\\ReactNativeApp\\node_modules\\@aguacerowx\\react-native\\android\\build\\intermediates\\packaged_res\\debug\\packageDebugResources\\raw\\fragment_shader.glsl
|
|
3
3
|
com.aguacerowx.reactnative.aguacerowx_react-native-main-6\:/raw/debug_vertex_shader.glsl=C\:\\Users\\my41m\\aguacero\\ReactNativeApp\\node_modules\\@aguacerowx\\react-native\\android\\build\\intermediates\\packaged_res\\debug\\packageDebugResources\\raw\\debug_vertex_shader.glsl
|
|
4
4
|
com.aguacerowx.reactnative.aguacerowx_react-native-main-6\:/raw/vertex_shader.glsl=C\:\\Users\\my41m\\aguacero\\ReactNativeApp\\node_modules\\@aguacerowx\\react-native\\android\\build\\intermediates\\packaged_res\\debug\\packageDebugResources\\raw\\vertex_shader.glsl
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// packages/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java
|
|
2
|
+
|
|
1
3
|
package com.aguacerowx.reactnative;
|
|
2
4
|
|
|
3
5
|
import androidx.annotation.NonNull;
|
|
@@ -10,6 +12,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
|
10
12
|
import com.facebook.react.bridge.ReactMethod;
|
|
11
13
|
import com.facebook.react.bridge.ReadableMap;
|
|
12
14
|
import com.facebook.react.bridge.WritableMap;
|
|
15
|
+
import com.facebook.react.modules.network.OkHttpClientProvider;
|
|
13
16
|
|
|
14
17
|
import org.json.JSONObject;
|
|
15
18
|
|
|
@@ -17,12 +20,16 @@ import java.io.ByteArrayOutputStream;
|
|
|
17
20
|
import java.io.File;
|
|
18
21
|
import java.io.FileOutputStream;
|
|
19
22
|
import java.io.IOException;
|
|
20
|
-
|
|
21
|
-
import java.net.URL;
|
|
23
|
+
|
|
22
24
|
import java.nio.charset.StandardCharsets;
|
|
23
25
|
import java.util.concurrent.ExecutorService;
|
|
24
26
|
import java.util.concurrent.Executors;
|
|
25
27
|
|
|
28
|
+
import okhttp3.OkHttpClient;
|
|
29
|
+
import okhttp3.Request;
|
|
30
|
+
import okhttp3.Response;
|
|
31
|
+
import okhttp3.ResponseBody;
|
|
32
|
+
|
|
26
33
|
|
|
27
34
|
public class WeatherFrameProcessorModule extends ReactContextBaseJavaModule {
|
|
28
35
|
|
|
@@ -59,74 +66,73 @@ public class WeatherFrameProcessorModule extends ReactContextBaseJavaModule {
|
|
|
59
66
|
FileOutputStream fos = null;
|
|
60
67
|
try {
|
|
61
68
|
if (taskToken != this.currentRunToken) {
|
|
62
|
-
// Task was cancelled
|
|
63
|
-
return;
|
|
69
|
+
return; // Task was cancelled
|
|
64
70
|
}
|
|
65
|
-
|
|
66
|
-
//
|
|
71
|
+
|
|
72
|
+
// --- START OF REPLACEMENT ---
|
|
73
|
+
|
|
74
|
+
// 1. Get the shared OkHttpClient instance from React Native
|
|
75
|
+
OkHttpClient client = OkHttpClientProvider.getOkHttpClient();
|
|
76
|
+
|
|
77
|
+
// 2. Get request details from options
|
|
67
78
|
String urlString = options.getString("url");
|
|
68
79
|
String apiKey = options.getString("apiKey");
|
|
69
80
|
String bundleId = options.getString("bundleId");
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
|
|
82
|
+
// 3. Build the OkHttp Request
|
|
83
|
+
Request.Builder requestBuilder = new Request.Builder()
|
|
84
|
+
.url(urlString)
|
|
85
|
+
.header("x-api-key", apiKey);
|
|
86
|
+
|
|
74
87
|
if (bundleId != null) {
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (conn.getResponseCode() != 200) {
|
|
79
|
-
throw new IOException("HTTP Error: " + conn.getResponseCode());
|
|
88
|
+
requestBuilder.header("x-app-identifier", bundleId);
|
|
80
89
|
}
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
Request request = requestBuilder.build();
|
|
92
|
+
|
|
93
|
+
String responseString;
|
|
94
|
+
// 4. Execute the request and handle the response
|
|
95
|
+
try (Response response = client.newCall(request).execute()) {
|
|
96
|
+
if (!response.isSuccessful()) {
|
|
97
|
+
throw new IOException("HTTP Error: " + response.code());
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
ResponseBody body = response.body();
|
|
101
|
+
if (body == null) {
|
|
102
|
+
throw new IOException("Response body was null");
|
|
103
|
+
}
|
|
104
|
+
responseString = body.string();
|
|
87
105
|
}
|
|
88
|
-
String responseString = result.toString(StandardCharsets.UTF_8.name());
|
|
89
|
-
JSONObject jsonResponse = new JSONObject(responseString);
|
|
90
|
-
conn.disconnect();
|
|
91
106
|
|
|
107
|
+
// --- END OF REPLACEMENT ---
|
|
108
|
+
|
|
109
|
+
// The rest of your logic remains the same
|
|
110
|
+
JSONObject jsonResponse = new JSONObject(responseString);
|
|
92
111
|
String b64CompressedData = jsonResponse.getString("data");
|
|
93
112
|
JSONObject encoding = jsonResponse.getJSONObject("encoding");
|
|
94
|
-
|
|
95
|
-
// --- START OF EDITS ---
|
|
96
113
|
|
|
97
|
-
// 2. Decode Base64 into the RAW COMPRESSED bytes.
|
|
98
|
-
// DO NOT decompress it here.
|
|
99
114
|
byte[] compressedData = Base64.decode(b64CompressedData, Base64.DEFAULT);
|
|
100
115
|
|
|
101
|
-
// 3. Write the SMALL, COMPRESSED data to a file.
|
|
102
116
|
File cacheDir = reactContext.getCacheDir();
|
|
103
|
-
// Use a predictable filename to avoid creating duplicate files for the same frame
|
|
104
117
|
String fileName = "frame_" + urlString.hashCode() + ".zst";
|
|
105
118
|
File dataFile = new File(cacheDir, fileName);
|
|
106
119
|
|
|
107
120
|
fos = new FileOutputStream(dataFile);
|
|
108
|
-
fos.write(compressedData);
|
|
121
|
+
fos.write(compressedData);
|
|
109
122
|
fos.flush();
|
|
110
123
|
fos.close();
|
|
111
|
-
fos = null;
|
|
124
|
+
fos = null;
|
|
112
125
|
|
|
113
|
-
// 4. Prepare Success Response with the file path and metadata
|
|
114
126
|
WritableMap responseMap = Arguments.createMap();
|
|
115
127
|
responseMap.putString("filePath", dataFile.getAbsolutePath());
|
|
116
128
|
responseMap.putDouble("scale", encoding.getDouble("scale"));
|
|
117
129
|
responseMap.putDouble("offset", encoding.getDouble("offset"));
|
|
118
130
|
responseMap.putDouble("missing", encoding.getDouble("missing_quantized"));
|
|
119
|
-
|
|
120
|
-
// We still pass this for the very first frame to load instantly without a flicker.
|
|
121
|
-
// The preloader logic on the JS side will ignore this and just use the filePath.
|
|
122
131
|
responseMap.putString("dataAsBase64", b64CompressedData);
|
|
123
132
|
|
|
124
133
|
callback.invoke(null, responseMap);
|
|
125
134
|
|
|
126
|
-
// --- END OF EDITS ---
|
|
127
|
-
|
|
128
135
|
} catch (Exception e) {
|
|
129
|
-
// Don't invoke callback if task was cancelled, to avoid spamming logs
|
|
130
136
|
if (taskToken == this.currentRunToken) {
|
|
131
137
|
android.util.Log.e("AguaceroWX", "Error processing frame", e);
|
|
132
138
|
callback.invoke(e.getMessage(), null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aguacerowx/react-native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Native weather rendering for React Native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"react-native": "index.js",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@rnmapbox/maps": "*",
|
|
21
21
|
"react": "*",
|
|
22
|
-
"react-native": "*"
|
|
22
|
+
"react-native": "*",
|
|
23
|
+
"react-native-device-info": ">=10.0.0"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@aguacerowx/javascript-sdk": "^0.0.
|
|
26
|
-
"base64-js": "^1.5.1"
|
|
27
|
-
"fzstd": "^0.1.1"
|
|
26
|
+
"@aguacerowx/javascript-sdk": "^0.0.5",
|
|
27
|
+
"base64-js": "^1.5.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {},
|
|
30
30
|
"scripts": {
|