mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
ios/DModem (XcodeGen's project.yml, iOS 16): Home (the modem's state, the rates and what the CONNECT was, the call's time, start, hang up, stop, an AT command line and its last words), the terminal (the shared Kotlin emulator through TerminalBridge, drawn run by run in a Canvas; CP437 and the VGA colours; the keyboard and a hardware one's arrows and Esc; Esc, a sticky Ctrl, Tab and the arrows on a bar; pinch for the font), the log (shared as text) and the settings (the SIP account or user:password@host, incoming calls, T.38, the speaker, the AT commands at start, the log levels). The modem's speaker on AVAudioEngine; the audio session (its sound, or quiet) keeps a call going in the background. The DNS servers from the resolver's state (SystemDNS.c: iOS has no resolv.conf for the engine). shared: TerminalBridge, the terminal for Swift (octets as Latin-1 strings both ways, rows as runs, keys, replies, the title, the look and the character set), tested on the JVM and natively; the framework also as an XCFramework (assembleDModemSharedXCFramework). CI: the macOS job builds the shared XCFramework, runs DModemKit's tests and builds the app for the simulator; the Linux job runs DModemKit's tests on the host engine. Not built here: no Xcode on Linux (DModemKit, TerminalBridge and SystemDNS.c are). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
63 lines
2.8 KiB
Swift
63 lines
2.8 KiB
Swift
// SPDX-License-Identifier: AGPL-3.0-only
|
|
// Copyright (C) 2026 Neo-Desktop
|
|
import DModemKit
|
|
import SwiftUI
|
|
|
|
/// The SIP account (or pasted as user:password@host), incoming calls, T.38,
|
|
/// the AT commands at start, the speaker, the log levels. Kept as they're
|
|
/// changed; they apply the next time the modem starts.
|
|
struct SettingsView: View {
|
|
@ObservedObject var model: AppModel
|
|
@State private var login = ""
|
|
|
|
var body: some View {
|
|
Form {
|
|
Section {
|
|
TextField("User", text: $model.settings.user)
|
|
.textInputAutocapitalization(.never).autocorrectionDisabled()
|
|
SecureField("Password", text: $model.settings.password)
|
|
TextField("Server (host[:port])", text: $model.settings.domain)
|
|
.textInputAutocapitalization(.never).autocorrectionDisabled().keyboardType(.URL)
|
|
TextField("Or paste user:password@host", text: $login)
|
|
.textInputAutocapitalization(.never).autocorrectionDisabled()
|
|
.onSubmit {
|
|
if let l = ModemSettings.parseLogin(login) {
|
|
model.settings.user = l.user
|
|
model.settings.password = l.password
|
|
model.settings.domain = l.domain
|
|
login = ""
|
|
}
|
|
}
|
|
} header: {
|
|
Text("SIP account")
|
|
} footer: {
|
|
Text("The provider must carry G.711 (PCMU/PCMA) to the phone network.")
|
|
}
|
|
Section("Calls") {
|
|
Toggle("Take incoming calls", isOn: $model.settings.listen)
|
|
Toggle("Fax over T.38", isOn: $model.settings.t38)
|
|
Toggle("Speaker (the dialling and the handshake)", isOn: $model.settings.speaker)
|
|
Stepper("Local SIP port: \(model.settings.sipPort)", value: $model.settings.sipPort, in: 1024...65535)
|
|
}
|
|
Section {
|
|
TextField("AT commands at start", text: $model.settings.initCommands)
|
|
.textInputAutocapitalization(.characters).autocorrectionDisabled().font(.body.monospaced())
|
|
} header: {
|
|
Text("Modem")
|
|
} footer: {
|
|
Text("ATX3 by default: a SIP line has no dial tone.")
|
|
}
|
|
Section("Log") {
|
|
Stepper("Modem's level: \(model.settings.logLevel)", value: $model.settings.logLevel, in: 0...5)
|
|
Stepper("SIP's level: \(model.settings.sipLogLevel)", value: $model.settings.sipLogLevel, in: 0...4)
|
|
}
|
|
if model.run == .running {
|
|
Section {
|
|
Text("Changes apply when the modem starts again.").foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
}
|
|
.navigationTitle("Settings")
|
|
}
|
|
}
|