Skip to content

Commit

Permalink
[Android@RNPhotoManipulatorModule] Change: Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
guhungry committed Apr 10, 2024
1 parent 148013e commit 5375a45
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.facebook.react.bridge.ReadableMap;

public class RNPhotoManipulatorModule extends NativeRNPhotoManipulatorSpec {
public static final String NAME = "RNPhotoManipulator";
private final RNPhotoManipulatorModuleImpl implement;

public RNPhotoManipulatorModule(ReactApplicationContext reactContext) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@

package com.guhungry.rnphotomanipulator;

import android.graphics.Bitmap;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.Typeface;
import androidx.annotation.Nullable;

import com.facebook.react.bridge.Promise;
Expand All @@ -13,21 +8,8 @@
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.views.text.ReactFontManager;
import com.facebook.react.module.annotations.ReactModule;
import com.guhungry.photomanipulator.BitmapUtils;
import com.guhungry.photomanipulator.MimeUtils;
import com.guhungry.rnphotomanipulator.utils.ImageUtils;
import com.guhungry.rnphotomanipulator.utils.ParamUtils;

import java.util.HashMap;
import java.util.Map;

@ReactModule(name = RNPhotoManipulatorModule.NAME)
public class RNPhotoManipulatorModule extends ReactContextBaseJavaModule {
public static final String NAME = "RNPhotoManipulator";
private final String FILE_PREFIX = "RNPM_";
private final int DEFAULT_QUALITY = 100;
private final RNPhotoManipulatorModuleImpl implement;

public RNPhotoManipulatorModule(ReactApplicationContext reactContext) {
Expand Down Expand Up @@ -68,15 +50,5 @@ public void printText(String uri, ReadableArray list, String mimeType, Promise p
@ReactMethod
public void optimize(String uri, double quality, Promise promise) {
implement.optimize(uri, quality, promise);
try {
Bitmap output = ImageUtils.bitmapFromUri(getReactApplicationContext(), uri);

String file = ImageUtils.saveTempFile(getReactApplicationContext(), output, MimeUtils.JPEG, FILE_PREFIX, (int)quality);
output.recycle();

promise.resolve(file);
} catch (Exception e) {
promise.reject(e);
}
}
}

0 comments on commit 5375a45

Please sign in to comment.