Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

update patch

ammarahm-eda11665cea073
diff --git a/apps/mobile/patches/react-native-image-picker+4.1.2.patch b/apps/mobile/patches/react-native-image-picker+4.1.2.patch
index 01b8e3e7e..41d8128fc 100644
--- a/apps/mobile/patches/react-native-image-picker+4.1.2.patch
+++ b/apps/mobile/patches/react-native-image-picker+4.1.2.patch
@@ -7,7 +7,7 @@ index 0000000..0d259dd
+o/classes
diff --git a/node_modules/react-native-image-picker/android/build/.transforms/c1f7f4bc703e2ccf8644adfe120256db/transformed/classes/classes.dex b/node_modules/react-native-image-picker/android/build/.transforms/c1f7f4bc703e2ccf8644adfe120256db/transformed/classes/classes.dex
new file mode 100644
-index 0000000..cc0e1a0
+index 0000000..e3ea7dd
Binary files /dev/null and b/node_modules/react-native-image-picker/android/build/.transforms/c1f7f4bc703e2ccf8644adfe120256db/transformed/classes/classes.dex differ
diff --git a/node_modules/react-native-image-picker/android/build/generated/source/buildConfig/debug/com/imagepicker/BuildConfig.java b/node_modules/react-native-image-picker/android/build/generated/source/buildConfig/debug/com/imagepicker/BuildConfig.java
new file mode 100644
@@ -94,7 +94,7 @@ index 0000000..9e26dfe
\ No newline at end of file
diff --git a/node_modules/react-native-image-picker/android/build/intermediates/compile_library_classes_jar/debug/classes.jar b/node_modules/react-native-image-picker/android/build/intermediates/compile_library_classes_jar/debug/classes.jar
new file mode 100644
-index 0000000..4ce3514
+index 0000000..f30f7c9
Binary files /dev/null and b/node_modules/react-native-image-picker/android/build/intermediates/compile_library_classes_jar/debug/classes.jar differ
diff --git a/node_modules/react-native-image-picker/android/build/intermediates/compile_r_class_jar/debug/R.jar b/node_modules/react-native-image-picker/android/build/intermediates/compile_r_class_jar/debug/R.jar
new file mode 100644
@@ -1998,11 +1998,11 @@ index 0000000..0ca7f29
\ No newline at end of file
diff --git a/node_modules/react-native-image-picker/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties b/node_modules/react-native-image-picker/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties
new file mode 100644
-index 0000000..799de95
+index 0000000..80a6e80
--- /dev/null
+++ b/node_modules/react-native-image-picker/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties
@@ -0,0 +1,2 @@
-+#Fri Oct 29 09:22:09 PKT 2021
++#Sat Nov 13 09:09:40 PKT 2021
+/Users/ammarahmed/Repos/Notesnook/node_modules/react-native-image-picker/android/src/main/res/xml/imagepicker_provider_paths.xml=/Users/ammarahmed/Repos/Notesnook/node_modules/react-native-image-picker/android/build/intermediates/packaged_res/debug/xml/imagepicker_provider_paths.xml
diff --git a/node_modules/react-native-image-picker/android/build/intermediates/incremental/packageDebugResources/merger.xml b/node_modules/react-native-image-picker/android/build/intermediates/incremental/packageDebugResources/merger.xml
new file mode 100644
@@ -2035,7 +2035,7 @@ index 0000000..37f9bd4
Binary files /dev/null and b/node_modules/react-native-image-picker/android/build/intermediates/javac/debug/classes/com/imagepicker/Options.class differ
diff --git a/node_modules/react-native-image-picker/android/build/intermediates/javac/debug/classes/com/imagepicker/Utils.class b/node_modules/react-native-image-picker/android/build/intermediates/javac/debug/classes/com/imagepicker/Utils.class
new file mode 100644
-index 0000000..c0947ff
+index 0000000..42e5b3c
Binary files /dev/null and b/node_modules/react-native-image-picker/android/build/intermediates/javac/debug/classes/com/imagepicker/Utils.class differ
diff --git a/node_modules/react-native-image-picker/android/build/intermediates/local_only_symbol_list/debug/R-def.txt b/node_modules/react-native-image-picker/android/build/intermediates/local_only_symbol_list/debug/R-def.txt
new file mode 100644
@@ -2156,7 +2156,7 @@ index 0000000..ce57598
\ No newline at end of file
diff --git a/node_modules/react-native-image-picker/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar b/node_modules/react-native-image-picker/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar
new file mode 100644
-index 0000000..fc3d37a
+index 0000000..6ae44c8
Binary files /dev/null and b/node_modules/react-native-image-picker/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar differ
diff --git a/node_modules/react-native-image-picker/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt b/node_modules/react-native-image-picker/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt
new file mode 100644
@@ -3594,7 +3594,7 @@ index 0000000..25f117c
+ INJECTED from /Users/ammarahmed/Repos/Notesnook/node_modules/react-native-image-picker/android/src/main/AndroidManifest.xml
diff --git a/node_modules/react-native-image-picker/android/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt b/node_modules/react-native-image-picker/android/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt
new file mode 100644
-index 0000000..b29f29e
+index 0000000..b764f6e
--- /dev/null
+++ b/node_modules/react-native-image-picker/android/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt
@@ -0,0 +1,12 @@
@@ -3602,16 +3602,95 @@ index 0000000..b29f29e
+ com.imagepicker.ImagePickerPackage
+com/imagepicker/BuildConfig.java
+ com.imagepicker.BuildConfig
-+com/imagepicker/ImagePickerModule.java
-+ com.imagepicker.ImagePickerModule
-+com/imagepicker/Options.java
-+ com.imagepicker.Options
+com/imagepicker/ImagePickerProvider.java
+ com.imagepicker.ImagePickerProvider
++com/imagepicker/Options.java
++ com.imagepicker.Options
++com/imagepicker/ImagePickerModule.java
++ com.imagepicker.ImagePickerModule
+com/imagepicker/Utils.java
+ com.imagepicker.Utils
+diff --git a/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/Utils.java b/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/Utils.java
+index 8e59033..2a2bf3b 100644
+--- a/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/Utils.java
++++ b/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/Utils.java
+@@ -21,6 +21,7 @@ import android.provider.OpenableColumns;
+ import android.util.Base64;
+ import android.webkit.MimeTypeMap;
+
++import androidx.annotation.NonNull;
+ import androidx.core.app.ActivityCompat;
+ import androidx.core.content.FileProvider;
+ import androidx.exifinterface.media.ExifInterface;
+@@ -36,6 +37,7 @@ import java.io.FileNotFoundException;
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.OutputStream;
++import java.net.URI;
+ import java.util.ArrayList;
+ import java.util.Arrays;
+ import java.util.Collections;
+@@ -383,7 +385,7 @@ public class Utils {
+ return fileUris;
+ }
+
+- static ReadableMap getImageResponseMap(Uri uri, Options options, Context context) {
++ static WritableMap getImageResponseMap(Uri uri, Options options, Context context) {
+ String fileName = uri.getLastPathSegment();
+ int[] dimensions = getImageDimensions(uri, context);
+
+@@ -418,13 +420,16 @@ public class Utils {
+
+ for(int i = 0; i < fileUris.size(); ++i) {
+ Uri uri = fileUris.get(i);
++ String fileName = getNameFromURI(context,uri);
+
+ if (isImageType(uri, context)) {
+ if (uri.getScheme().contains("content")) {
+ uri = getAppSpecificStorageUri(uri, context);
+ }
+ uri = resizeImage(uri, context, options);
+- assets.pushMap(getImageResponseMap(uri, options, context));
++ WritableMap resMap = getImageResponseMap(uri, options, context);
++ resMap.putString("originalFileName",fileName);
++ assets.pushMap(resMap);
+ } else if (isVideoType(uri, context)) {
+ assets.pushMap(getVideoResponseMap(uri, context));
+ } else {
+@@ -438,6 +443,31 @@ public class Utils {
+ return response;
+ }
+
++ /**
++ * Return file name from Uri given.
++ * @param context the context, cannot be null.
++ * @param uri uri request for file name, cannot be null
++ * @return the corresponding display name for file defined in uri or null if error occurs.
++ */
++ static String getNameFromURI(@NonNull Context context, @NonNull Uri uri) {
++ String result = null;
++ Cursor c = null;
++ try {
++ c = context.getContentResolver().query(uri, null, null, null, null);
++ c.moveToFirst();
++ result = c.getString(c.getColumnIndex(OpenableColumns.DISPLAY_NAME));
++ }
++ catch (Exception e){
++ // error occurs
++ }
++ finally {
++ if(c != null){
++ c.close();
++ }
++ }
++ return result;
++ }
++
+ static ReadableMap getErrorMap(String errCode, String errMsg) {
+ WritableMap map = Arguments.createMap();
+ map.putString("errorCode", errCode);
diff --git a/node_modules/react-native-image-picker/ios/ImagePickerManager.m b/node_modules/react-native-image-picker/ios/ImagePickerManager.m
-index b634ffb..109ae0a 100644
+index b634ffb..18b8950 100644
--- a/node_modules/react-native-image-picker/ios/ImagePickerManager.m
+++ b/node_modules/react-native-image-picker/ios/ImagePickerManager.m
@@ -96,6 +96,39 @@ - (void) showPickerViewController:(UIViewController *)picker
@@ -3656,12 +3735,12 @@ index b634ffb..109ae0a 100644
-(NSMutableDictionary *)mapImageToAsset:(UIImage *)image data:(NSData *)data {
@@ -121,22 +154,14 @@ -(NSMutableDictionary *)mapImageToAsset:(UIImage *)image data:(NSData *)data {
asset[@"type"] = [@"image/" stringByAppendingString:fileType];
-
+
NSString *fileName = [self getImageFileName:fileType];
- NSString *path = [[NSTemporaryDirectory() stringByStandardizingPath] stringByAppendingPathComponent:fileName];
- [data writeToFile:path atomically:YES];
+ NSString *path = [self saveToCacheDirectory:data withName:fileName];
-
+
if ([self.options[@"includeBase64"] boolValue]) {
asset[@"base64"] = [data base64EncodedStringWithOptions:0];
}