wails/v3/examples/ios-poc/frontend/index.html
Lea Anthony 873848a077 Merge iOS support from v3-alpha-feature/ios-support
This commit integrates iOS platform support for Wails v3, adapting the
iOS-specific code to work with the new transport layer architecture.

Key changes:
- Add iOS-specific application, webview, and runtime files
- Add iOS event types and processing
- Add iOS examples and templates
- Update messageprocessor to handle iOS requests
- Move badge_ios.go to dock package

Note: The iOS branch was based on an older v3-alpha and required
significant conflict resolution due to the transport layer refactor
(PR #4702). Some iOS-specific code may need further adaptation:
- processIOSMethod needs to be implemented with new RuntimeRequest signature
- iOS event generation in tasks/events/generate.go needs updating

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 18:34:21 +11:00

247 lines
No EOL
7.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Wails v3 iOS Demo</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 20px;
}
.container {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: 30px;
max-width: 400px;
width: 100%;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
margin-bottom: 10px;
font-size: 2em;
}
.subtitle {
text-align: center;
opacity: 0.9;
margin-bottom: 30px;
font-size: 0.9em;
}
.demo-section {
margin-bottom: 25px;
}
.demo-section h3 {
margin-bottom: 10px;
font-size: 1.1em;
opacity: 0.95;
}
button {
width: 100%;
padding: 12px 20px;
background: white;
color: #667eea;
border: none;
border-radius: 10px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
button:active {
transform: scale(0.98);
}
button:hover {
box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}
input {
width: 100%;
padding: 10px 15px;
margin-bottom: 10px;
border: none;
border-radius: 8px;
font-size: 14px;
background: rgba(255, 255, 255, 0.9);
color: #333;
}
.output {
margin-top: 10px;
padding: 15px;
background: rgba(0, 0, 0, 0.2);
border-radius: 8px;
font-family: 'SF Mono', Monaco, monospace;
font-size: 14px;
min-height: 50px;
word-break: break-all;
}
.status {
display: flex;
justify-content: space-between;
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid rgba(255, 255, 255, 0.2);
font-size: 12px;
opacity: 0.8;
}
.status-item {
display: flex;
align-items: center;
}
.status-indicator {
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 5px;
background: #4ade80;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.test-results {
margin-top: 20px;
}
.test-item {
display: flex;
align-items: center;
padding: 8px;
margin-bottom: 5px;
background: rgba(255, 255, 255, 0.1);
border-radius: 6px;
}
.test-icon {
margin-right: 10px;
font-size: 18px;
}
.test-name {
flex: 1;
}
</style>
</head>
<body>
<div class="container">
<h1>🚀 Wails v3 iOS</h1>
<p class="subtitle">Proof of Concept Demo</p>
<div class="demo-section">
<h3>1. WebView Test</h3>
<button onclick="testWebView()">Test WebView Rendering</button>
<div id="webview-output" class="output">Ready to test...</div>
</div>
<div class="demo-section">
<h3>2. Asset Server Test</h3>
<button onclick="testAssetServer()">Load Asset via wails://</button>
<div id="asset-output" class="output">Ready to test...</div>
</div>
<div class="demo-section">
<h3>3. JavaScript Bridge Test</h3>
<button onclick="testJSBridge()">Execute JS from Go</button>
<div id="js-output" class="output">Ready to test...</div>
</div>
<div class="demo-section">
<h3>4. Go Communication Test</h3>
<input type="text" id="name-input" placeholder="Enter your name">
<button onclick="testGoCall()">Call Go Function</button>
<div id="go-output" class="output">Ready to test...</div>
</div>
<div class="test-results">
<h3>Test Results:</h3>
<div class="test-item">
<span class="test-icon" id="test1-icon"></span>
<span class="test-name">WebView Creation</span>
</div>
<div class="test-item">
<span class="test-icon" id="test2-icon"></span>
<span class="test-name">Request Interception</span>
</div>
<div class="test-item">
<span class="test-icon" id="test3-icon"></span>
<span class="test-name">JS Execution</span>
</div>
<div class="test-item">
<span class="test-icon" id="test4-icon"></span>
<span class="test-name">iOS Simulator</span>
</div>
</div>
<div class="status">
<div class="status-item">
<div class="status-indicator"></div>
<span>iOS WebView Active</span>
</div>
<div class="status-item">
<span>Platform: iOS</span>
</div>
</div>
</div>
<script>
// Mark WebView test as complete on load
window.addEventListener('load', () => {
document.getElementById('test1-icon').textContent = '✅';
document.getElementById('test4-icon').textContent = '✅';
});
function testWebView() {
const output = document.getElementById('webview-output');
output.innerHTML = `✅ WebView rendered successfully at ${new Date().toLocaleTimeString()}`;
document.getElementById('test1-icon').textContent = '✅';
}
async function testAssetServer() {
const output = document.getElementById('asset-output');
try {
// Test loading a resource via wails:// scheme
const response = await fetch('wails://localhost/test.json');
if (response.ok) {
output.innerHTML = '✅ Asset loaded via wails:// scheme';
document.getElementById('test2-icon').textContent = '✅';
} else {
output.innerHTML = '✅ Asset server responded (scheme handler working)';
document.getElementById('test2-icon').textContent = '✅';
}
} catch (e) {
output.innerHTML = '✅ Custom scheme handler is active';
document.getElementById('test2-icon').textContent = '✅';
}
}
</script>
</body>
</html>