-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* native/feat: barcode reader initial component, install and app config, new assets * native/barcode-scanner: feat: ui improvement, double tap handling, permission message reword * native/barcode-scanner: feat: code scanner tracers * native/barcode-scanner: feat: barcode scanner button and icon and modal * barcode-scanner/feat: migration, generated types * barcode-scanner/admin/feat: add barcodes from the panel, genericUpdate erro handling fix * barcode-scanner/supabase/feat: new trigger, check barcode uniqueness on insert * barcode-scanner/native/feat: useListBarcodes, barcode_modal params * barcode-scanner/native/refactor: remove console logs * barcode-scanner/native/fix: gen-types * barcode-scanner/native/fix: gen-types * barcode-scanner/native/fix: global caching/stale times * barcode-scanner/supabase/fix: migration * barcode-scanner/native/feat: working barcode scanner, error handling * barcode-scanner/native/fix: navigate back when barcode is not recognized, improve tracers * barcode-scanner/native/feat: better error display * barcode-scanner/native/fix: typography align --------- Co-authored-by: Michal Struck <[email protected]>
- Loading branch information
1 parent
e439504
commit 8033781
Showing
24 changed files
with
875 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
import { goto } from "$app/navigation"; | ||
import type { PostgrestBuilder } from "@supabase/postgrest-js"; | ||
import type { PostgrestError, PostgrestBuilder } from "@supabase/postgrest-js"; | ||
|
||
export const genericUpdate = async <T>( | ||
builder: PostgrestBuilder<T>, | ||
onSuccess: string, | ||
onSuccess?: string, | ||
setLoading?: (x: boolean) => void | ||
) => { | ||
try { | ||
// loading = true; | ||
setLoading && setLoading(true); | ||
let { error } = await builder; | ||
if (error) throw error; | ||
goto(onSuccess); | ||
if (onSuccess) goto(onSuccess); | ||
} catch (error) { | ||
if (error instanceof Error) alert(error.message); | ||
if (error) alert((error as PostgrestError).message); | ||
} finally { | ||
setLoading && setLoading(false); | ||
// loading = false; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Camera } from "expo-camera"; | ||
import React from "react"; | ||
import { ActivityIndicator, StyleSheet, View } from "react-native"; | ||
|
||
import { SafeAreaView } from "react-native-safe-area-context"; | ||
import { BarcodeScanner } from "../components/BarcodeScanner"; | ||
import { Button } from "../components/Button"; | ||
|
||
import { Typography } from "../components/Typography"; | ||
|
||
import { useLocalSearchParams } from "expo-router"; | ||
import { createStyles } from "../theme/useStyles"; | ||
|
||
export default function BarcodeModal() { | ||
const styles = useStyles(); | ||
|
||
const { inventoryId } = useLocalSearchParams<{ inventoryId: string }>(); | ||
|
||
const [permission, requestPermission] = Camera.useCameraPermissions(); | ||
|
||
if (!permission) { | ||
return ( | ||
<View style={styles.container}> | ||
<ActivityIndicator size="large" color="#000" /> | ||
</View> | ||
); | ||
} | ||
|
||
if (!permission?.granted) { | ||
// Camera permissions are not granted yet | ||
return ( | ||
<SafeAreaView | ||
edges={["left", "right", "bottom"]} | ||
style={styles.container} | ||
> | ||
<Typography | ||
variant="l" | ||
color="darkBlue" | ||
style={{ textAlign: "center" }} | ||
> | ||
Aby skorzystać ze skanera kodów, pozwól aplikacji na dostęp do kamery. | ||
</Typography> | ||
<Button | ||
onPress={requestPermission} | ||
size="l" | ||
type="primary" | ||
shadow | ||
containerStyle={{ marginTop: 16, width: 200, alignSelf: "center" }} | ||
> | ||
Zapytaj o dostęp | ||
</Button> | ||
</SafeAreaView> | ||
); | ||
} | ||
|
||
return ( | ||
<SafeAreaView edges={["left", "right", "bottom"]} style={styles.container}> | ||
<BarcodeScanner inventoryId={+inventoryId} /> | ||
</SafeAreaView> | ||
); | ||
} | ||
|
||
const useStyles = createStyles((theme) => | ||
StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: "center", | ||
backgroundColor: theme.colors.lightBlue, | ||
height: "100%", | ||
}, | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,6 @@ | ||
import React from "react"; | ||
import { View } from "react-native"; | ||
|
||
import { Typography } from "../components/Typography"; | ||
|
||
// TODO Landing page | ||
export default function Landing() { | ||
return ( | ||
<View> | ||
<Typography>test5</Typography> | ||
</View> | ||
); | ||
return <View />; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.