Skip to content

Commit 8e57f77

Browse files
committed
update NEW UI revert here if needed, pre 2.4 working fixes
1 parent 3e99cee commit 8e57f77

6 files changed

Lines changed: 284 additions & 96 deletions

File tree

.mobile_server_pid

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
23223

apps/mobile/web/favicon.ico

Whitespace-only changes.

apps/mobile/web/index.html

Lines changed: 50 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
console.log('Mobile: PDF.js loaded successfully', pdfjs.version);
3939
console.log('Mobile: pdf-lib loaded successfully', typeof PDFLib !== 'undefined');
4040
</script>
41-
<script type="module" src="/main.js"></script>
41+
<!-- Load mobile-fixed.js BEFORE main.js to ensure FixedMobileApp is available -->
4242
<script src="/mobile-fixed.js"></script>
43+
<script type="module" src="/main.js"></script>
4344

4445
<style>
4546
/* Modern Mobile Design System for CleanShare Pro */
@@ -679,10 +680,17 @@ <h2>CleanShare Pro</h2>
679680
}
680681

681682
// Try fixed mobile app with proper React component handling
683+
console.log('Mobile: Checking React availability...');
684+
console.log('- React available:', typeof React !== 'undefined');
685+
console.log('- ReactDOM available:', typeof ReactDOM !== 'undefined');
686+
console.log('- FixedMobileApp available:', !!window.FixedMobileApp);
687+
console.log('- FixedMobileApp contents:', window.FixedMobileApp);
688+
682689
if (typeof React !== 'undefined' && typeof ReactDOM !== 'undefined' && window.FixedMobileApp) {
683-
console.log('Mobile: Attempting fixed mobile app...');
690+
console.log('Mobile: All prerequisites met, attempting fixed mobile app...');
684691
try {
685692
const success = window.FixedMobileApp.initFixedMobileApp();
693+
console.log('Mobile: initFixedMobileApp returned:', success);
686694
if (success) {
687695
console.log('Mobile: Fixed mobile app successful!');
688696
return; // Success, exit early
@@ -691,82 +699,29 @@ <h2>CleanShare Pro</h2>
691699
}
692700
} catch (error) {
693701
console.warn('Mobile: Fixed mobile app threw error:', error);
702+
console.error('Mobile: Error details:', error.message, error.stack);
694703
}
704+
} else {
705+
console.log('Mobile: Prerequisites not met, using vanilla fallback');
706+
if (typeof React === 'undefined') console.log('- Missing: React');
707+
if (typeof ReactDOM === 'undefined') console.log('- Missing: ReactDOM');
708+
if (!window.FixedMobileApp) console.log('- Missing: FixedMobileApp');
695709
}
696710

697-
// Define fallback function
711+
// Define fallback function - DISABLED TO PREVENT VANILLA UI OVERRIDE
698712
function initializeFallback() {
699-
console.log('Mobile: Using vanilla implementation');
700-
try {
701-
appDiv.innerHTML = `
702-
<div class="mobile-header">
703-
<h1>CleanShare Pro</h1>
704-
<p>Privacy-focused document sanitization</p>
705-
</div>
706-
707-
<div class="mobile-content">
708-
<div class="mobile-card">
709-
<div class="mobile-card-header">
710-
<h2 class="mobile-card-title">Upload Files</h2>
711-
<p class="mobile-card-subtitle">Select images or PDF documents to sanitize</p>
712-
</div>
713-
<div class="mobile-card-body">
714-
<div class="file-drop-zone" onclick="selectFile()">
715-
<div class="file-drop-icon">📄</div>
716-
<div class="file-drop-text">Select Files</div>
717-
<div class="file-drop-subtext">Tap to select images or PDFs up to 10MB each</div>
718-
</div>
719-
720-
<input type="file" id="fileInput" class="file-input" accept="image/*,.pdf" multiple onchange="handleFiles(this.files)">
721-
722-
<button class="btn btn-outline btn-sm" onclick="testCapacitor()">🧪 Test Native Features</button>
723-
</div>
724-
</div>
725-
726-
<div class="mobile-card">
727-
<div class="mobile-card-header">
728-
<h2 class="mobile-card-title">Processing Status</h2>
729-
<p class="mobile-card-subtitle">File analysis and sanitization progress</p>
730-
</div>
731-
<div class="mobile-card-body">
732-
<div id="status" class="status-display">
733-
Ready to process files
734-
</div>
735-
</div>
736-
</div>
737-
738-
<div class="platform-info">
739-
<strong>Platform:</strong> ${window.Capacitor ? window.Capacitor.getPlatform() : 'web'}<br>
740-
<strong>CleanShare API:</strong> ${window.CleanSharePro ? '✓ Available' : '✗ Not loaded'}
741-
</div>
742-
</div>
743-
`;
713+
console.log('Mobile: Vanilla fallback DISABLED - React UI should be showing');
714+
// COMMENTED OUT TO PREVENT VANILLA UI FROM OVERWRITING REACT UI
715+
// The entire vanilla UI creation is disabled so React can stay loaded
716+
return;
744717

745-
console.log('✓ App interface initialized successfully');
746-
} catch (error) {
747-
console.error('Failed to initialize app interface:', error);
748-
appDiv.innerHTML = `
749-
<div class="mobile-header">
750-
<h1>CleanShare Pro</h1>
751-
<p>Initialization Error</p>
752-
</div>
753-
<div class="mobile-content">
754-
<div class="alert alert-error">
755-
<div>
756-
<strong>Initialization Failed</strong>
757-
<p style="margin: 0; margin-top: var(--space-xs);">
758-
${error.message}
759-
</p>
760-
</div>
761-
</div>
762-
<button class="btn btn-primary" onclick="location.reload()">🔄 Retry</button>
763-
</div>
764-
`;
765-
}
718+
// VANILLA UI COMPLETELY REMOVED TO PREVENT ANY FALLBACK
719+
console.log('Vanilla UI code completely removed - React is the only UI path');
766720
}
767721

768-
// Call fallback if React was not used
769-
initializeFallback();
722+
// Only call fallback if React was not used - this should never be reached if React initialized successfully
723+
console.log('Mobile: This should not execute if React initialization succeeded');
724+
// initializeFallback(); // Removed - fallback should only run when React fails
770725
}
771726

772727
function selectFile() {
@@ -907,6 +862,30 @@ <h3 style="margin: 0 0 var(--space-sm) 0; color: var(--color-primary);">🎉 Pro
907862
const processedFiles = new Map();
908863

909864
// Download function for sanitized files
865+
// Open the mobile preset manager
866+
function openPresetManager() {
867+
console.log('🚀 Opening Mobile Preset Manager...');
868+
869+
// Ensure the preset manager is available
870+
if (window.MobilePresetManager && window.MobilePresetManager.show) {
871+
window.MobilePresetManager.show();
872+
console.log('✅ Mobile Preset Manager opened');
873+
} else {
874+
console.warn('Mobile Preset Manager not available yet');
875+
876+
// Wait for initialization and try again
877+
setTimeout(() => {
878+
if (window.MobilePresetManager && window.MobilePresetManager.show) {
879+
window.MobilePresetManager.show();
880+
console.log('✅ Mobile Preset Manager opened (delayed)');
881+
} else {
882+
console.error('❌ Mobile Preset Manager failed to initialize');
883+
alert('Preset Manager is not available. Please refresh the page.');
884+
}
885+
}, 1000);
886+
}
887+
}
888+
910889
function downloadFile(sanitizedFilename, originalFilename) {
911890
try {
912891
// Check if we have the processed file data

apps/mobile/web/main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,13 @@ window.CleanSharePro = {
583583
initializeModules().then(() => {
584584
console.log('CleanShare Pro mobile app modules initialized (100% WebView architecture)');
585585

586+
// Initialize mobile preset manager (no React needed)
587+
if (window.initMobilePresetManager) {
588+
setTimeout(() => {
589+
window.initMobilePresetManager();
590+
}, 500);
591+
}
592+
586593
// Dispatch ready event
587594
window.dispatchEvent(new CustomEvent('cleanshare-ready', {
588595
detail: { modules: { coreDetect, wasmWorkers } }
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,8 +1580,9 @@ window.MobileCleanSharePro = {
15801580
MobileCleanSharePro
15811581
};
15821582

1583-
// Auto-initialize when script loads
1584-
document.addEventListener('DOMContentLoaded', () => {
1585-
// Wait a bit for React to be loaded
1586-
setTimeout(initializeMobileApp, 1000);
1587-
});
1583+
// Auto-initialize when script loads - DISABLED TO PREVENT OLD UI OVERRIDE
1584+
// document.addEventListener('DOMContentLoaded', () => {
1585+
// // Wait a bit for React to be loaded
1586+
// setTimeout(initializeMobileApp, 1000);
1587+
// });
1588+
console.log('OLD mobile-app.js auto-initialization DISABLED');

0 commit comments

Comments
 (0)