Skip to content

Commit

Permalink
fix: * fix #26 adapt rn v0.58
Browse files Browse the repository at this point in the history
* fix #25 iOS multi timeop make image size incorrect
* fix #24 allow output name self definition
  • Loading branch information
JimmyDaddy committed Feb 11, 2019
1 parent 9d66972 commit 71f930c
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.views.text.ReactFontManager;

import java.io.BufferedOutputStream;
Expand Down Expand Up @@ -101,7 +102,7 @@ private void markImage(

File file = new File(preImgPath);
if (!file.exists()){
promise.reject( "imgSavePath error","Can't retrieve the file from the imgSavePath: " + imgSavePath,null);
promise.reject( "imgSavePath error","Can't retrieve the file from the imgSavePath: " + imgSavePath);
return;
}

Expand All @@ -125,20 +126,20 @@ public void onNewResultImpl(@Nullable Bitmap bitmap) {
String preImgPath = myUri.getPath();
markImageByBitmap(preImgPath, mark, position, X, Y, scale, quality, filename, promise);
} else {
promise.reject( "marker error","Can't retrieve the file from the markerpath: " + uri,null);
promise.reject( "marker error","Can't retrieve the file from the markerpath: " + uri);
}
}

@Override
public void onFailureImpl(DataSource dataSource) {
promise.reject( "error","Can't request the image from the uri: " + uri,null);
promise.reject( "error","Can't request the image from the uri: " + uri);
}
}, executor);
} else {
int resId = getDrawableResourceByName(uri);
if (resId == 0) {
Log.d(IMAGE_MARKER_TAG, "cannot find res");
promise.reject( "error","Can't get resource by the path: " + uri,null);
promise.reject( "error","Can't get resource by the path: " + uri);
} else {
Log.d(IMAGE_MARKER_TAG, "res:" + resId);

Expand Down Expand Up @@ -287,7 +288,7 @@ public void addText(
Promise promise
) {
if (TextUtils.isEmpty(mark)){
promise.reject("error", "mark should not be empty", null);
promise.reject("error", "mark should not be empty");
}
BufferedOutputStream bos = null;
boolean isFinished;
Expand All @@ -301,7 +302,7 @@ public void addText(

File file = new File(preImgPath);
if (!file.exists()){
promise.reject( "error","Can't retrieve the file from the path.",null);
promise.reject( "error","Can't retrieve the file from the path.");
return;
}
Bitmap prePhoto = Utils.scaleBitmap(preImgPath, scale);
Expand Down Expand Up @@ -414,7 +415,7 @@ public void addTextByPostion(
Promise promise
) {
if (TextUtils.isEmpty(mark)){
promise.reject("error", "mark should not be empty", null);
promise.reject("error", "mark should not be empty");
}
BufferedOutputStream bos = null;
boolean isFinished;
Expand All @@ -426,7 +427,7 @@ public void addTextByPostion(

File file = new File(preImgPath);
if (!file.exists()){
promise.reject( "error","Can't retrieve the file from the path.",null);
promise.reject( "error","Can't retrieve the file from the path.");
return;
}
Bitmap prePhoto = Utils.scaleBitmap(preImgPath, scale);
Expand Down
8 changes: 3 additions & 5 deletions example/markerExample/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ export default class MarkerTest extends React.Component {
markerSrc: this.state.marker,
position: type,
scale: 1,
markerScale: 0.5,
quality: 100,
filename: 'markerfile1'
markerScale: 1,
quality: 100
}).then((path) => {
console.log('====================================');
console.log(path);
Expand Down Expand Up @@ -230,8 +229,7 @@ export default class MarkerTest extends React.Component {
fontName: 'Arial-BoldItalicMT',
fontSize: 44,
scale: 1,
quality: 100,
filename: 'markerfile4'
quality: 100
}).then((path) => {
console.log('====================================');
console.log(path);
Expand Down
128 changes: 68 additions & 60 deletions example/markerExample/ios/markerExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
6D98A830D8424447A153CB07 /* libRCTImageMarker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C6D82152CCC0428D9D98BCC1 /* libRCTImageMarker.a */; };
79615464FDE547BC844C6D5C /* libRNImagePicker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 67D5C7074B7749BAA5E8156A /* libRNImagePicker.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
A14A02E622112EFC001E2004 /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = A14A02B622112EFC001E2004 /* libstdc++.tbd */; };
A14A02E8221131C4001E2004 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A14A02E7221131C4001E2004 /* JavaScriptCore.framework */; };
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -176,20 +178,6 @@
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
remoteInfo = "double-conversion-tvOS";
};
2DF0FFEA2056DD460020B375 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9936F3131F5F2E4B0010BF04;
remoteInfo = privatedata;
};
2DF0FFEC2056DD460020B375 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04;
remoteInfo = "privatedata-tvOS";
};
3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
Expand Down Expand Up @@ -267,20 +255,6 @@
remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4;
remoteInfo = "cxxreact-tvOS";
};
3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4;
remoteInfo = jschelpers;
};
3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4;
remoteInfo = "jschelpers-tvOS";
};
5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */;
Expand Down Expand Up @@ -309,6 +283,34 @@
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
A14A02DD22112EFC001E2004 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EDEBC6D6214B3E7000DD5AC8;
remoteInfo = jsi;
};
A14A02DF22112EFC001E2004 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EDEBC73B214B45A300DD5AC8;
remoteInfo = jsiexecutor;
};
A14A02E122112EFC001E2004 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = ED296FB6214C9A0900B7C4FE;
remoteInfo = "jsi-tvOS";
};
A14A02E322112EFC001E2004 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = ED296FEE214C9CF800B7C4FE;
remoteInfo = "jsiexecutor-tvOS";
};
A15CD72621DD206E00A9EE1B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = A2EA32D95A5D4E0F8EF58BFC /* RCTImageMarker.xcodeproj */;
Expand Down Expand Up @@ -359,6 +361,8 @@
67D5C7074B7749BAA5E8156A /* libRNImagePicker.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNImagePicker.a; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
A14A02B622112EFC001E2004 /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; };
A14A02E7221131C4001E2004 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
A2EA32D95A5D4E0F8EF58BFC /* RCTImageMarker.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTImageMarker.xcodeproj; path = "../node_modules/react-native-image-marker/ios/RCTImageMarker.xcodeproj"; sourceTree = "<group>"; };
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
C6D82152CCC0428D9D98BCC1 /* libRCTImageMarker.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTImageMarker.a; sourceTree = "<group>"; };
Expand All @@ -378,6 +382,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A14A02E8221131C4001E2004 /* JavaScriptCore.framework in Frameworks */,
A14A02E622112EFC001E2004 /* libstdc++.tbd in Frameworks */,
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */,
11D1A2F320CAFA9E000508D9 /* libRCTAnimation.a in Frameworks */,
146834051AC3E58100842450 /* libReact.a in Frameworks */,
Expand Down Expand Up @@ -523,23 +529,25 @@
3DAD3EA71DF850E9000B6D8A /* libyoga.a */,
3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */,
3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
2DF0FFDF2056DD460020B375 /* libjsinspector.a */,
2DF0FFE12056DD460020B375 /* libjsinspector-tvOS.a */,
2DF0FFE32056DD460020B375 /* libthird-party.a */,
2DF0FFE52056DD460020B375 /* libthird-party.a */,
2DF0FFE72056DD460020B375 /* libdouble-conversion.a */,
2DF0FFE92056DD460020B375 /* libdouble-conversion.a */,
2DF0FFEB2056DD460020B375 /* libprivatedata.a */,
2DF0FFED2056DD460020B375 /* libprivatedata-tvOS.a */,
A14A02DE22112EFC001E2004 /* libjsi.a */,
A14A02E022112EFC001E2004 /* libjsiexecutor.a */,
A14A02E222112EFC001E2004 /* libjsi-tvOS.a */,
A14A02E422112EFC001E2004 /* libjsiexecutor-tvOS.a */,
);
name = Products;
sourceTree = "<group>";
};
2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
isa = PBXGroup;
children = (
A14A02E7221131C4001E2004 /* JavaScriptCore.framework */,
A14A02B622112EFC001E2004 /* libstdc++.tbd */,
2D16E6891FA4F8E400B85C8A /* libReact.a */,
);
name = Frameworks;
Expand Down Expand Up @@ -951,20 +959,6 @@
remoteRef = 2DF0FFE82056DD460020B375 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2DF0FFEB2056DD460020B375 /* libprivatedata.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libprivatedata.a;
remoteRef = 2DF0FFEA2056DD460020B375 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2DF0FFED2056DD460020B375 /* libprivatedata-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libprivatedata-tvOS.a";
remoteRef = 2DF0FFEC2056DD460020B375 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand Down Expand Up @@ -1042,20 +1036,6 @@
remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libjschelpers.a;
remoteRef = 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libjschelpers.a;
remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand Down Expand Up @@ -1084,6 +1064,34 @@
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
A14A02DE22112EFC001E2004 /* libjsi.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libjsi.a;
remoteRef = A14A02DD22112EFC001E2004 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
A14A02E022112EFC001E2004 /* libjsiexecutor.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libjsiexecutor.a;
remoteRef = A14A02DF22112EFC001E2004 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
A14A02E222112EFC001E2004 /* libjsi-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libjsi-tvOS.a";
remoteRef = A14A02E122112EFC001E2004 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
A14A02E422112EFC001E2004 /* libjsiexecutor-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libjsiexecutor-tvOS.a";
remoteRef = A14A02E322112EFC001E2004 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
A15CD72721DD206E00A9EE1B /* libRCTImageMarker.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
6 changes: 3 additions & 3 deletions example/markerExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"test": "jest"
},
"dependencies": {
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-image-marker": "^0.3.9",
"react": "16.8.1",
"react-native": "^0.58.4",
"react-native-image-marker": "^0.4.0",
"react-native-image-picker": "^0.27.2"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 71f930c

Please sign in to comment.