Skip to content

Commit ae8dafa

Browse files
author
Jenkins
committed
5.7.0
1 parent 99bc61a commit ae8dafa

16 files changed

Lines changed: 1207 additions & 359 deletions

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ $ pod install
2929
* Change the application ID to the one you have specified during the registration at [licensing.regulaforensics.com](https://licensing.regulaforensics.com).
3030
* Run `npx react-native run-android` inside `example` folder - this is just one way to run the app. You can also run it directly from within Android Studio. **Note**: `npx react-native log-android` is used to view logs.
3131

32+
**Note**: if the running failed with the following error `Error: spawn ./gradlew EACCES`, try to run the following command `chmod +x gradlew` within the `example/android` directory.
33+
3234
5. iOS:
3335
* Copy the `regula.license` file to the `example/ios/DocumentReader` folder.
3436
* Change the Bundle Identifier to the one you have specified during the registration at [licensing.regulaforensics.com](https://licensing.regulaforensics.com).

RNDocumentReaderApi.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ Pod::Spec.new do |s|
1414
s.source = { :http => 'file:' + __dir__ }
1515
s.ios.deployment_target = '9.0.0'
1616
s.source_files = "ios/*.{h,m}"
17-
s.dependency 'DocumentReader', '5.6.2001'
17+
s.dependency 'DocumentReader', '5.7.2075'
1818
s.dependency 'React'
1919
end

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ dependencies {
5151
//noinspection GradleDynamicVersion
5252
implementation 'com.facebook.react:react-native:+'
5353
//noinspection GradleDependency
54-
implementation('com.regula.documentreader:api:5.6.4832') {
54+
implementation('com.regula.documentreader:api:5.7.4947') {
5555
transitive = true
5656
}
5757
}

android/src/main/java/com/regula/documentreader/Helpers.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.json.JSONException;
1818
import org.json.JSONObject;
1919

20-
import java.io.ByteArrayInputStream;
2120
import java.io.ByteArrayOutputStream;
2221
import java.util.ArrayList;
2322
import java.util.List;
@@ -34,9 +33,14 @@ static Bitmap bitmapFromBase64(String base64) {
3433
return result;
3534
}
3635

37-
static Drawable drawableFromBase64(String base64, Context context) {
38-
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(Base64.decode(base64.getBytes(), Base64.DEFAULT));
39-
return Drawable.createFromResourceStream(context.getResources(), null, byteArrayInputStream, null);
36+
static BitmapDrawable drawableFromBase64(String base64, Context context)
37+
{
38+
byte[] decodedByte = Base64.decode(base64, 0);
39+
Bitmap bitmap = BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length);
40+
float density = context.getResources().getDisplayMetrics().density;
41+
int width = (int)(bitmap.getWidth()*density);
42+
int height = (int)(bitmap.getHeight()*density);
43+
return new BitmapDrawable(context.getResources(), Bitmap.createScaledBitmap(bitmap, width, height, false));
4044
}
4145

4246
static Bitmap bitmapFromDrawable(Drawable drawable) {

0 commit comments

Comments
 (0)