From 54ec1eafee2c423855d8fd7c00ffd008288479db Mon Sep 17 00:00:00 2001 From: natjms Date: Thu, 1 Jul 2021 17:44:48 -0300 Subject: [PATCH] Fix issue with multipart data in Publish This commit enables publishing statuses :tada: --- package-lock.json | 23 +++++++++++++++-------- package.json | 1 + src/components/pages/publish.js | 5 +++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c48d2f..5fab39a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "expo-linking": "~2.2.3", "expo-status-bar": "~1.0.4", "expo-web-browser": "~9.1.0", + "mime": "^2.5.2", "react": "16.13.1", "react-dom": "16.13.1", "react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz", @@ -14328,7 +14329,8 @@ "@react-native-community/masked-view": { "version": "0.1.10", "resolved": "https://registry.npmjs.org/@react-native-community/masked-view/-/masked-view-0.1.10.tgz", - "integrity": "sha512-rk4sWFsmtOw8oyx8SD3KSvawwaK7gRBSEIy2TAwURyGt+3TizssXP1r8nx3zY+R7v2vYYHXZ+k2/GULAT/bcaQ==" + "integrity": "sha512-rk4sWFsmtOw8oyx8SD3KSvawwaK7gRBSEIy2TAwURyGt+3TizssXP1r8nx3zY+R7v2vYYHXZ+k2/GULAT/bcaQ==", + "requires": {} }, "@react-navigation/core": { "version": "5.2.3", @@ -18023,7 +18025,6 @@ "resolved": "https://registry.npmjs.org/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.59.0.tgz", "integrity": "sha512-1O3wrnMq4NcPQ1asEcl9lRDn/t+F1Oef6S9WaYVIKEhg9m/EQRGVrrTVP+R6B5Eeaj3+zNKbzM8Dx/NWy1hUbQ==", "requires": { - "@babel/core": "^7.0.0", "babel-preset-fbjs": "^3.3.0", "metro-babel-transformer": "0.59.0", "metro-react-native-babel-preset": "0.59.0", @@ -18917,7 +18918,8 @@ "ws": { "version": "7.5.1", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.1.tgz", - "integrity": "sha512-2c6faOUH/nhoQN6abwMloF7Iyl0ZS2E9HGtsiLrWn0zOOMWlhtDmdf/uihDt6jnuCxgtwGBNy6Onsoy2s2O2Ow==" + "integrity": "sha512-2c6faOUH/nhoQN6abwMloF7Iyl0ZS2E9HGtsiLrWn0zOOMWlhtDmdf/uihDt6jnuCxgtwGBNy6Onsoy2s2O2Ow==", + "requires": {} } } }, @@ -19084,12 +19086,14 @@ "react-native-iphone-x-helper": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz", - "integrity": "sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==" + "integrity": "sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==", + "requires": {} }, "react-native-pager-view": { "version": "5.0.12", "resolved": "https://registry.npmjs.org/react-native-pager-view/-/react-native-pager-view-5.0.12.tgz", - "integrity": "sha512-QmHUnQeP2qcxDofEOnKRmoUue0RaT55lhNJDfcQ1/SNuxif4Q2UyvDfqeItm1+toaE5tVnXqoreZh82FqUqnvw==" + "integrity": "sha512-QmHUnQeP2qcxDofEOnKRmoUue0RaT55lhNJDfcQ1/SNuxif4Q2UyvDfqeItm1+toaE5tVnXqoreZh82FqUqnvw==", + "requires": {} }, "react-native-popup-menu": { "version": "0.15.11", @@ -19126,7 +19130,8 @@ "react-native-safe-area-context": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-3.2.0.tgz", - "integrity": "sha512-k2Nty4PwSnrg9HwrYeeE+EYqViYJoOFwEy9LxL5RIRfoqxAq/uQXNGwpUg2/u4gnKpBbEPa9eRh15KKMe/VHkA==" + "integrity": "sha512-k2Nty4PwSnrg9HwrYeeE+EYqViYJoOFwEy9LxL5RIRfoqxAq/uQXNGwpUg2/u4gnKpBbEPa9eRh15KKMe/VHkA==", + "requires": {} }, "react-native-safe-area-view": { "version": "0.14.9", @@ -19146,12 +19151,14 @@ "react-native-screens": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-3.0.0.tgz", - "integrity": "sha512-35II5oxTaVp3OP8y0eLPOPpQkxG4fRKQ+dL1YSE1we5kCZFOU0l/Rn0T79HbyUu1LPwUZr6lZupPs0ULnRyMuQ==" + "integrity": "sha512-35II5oxTaVp3OP8y0eLPOPpQkxG4fRKQ+dL1YSE1we5kCZFOU0l/Rn0T79HbyUu1LPwUZr6lZupPs0ULnRyMuQ==", + "requires": {} }, "react-native-tab-view": { "version": "2.16.0", "resolved": "https://registry.npmjs.org/react-native-tab-view/-/react-native-tab-view-2.16.0.tgz", - "integrity": "sha512-ac2DmT7+l13wzIFqtbfXn4wwfgtPoKzWjjZyrK1t+T8sdemuUvD4zIt+UImg03fu3s3VD8Wh/fBrIdcqQyZJWg==" + "integrity": "sha512-ac2DmT7+l13wzIFqtbfXn4wwfgtPoKzWjjZyrK1t+T8sdemuUvD4zIt+UImg03fu3s3VD8Wh/fBrIdcqQyZJWg==", + "requires": {} }, "react-native-web": { "version": "0.13.18", diff --git a/package.json b/package.json index 9789577..67513e3 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "expo-linking": "~2.2.3", "expo-status-bar": "~1.0.4", "expo-web-browser": "~9.1.0", + "mime": "^2.5.2", "react": "16.13.1", "react-dom": "16.13.1", "react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz", diff --git a/src/components/pages/publish.js b/src/components/pages/publish.js index 09a6f18..caae875 100644 --- a/src/components/pages/publish.js +++ b/src/components/pages/publish.js @@ -12,6 +12,7 @@ import { getAutoHeight } from "src/interface/rendering"; import { ScreenWithTrayJsx } from "src/components/navigation/navigators"; import { TouchableOpacity } from "react-native-gesture-handler"; +import mime from "mime"; import * as ImagePicker from 'expo-image-picker'; import * as Permissions from "expo-permissions"; import AsyncStorage from "@react-native-async-storage/async-storage"; @@ -64,7 +65,7 @@ const PublishJsx = ({ navigation }) => { image: { data: { uri, - type, + type: mime.getType(uri), name, }, width: newWidth, @@ -86,7 +87,7 @@ const PublishJsx = ({ navigation }) => { const params = { status: state.caption, - media_ids: [mediaAttachment.id], + "media_ids[]": mediaAttachment.id, visibility: state.visibility, };