Files
app/ios/DModem/Sources/DModemApp.swift
Claude a6a2f5ef50 iOS: CallKit, and the fax, file transfer and dial-up screens
- CallKit: the modem's RING rings as a phone call (answered with ATA or
  turned down on the phone's screen); a call the modem dials is an
  outgoing call, hung up from the call screen; both in Recents
- Fax tab: PDFs, images and text drawn at the fax's width (CoreGraphics,
  then the shared FaxImage), sent; a ringing call answered as a fax, by
  hand or every one; received faxes as PDFs in Documents/Faxes
- File transfers from the terminal's toolbar: ZMODEM, YMODEM, XMODEM,
  Kermit; a remote's sz or kermit -s starts receiving by itself, its rz
  asks for files; received files in Documents/Received (the Files app)
- Internet tab: dial-up to an ISP on the shared DialUpJob, the phone's
  traffic through the new DModemTunnel packet tunnel extension, its
  packets to the app's PPP over the loopback
- the log moves to a button on Home; tabs: Home, Terminal, Fax,
  Internet, Settings
- PeerLine passes LogOut objects (Kotlin lambdas aren't plain closures)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-18 04:17:48 +00:00

48 lines
1.9 KiB
Swift

// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (C) 2026 Neo-Desktop
import SwiftUI
/// D-Modem for iOS: the modem on a SIP account (or another phone), its
/// terminal and file transfers, faxes, dial-up internet.
@main
struct DModemApp: App {
@StateObject private var model = AppModel()
var body: some Scene {
WindowGroup {
TabView {
NavigationStack { HomeView(model: model) }
.tabItem { Label("Home", systemImage: "house") }
NavigationStack { TerminalTab(model: model, jobs: model.jobs) }
.tabItem { Label("Terminal", systemImage: "terminal") }
NavigationStack { FaxView(model: model, jobs: model.jobs) }
.tabItem { Label("Fax", systemImage: "printer") }
NavigationStack { InternetView(model: model, jobs: model.jobs) }
.tabItem { Label("Internet", systemImage: "globe") }
NavigationStack { SettingsView(model: model) }
.tabItem { Label("Settings", systemImage: "gear") }
}
}
}
}
/// the terminal, its file transfers a button away (and shown when the remote starts one)
private struct TerminalTab: View {
@ObservedObject var model: AppModel
@ObservedObject var jobs: JobsModel
@State private var transfers = false
var body: some View {
TerminalScreen(model: model.terminal)
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button { transfers = true } label: { Image(systemName: "arrow.up.arrow.down.circle") }
.accessibilityLabel("File transfer")
}
}
.sheet(isPresented: $transfers) { TransferView(jobs: jobs) }
.onChange(of: jobs.transfer?.running) { r in if r == true { transfers = true } }
.onChange(of: jobs.filesWanted) { w in if w { transfers = true } }
}
}