Skip to content

Commit

Permalink
WALLET-573 : Fix issues when upload file (#69)
Browse files Browse the repository at this point in the history
* Fix issue and increase some dependiences

* Revert text change from WALLET-539

* Align readme with docs

* Remove vulnerability

---------

Co-authored-by: Pete Edwards <[email protected]>
  • Loading branch information
quanvo298Wizeline and edwardsph authored Sep 23, 2024
1 parent 4765d04 commit 9f7c7fb
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ In the output, you'll find options to open the app in a
### On a device with Expo Go

After expo has started, make sure it targets the Expo Go environment (as opposed to "development build").
This will display a QR code which you will need to scan from your device's Expo Go application.
This will display a QR code which you will need to scan with your device.

The Wallet application will then build and install into your device for you to test & debug.

Expand Down
13 changes: 13 additions & 0 deletions components/PopupMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import { faCamera } from "@fortawesome/free-solid-svg-icons/faCamera";
import { faQrcode } from "@fortawesome/free-solid-svg-icons/faQrcode";
import { useError } from "@/hooks/useError";
import * as Linking from "expo-linking";
import {
hasProblemDetails,
NOT_ACCEPTABLE_STATUS,
} from "@inrupt/solid-client-errors";
import { ThemedText } from "./ThemedText";

const { width } = Dimensions.get("window");
Expand Down Expand Up @@ -61,6 +65,15 @@ const PopupMenu: React.FC<PopupMenuProps> = ({
mutationFn: postFile,
onSuccess: onUploadSuccess,
onError: (error) => {
if (
error &&
hasProblemDetails(error) &&
error.problemDetails.status === NOT_ACCEPTABLE_STATUS
) {
// This is the expected behavior of the Solid server. The file has already been uploaded to Solid, even though the server returned a 406 error.
onUploadSuccess();
return;
}
console.debug("A non-HTTP error occurred.", error);
showErrorMsg("Unable to save the file into your Wallet.");
},
Expand Down
9 changes: 3 additions & 6 deletions components/files/BottomModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ const BottomModal: React.FC<BottomModalProps> = ({
const [isShowQRCode, setShowQRCode] = useState(false);
const deleteMutation = useMutation({
mutationFn: deleteFile,
onSuccess: () => queryClient.refetchQueries({ queryKey: ["files"] }),
onSuccess: () => {
onDeleteSuccessfully?.();
},
mutationKey: ["filesMutation"],
});
const queryClient = useQueryClient();
Expand Down Expand Up @@ -105,11 +107,6 @@ const BottomModal: React.FC<BottomModalProps> = ({
// eslint-disable-next-line no-console
.catch(() => console.error("Error while deleting data"));
onCloseModal();
onDeleteSuccessfully?.();
queryClient
.refetchQueries({ queryKey: ["files"] })
// eslint-disable-next-line no-console
.catch(() => console.error("Error while refetching data"));
};

const onShareViaQR = () => {
Expand Down
138 changes: 121 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@inrupt/solid-client-errors": "^0.0.2",
"@react-native-cookies/cookies": "^6.2.1",
"@react-navigation/native": "^6.1.18",
"@tanstack/react-query": "^5.51.23",
"@tanstack/react-query": "^5.56.2",
"date-fns": "^3.6.0",
"expo": "~51.0.31",
"expo-build-properties": "~0.12.5",
Expand All @@ -51,7 +51,7 @@
"react-native-gesture-handler": "~2.16.1",
"react-native-qrcode-svg": "^6.3.1",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.5",
"react-native-safe-area-context": "4.11.0",
"react-native-screens": "3.31.1",
"react-native-svg": "15.2.0",
"react-native-svg-transformer": "^1.5.0",
Expand Down

0 comments on commit 9f7c7fb

Please sign in to comment.