Skip to content

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

mobile: patch react-native-image-picker

ammarahm-edf2672d83357a
diff --git a/apps/mobile/app/features.ts b/apps/mobile/app/features.ts
index 51700de34..958da66f8 100644
--- a/apps/mobile/app/features.ts
+++ b/apps/mobile/app/features.ts
@@ -19,9 +19,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { FeatureType } from "./components/sheets/new-feature";
-export const features: FeatureType[] = [
- {
- title: "Max 3 pins limit removed",
- body: "Now you can pin unlimited notes/notebooks to top of the list."
- },
-];
+export const features: FeatureType[] = [];
diff --git a/apps/mobile/app/package.json b/apps/mobile/app/package.json
index 39e0eb890..5142ef92b 100644
--- a/apps/mobile/app/package.json
+++ b/apps/mobile/app/package.json
@@ -21,7 +21,7 @@
"react-native-qrcode-svg": "^6.0.6",
"react-native-reanimated-material-menu": "github:ammarahm-ed/react-native-reanimated-material-menu",
"react-native-reanimated-progress-bar": "1.0.1",
- "showdown": "github:thecodrr/showdown",
+ "@streetwriters/showdown": "3.0.1-alpha",
"toggle-switch-react-native": "3.2.0",
"url": "^0.11.0",
"validator": "^13.5.2",
diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.json
index 3d8ab9bdc..4cbd3508e 100644
--- a/apps/mobile/package-lock.json
+++ b/apps/mobile/package-lock.json
@@ -29,6 +29,7 @@
"dependencies": {
"@flyerhq/react-native-link-preview": "^1.6.0",
"@mdi/js": "^6.7.96",
+ "@streetwriters/showdown": "3.0.1-alpha",
"absolutify": "^0.1.0",
"buffer": "^6.0.3",
"dayjs": "^1.10.4",
@@ -45,7 +46,6 @@
"react-native-qrcode-svg": "^6.0.6",
"react-native-reanimated-material-menu": "github:ammarahm-ed/react-native-reanimated-material-menu",
"react-native-reanimated-progress-bar": "1.0.1",
- "showdown": "github:thecodrr/showdown",
"toggle-switch-react-native": "3.2.0",
"url": "^0.11.0",
"validator": "^13.5.2",
@@ -5617,6 +5617,15 @@
"@sinonjs/commons": "^1.7.0"
}
},
+ "node_modules/@streetwriters/showdown": {
+ "version": "3.0.1-alpha",
+ "resolved": "https://npm.pkg.github.com/download/@streetwriters/showdown/3.0.1-alpha/ad77ee5cff062beab270695276ae96836c2c5a6c",
+ "integrity": "sha512-Mnz7HdEppWmkFzIOSL3u//o35c8RzYenXmRQwcK6uxz3X27UprS0pXYCHDy5uHDsVAmE7W+Ov72tYFURDyPSfQ==",
+ "license": "MIT",
+ "bin": {
+ "showdown": "bin/showdown.js"
+ }
+ },
"node_modules/@types/babel__core": {
"version": "7.1.19",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz",
@@ -19398,19 +19407,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/showdown": {
- "name": "@streetwriters/showdown",
- "version": "3.0.0-alpha",
- "resolved": "git+ssh://[email protected]/thecodrr/showdown.git#296d5af5cd2e06bc86f2377653ddaa2f4a1a36a5",
- "license": "MIT",
- "bin": {
- "showdown": "bin/showdown.js"
- },
- "funding": {
- "type": "individual",
- "url": "https://www.paypal.me/tiviesantos"
- }
- },
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
@@ -24219,6 +24215,7 @@
"requires": {
"@flyerhq/react-native-link-preview": "^1.6.0",
"@mdi/js": "^6.7.96",
+ "@streetwriters/showdown": "3.0.1-alpha",
"absolutify": "^0.1.0",
"buffer": "^6.0.3",
"dayjs": "^1.10.4",
@@ -24235,7 +24232,6 @@
"react-native-qrcode-svg": "^6.0.6",
"react-native-reanimated-material-menu": "github:ammarahm-ed/react-native-reanimated-material-menu",
"react-native-reanimated-progress-bar": "1.0.1",
- "showdown": "github:thecodrr/showdown",
"toggle-switch-react-native": "3.2.0",
"url": "^0.11.0",
"validator": "^13.5.2",
@@ -25495,6 +25491,11 @@
"@sinonjs/commons": "^1.7.0"
}
},
+ "@streetwriters/showdown": {
+ "version": "3.0.1-alpha",
+ "resolved": "https://npm.pkg.github.com/download/@streetwriters/showdown/3.0.1-alpha/ad77ee5cff062beab270695276ae96836c2c5a6c",
+ "integrity": "sha512-Mnz7HdEppWmkFzIOSL3u//o35c8RzYenXmRQwcK6uxz3X27UprS0pXYCHDy5uHDsVAmE7W+Ov72tYFURDyPSfQ=="
+ },
"@types/babel__core": {
"version": "7.1.19",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz",
@@ -35824,10 +35825,6 @@
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.4.tgz",
"integrity": "sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw=="
},
- "showdown": {
- "version": "git+ssh://[email protected]/thecodrr/showdown.git#296d5af5cd2e06bc86f2377653ddaa2f4a1a36a5",
- "from": "showdown@github:thecodrr/showdown"
- },
"side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
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 c8367ab8e..a16bcee38 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
@@ -1,8 +1,16 @@
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
+index 8e59033..c87febe 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;
+@@ -1,6 +1,7 @@
+ package com.imagepicker;
+
+ import android.Manifest;
++import android.annotation.SuppressLint;
+ import android.app.Activity;
+ import android.content.ClipData;
+ import android.content.ContentResolver;
+@@ -21,6 +22,7 @@ import android.provider.OpenableColumns;
import android.util.Base64;
import android.webkit.MimeTypeMap;
@@ -10,7 +18,7 @@ index 8e59033..2a2bf3b 100644
import androidx.core.app.ActivityCompat;
import androidx.core.content.FileProvider;
import androidx.exifinterface.media.ExifInterface;
-@@ -36,6 +37,7 @@ import java.io.FileNotFoundException;
+@@ -36,6 +38,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -18,7 +26,18 @@ index 8e59033..2a2bf3b 100644
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-@@ -383,7 +385,7 @@ public class Utils {
+@@ -266,7 +269,9 @@ public class Utils {
+ MediaMetadataRetriever m = new MediaMetadataRetriever();
+ m.setDataSource(context, uri);
+ int duration = Math.round(Float.parseFloat(m.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION))) / 1000;
+- m.release();
++ try {
++ m.release();
++ } catch(Exception e) {}
+ return duration;
+ }
+
+@@ -383,7 +388,7 @@ public class Utils {
return fileUris;
}
@@ -27,7 +46,7 @@ index 8e59033..2a2bf3b 100644
String fileName = uri.getLastPathSegment();
int[] dimensions = getImageDimensions(uri, context);
-@@ -418,13 +420,16 @@ public class Utils {
+@@ -418,13 +423,16 @@ public class Utils {
for(int i = 0; i < fileUris.size(); ++i) {
Uri uri = fileUris.get(i);
@@ -45,7 +64,7 @@ index 8e59033..2a2bf3b 100644
} else if (isVideoType(uri, context)) {
assets.pushMap(getVideoResponseMap(uri, context));
} else {
-@@ -438,6 +443,31 @@ public class Utils {
+@@ -438,6 +446,32 @@ public class Utils {
return response;
}
@@ -55,6 +74,7 @@ index 8e59033..2a2bf3b 100644
+ * @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.
+ */
++ @SuppressLint("Range")
+ static String getNameFromURI(@NonNull Context context, @NonNull Uri uri) {
+ String result = null;
+ Cursor c = null;
@@ -81,7 +101,7 @@ diff --git a/node_modules/react-native-image-picker/ios/ImagePickerManager.m b/n
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 @@ RCT_EXPORT_METHOD(launchImageLibrary:(NSDictionary *)options callback:(RCTRespon
+@@ -96,6 +96,39 @@ - (void) showPickerViewController:(UIViewController *)picker
});
}
@@ -121,7 +141,7 @@ index b634ffb..18b8950 100644
#pragma mark - Helpers
-(NSMutableDictionary *)mapImageToAsset:(UIImage *)image data:(NSData *)data {
-@@ -121,22 +154,14 @@ RCT_EXPORT_METHOD(launchImageLibrary:(NSDictionary *)options callback:(RCTRespon
+@@ -121,22 +154,14 @@ -(NSMutableDictionary *)mapImageToAsset:(UIImage *)image data:(NSData *)data {
asset[@"type"] = [@"image/" stringByAppendingString:fileType];
NSString *fileName = [self getImageFileName:fileType];