Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Nov 17, 2024
1 parent 4f55cb7 commit 1953435
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;

import com.getcapacitor.JSArray;
import com.getcapacitor.JSObject;
import com.getcapacitor.Logger;
Expand Down Expand Up @@ -142,16 +141,20 @@ public void captureSample(PluginCall call) {

@PluginMethod
public void getSupportedPictureSizes(final PluginCall call) {
CameraManager cameraManager = (CameraManager) this.getContext().getSystemService(Context.CAMERA_SERVICE);
CameraManager cameraManager = (CameraManager) this.getContext()
.getSystemService(Context.CAMERA_SERVICE);

JSArray ret = new JSArray();
try {
String[] cameraIdList = cameraManager.getCameraIdList();
for (String cameraId : cameraIdList) {
CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(cameraId);
CameraCharacteristics characteristics =
cameraManager.getCameraCharacteristics(cameraId);

// Determine the facing of the camera
Integer lensFacing = characteristics.get(CameraCharacteristics.LENS_FACING);
Integer lensFacing = characteristics.get(
CameraCharacteristics.LENS_FACING
);
String facing = "Unknown";
if (lensFacing != null) {
switch (lensFacing) {
Expand All @@ -167,7 +170,9 @@ public void getSupportedPictureSizes(final PluginCall call) {
}
}

StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
StreamConfigurationMap map = characteristics.get(
CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP
);
if (map == null) {
continue;
}
Expand All @@ -190,14 +195,15 @@ public void getSupportedPictureSizes(final PluginCall call) {
JSObject finalRet = new JSObject();
finalRet.put("supportedPictureSizes", ret);
call.resolve(finalRet);
} catch (CameraAccessException ex) {
} catch (CameraAccessException ex) {
Logger.error(getLogTag(), "Cannot call getSupportedPictureSizes", ex);
call.reject(String.format("Cannot call getSupportedPictureSizes. Error: %s", ex));
call.reject(
String.format("Cannot call getSupportedPictureSizes. Error: %s", ex)
);
}
}


@PluginMethod
@PluginMethod
public void stop(final PluginCall call) {
bridge
.getActivity()
Expand Down
7 changes: 5 additions & 2 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ export interface CameraPreviewPlugin {
* @throws An error if the something goes wrong
*/
getSupportedPictureSizes(): Promise<{
supportedPictureSizes: {facing: string, supportedPictureSizes: {width: number, height: number}[]}[]
}>
supportedPictureSizes: {
facing: string;
supportedPictureSizes: { width: number; height: number }[];
}[];
}>;
/**
* Set flash mode.
* @param options the options to set the flash mode with
Expand Down

0 comments on commit 1953435

Please sign in to comment.