Files
app/ios/DModem/Sources/DModemApp.swift
T
Claude 98aa27f9ea Add voice calls and a local answering machine
Calls through D-Modem's V.253 voice mode, on the phone's earpiece or
loudspeaker and microphone: a number called, the ringing call answered,
the keypad (DTMF), mute. The answering machine, off until the user turns
it on, answers after the rings set, plays the greeting and a beep, and
keeps the caller's message as a WAV file on the phone.

The call is the shared Kotlin's VoiceJob (with G.711, tones and WAV
files, tested against a fake V.253 modem). Android has Home's Phone
section, a settings page and the incoming call popup's two new answers;
iOS a Phone tab. D-Modem bumped to main (Rockwell/USR voice, #109).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTvbHMpudRfQWK4c4H
2026-11-11 12:34:44 +00:00

51 lines
2.1 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, voice calls and the answering machine,
/// 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 { PhoneView(model: model, jobs: model.jobs) }
.tabItem { Label("Phone", systemImage: "phone") }
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 } }
}
}