From 6d5ac9320061d5d3460a699153215e5473901c65 Mon Sep 17 00:00:00 2001 From: vishnuraghavb Date: Sun, 18 Apr 2021 21:38:58 +0530 Subject: [PATCH] share recipe photo as provider --- app/components/ViewRecipe.vue | 2 +- app/resources/Android/src/main/AndroidManifest.xml | 11 ++++++++++- app/resources/Android/src/main/res/xml/provider.xml | 4 ++++ app/shared/utils.js | 8 +++++--- 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 app/resources/Android/src/main/res/xml/provider.xml diff --git a/app/components/ViewRecipe.vue b/app/components/ViewRecipe.vue index b8d961d7..3a962590 100644 --- a/app/components/ViewRecipe.vue +++ b/app/components/ViewRecipe.vue @@ -791,7 +791,7 @@ export default { ) .then(() => pv.animate({ - height: sh, + height: sh + 8, translate: { x: -sw + 112, y: -((sh - sw) / 6) }, duration: 250, curve: CoreTypes.AnimationCurve.ease, diff --git a/app/resources/Android/src/main/AndroidManifest.xml b/app/resources/Android/src/main/AndroidManifest.xml index e8d2b19f..ac8a9170 100644 --- a/app/resources/Android/src/main/AndroidManifest.xml +++ b/app/resources/Android/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ + android:name="com.tns.NativeScriptApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:hardwareAccelerated="true" android:largeHeap="true" android:theme="@style/AppTheme"> @@ -19,5 +19,14 @@ + + + diff --git a/app/resources/Android/src/main/res/xml/provider.xml b/app/resources/Android/src/main/res/xml/provider.xml new file mode 100644 index 00000000..d82b1349 --- /dev/null +++ b/app/resources/Android/src/main/res/xml/provider.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/shared/utils.js b/app/shared/utils.js index 85f2b2b8..86f840e7 100644 --- a/app/shared/utils.js +++ b/app/shared/utils.js @@ -264,9 +264,11 @@ export const shareImage = (image, subject) => { fos.write(baos.toByteArray()) fos.flush() fos.close() - intent.putExtra( - android.content.Intent.EXTRA_STREAM, - android.net.Uri.fromFile(tmpFile) + let shareUri = global.androidx.core.content.FileProvider.getUriForFile( + ctx, + Application.android.nativeApp.getPackageName() + '.provider', + tmpFile ) + intent.putExtra(android.content.Intent.EXTRA_STREAM, shareUri) share(intent, subject) }