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 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.');
|
||||
return;
|
||||
}
|
||||
if (!ipRegex.test(ipTrimmed)) {
|
||||
Alert.alert('Ungültige Eingabe', 'Bitte gib eine gültige IP-Adresse ein (z.B. 192.168.1.100).');
|
||||
|
||||
// IP may be empty to enable digital-only mode
|
||||
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).');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -635,6 +635,7 @@ export default function PreviewScreen({
|
||||
|
||||
{/* Action Buttons */}
|
||||
<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}>
|
||||
<LinearGradient
|
||||
colors={THEME.gradient.primary}
|
||||
@@ -646,6 +647,7 @@ export default function PreviewScreen({
|
||||
<Text style={styles.actionBtnText}>JETZT DRUCKEN</Text>
|
||||
</LinearGradient>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,8 +18,9 @@ export interface PrintOptions {
|
||||
export async function printImageLocal(imageUri: string, options: PrintOptions): Promise<void> {
|
||||
const { ipAddress, jobName = 'Schnappix Photo', username = 'Schnappix Kiosk' } = options;
|
||||
|
||||
if (!ipAddress) {
|
||||
throw new Error('Drucker-IP-Adresse ist erforderlich.');
|
||||
if (!ipAddress || ipAddress.trim() === '') {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user