subrascasse

Sub Rascasse: an iPhone dive log for Subsurface cloud storage, with a pure-Swift git client (GPL-2.0)
git clone https://git.schurger.org/subrascasse.git
Log | Files | Refs | README | LICENSE

commit 363b4f08a7af3d1e0151791172d3b6ba5f32affc
parent 6d3b48b239663acba0bbadbb380ff76b7d728e02
Author: Jean Schurger <jean@schurger.org>
Date:   Sat, 14 Nov 2026 13:21:04 -0500

Show the next logbook number after a download from a dive computer

The logbook numbers dives itself and ignores the computer's own counter; the
import preview now says which number comes next so the counter can be set.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7deYG3yp7VDUZJzSBkvTc

Diffstat:
MApp/Localizable.xcstrings | 20++++++++++++++++++++
MApp/Views/DiveComputerView.swift | 6+++++-
MApp/Views/ImportView.swift | 13+++++++++++--
3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/App/Localizable.xcstrings b/App/Localizable.xcstrings @@ -1061,6 +1061,16 @@ } } }, + "Dives are numbered by the logbook, not by the computer. After this import, the next dive will be no. %lld: set the computer's counter to it if you want both to match.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Les plongées sont numérotées par le carnet, pas par l'ordinateur. Après cet import, la prochaine plongée sera la n° %lld : réglez le compteur de l'ordinateur sur ce numéro si vous voulez que les deux concordent." + } + } + } + }, "Dives per month": { "localizations": { "fr": { @@ -1761,6 +1771,16 @@ } } }, + "Next dive in the logbook: no. %lld.": { + "localizations": { + "fr": { + "stringUnit": { + "state": "translated", + "value": "Prochaine plongée du carnet : n° %lld." + } + } + } + }, "Night dive: bioluminescence at the safety stop.": { "localizations": { "fr": { diff --git a/App/Views/DiveComputerView.swift b/App/Views/DiveComputerView.swift @@ -34,7 +34,7 @@ struct DiveComputerImport: ViewModifier { }) { DiveComputerSheet(session: session) { name, dives in let session = session - downloaded = ImportBatch(name: name, candidates: model.importCandidates(for: dives)) { session.rememberDownload() } + downloaded = ImportBatch(name: name, candidates: model.importCandidates(for: dives), fromComputer: true) { session.rememberDownload() } isPresented = false } } @@ -49,6 +49,7 @@ struct DiveComputerImport: ViewModifier { struct DiveComputerSheet: View { @Environment(\.dismiss) private var dismiss + @Environment(AppModel.self) private var model let session: DiveComputerSession /// Called with the name of the computer and its dives, to move on to the import preview. let onDives: (String, [ImportedDive]) -> Void @@ -79,6 +80,8 @@ struct DiveComputerSheet: View { .onAppear { session.start() } } + private var nextNumber: Int { model.logbook.nextNumber } + private var isBusy: Bool { switch session.phase { case .connecting, .downloading: return true @@ -192,6 +195,7 @@ struct DiveComputerSheet: View { Text(session.onlyNewer ? String(localized: "Nothing new on \(computer.name) since the last download.") : String(localized: "\(computer.name) has no dives in memory.")) + Text("Next dive in the logbook: no. \(nextNumber).") } } actions: { if session.dives.isEmpty { diff --git a/App/Views/ImportView.swift b/App/Views/ImportView.swift @@ -51,10 +51,13 @@ struct ImportBatch: Identifiable { let candidates: [AppModel.ImportCandidate] /// Called once the selected dives are in the logbook. var onImported: (() -> Void)? + /// True for dives downloaded from a dive computer, whose own dive counter may need adjusting. + var fromComputer = false - init(name: String, candidates: [AppModel.ImportCandidate], onImported: (() -> Void)? = nil) { + init(name: String, candidates: [AppModel.ImportCandidate], fromComputer: Bool = false, onImported: (() -> Void)? = nil) { self.name = name self.candidates = candidates + self.fromComputer = fromComputer self.onImported = onImported } } @@ -88,7 +91,13 @@ struct ImportSheet: View { } header: { Text(batch.name) } footer: { - Text("The selected dives are added to the logbook with their full profile, then uploaded to the Subsurface cloud. Dives already in the logbook (same start time) are skipped.") + VStack(alignment: .leading, spacing: 8) { + Text("The selected dives are added to the logbook with their full profile, then uploaded to the Subsurface cloud. Dives already in the logbook (same start time) are skipped.") + if batch.fromComputer { + // The logbook numbers the dives itself; the computer's own counter is not used. + Text("Dives are numbered by the logbook, not by the computer. After this import, the next dive will be no. \(model.logbook.nextNumber + selected.count): set the computer's counter to it if you want both to match.") + } + } } if let error { Section { Text(error).foregroundStyle(.red) }