Skip to content

Commit

Permalink
Fix issue and increase some dependiences
Browse files Browse the repository at this point in the history
  • Loading branch information
quanvo298Wizeline committed Sep 23, 2024
1 parent 4765d04 commit ce6b949
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 19 deletions.
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
13 changes: 5 additions & 8 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 Expand Up @@ -161,7 +158,7 @@ const BottomModal: React.FC<BottomModalProps> = ({
>
<FontAwesome6 size={24} name="share" />
<ThemedText style={{ paddingLeft: 24, fontSize: 16 }}>
Share via QR Code
Show QR Code
</ThemedText>
</TouchableOpacity>
<TouchableOpacity
Expand All @@ -170,7 +167,7 @@ const BottomModal: React.FC<BottomModalProps> = ({
>
<FontAwesome6 size={24} name="download" />
<ThemedText style={{ paddingLeft: 16, fontSize: 16 }}>
Download a copy
Share
</ThemedText>
{Boolean(fileDownload) && (
<ActivityIndicator
Expand Down
22 changes: 13 additions & 9 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 ce6b949

Please sign in to comment.