Add digital-only mode by allowing empty printer IP
This commit is contained in:
@@ -213,12 +213,10 @@ export default function AdminScreen({ currentSettings, onSave, onClose }: AdminS
|
|||||||
|
|
||||||
const ipTrimmed = printerIp.trim();
|
const ipTrimmed = printerIp.trim();
|
||||||
const ipRegex = /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/;
|
const ipRegex = /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/;
|
||||||
if (!ipTrimmed) {
|
|
||||||
Alert.alert('Ungültige Eingabe', 'Die Drucker-IP-Adresse darf nicht leer sein.');
|
// IP may be empty to enable digital-only mode
|
||||||
return;
|
if (ipTrimmed !== '' && !ipRegex.test(ipTrimmed)) {
|
||||||
}
|
Alert.alert('Ungültige Eingabe', 'Bitte gib eine gültige IP-Adresse ein oder lass das Feld leer (für rein digitalen Modus).');
|
||||||
if (!ipRegex.test(ipTrimmed)) {
|
|
||||||
Alert.alert('Ungültige Eingabe', 'Bitte gib eine gültige IP-Adresse ein (z.B. 192.168.1.100).');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -635,6 +635,7 @@ export default function PreviewScreen({
|
|||||||
|
|
||||||
{/* Action Buttons */}
|
{/* Action Buttons */}
|
||||||
<View style={styles.actions}>
|
<View style={styles.actions}>
|
||||||
|
{!!printerIp?.trim() && (
|
||||||
<TouchableOpacity style={[styles.actionBtn, styles.printBtn, isProcessing && styles.btnDisabled, isSmallDevice && { marginBottom: THEME.spacing.sm }]} onPress={handlePrint} activeOpacity={0.8} disabled={isProcessing}>
|
<TouchableOpacity style={[styles.actionBtn, styles.printBtn, isProcessing && styles.btnDisabled, isSmallDevice && { marginBottom: THEME.spacing.sm }]} onPress={handlePrint} activeOpacity={0.8} disabled={isProcessing}>
|
||||||
<LinearGradient
|
<LinearGradient
|
||||||
colors={THEME.gradient.primary}
|
colors={THEME.gradient.primary}
|
||||||
@@ -646,6 +647,7 @@ export default function PreviewScreen({
|
|||||||
<Text style={styles.actionBtnText}>JETZT DRUCKEN</Text>
|
<Text style={styles.actionBtnText}>JETZT DRUCKEN</Text>
|
||||||
</LinearGradient>
|
</LinearGradient>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ export interface PrintOptions {
|
|||||||
export async function printImageLocal(imageUri: string, options: PrintOptions): Promise<void> {
|
export async function printImageLocal(imageUri: string, options: PrintOptions): Promise<void> {
|
||||||
const { ipAddress, jobName = 'Schnappix Photo', username = 'Schnappix Kiosk' } = options;
|
const { ipAddress, jobName = 'Schnappix Photo', username = 'Schnappix Kiosk' } = options;
|
||||||
|
|
||||||
if (!ipAddress) {
|
if (!ipAddress || ipAddress.trim() === '') {
|
||||||
throw new Error('Drucker-IP-Adresse ist erforderlich.');
|
console.log('Drucken übersprungen: Keine Drucker-IP-Adresse hinterlegt (Digitaler Modus).');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Read the image file from local storage as Base64 and convert to binary Buffer
|
// 1. Read the image file from local storage as Base64 and convert to binary Buffer
|
||||||
|
|||||||
Reference in New Issue
Block a user