NetMirror.apk
Download file
package com.facebook.react.modules.blob;
import android.util.Base64;
import com.facebook.fbreact.specs.NativeFileReaderModuleSpec;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableMap;
import v1.InterfaceC0756a;
/* JADX INFO: loaded from: classes.dex */
@InterfaceC0756a(name = NativeFileReaderModuleSpec.NAME)
public class FileReaderModule extends NativeFileReaderModuleSpec {
private static final String ERROR_INVALID_BLOB = "ERROR_INVALID_BLOB";
public FileReaderModule(ReactApplicationContext reactApplicationContext) {
super(reactApplicationContext);
}
private BlobModule getBlobModule(String str) {
ReactApplicationContext reactApplicationContextIfActiveOrWarn = getReactApplicationContextIfActiveOrWarn();
if (reactApplicationContextIfActiveOrWarn != null) {
return (BlobModule) reactApplicationContextIfActiveOrWarn.getNativeModule(BlobModule.class);
}
return null;
}
@Override // com.facebook.fbreact.specs.NativeFileReaderModuleSpec
public void readAsDataURL(ReadableMap readableMap, Promise promise) {
BlobModule blobModule = getBlobModule("readAsDataURL");
if (blobModule == null) {
promise.reject(new IllegalStateException("Could not get BlobModule from ReactApplicationContext"));
return;
}
if (readableMap == null) {
promise.reject(ERROR_INVALID_BLOB, "The specified blob is null");
return;
}
byte[] bArrResolve = blobModule.resolve(readableMap.getString("blobId"), readableMap.getInt("offset"), readableMap.getInt("size"));
if (bArrResolve == null) {
promise.reject(ERROR_INVALID_BLOB, "The specified blob is invalid");
return;
}
try {
StringBuilder sb = new StringBuilder();
sb.append("data:");
if (!readableMap.hasKey("type") || readableMap.getString("type").isEmpty()) {
sb.append("application/octet-stream");
} else {
sb.append(readableMap.getString("type"));
}
sb.append(";base64,");
sb.append(Base64.encodeToString(bArrResolve, 2));
promise.resolve(sb.toString());
} catch (Exception e4) {
promise.reject(e4);
}
}
@Override // com.facebook.fbreact.specs.NativeFileReaderModuleSpec
public void readAsText(ReadableMap readableMap, String str, Promise promise) {
BlobModule blobModule = getBlobModule("readAsText");
if (blobModule == null) {
promise.reject(new IllegalStateException("Could not get BlobModule from ReactApplicationContext"));
return;
}
if (readableMap == null) {
promise.reject(ERROR_INVALID_BLOB, "The specified blob is null");
return;
}
byte[] bArrResolve = blobModule.resolve(readableMap.getString("blobId"), readableMap.getInt("offset"), readableMap.getInt("size"));
if (bArrResolve == null) {
promise.reject(ERROR_INVALID_BLOB, "The specified blob is invalid");
return;
}
try {
promise.resolve(new String(bArrResolve, str));
} catch (Exception e4) {
promise.reject(e4);
}
}
}
⚠️ This content was hidden by an advertisement filtering extension in your browser. Please disable it and reload the page to access the decompiled content.
We only display one small text ad to keep this service free. Here's what it looks like:
Read the Docs for Business: You write the docs. We do the rest.
Try it today!Ad by EthicalAds
Download file