commit 9f571f8db1568e71336e7ce46a23b49e77a5987f
parent a55e5a48497424db4895230e3b2fdb4d89bb1906
Author: Jean Schurger <jean@schurger.org>
Date: Sat, 14 Nov 2026 09:37:59 -0500
English code, comments and docs; English source language with French localization; GPL-2.0 license
All comments, engine messages, tool and fastlane output, test suite names
and docs are now in English (docs/CONCEPTION.md -> docs/DESIGN.md,
docs/PARTAGE.md -> docs/SHARING.md), with a README. The watch app, the
iPhone app and the widget extension use English as their source language
and keep French, with the wording unchanged, as a translation in String
Catalogs (Localizable.xcstrings per target, InfoPlist.xcstrings for the
watch usage descriptions). Decimal separator and date style follow the
interface language. Every Swift file carries an SPDX identifier and
LICENSE holds the GPL version 2 text.
Stored data and wire formats are untouched: JSON keys, enum raw values,
UserDefaults keys, file names on disk (carnet.json, reglages.json,
plongees.json, reglages-montre.json), the shared folder
OpenRemora/Plongees/ and the subrascasse://open-remora URL.
Adds `make build-phone` (unsigned simulator build of the iPhone app).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7deYJwSV8KMFfnh7K4gJq
Diffstat:
64 files changed, 3747 insertions(+), 705 deletions(-)
diff --git a/LICENSE b/LICENSE
@@ -0,0 +1,338 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Moe Ghoul>, 1 April 1989
+ Moe Ghoul, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/Makefile b/Makefile
@@ -1,4 +1,5 @@
-# Le code vit ici (hotrats) ; Swift et Xcode tournent sur chunga.
+# The sources are edited here (a Linux host); Swift and Xcode run on a Mac reachable over SSH.
+# CHUNGA is the SSH host, REMOTE the directory on the Mac (relative to the home directory).
CHUNGA ?= chunga
REMOTE ?= src/perso/open-remora
@@ -7,20 +8,26 @@ REMOTE ?= src/perso/open-remora
sync:
rsync -a --delete --exclude .git --exclude '*.xcodeproj' --exclude build --exclude .build ./ $(CHUNGA):$(REMOTE)/
-# Moteur de décompression seul (paquet Swift, sans interface)
+# Decompression engine alone (Swift package, no user interface)
test-deco: sync
ssh $(CHUNGA) 'cd $(REMOTE)/Packages/RemoraDeco && swift test 2>&1'
WATCH_DEST ?= generic/platform=watchOS Simulator
-.PHONY: project build-watch
+.PHONY: project build-watch build-phone
project: sync
ssh $(CHUNGA) 'cd $(REMOTE) && xcodegen -q'
build-watch: project
ssh $(CHUNGA) 'cd $(REMOTE) && xcodebuild -quiet -scheme OpenRemoraWatch -destination "$(WATCH_DEST)" -derivedDataPath build CODE_SIGNING_ALLOWED=NO build'
-# Archive signée pour TestFlight (signature automatique, clé API perso de chunga). BUILD=n fixe le numéro.
+PHONE_DEST ?= generic/platform=iOS Simulator
+
+# iPhone app (with its widget extension and the embedded watch app), unsigned, for the simulator.
+build-phone: project
+ ssh $(CHUNGA) 'cd $(REMOTE) && xcodebuild -quiet -scheme OpenRemora -destination "$(PHONE_DEST)" -derivedDataPath build CODE_SIGNING_ALLOWED=NO build'
+
+# Signed archive for TestFlight (automatic signing, personal API key on the Mac). BUILD=n sets the build number.
BUILD ?= $(shell date +%Y%m%d%H%M)
AUTH = -allowProvisioningUpdates -authenticationKeyPath $$PERSO_ASC_KEY_PATH -authenticationKeyID $$PERSO_ASC_KEY_ID -authenticationKeyIssuerID $$PERSO_ASC_ISSUER_ID
@@ -28,6 +35,6 @@ AUTH = -allowProvisioningUpdates -authenticationKeyPath $$PERSO_ASC_KEY_PATH -au
archive: project
ssh $(CHUNGA) 'source ~/.zshrc_build && security unlock-keychain -p "$$(cat ~/.keyring_secret)" ~/Library/Keychains/login.keychain-db && cd $(REMOTE) && rm -rf build/OpenRemora.xcarchive build/ipa && xcodebuild -quiet -scheme OpenRemora -configuration Release -destination "generic/platform=iOS" -archivePath build/OpenRemora.xcarchive CURRENT_PROJECT_VERSION=$(BUILD) $(AUTH) archive && PATH=/usr/bin:$$PATH xcodebuild -quiet -exportArchive -archivePath build/OpenRemora.xcarchive -exportOptionsPlist tools/ExportOptions.plist -exportPath build/ipa $(AUTH) && ls -la build/ipa'
-# Envoi sur TestFlight de l'IPA archivée (la fiche App Store Connect doit exister).
+# Uploads the archived IPA to TestFlight (the App Store Connect record must exist).
upload:
ssh $(CHUNGA) 'cd $(REMOTE) && zsh tools/upload.sh'
diff --git a/OpenRemora/DiveNotifier.swift b/OpenRemora/DiveNotifier.swift
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import UIKit
@preconcurrency import UserNotifications
@@ -6,15 +7,16 @@ import UIKit
#endif
import RemoraDeco
-/// Notifications de l'iPhone :
-/// - à la réception d'une plongée (la toucher ouvre Sub Rascasse, qui l'importe) ;
-/// - à la fin du délai avant l'avion ;
-/// - activité en direct « délai avant l'avion » (écran verrouillé, Dynamic Island), démarrée quand l'app
-/// est au premier plan (iOS ne permet pas de la lancer en arrière-plan sans serveur de notifications).
+/// iPhone notifications:
+/// - when a dive is received (tapping it opens Sub Rascasse, which imports it);
+/// - at the end of the no-fly time;
+/// - "no-fly time" Live Activity (lock screen, Dynamic Island), started when the app is in the foreground
+/// (iOS does not allow starting it in the background without a push notification server).
@MainActor
final class DiveNotifier: NSObject, UNUserNotificationCenterDelegate {
static let subRascasseURL = URL(string: "subrascasse://open-remora")!
private let center = UNUserNotificationCenter.current()
+ /// Identifier of the pending notification: kept as is so that an update replaces the one already scheduled.
private let noFlyEndID = "open-remora.avion"
override init() {
@@ -26,33 +28,33 @@ final class DiveNotifier: NSObject, UNUserNotificationCenterDelegate {
_ = try? await center.requestAuthorization(options: [.alert, .sound])
}
- /// Plongée reçue de la montre (l'app peut être en arrière-plan).
+ /// Dive received from the watch (the app may be in the background).
func diveReceived(_ dive: DiveLog, noFlyHours: Double) {
let content = UNMutableNotificationContent()
- content.title = "Plongée nº \(dive.number) reçue"
- var body = "\(Format.depth(dive.maxDepth)) m · \(Format.minutes(dive.duration))"
- if noFlyHours > 0 { body += " · avion dans \(Self.hours(noFlyHours))" }
- body += ". Touchez pour l'ouvrir dans Sub Rascasse."
- content.body = body
+ content.title = String(localized: "Dive no. \(dive.number) received")
+ let depth = Format.depth(dive.maxDepth), duration = Format.minutes(dive.duration)
+ content.body = noFlyHours > 0
+ ? String(localized: "\(depth) m · \(duration) · flying in \(Format.hours(noFlyHours)). Tap to open it in Sub Rascasse.")
+ : String(localized: "\(depth) m · \(duration). Tap to open it in Sub Rascasse.")
content.sound = .default
content.userInfo = ["open": "subrascasse"]
center.add(UNNotificationRequest(identifier: "plongee-\(dive.id.uuidString)", content: content, trigger: nil))
scheduleNoFlyEnd(after: noFlyHours)
}
- /// Notification à la fin du délai avant l'avion (remplace la précédente).
+ /// Notification at the end of the no-fly time (replaces the previous one).
func scheduleNoFlyEnd(after hours: Double) {
center.removePendingNotificationRequests(withIdentifiers: [noFlyEndID])
guard hours > 0 else { return }
let content = UNMutableNotificationContent()
- content.title = "Délai avant l'avion terminé"
- content.body = "D'après Open Rémora et la règle de DAN, vous pouvez prendre l'avion. Suivez aussi votre ordinateur principal."
+ content.title = String(localized: "No-fly time is over")
+ content.body = String(localized: "According to Open Rémora and the DAN rule, you can fly. Also follow your primary computer.")
content.sound = .default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: hours * 3600, repeats: false)
center.add(UNNotificationRequest(identifier: noFlyEndID, content: content, trigger: trigger))
}
- /// Démarre, met à jour ou termine l'activité en direct (app au premier plan).
+ /// Starts, updates or ends the Live Activity (app in the foreground).
func updateLiveActivity(lastDive: DiveLog?, noFlyHours: Double, altitudeHours: Double) {
#if canImport(ActivityKit)
let now = Date()
@@ -68,7 +70,7 @@ final class DiveNotifier: NSObject, UNUserNotificationCenterDelegate {
}
#if canImport(ActivityKit)
- /// Tout le travail sur les activités se fait ici, hors de l'acteur principal.
+ /// All the work on activities happens here, off the main actor.
nonisolated private static func apply(attributes: NoFlyAttributes?, state: NoFlyAttributes.ContentState,
enabled: Bool) async {
let content = ActivityContent(state: state, staleDate: state.until)
@@ -88,7 +90,7 @@ final class DiveNotifier: NSObject, UNUserNotificationCenterDelegate {
// MARK: UNUserNotificationCenterDelegate
- /// Notification touchée : on passe directement dans Sub Rascasse s'il est installé.
+ /// Notification tapped: go straight to Sub Rascasse when it is installed.
nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse) async {
guard response.notification.request.content.userInfo["open"] as? String == "subrascasse" else { return }
@@ -99,14 +101,9 @@ final class DiveNotifier: NSObject, UNUserNotificationCenterDelegate {
}
}
- /// App au premier plan : afficher quand même la notification.
+ /// App in the foreground: show the notification anyway.
nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification) async -> UNNotificationPresentationOptions {
[.banner, .sound]
}
-
- static func hours(_ h: Double) -> String {
- let total = Int((h * 60).rounded(.up))
- return total >= 60 ? "\(total / 60) h \(String(format: "%02d", total % 60))" : "\(total) min"
- }
}
diff --git a/OpenRemora/HomeView.swift b/OpenRemora/HomeView.swift
@@ -1,8 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
import SwiftUI
import RemoraDeco
-/// Écran unique de l'app iPhone : état de la montre, réglages (lecture seule), dernière plongée et
-/// délais d'après-plongée, passage vers Sub Rascasse. Le carnet complet est dans Sub Rascasse.
+/// Single screen of the iPhone app: watch status, settings (read-only), last dive and post-dive waiting
+/// times, link to Sub Rascasse. The full logbook is in Sub Rascasse.
struct HomeView: View {
@Environment(PhoneStore.self) private var store
@Environment(\.openURL) private var openURL
@@ -20,11 +21,11 @@ struct HomeView: View {
if let dive = store.dives.first { lastDiveSection(dive) }
subRascasseSection
Section {
- NavigationLink { HelpView() } label: { Label("Mode d'emploi", systemImage: "book") }
- Link(destination: Terms.link) { Label("Conditions d'utilisation", systemImage: "doc.text") }
- Link(destination: Terms.privacy) { Label("Confidentialité", systemImage: "hand.raised") }
+ NavigationLink { HelpView() } label: { Label("User guide", systemImage: "book") }
+ Link(destination: Terms.link) { Label("Terms of use", systemImage: "doc.text") }
+ Link(destination: Terms.privacy) { Label("Privacy", systemImage: "hand.raised") }
} footer: {
- Text("Open Rémora est un ordinateur de plongée secondaire, non certifié. Plongez toujours avec un ordinateur principal.")
+ Text("Open Rémora is a secondary dive computer, not certified. Always dive with a primary computer.")
}
}
.navigationTitle("Open Rémora")
@@ -43,16 +44,16 @@ struct HomeView: View {
// MARK: Sections
private var watchSection: some View {
- Section("Montre") {
+ Section("Watch") {
if !store.watchPaired {
- Label("Aucune Apple Watch jumelée", systemImage: "applewatch.slash").foregroundStyle(.orange)
+ Label("No paired Apple Watch", systemImage: "applewatch.slash").foregroundStyle(.orange)
} else if !store.watchAppInstalled {
- Label("Installez Open Rémora sur la montre (app Watch)", systemImage: "applewatch").foregroundStyle(.orange)
+ Label("Install Open Rémora on the watch (Watch app)", systemImage: "applewatch").foregroundStyle(.orange)
} else {
- Label("Open Rémora est installé sur la montre", systemImage: "applewatch.radiowaves.left.and.right")
+ Label("Open Rémora is installed on the watch", systemImage: "applewatch.radiowaves.left.and.right")
}
if let at = store.settingsReceivedAt {
- Text("Dernières nouvelles de la montre : \(at.formatted(.relative(presentation: .named)))")
+ Text("Last heard from the watch: \(at.formatted(.relative(presentation: .named)))")
.font(.footnote).foregroundStyle(.secondary)
}
if let error = store.lastError {
@@ -63,16 +64,16 @@ struct HomeView: View {
private func settingsSection(_ s: UserSettings) -> some View {
Section {
- row("Mélange", s.gas.description)
- row("Profondeur maximale du mélange", "\(Format.depth(s.maximumOperatingDepth())) m")
- row("Eau", s.water.label)
- row("Alarme de NDL", s.ndlAlarmMinutes == 0 ? "Désactivée" : "Sous \(s.ndlAlarmMinutes) min")
- row("Prudence", s.conservatism == .custom ? "Personnalisée (\(s.gradientFactors.description))" : s.conservatism.label)
- row("ppO2 maximale", String(format: "%.1f bar", s.ppO2Max).replacingOccurrences(of: ".", with: ","))
+ row("Gas", s.gas.description)
+ row("Maximum operating depth", "\(Format.depth(s.maximumOperatingDepth())) m")
+ row("Water", s.water.label)
+ row("NDL alarm", s.ndlAlarmMinutes == 0 ? String(localized: "Off") : String(localized: "Below \(s.ndlAlarmMinutes) min"))
+ row("Conservatism", s.conservatism == .custom ? String(localized: "Custom (\(s.gradientFactors.description))") : s.conservatism.label)
+ row("Maximum ppO2", "\(Format.decimal(s.ppO2Max, digits: 1)) bar")
} header: {
- Text("Réglages")
+ Text("Settings")
} footer: {
- Text("Les réglages se changent sur la montre seulement.")
+ Text("Settings can only be changed on the watch.")
}
}
@@ -81,17 +82,17 @@ struct HomeView: View {
let fly = SurfaceAdvice.noFlyHours(logbook: store.logbook, at: now, surfacePressure: standardSurfacePressure)
let mountain = SurfaceAdvice.hoursBeforeAltitude(2000, logbook: store.logbook, at: now,
surfacePressure: standardSurfacePressure)
- return Section("Dernière plongée") {
- row("Nº \(dive.number) · \(Format.dayTime(dive.start))",
+ return Section("Last dive") {
+ row("No. \(dive.number) · \(Format.dayTime(dive.start))",
"\(Format.depth(dive.maxDepth)) m · \(Format.minutes(dive.duration))")
- if dive.hadDecompression { Label("Paliers obligatoires", systemImage: "arrow.up.to.line").foregroundStyle(.orange) }
+ if dive.hadDecompression { Label("Mandatory stops", systemImage: "arrow.up.to.line").foregroundStyle(.orange) }
ForEach(Array(dive.violations.enumerated()), id: \.offset) { _, event in
- Label("\(event.warning.label) à \(Format.clock(event.time))", systemImage: "exclamationmark.triangle.fill")
+ Label("\(event.warning.label) at \(Format.clock(event.time))", systemImage: "exclamationmark.triangle.fill")
.foregroundStyle(.red)
}
- Label(fly > 0 ? "Avion : attendre encore \(hours(fly))" : "Avion : plus de restriction",
+ Label(fly > 0 ? "Flying: wait another \(Format.hours(fly))" : "Flying: no more restriction",
systemImage: "airplane")
- Label(mountain > 0 ? "Monter à 2000 m : attendre encore \(hours(mountain))" : "Altitude : plus de restriction",
+ Label(mountain > 0 ? "Going up to 2000 m: wait another \(Format.hours(mountain))" : "Altitude: no more restriction",
systemImage: "mountain.2")
}
}
@@ -99,63 +100,58 @@ struct HomeView: View {
private var subRascasseSection: some View {
Section {
if store.pendingForSubRascasse > 0 {
- Label("\(store.pendingForSubRascasse) plongée\(store.pendingForSubRascasse > 1 ? "s" : "") en attente pour Sub Rascasse",
- systemImage: "tray.and.arrow.up")
+ // Plural forms are in the String Catalog.
+ Label("\(store.pendingForSubRascasse) dives waiting for Sub Rascasse", systemImage: "tray.and.arrow.up")
} else if !store.dives.isEmpty {
- Label("Toutes les plongées sont dans Sub Rascasse", systemImage: "checkmark.circle")
+ Label("All dives are in Sub Rascasse", systemImage: "checkmark.circle")
}
if subRascasseInstalled {
- Button { openURL(Self.subRascasseURL) } label: { Label("Ouvrir Sub Rascasse", systemImage: "book.pages") }
+ Button { openURL(Self.subRascasseURL) } label: { Label("Open Sub Rascasse", systemImage: "book.pages") }
} else {
- Label("Installez Sub Rascasse pour revoir vos plongées", systemImage: "arrow.down.app")
+ Label("Install Sub Rascasse to review your dives", systemImage: "arrow.down.app")
.foregroundStyle(.secondary)
}
if let exportURL {
- ShareLink(item: exportURL) { Label("Exporter les plongées (UDDF)", systemImage: "square.and.arrow.up") }
+ ShareLink(item: exportURL) { Label("Export dives (UDDF)", systemImage: "square.and.arrow.up") }
}
if !store.sharedFolderAvailable {
- Text("Dossier partagé indisponible : les plongées restent dans cette app.").font(.footnote).foregroundStyle(.orange)
+ Text("Shared folder unavailable: dives stay in this app.").font(.footnote).foregroundStyle(.orange)
}
} header: {
- Text("Carnet")
+ Text("Logbook")
} footer: {
- Text("Le carnet, le profil et les graphes sont dans Sub Rascasse, avec vos autres plongées. L'export UDDF s'ouvre aussi dans Subsurface.")
+ Text("The logbook, the profile and the charts are in Sub Rascasse, with your other dives. The UDDF export also opens in Subsurface.")
}
}
- private func row(_ title: String, _ value: String) -> some View {
+ private func row(_ title: LocalizedStringKey, _ value: String) -> some View {
LabeledContent(title, value: value)
}
-
- private func hours(_ h: Double) -> String {
- let total = Int((h * 60).rounded(.up))
- return total >= 60 ? "\(total / 60) h \(String(format: "%02d", total % 60))" : "\(total) min"
- }
}
-/// Mode d'emploi court.
+/// Short user guide.
struct HelpView: View {
var body: some View {
List {
- Section("Avant la plongée") {
- Text("Sur la montre, touchez « Prêt à plonger » : l'app reste ouverte jusqu'à la mise à l'eau. Vérifiez le mélange, la prudence et la batterie.")
- Text("Sans cela, la plongée démarre quand même toute seule dès l'immersion.")
+ Section("Before the dive") {
+ Text("On the watch, tap “Ready to dive”: the app stays open until you get in the water. Check the gas, the conservatism and the battery.")
+ Text("Without it, the dive still starts by itself on submersion.")
}
- Section("Pendant la plongée") {
- Text("La profondeur est en grand. Dessous : le NDL (temps restant sans palier obligatoire), ou le palier à faire avec son compte à rebours.")
- Text("Les flèches en bas à droite montrent la vitesse de remontée. Au-delà de 10 m/min : orange ; au-delà de 12 m/min : rouge et vibration.")
- Text("Alarme : tout l'écran clignote en rouge et la montre vibre sans arrêt (plafond ou palier franchi, remontée trop rapide, pression d'oxygène critique, profondeur inconnue). Redescendez au palier ou ralentissez.")
- Text("Avertissement : seule la valeur concernée clignote, avec une vibration (NDL bas, profondeur limite, remontée rapide).")
+ Section("During the dive") {
+ Text("The depth is shown large. Below it: the NDL (time left without a mandatory stop), or the stop to do with its countdown.")
+ Text("The arrows at the bottom right show the ascent rate. Above 10 m/min: orange; above 12 m/min: red and vibration.")
+ Text("Alarm: the whole screen flashes red and the watch vibrates continuously (ceiling or stop broken, ascent too fast, critical oxygen pressure, depth unknown). Go back down to the stop or slow down.")
+ Text("Warning: only the value concerned blinks, with a vibration (low NDL, depth limit, fast ascent).")
}
- Section("Après la plongée") {
- Text("La plongée se termine après une minute en surface. Elle arrive dans cette app, puis dans Sub Rascasse, et dans Santé comme entraînement de plongée.")
- Text("Sur la montre, le carnet garde vos plongées : touchez une plongée, puis le profil, et tournez la couronne pour le parcourir.")
+ Section("After the dive") {
+ Text("The dive ends after one minute at the surface. It arrives in this app, then in Sub Rascasse, and in Health as a diving workout.")
+ Text("On the watch, the logbook keeps your dives: tap a dive, then the profile, and turn the crown to browse it.")
}
- Section("Réglages (sur la montre)") {
- Text("Oxygène : 21 % (air) à 40 % (nitrox). Eau : douce, salée ou standard. Alarme de NDL : seuil au choix, ou désactivée.")
- Text("Réglages avancés : prudence (facteurs de gradient) et pression d'oxygène maximale.")
+ Section("Settings (on the watch)") {
+ Text("Oxygen: 21% (air) to 40% (nitrox). Water: fresh, salt or standard. NDL alarm: threshold of your choice, or off.")
+ Text("Advanced settings: conservatism (gradient factors) and maximum oxygen pressure.")
}
}
- .navigationTitle("Mode d'emploi")
+ .navigationTitle("User guide")
}
}
diff --git a/OpenRemora/Localizable.xcstrings b/OpenRemora/Localizable.xcstrings
@@ -0,0 +1,846 @@
+{
+ "sourceLanguage": "en",
+ "strings": {
+ "%@ at %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%@ à %@"
+ }
+ }
+ }
+ },
+ "%@ m · %@ · flying in %@. Tap to open it in Sub Rascasse.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%@ m · %@ · avion dans %@. Touchez pour l'ouvrir dans Sub Rascasse."
+ }
+ }
+ }
+ },
+ "%@ m · %@. Tap to open it in Sub Rascasse.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%@ m · %@. Touchez pour l'ouvrir dans Sub Rascasse."
+ }
+ }
+ }
+ },
+ "%lld dives waiting for Sub Rascasse": {
+ "localizations": {
+ "en": {
+ "variations": {
+ "plural": {
+ "one": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld dive waiting for Sub Rascasse"
+ }
+ },
+ "other": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld dives waiting for Sub Rascasse"
+ }
+ }
+ }
+ }
+ },
+ "fr": {
+ "variations": {
+ "plural": {
+ "one": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld plongée en attente pour Sub Rascasse"
+ }
+ },
+ "other": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld plongées en attente pour Sub Rascasse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "%lld%%": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld %%"
+ }
+ }
+ }
+ },
+ "According to Open Rémora and the DAN rule, you can fly. Also follow your primary computer.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "D'après Open Rémora et la règle de DAN, vous pouvez prendre l'avion. Suivez aussi votre ordinateur principal."
+ }
+ }
+ }
+ },
+ "Advanced settings: conservatism (gradient factors) and maximum oxygen pressure.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Réglages avancés : prudence (facteurs de gradient) et pression d'oxygène maximale."
+ }
+ }
+ }
+ },
+ "After the dive": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Après la plongée"
+ }
+ }
+ }
+ },
+ "Alarm: the whole screen flashes red and the watch vibrates continuously (ceiling or stop broken, ascent too fast, critical oxygen pressure, depth unknown). Go back down to the stop or slow down.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Alarme : tout l'écran clignote en rouge et la montre vibre sans arrêt (plafond ou palier franchi, remontée trop rapide, pression d'oxygène critique, profondeur inconnue). Redescendez au palier ou ralentissez."
+ }
+ }
+ }
+ },
+ "All dives are in Sub Rascasse": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Toutes les plongées sont dans Sub Rascasse"
+ }
+ }
+ }
+ },
+ "Altitude: no more restriction": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Altitude : plus de restriction"
+ }
+ }
+ }
+ },
+ "Always dive with a primary dive computer, and follow it when the two disagree.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plongez toujours avec un ordinateur de plongée principal, et suivez-le en cas d'écart."
+ }
+ }
+ }
+ },
+ "Ascent too fast": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Remontée trop rapide"
+ }
+ }
+ }
+ },
+ "Before the dive": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Avant la plongée"
+ }
+ }
+ }
+ },
+ "Before you dive": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Avant de plonger"
+ }
+ }
+ }
+ },
+ "Below %lld min": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sous %lld min"
+ }
+ }
+ }
+ },
+ "Ceiling broken": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plafond franchi"
+ }
+ }
+ }
+ },
+ "Conservatism": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Prudence"
+ }
+ }
+ }
+ },
+ "Critical ppO2": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ppO2 critique"
+ }
+ }
+ }
+ },
+ "Custom": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Personnalisée"
+ }
+ }
+ }
+ },
+ "Custom (%@)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Personnalisée (%@)"
+ }
+ }
+ }
+ },
+ "Depth limit": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Profondeur limite"
+ }
+ }
+ }
+ },
+ "Dive no. %lld received": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plongée nº %lld reçue"
+ }
+ }
+ }
+ },
+ "Dive within the limits of your training. You are responsible for your settings and your gas.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plongez dans les limites de votre formation. Vous êtes responsable de vos réglages et de votre mélange."
+ }
+ }
+ }
+ },
+ "During the dive": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Pendant la plongée"
+ }
+ }
+ }
+ },
+ "Export dives (UDDF)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Exporter les plongées (UDDF)"
+ }
+ }
+ }
+ },
+ "Fast ascent": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Remontée rapide"
+ }
+ }
+ }
+ },
+ "Flying: no more restriction": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Avion : plus de restriction"
+ }
+ }
+ }
+ },
+ "Flying: wait another %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Avion : attendre encore %@"
+ }
+ }
+ }
+ },
+ "Fresh": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Douce"
+ }
+ }
+ }
+ },
+ "Gas": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Mélange"
+ }
+ }
+ }
+ },
+ "Going up to 2000 m: wait another %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Monter à 2000 m : attendre encore %@"
+ }
+ }
+ }
+ },
+ "High (GF 30/70)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Élevée (GF 30/70)"
+ }
+ }
+ }
+ },
+ "High ppO2": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ppO2 élevée"
+ }
+ }
+ }
+ },
+ "I understand and accept": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "J'ai compris, j'accepte"
+ }
+ }
+ }
+ },
+ "Install Open Rémora on the watch (Watch app)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Installez Open Rémora sur la montre (app Watch)"
+ }
+ }
+ }
+ },
+ "Install Sub Rascasse to review your dives": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Installez Sub Rascasse pour revoir vos plongées"
+ }
+ }
+ }
+ },
+ "Last dive": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Dernière plongée"
+ }
+ }
+ }
+ },
+ "Last heard from the watch: %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Dernières nouvelles de la montre : %@"
+ }
+ }
+ }
+ },
+ "Logbook": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Carnet"
+ }
+ }
+ }
+ },
+ "Low (GF 50/85)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Faible (GF 50/85)"
+ }
+ }
+ }
+ },
+ "Low NDL": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "NDL bas"
+ }
+ }
+ }
+ },
+ "Mandatory stops": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Paliers obligatoires"
+ }
+ }
+ }
+ },
+ "Maximum operating depth": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Profondeur maximale du mélange"
+ }
+ }
+ }
+ },
+ "Maximum ppO2": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ppO2 maximale"
+ }
+ }
+ }
+ },
+ "Medium (GF 40/80)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Moyenne (GF 40/80)"
+ }
+ }
+ }
+ },
+ "NDL alarm": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Alarme de NDL"
+ }
+ }
+ }
+ },
+ "No computation guarantees the absence of decompression sickness.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aucun calcul ne garantit l'absence d'accident de décompression."
+ }
+ }
+ }
+ },
+ "No paired Apple Watch": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aucune Apple Watch jumelée"
+ }
+ }
+ }
+ },
+ "No-fly time is over": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Délai avant l'avion terminé"
+ }
+ }
+ }
+ },
+ "No. %lld · %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Nº %lld · %@"
+ }
+ }
+ }
+ },
+ "Off": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Désactivée"
+ }
+ }
+ }
+ },
+ "On the watch, tap “Ready to dive”: the app stays open until you get in the water. Check the gas, the conservatism and the battery.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sur la montre, touchez « Prêt à plonger » : l'app reste ouverte jusqu'à la mise à l'eau. Vérifiez le mélange, la prudence et la batterie."
+ }
+ }
+ }
+ },
+ "On the watch, the logbook keeps your dives: tap a dive, then the profile, and turn the crown to browse it.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sur la montre, le carnet garde vos plongées : touchez une plongée, puis le profil, et tournez la couronne pour le parcourir."
+ }
+ }
+ }
+ },
+ "Open Rémora": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora"
+ }
+ }
+ }
+ },
+ "Open Rémora is a secondary dive computer, not certified. Always dive with a primary computer.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora est un ordinateur de plongée secondaire, non certifié. Plongez toujours avec un ordinateur principal."
+ }
+ }
+ }
+ },
+ "Open Rémora is installed on the watch": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora est installé sur la montre"
+ }
+ }
+ }
+ },
+ "Open Rémora is not a certified dive computer.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora n'est pas un ordinateur de plongée certifié."
+ }
+ }
+ }
+ },
+ "Open Sub Rascasse": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Ouvrir Sub Rascasse"
+ }
+ }
+ }
+ },
+ "Oxygen: 21% (air) to 40% (nitrox). Water: fresh, salt or standard. NDL alarm: threshold of your choice, or off.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Oxygène : 21 % (air) à 40 % (nitrox). Eau : douce, salée ou standard. Alarme de NDL : seuil au choix, ou désactivée."
+ }
+ }
+ }
+ },
+ "Privacy": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Confidentialité"
+ }
+ }
+ }
+ },
+ "Safety stop missed": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Palier de sécurité sauté"
+ }
+ }
+ }
+ },
+ "Salt": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Salée"
+ }
+ }
+ }
+ },
+ "Settings": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Réglages"
+ }
+ }
+ }
+ },
+ "Settings (on the watch)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Réglages (sur la montre)"
+ }
+ }
+ }
+ },
+ "Settings can only be changed on the watch.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Les réglages se changent sur la montre seulement."
+ }
+ }
+ }
+ },
+ "Shared folder unavailable: dives stay in this app.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Dossier partagé indisponible : les plongées restent dans cette app."
+ }
+ }
+ }
+ },
+ "Shared folder: %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Dossier partagé : %@"
+ }
+ }
+ }
+ },
+ "Standard (EN 13319)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Standard (EN 13319)"
+ }
+ }
+ }
+ },
+ "Terms of use": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Conditions d'utilisation"
+ }
+ }
+ }
+ },
+ "The arrows at the bottom right show the ascent rate. Above 10 m/min: orange; above 12 m/min: red and vibration.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Les flèches en bas à droite montrent la vitesse de remontée. Au-delà de 10 m/min : orange ; au-delà de 12 m/min : rouge et vibration."
+ }
+ }
+ }
+ },
+ "The depth is shown large. Below it: the NDL (time left without a mandatory stop), or the stop to do with its countdown.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "La profondeur est en grand. Dessous : le NDL (temps restant sans palier obligatoire), ou le palier à faire avec son compte à rebours."
+ }
+ }
+ }
+ },
+ "The dive ends after one minute at the surface. It arrives in this app, then in Sub Rascasse, and in Health as a diving workout.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "La plongée se termine après une minute en surface. Elle arrive dans cette app, puis dans Sub Rascasse, et dans Santé comme entraînement de plongée."
+ }
+ }
+ }
+ },
+ "The logbook, the profile and the charts are in Sub Rascasse, with your other dives. The UDDF export also opens in Subsurface.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Le carnet, le profil et les graphes sont dans Sub Rascasse, avec vos autres plongées. L'export UDDF s'ouvre aussi dans Subsurface."
+ }
+ }
+ }
+ },
+ "The watch can fail or measure wrongly during the dive.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "La montre peut tomber en panne ou mal mesurer pendant la plongée."
+ }
+ }
+ }
+ },
+ "User guide": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Mode d'emploi"
+ }
+ }
+ }
+ },
+ "Warning: only the value concerned blinks, with a vibration (low NDL, depth limit, fast ascent).": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Avertissement : seule la valeur concernée clignote, avec une vibration (NDL bas, profondeur limite, remontée rapide)."
+ }
+ }
+ }
+ },
+ "Watch": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Montre"
+ }
+ }
+ }
+ },
+ "Water": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Eau"
+ }
+ }
+ }
+ },
+ "Without it, the dive still starts by itself on submersion.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sans cela, la plongée démarre quand même toute seule dès l'immersion."
+ }
+ }
+ }
+ },
+ "•": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "•"
+ }
+ }
+ }
+ }
+ },
+ "version": "1.0"
+}
diff --git a/OpenRemora/OpenRemoraApp.swift b/OpenRemora/OpenRemoraApp.swift
@@ -1,7 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-only
import SwiftUI
-/// App iPhone : le pont entre la montre et Sub Rascasse (qui sert de carnet).
-/// Les réglages se font sur la montre ; ici on les affiche seulement.
+/// iPhone app: the bridge between the watch and Sub Rascasse (which acts as the logbook).
+/// Settings are changed on the watch; here they are only displayed.
@main
struct OpenRemoraApp: App {
@State private var store = PhoneStore()
diff --git a/OpenRemora/PhoneStore.swift b/OpenRemora/PhoneStore.swift
@@ -1,10 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Observation
@preconcurrency import WatchConnectivity
import RemoraDeco
-/// Côté iPhone : reçoit de la montre les réglages et les plongées, garde une copie des plongées
-/// (pour le délai avant l'avion) et les dépose dans le dossier partagé avec Sub Rascasse.
+/// iPhone side: receives the settings and the dives from the watch, keeps a copy of the dives
+/// (for the no-fly time) and drops them into the folder shared with Sub Rascasse.
@MainActor @Observable
final class PhoneStore: NSObject, WCSessionDelegate {
private(set) var logbook = Logbook()
@@ -19,6 +20,7 @@ final class PhoneStore: NSObject, WCSessionDelegate {
private let folder: URL
private var demo = false
let notifier = DiveNotifier()
+ // File names on disk: kept as is, existing installs read them.
private var logbookURL: URL { folder.appendingPathComponent("plongees.json") }
private var settingsURL: URL { folder.appendingPathComponent("reglages-montre.json") }
@@ -34,11 +36,11 @@ final class PhoneStore: NSObject, WCSessionDelegate {
refreshOutbox()
}
- /// Captures d'écran (argument `-demo`) : réglages et deux plongées en mémoire seulement, rien n'est écrit.
+ /// Screenshots (`-demo` argument): settings and two dives in memory only, nothing is written.
func seedDemo() {
demo = true
var s = UserSettings()
- s.oxygenPercent = 28 // profondeur maximale 40 m : cohérent avec la plongée profonde de démonstration
+ s.oxygenPercent = 28 // maximum depth 40 m: consistent with the deep demo dive
s.water = .salt
settings = s
settingsReceivedAt = Date().addingTimeInterval(-600)
@@ -50,7 +52,7 @@ final class PhoneStore: NSObject, WCSessionDelegate {
logbook.add(second)
pendingForSubRascasse = 1
sharedFolderAvailable = true
- refreshLiveActivity() // seulement avec -liveActivity (voir refreshLiveActivity)
+ refreshLiveActivity() // only with -liveActivity (see refreshLiveActivity)
}
func activate() {
@@ -59,10 +61,10 @@ final class PhoneStore: NSObject, WCSessionDelegate {
WCSession.default.activate()
}
- /// Plongées réelles, les plus récentes d'abord.
+ /// Real dives, most recent first.
var dives: [DiveLog] { logbook.realDives.reversed() }
- /// Dossier des plongées en attente pour Sub Rascasse (nil si le groupe d'apps n'est pas disponible).
+ /// Folder of the dives waiting for Sub Rascasse (nil when the app group is not available).
var outbox: URL? {
FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: SharedFolder.appGroup)?
.appendingPathComponent(SharedFolder.outboxPath, isDirectory: true)
@@ -80,7 +82,7 @@ final class PhoneStore: NSObject, WCSessionDelegate {
pendingForSubRascasse = files.filter { $0.hasSuffix(".json") }.count
}
- /// Toutes les plongées reçues en UDDF (export de secours, sans Sub Rascasse).
+ /// All received dives as UDDF (fallback export, without Sub Rascasse).
func exportUDDF() -> URL? {
let url = FileManager.default.temporaryDirectory.appendingPathComponent("OpenRemora.uddf")
guard (try? UDDF.export(logbook.realDives).write(to: url, atomically: true, encoding: .utf8)) != nil
@@ -99,14 +101,14 @@ final class PhoneStore: NSObject, WCSessionDelegate {
try PhoneSync.encoder.encode(dive).write(to: base.appendingPathExtension("json"), options: .atomic)
try UDDF.export([dive]).write(to: base.appendingPathExtension("uddf"), atomically: true, encoding: .utf8)
} catch {
- lastError = "Dossier partagé : \(error.localizedDescription)"
+ lastError = String(localized: "Shared folder: \(error.localizedDescription)")
}
}
refreshOutbox()
notifier.diveReceived(dive, noFlyHours: noFlyHours)
}
- /// Heures avant l'avion d'après les plongées reçues (0 = plus de restriction).
+ /// Hours before flying according to the received dives (0 = no more restriction).
var noFlyHours: Double {
SurfaceAdvice.noFlyHours(logbook: logbook, at: Date(), surfacePressure: standardSurfacePressure)
}
@@ -115,7 +117,7 @@ final class PhoneStore: NSObject, WCSessionDelegate {
SurfaceAdvice.hoursBeforeAltitude(2000, logbook: logbook, at: Date(), surfacePressure: standardSurfacePressure)
}
- /// Activité en direct « délai avant l'avion » (à appeler app au premier plan).
+ /// "No-fly time" Live Activity (to be called with the app in the foreground).
func refreshLiveActivity() {
guard !demo || CommandLine.arguments.contains("-liveActivity") else { return }
notifier.updateLiveActivity(lastDive: dives.first, noFlyHours: noFlyHours, altitudeHours: altitudeHours)
@@ -163,7 +165,7 @@ final class PhoneStore: NSObject, WCSessionDelegate {
}
nonisolated func session(_ session: WCSession, didReceive file: WCSessionFile) {
- // Le fichier disparaît au retour de cette méthode : on le lit tout de suite.
+ // The file disappears when this method returns: read it right away.
guard file.metadata?[PhoneSync.kindKey] as? String == PhoneSync.diveKind,
let data = try? Data(contentsOf: file.fileURL),
let dive = try? PhoneSync.decoder.decode(DiveLog.self, from: data) else { return }
@@ -173,6 +175,6 @@ final class PhoneStore: NSObject, WCSessionDelegate {
nonisolated func sessionDidBecomeInactive(_ session: WCSession) {}
nonisolated func sessionDidDeactivate(_ session: WCSession) {
- session.activate() // changement de montre : on se reconnecte à la nouvelle
+ session.activate() // watch switched: reconnect to the new one
}
}
diff --git a/OpenRemoraWatch/Compass.swift b/OpenRemoraWatch/Compass.swift
@@ -1,23 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Observation
@preconcurrency import CoreLocation
import SwiftUI
-/// Boussole de la montre (magnétomètre, cap magnétique) et cap à suivre.
+/// Watch compass (magnetometer, magnetic heading) and bearing to follow.
@MainActor @Observable
final class Compass: NSObject, CLLocationManagerDelegate {
- /// Cap magnétique en degrés (0 = nord), nil tant que la montre n'en donne pas.
+ /// Magnetic heading in degrees (0 = north), nil until the watch provides one.
private(set) var heading: Double?
- /// Précision annoncée par la montre, en degrés (négative = calibrage nécessaire).
+ /// Accuracy reported by the watch, in degrees (negative = calibration needed).
private(set) var accuracy: Double?
- /// Cap à suivre, posé par le plongeur.
+ /// Bearing to follow, set by the diver.
var bearing: Double?
private let manager = CLLocationManager()
private var users = 0
static var isAvailable: Bool { CLLocationManager.headingAvailable() || isDemo }
- /// Captures d'écran (`-demo`) : cap fixe simulé, le simulateur n'a pas de boussole.
+ /// Screenshots (`-demo`): simulated fixed heading, the simulator has no compass.
static let isDemo = CommandLine.arguments.contains("-demo")
override init() {
@@ -31,7 +32,7 @@ final class Compass: NSObject, CLLocationManagerDelegate {
}
}
- /// Plusieurs vues peuvent la demander : elle tourne tant qu'au moins une est affichée.
+ /// Several views may ask for it: it runs as long as at least one is shown.
func start() {
users += 1
if users == 1, Self.isAvailable { manager.startUpdatingHeading() }
@@ -45,7 +46,7 @@ final class Compass: NSObject, CLLocationManagerDelegate {
func setBearing() { bearing = heading }
func clearBearing() { bearing = nil }
- /// Écart signé vers le cap (négatif = tourner à gauche), en degrés.
+ /// Signed offset to the bearing (negative = turn left), in degrees.
var offset: Double? {
guard let heading, let bearing else { return nil }
var d = (bearing - heading).truncatingRemainder(dividingBy: 360)
@@ -55,7 +56,8 @@ final class Compass: NSObject, CLLocationManagerDelegate {
}
static func cardinal(_ degrees: Double) -> String {
- let names = ["N", "NE", "E", "SE", "S", "SO", "O", "NO"]
+ let names = [String(localized: "N"), String(localized: "NE"), String(localized: "E"), String(localized: "SE"),
+ String(localized: "S"), String(localized: "SW"), String(localized: "W"), String(localized: "NW")]
return names[Int(((degrees + 22.5).truncatingRemainder(dividingBy: 360)) / 45) % 8]
}
@@ -71,7 +73,7 @@ final class Compass: NSObject, CLLocationManagerDelegate {
nonisolated func locationManagerShouldDisplayHeadingCalibration(_ manager: CLLocationManager) -> Bool { true }
}
-/// Rose des vents qui tourne avec la montre ; repère fixe en haut ; cap posé en orange.
+/// Compass rose that turns with the watch; fixed mark at the top; set bearing in orange.
struct CompassView: View {
@Environment(Compass.self) private var compass
var compact = false
@@ -79,11 +81,11 @@ struct CompassView: View {
var body: some View {
VStack(spacing: 2) {
if !Compass.isAvailable {
- Label("Pas de boussole sur cette montre", systemImage: "location.slash").font(.footnote)
+ Label("No compass on this watch", systemImage: "location.slash").font(.footnote)
} else if let heading = compass.heading {
ZStack {
Dial(bearing: compass.bearing).rotationEffect(.degrees(-heading))
- // Repère fixe : la direction de la montre.
+ // Fixed mark: the direction of the watch.
Triangle().fill(.red).frame(width: 12, height: 10).offset(y: compact ? -52 : -66)
VStack(spacing: 0) {
Text("\(Int(heading.rounded()) % 360)°")
@@ -96,17 +98,17 @@ struct CompassView: View {
if let offset = compass.offset, let bearing = compass.bearing {
HStack(spacing: 4) {
Image(systemName: abs(offset) < 5 ? "checkmark" : (offset < 0 ? "arrow.left" : "arrow.right"))
- Text("cap \(Int(bearing.rounded()) % 360)° · \(Int(abs(offset).rounded()))°")
+ Text("bearing \(Int(bearing.rounded()) % 360)° · \(Int(abs(offset).rounded()))°")
}
.font(.footnote.bold())
.foregroundStyle(abs(offset) < 5 ? .green : .orange)
}
if let accuracy = compass.accuracy, accuracy < 0 || accuracy > 20 {
- Text("Précision faible : faites un 8 avec le poignet").font(.caption2).foregroundStyle(.orange)
+ Text("Low accuracy: draw a figure 8 with your wrist").font(.caption2).foregroundStyle(.orange)
}
} else {
ProgressView()
- Text("Boussole…").font(.footnote).foregroundStyle(.secondary)
+ Text("Compass…").font(.footnote).foregroundStyle(.secondary)
}
}
.onAppear { compass.start() }
@@ -130,10 +132,11 @@ private struct Dial: View {
tick.addLine(to: CGPoint(x: c.x + r * cos(a), y: c.y + r * sin(a)))
context.stroke(tick, with: .color(i == 0 ? .red : .gray), lineWidth: long ? 2.5 : 1)
}
- for (label, deg) in [("N", 0.0), ("E", 90.0), ("S", 180.0), ("O", 270.0)] {
+ for (label, deg) in [(String(localized: "N"), 0.0), (String(localized: "E"), 90.0),
+ (String(localized: "S"), 180.0), (String(localized: "W"), 270.0)] {
let a = Angle.degrees(deg - 90).radians
let p = CGPoint(x: c.x + (r - 22) * cos(a), y: c.y + (r - 22) * sin(a))
- context.draw(Text(label).font(.system(size: 11, weight: .bold)).foregroundColor(label == "N" ? .red : .white), at: p)
+ context.draw(Text(label).font(.system(size: 11, weight: .bold)).foregroundColor(deg == 0 ? .red : .white), at: p)
}
if let bearing {
let a = Angle.degrees(bearing - 90).radians
@@ -155,7 +158,7 @@ private struct Triangle: Shape {
}
}
-/// Boussole seule, depuis l'accueil (à terre ou en surface, l'écran tactile marche : on pose le cap au toucher).
+/// Compass alone, from the home screen (on land or at the surface the touch screen works: the bearing is set by touch).
struct CompassScreen: View {
@Environment(Compass.self) private var compass
@@ -165,18 +168,18 @@ struct CompassScreen: View {
CompassView()
if compass.heading != nil {
if compass.bearing == nil {
- Button("Fixer le cap") { compass.setBearing() }.tint(.orange)
+ Button("Set bearing") { compass.setBearing() }.tint(.orange)
} else {
HStack {
- Button("Nouveau cap") { compass.setBearing() }.tint(.orange)
- Button("Effacer") { compass.clearBearing() }
+ Button("New bearing") { compass.setBearing() }.tint(.orange)
+ Button("Clear") { compass.clearBearing() }
}
}
}
- Text("Le cap posé ici reste affiché pendant la plongée (page boussole, deux crans de couronne).")
+ Text("The bearing set here stays displayed during the dive (compass page, two crown clicks).")
.font(.caption2).foregroundStyle(.secondary).multilineTextAlignment(.center)
}
}
- .navigationTitle("Boussole")
+ .navigationTitle("Compass")
}
}
diff --git a/OpenRemoraWatch/DiveDetailView.swift b/OpenRemoraWatch/DiveDetailView.swift
@@ -1,8 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
import SwiftUI
import Charts
import RemoraDeco
-/// Résumé d'une plongée : le profil en premier, on le touche pour le parcourir à la couronne.
+/// Dive summary: the profile first, tap it to browse it with the crown.
struct DiveDetailView: View {
let dive: DiveLog
@AppStorage(PhoneLink.deliveredKey) private var delivered = ""
@@ -13,7 +14,7 @@ struct DiveDetailView: View {
NavigationLink { ProfileView(dive: dive) } label: {
VStack(alignment: .leading, spacing: 4) {
ProfileChart(dive: dive, cursor: nil).frame(height: 70)
- Text("Toucher pour parcourir le profil").font(.caption2).foregroundStyle(.secondary)
+ Text("Tap to browse the profile").font(.caption2).foregroundStyle(.secondary)
}
}
}
@@ -21,26 +22,26 @@ struct DiveDetailView: View {
if dive.source == .remora {
Section {
if delivered.contains(dive.id.uuidString) {
- Label("Sur l'iPhone", systemImage: "checkmark.circle.fill").foregroundStyle(.green)
+ Label("On the iPhone", systemImage: "checkmark.circle.fill").foregroundStyle(.green)
} else {
- Label("En attente de l'iPhone", systemImage: "iphone.slash").foregroundStyle(.orange)
+ Label("Waiting for the iPhone", systemImage: "iphone.slash").foregroundStyle(.orange)
}
} footer: {
- Text("De là, elle passe dans Sub Rascasse.")
+ Text("From there, it goes to Sub Rascasse.")
}
}
Section {
- row("Profondeur max", "\(Format.depth(dive.maxDepth)) m")
- row("Durée", Format.clock(dive.duration))
- row("Profondeur moyenne", "\(Format.depth(dive.averageDepth)) m")
- if let t = dive.minTemperature { row("Eau au plus froid", "\(Int(t.rounded())) °C") }
- row("Mélange", dive.gas.description)
- row("Paliers obligatoires", dive.hadDecompression ? "Oui" : "Non")
- if let si = dive.surfaceIntervalBefore { row("Intervalle de surface", Format.clock(si * 60)) }
+ row("Max depth", "\(Format.depth(dive.maxDepth)) m")
+ row("Duration", Format.clock(dive.duration))
+ row("Average depth", "\(Format.depth(dive.averageDepth)) m")
+ if let t = dive.minTemperature { row("Coldest water", "\(Int(t.rounded())) °C") }
+ row("Gas", dive.gas.description)
+ row("Mandatory stops", dive.hadDecompression ? String(localized: "Yes") : String(localized: "No"))
+ if let si = dive.surfaceIntervalBefore { row("Surface interval", Format.clock(si * 60)) }
}
- Section(dive.events.isEmpty ? "Aucune alarme" : "Alarmes") {
+ Section(dive.events.isEmpty ? "No alarms" : "Alarms") {
ForEach(Array(dive.events.enumerated()), id: \.offset) { _, event in
HStack {
Image(systemName: event.warning.isViolation ? "exclamationmark.triangle.fill" : "exclamationmark.circle")
@@ -53,17 +54,17 @@ struct DiveDetailView: View {
}
Section {
- row("Début", Format.dayTime(dive.start))
+ row("Start", Format.dayTime(dive.start))
if let site = dive.site { row("Site", site) }
- if let gf = dive.gradientFactors { row("Prudence", gf.description) }
- row("Eau", dive.water.label)
- if let model = dive.computerModel { row("Ordinateur", model) }
+ if let gf = dive.gradientFactors { row("Conservatism", gf.description) }
+ row("Water", dive.water.label)
+ if let model = dive.computerModel { row("Computer", model) }
}
}
- .navigationTitle("Plongée \(dive.number)")
+ .navigationTitle("Dive \(dive.number)")
}
- private func row(_ title: String, _ value: String) -> some View {
+ private func row(_ title: LocalizedStringKey, _ value: String) -> some View {
VStack(alignment: .leading, spacing: 0) {
Text(title).font(.caption2).foregroundStyle(.secondary)
Text(value).font(.body)
@@ -71,7 +72,7 @@ struct DiveDetailView: View {
}
}
-/// Profil en plein écran : la couronne déplace le curseur le long de la plongée.
+/// Full-screen profile: the crown moves the cursor along the dive.
struct ProfileView: View {
let dive: DiveLog
@State private var position = 0.0
@@ -98,12 +99,12 @@ struct ProfileView: View {
by: 1, sensitivity: .high, isContinuous: false, isHapticFeedbackEnabled: false)
.onAppear {
focused = true
- // Ouvrir sur le point le plus profond.
+ // Open on the deepest point.
if let deepest = dive.samples.indices.max(by: { dive.samples[$0].depth < dive.samples[$1].depth }) {
position = Double(deepest)
}
}
- .navigationTitle("Profil")
+ .navigationTitle("Profile")
}
private func event(at sample: DiveSample) -> DiveEvent? {
@@ -115,7 +116,7 @@ struct ProfileView: View {
var parts: [String] = []
if let t = s.temperature { parts.append("\(Int(t.rounded())) °C") }
if let stop = s.stopDepth, let minutes = s.stopMinutes {
- parts.append("palier \(Int(stop)) m · \(minutes) min")
+ parts.append(String(localized: "stop \(Int(stop)) m · \(minutes) min"))
} else if dive.source != .subsurface || s.noDecompressionLimit != nil {
parts.append("NDL \(Format.ndl(s.noDecompressionLimit)) min")
}
@@ -128,12 +129,12 @@ struct ProfileView: View {
}
}
-/// Le graphe : profondeur (vers le bas), plafond de décompression, alarmes.
+/// The chart: depth (downwards), decompression ceiling, alarms.
struct ProfileChart: View {
let dive: DiveLog
let cursor: DiveSample?
- /// Au plus ~150 points pour le tracé.
+ /// At most ~150 points for the plot.
private var points: [DiveSample] {
let step = max(1, dive.samples.count / 150)
var out = stride(from: 0, to: dive.samples.count, by: step).map { dive.samples[$0] }
@@ -148,30 +149,30 @@ struct ProfileChart: View {
var body: some View {
Chart {
ForEach(points, id: \.time) { s in
- AreaMark(x: .value("Temps", s.time / 60), y: .value("Profondeur", s.depth))
+ AreaMark(x: .value("Time", s.time / 60), y: .value("Depth", s.depth))
.foregroundStyle(.linearGradient(colors: [.cyan.opacity(0.25), .blue.opacity(0.6)],
startPoint: .top, endPoint: .bottom))
- LineMark(x: .value("Temps", s.time / 60), y: .value("Profondeur", s.depth),
- series: .value("Série", "profondeur"))
+ LineMark(x: .value("Time", s.time / 60), y: .value("Depth", s.depth),
+ series: .value("Series", "depth"))
.foregroundStyle(.cyan)
.lineStyle(StrokeStyle(lineWidth: 1.5))
}
if dive.hadDecompression {
ForEach(points, id: \.time) { s in
- LineMark(x: .value("Temps", s.time / 60), y: .value("Plafond", s.ceiling),
- series: .value("Série", "plafond"))
+ LineMark(x: .value("Time", s.time / 60), y: .value("Ceiling", s.ceiling),
+ series: .value("Series", "ceiling"))
.foregroundStyle(.orange)
.lineStyle(StrokeStyle(lineWidth: 1, dash: [3, 2]))
}
}
ForEach(Array(dive.events.enumerated()), id: \.offset) { _, e in
- PointMark(x: .value("Temps", e.time / 60), y: .value("Profondeur", depth(at: e.time)))
+ PointMark(x: .value("Time", e.time / 60), y: .value("Depth", depth(at: e.time)))
.foregroundStyle(e.warning.color)
.symbolSize(30)
}
if let cursor {
- RuleMark(x: .value("Temps", cursor.time / 60)).foregroundStyle(.white.opacity(0.7))
- PointMark(x: .value("Temps", cursor.time / 60), y: .value("Profondeur", cursor.depth))
+ RuleMark(x: .value("Time", cursor.time / 60)).foregroundStyle(.white.opacity(0.7))
+ PointMark(x: .value("Time", cursor.time / 60), y: .value("Depth", cursor.depth))
.foregroundStyle(.white)
}
}
diff --git a/OpenRemoraWatch/DiveIntents.swift b/OpenRemoraWatch/DiveIntents.swift
@@ -1,10 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
import AppIntents
-/// Bouton Action de l'Apple Watch Ultra (Réglages > Bouton Action > Plongée > Open Rémora).
-/// Première pression : lance l'app et fait « Prêt à plonger ». Pressions suivantes, y compris sous l'eau
-/// où l'écran tactile est verrouillé : `DiveActionIntent`.
+/// Action button of the Apple Watch Ultra (Settings > Action Button > Dive > Open Rémora).
+/// First press: launches the app and does "Ready to dive". Following presses, including underwater
+/// where the touch screen is locked: `DiveActionIntent`.
struct StartDiveSessionIntent: StartDiveIntent {
- static let title: LocalizedStringResource = "Prêt à plonger"
+ static let title: LocalizedStringResource = "Ready to dive"
@MainActor
func perform() async throws -> some IntentResult {
@@ -13,9 +14,9 @@ struct StartDiveSessionIntent: StartDiveIntent {
}
}
-/// Pression du bouton Action pendant la séance de plongée.
+/// Action button press during the dive session.
struct DiveActionIntent: AppIntent {
- static let title: LocalizedStringResource = "Action de plongée"
+ static let title: LocalizedStringResource = "Dive action"
@MainActor
func perform() async throws -> some IntentResult {
@@ -25,8 +26,8 @@ struct DiveActionIntent: AppIntent {
}
enum ActionButton {
- /// Séance démarrée depuis l'écran (pas depuis le bouton Action) : on donne quand même l'action suivante
- /// au système, pour que le bouton Action arrive à l'app pendant la plongée.
+ /// Session started from the screen (not from the Action button): the next action is still donated
+ /// to the system, so that the Action button reaches the app during the dive.
static func offerNextAction() async -> String? {
do {
try await StartDiveSessionIntent().donate(result: .result(actionButtonIntent: DiveActionIntent()))
diff --git a/OpenRemoraWatch/DiveRuntime.swift b/OpenRemoraWatch/DiveRuntime.swift
@@ -1,14 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import WatchKit
-/// Session de plongée d'Apple (`WKExtendedRuntimeSession`, mode `underwater-depth`) : garde l'app au premier
-/// plan pendant toute la plongée et verrouille l'écran tactile (Water Lock, « mode immergé »). Le plongeur en
-/// sort par un appui long sur la couronne, ce qui termine la session ; elle expire aussi après 10 min hors de
-/// l'eau. Si l'app n'en démarre pas, le système en démarre une sous 1 m et la passe au délégué de l'app.
+/// Apple's dive session (`WKExtendedRuntimeSession`, `underwater-depth` mode): keeps the app in the
+/// foreground for the whole dive and locks the touch screen (Water Lock). The diver leaves it with a long
+/// press on the crown, which ends the session; it also expires after 10 min out of the water. When the app
+/// does not start one, the system starts one below 1 m and hands it to the app delegate.
@MainActor
final class DiveRuntime: NSObject, @preconcurrency WKExtendedRuntimeSessionDelegate {
private var session: WKExtendedRuntimeSession?
- /// Changement d'état (true = session en cours, donc écran verrouillé), avec un texte pour le diagnostic.
+ /// State change (true = session running, hence screen locked), with a text for the diagnostics.
var onChange: ((Bool, String) -> Void)?
var isRunning: Bool { session?.state == .running }
@@ -19,14 +20,14 @@ final class DiveRuntime: NSObject, @preconcurrency WKExtendedRuntimeSessionDeleg
session.delegate = self
self.session = session
session.start()
- onChange?(false, "demandée")
+ onChange?(false, String(localized: "requested"))
}
- /// Session démarrée par le système à l'immersion.
+ /// Session started by the system on submersion.
func adopt(_ session: WKExtendedRuntimeSession) {
session.delegate = self
self.session = session
- onChange?(session.state == .running, "démarrée par le système")
+ onChange?(session.state == .running, String(localized: "started by the system"))
}
func stop() {
@@ -35,11 +36,11 @@ final class DiveRuntime: NSObject, @preconcurrency WKExtendedRuntimeSessionDeleg
}
func extendedRuntimeSessionDidStart(_ extendedRuntimeSession: WKExtendedRuntimeSession) {
- onChange?(true, "en cours")
+ onChange?(true, String(localized: "running"))
}
func extendedRuntimeSessionWillExpire(_ extendedRuntimeSession: WKExtendedRuntimeSession) {
- onChange?(true, "va expirer")
+ onChange?(true, String(localized: "about to expire"))
}
func extendedRuntimeSession(_ extendedRuntimeSession: WKExtendedRuntimeSession,
@@ -49,19 +50,19 @@ final class DiveRuntime: NSObject, @preconcurrency WKExtendedRuntimeSessionDeleg
session = nil
let why: String
switch reason {
- case .none: why = "terminée"
- case .sessionInProgress: why = "refusée : une autre session tourne"
- case .expired: why = "expirée"
- case .resignedFrontmost: why = "terminée : l'app a quitté le premier plan"
- case .suppressedBySystem: why = "refusée par le système"
- case .error: why = "erreur"
- @unknown default: why = "terminée (raison \(reason.rawValue))"
+ case .none: why = String(localized: "ended")
+ case .sessionInProgress: why = String(localized: "refused: another session is running")
+ case .expired: why = String(localized: "expired")
+ case .resignedFrontmost: why = String(localized: "ended: the app left the foreground")
+ case .suppressedBySystem: why = String(localized: "refused by the system")
+ case .error: why = String(localized: "error")
+ @unknown default: why = String(localized: "ended (reason \(reason.rawValue))")
}
onChange?(false, error.map { "\(why) (\($0.localizedDescription))" } ?? why)
}
}
-/// Reçoit la session que le système démarre seul quand la montre passe sous 1 m.
+/// Receives the session the system starts by itself when the watch goes below 1 m.
final class AppDelegate: NSObject, WKApplicationDelegate {
func handle(_ extendedRuntimeSession: WKExtendedRuntimeSession) {
Task { @MainActor in DiveSession.current?.runtime.adopt(extendedRuntimeSession) }
diff --git a/OpenRemoraWatch/DiveSession.swift b/OpenRemoraWatch/DiveSession.swift
@@ -1,22 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Observation
import WatchKit
import RemoraDeco
-/// La plongée en cours : reçoit les mesures (capteur ou simulation), tient l'ordinateur et les alarmes.
+/// The dive in progress: receives the readings (sensor or simulation), runs the computer and the alarms.
@MainActor @Observable
final class DiveSession {
private(set) var isDiving = false
- /// « Prêt à plonger » : la séance d'entraînement tourne, l'app reste active jusqu'à l'immersion.
+ /// "Ready to dive": the workout session is running, the app stays active until submersion.
private(set) var isReady = false
private(set) var isSimulation = false
private(set) var status: DiveComputer.Status?
private(set) var temperature: Double?
private(set) var sensorMessage: String?
- /// Sous l'eau sans mesure de profondeur (limite du capteur dépassée, erreur, silence) : l'ordinateur
- /// suppose qu'on reste à la dernière profondeur connue et le dit en grand.
+ /// Underwater without a depth reading (sensor limit exceeded, error, silence): the computer assumes
+ /// the diver stays at the last known depth and says so in large type.
private(set) var depthUnknown = false
- /// Plongée qui vient de se terminer : l'écran d'accueil ouvre son résumé.
+ /// Dive that just ended: the home screen opens its summary.
var finishedDive: DiveLog?
private let store: LogStore
@@ -34,28 +35,28 @@ final class DiveSession {
private var lastHaptic: [DiveComputer.Warning: Date] = [:]
private var lastAlarmHaptic: Date?
- /// Alarme en cours : une violation, ou la profondeur inconnue. L'écran entier clignote en rouge.
+ /// Alarm in progress: a violation, or depth unknown. The whole screen flashes red.
var isAlarming: Bool { depthUnknown || warnings.contains(where: \.isViolation) || Self.forcedAlarm }
- /// Captures d'écran seulement (`-testAlarm`).
+ /// Screenshots only (`-testAlarm`).
private static let forcedAlarm = CommandLine.arguments.contains("-testAlarm")
- /// Avertissements en cours (sans les violations) : seule la valeur concernée clignote.
+ /// Warnings in progress (violations excluded): only the value concerned blinks.
var activeWarnings: Set<DiveComputer.Warning> { warnings.filter { !$0.isViolation } }
let workout = DiveWorkout()
- /// Session de plongée d'Apple : app au premier plan et écran tactile verrouillé.
+ /// Apple's dive session: app in the foreground and touch screen locked.
let runtime = DiveRuntime()
- /// Écran tactile verrouillé par la session de plongée (appui long sur la couronne pour en sortir).
+ /// Touch screen locked by the dive session (long press on the crown to leave it).
private(set) var screenLocked = false
- /// Page de l'écran de plongée (0 principale, 1 détails, 2 boussole) : couronne ou bouton Action.
+ /// Page of the dive screen (0 main, 1 details, 2 compass): crown or Action button.
var divePage = 0
- /// Bandeau affiché quelques secondes après une pression du bouton Action.
+ /// Banner shown for a few seconds after an Action button press.
private(set) var actionMessage: String?
private var actionMessageTask: Task<Void, Never>?
- /// Boussole (le bouton Action y fixe le cap).
+ /// Compass (the Action button sets the bearing there).
var compass: Compass?
let diagnostics = Diagnostics()
- /// La session de l'app, pour les intentions du bouton Action et le délégué de l'app.
+ /// The session of the app, for the Action button intents and the app delegate.
static weak var current: DiveSession?
- /// Appelé après chaque plongée enregistrée (envoi vers l'iPhone).
+ /// Called after every saved dive (sending to the iPhone).
var onDiveSaved: (() -> Void)?
init(store: LogStore) {
@@ -67,14 +68,14 @@ final class DiveSession {
}
}
- /// Niveau de batterie (0 à 1) ; nil si inconnu.
+ /// Battery level (0 to 1); nil when unknown.
var batteryLevel: Double? {
let device = WKInterfaceDevice.current()
device.isBatteryMonitoringEnabled = true
return device.batteryLevel >= 0 ? Double(device.batteryLevel) : nil
}
- /// Avant la mise à l'eau : démarre la séance « plongée » pour que l'app reste au premier plan.
+ /// Before getting in the water: starts the diving workout so that the app stays in the foreground.
func getReady() {
guard !isDiving, !isReady else { return }
isReady = true
@@ -83,26 +84,26 @@ final class DiveSession {
startDiveSession()
}
- /// Session de plongée d'Apple (écran verrouillé) et bouton Action branché sur l'app.
+ /// Apple's dive session (screen locked) and Action button wired to the app.
private func startDiveSession() {
guard SubmersionSource.isAvailable else { return }
runtime.start()
Task { [diagnostics] in
- diagnostics.donation = await ActionButton.offerNextAction() ?? "donnée"
+ diagnostics.donation = await ActionButton.offerNextAction() ?? String(localized: "donated")
}
}
- /// Bouton Action pendant la séance. Sur la page boussole : fixe le cap ; ailleurs : page suivante.
- /// Chaque pression vibre, s'affiche et est comptée (essai : le bouton arrive-t-il à l'app sous l'eau ?).
+ /// Action button during the session. On the compass page: sets the bearing; elsewhere: next page.
+ /// Every press vibrates, is displayed and is counted (trial: does the button reach the app underwater?).
func actionPressed() {
guard isReady || isDiving else { return }
WKInterfaceDevice.current().play(.click)
diagnostics.notePress(depth: isDiving ? status?.depth : nil)
- var text = "BOUTON ACTION \(diagnostics.presses)"
+ var text = String(localized: "ACTION BUTTON \(diagnostics.presses)")
if isDiving {
if divePage == 2, let compass, let heading = compass.heading {
compass.setBearing()
- text = "CAP FIXÉ \(Int(heading.rounded()) % 360)°"
+ text = String(localized: "BEARING SET \(Int(heading.rounded()) % 360)°")
} else {
divePage = (divePage + 1) % 3
}
@@ -124,7 +125,7 @@ final class DiveSession {
var sensorAvailable: Bool { SubmersionSource.isAvailable }
- /// Écoute le capteur : la plongée démarre seule à l'immersion.
+ /// Listens to the sensor: the dive starts by itself on submersion.
func listen() {
guard sensor == nil, SubmersionSource.isAvailable else { return }
sensor = SubmersionSource { [weak self] reading in self?.handle(reading) }
@@ -137,7 +138,7 @@ final class DiveSession {
case .pressure(let time, let surface, let absolute, let submerged):
guard !isSimulation else { return }
if !isDiving {
- guard let absolute, absolute > surface + 0.03 else { return } // ≈ 30 cm d'eau
+ guard let absolute, absolute > surface + 0.03 else { return } // ≈ 30 cm of water
start(surfacePressure: surface, simulation: false)
}
lastReadingAt = Date()
@@ -146,8 +147,8 @@ final class DiveSession {
lastPressure = absolute
ingest(time: time, pressure: absolute)
} else if submerged, let held = lastPressure {
- // Sous l'eau sans mesure : on reste à la dernière profondeur connue (les tissus continuent
- // de se charger), jamais un faux retour en surface.
+ // Underwater without a reading: stay at the last known depth (tissues keep loading),
+ // never a false return to the surface.
signalDepthUnknown()
ingest(time: time, pressure: held)
} else {
@@ -163,9 +164,9 @@ final class DiveSession {
depthUnknown = true
}
- /// Plongée réelle : si le capteur se tait plus de 5 s, on avance quand même le temps.
- /// Près de la surface, on considère qu'on est sorti (la plongée se termine après une minute) ;
- /// plus profond, on reste à la dernière profondeur connue et on le signale.
+ /// Real dive: when the sensor is silent for more than 5 s, time still moves forward.
+ /// Near the surface, the diver is considered out (the dive ends after one minute);
+ /// deeper, the last known depth is held and this is signalled.
private func startWatchdog() {
watchdog?.cancel()
watchdog = Task { [weak self] in
@@ -174,7 +175,7 @@ final class DiveSession {
guard let self, self.isDiving, !self.isSimulation else { return }
guard let last = self.lastReadingAt, Date().timeIntervalSince(last) > 5,
let held = self.lastPressure else { continue }
- let shallow = held < self.surfacePressure + 0.15 // ≈ 1,5 m
+ let shallow = held < self.surfacePressure + 0.15 // ≈ 1.5 m
if !shallow { self.signalDepthUnknown() }
self.ingest(time: Date().timeIntervalSinceReferenceDate,
pressure: shallow ? self.surfacePressure : held)
@@ -188,7 +189,7 @@ final class DiveSession {
start: Date(), logbook: store.logbook)
isSimulation = simulation
isDiving = true
- // Plongée réelle sans « Prêt à plonger » : la séance démarre à l'immersion.
+ // Real dive without "Ready to dive": the session starts on submersion.
if !simulation, !isReady {
diagnostics.reset()
workout.start()
@@ -216,7 +217,7 @@ final class DiveSession {
recorder = r
status = s
- // Palier de sécurité : une vibration au début et à la fin du compte à rebours.
+ // Safety stop: one vibration at the start and at the end of the countdown.
switch (safetyStop, s.safetyStop) {
case (.pending, .running), (.notRequired, .running): WKInterfaceDevice.current().play(.start)
case (.running, .done): WKInterfaceDevice.current().play(.success)
@@ -224,9 +225,9 @@ final class DiveSession {
}
safetyStop = s.safetyStop
- // Vibrations (horloge réelle, pas celle de la plongée).
- // Alarme (violation, profondeur inconnue) : vibration forte toutes les 2 s tant qu'elle dure.
- // Avertissement : une vibration à l'apparition, rappelée toutes les 15 s tant qu'il dure.
+ // Vibrations (wall clock, not the dive clock).
+ // Alarm (violation, depth unknown): strong vibration every 2 s for as long as it lasts.
+ // Warning: one vibration when it appears, repeated every 15 s for as long as it lasts.
let now = Date()
warnings = s.warnings
if isAlarming {
@@ -242,10 +243,10 @@ final class DiveSession {
WKInterfaceDevice.current().play(.notification)
}
}
- // Un avertissement disparu puis revenu vibre de nouveau, mais pas plus d'une fois toutes les 15 s.
+ // A warning that went away and came back vibrates again, but no more than once every 15 s.
lastHaptic = lastHaptic.filter { now.timeIntervalSince($0.value) < 15 || s.warnings.contains($0.key) }
- // Fin automatique : une minute en surface après être descendu sous 1 m.
+ // Automatic end: one minute at the surface after going below 1 m.
if s.depth > 1 { wentUnder = true }
if s.depth < 0.3 {
if surfacedAt == nil { surfacedAt = time }
@@ -255,7 +256,7 @@ final class DiveSession {
}
}
- /// Termine la plongée et l'ajoute au carnet (rien n'est gardé si on n'est jamais descendu).
+ /// Ends the dive and adds it to the logbook (nothing is kept when the diver never went down).
func end() {
simulation?.cancel()
simulation = nil
@@ -273,7 +274,7 @@ final class DiveSession {
var dive = r.finish()
if isSimulation {
dive.source = .simulation
- dive.site = "Démonstration"
+ dive.site = String(localized: "Demo")
}
let saved = store.add(dive)
finishedDive = saved
@@ -282,7 +283,7 @@ final class DiveSession {
onDiveSaved?()
}
- /// Plongée de démonstration à sec, accélérée.
+ /// Dry demo dive, accelerated.
func startSimulation(_ profile: DemoProfile = .reef, speed: Double = 30) {
guard !isDiving, !isReady else { return }
start(surfacePressure: standardSurfacePressure, simulation: true)
@@ -299,8 +300,8 @@ final class DiveSession {
}
}
-/// Ce qu'on veut savoir après un essai dans l'eau : le bouton Action est-il arrivé à l'app, et la session de
-/// plongée d'Apple (écran verrouillé) a-t-elle tourné. Gardé d'un lancement à l'autre.
+/// What we want to know after a trial in the water: did the Action button reach the app, and did Apple's
+/// dive session (screen locked) run. Kept from one launch to the next (the texts are stored as displayed).
@MainActor @Observable
final class Diagnostics {
private let defaults = UserDefaults.standard
@@ -313,8 +314,8 @@ final class Diagnostics {
init() {
presses = defaults.integer(forKey: "diag.presses")
deepestPress = defaults.object(forKey: "diag.deepest") as? Double
- runtime = defaults.string(forKey: "diag.runtime") ?? "jamais demandée"
- donation = defaults.string(forKey: "diag.donation") ?? "jamais donnée"
+ runtime = defaults.string(forKey: "diag.runtime") ?? String(localized: "never requested")
+ donation = defaults.string(forKey: "diag.donation") ?? String(localized: "never donated")
startedAt = defaults.object(forKey: "diag.start") as? Date
}
diff --git a/OpenRemoraWatch/DiveView.swift b/OpenRemoraWatch/DiveView.swift
@@ -1,10 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
import SwiftUI
import RemoraDeco
-/// Écran de plongée. Sous l'eau l'écran tactile est verrouillé : on passe d'une page à l'autre à la couronne.
-/// Page 1 : profondeur, vitesse de remontée, NDL ou palier ; page 2 : détails ; page 3 : boussole.
-/// Poignet baissé (luminosité réduite) : seulement la profondeur et le NDL ou le palier, en très gros.
-/// Alarme : tout l'écran clignote en rouge ; avertissement : seule la valeur concernée clignote.
+/// Dive screen. Underwater the touch screen is locked: the crown moves from one page to the next.
+/// Page 1: depth, ascent rate, NDL or stop; page 2: details; page 3: compass.
+/// Wrist down (reduced luminance): only the depth and the NDL or the stop, in very large type.
+/// Alarm: the whole screen flashes red; warning: only the value concerned blinks.
struct DiveView: View {
@Environment(DiveSession.self) private var session
@Environment(\.isLuminanceReduced) private var dimmed
@@ -27,12 +28,12 @@ struct DiveView: View {
.background { if session.isAlarming && !dimmed { AlarmFlash() } }
.toolbar {
ToolbarItem(placement: .cancellationAction) {
- Button("Fin", role: .destructive) { session.end() }
+ Button("End", role: .destructive) { session.end() }
}
}
.overlay(alignment: .bottom) {
if session.depthUnknown {
- Text("PROFONDEUR INCONNUE\nSuivez votre ordinateur principal")
+ Text("DEPTH UNKNOWN\nFollow your primary computer")
.font(.system(size: 13, weight: .heavy, design: .rounded))
.multilineTextAlignment(.center)
.padding(6)
@@ -57,7 +58,7 @@ struct DiveView: View {
}
-/// Alarme : tout l'écran clignote en rouge.
+/// Alarm: the whole screen flashes red.
private struct AlarmFlash: View {
var body: some View {
TimelineView(.periodic(from: .now, by: 0.4)) { context in
@@ -68,7 +69,7 @@ private struct AlarmFlash: View {
}
extension View {
- /// Avertissement : la valeur concernée clignote (rien ne bouge si `active` est faux).
+ /// Warning: the value concerned blinks (nothing moves when `active` is false).
@ViewBuilder func blinking(_ active: Bool) -> some View {
if active {
TimelineView(.periodic(from: .now, by: 0.4)) { context in
@@ -130,7 +131,7 @@ private struct MainDivePage: View {
}
}
-/// Ce qu'il faut faire maintenant : alarme, palier (compte à rebours), palier de sécurité, ou sans palier.
+/// What to do now: alarm, stop (countdown), safety stop, or no-stop.
private struct Instruction: View {
let status: DiveComputer.Status
@@ -147,17 +148,17 @@ private struct Instruction: View {
}
if let stop = s.plan.stops.first {
HStack(alignment: .firstTextBaseline, spacing: 4) {
- Text("PALIER \(Int(stop.depth)) m")
+ Text("STOP \(Int(stop.depth)) m")
.font(.system(size: 16, weight: .bold, design: .rounded))
Text(Format.clock(Double(stop.seconds ?? stop.minutes * 60)))
.font(.system(size: 22, weight: .bold, design: .rounded))
.monospacedDigit()
}
.foregroundStyle(.orange)
- Text("surface dans \(Int(s.plan.timeToSurface.rounded(.up))) min")
+ Text("surface in \(Int(s.plan.timeToSurface.rounded(.up))) min")
.font(.caption2).foregroundStyle(.secondary)
} else if case .running(let remaining) = s.safetyStop {
- Text("PALIER DE SÉCURITÉ").font(.system(size: 12, weight: .bold, design: .rounded)).foregroundStyle(.cyan)
+ Text("SAFETY STOP").font(.system(size: 12, weight: .bold, design: .rounded)).foregroundStyle(.cyan)
Text(Format.clock(remaining))
.font(.system(size: 26, weight: .bold, design: .rounded))
.monospacedDigit()
@@ -175,9 +176,9 @@ private struct Instruction: View {
}
switch s.safetyStop {
case .pending where s.depth < 9:
- Text("Palier de sécurité 3 min à 5 m").font(.caption2).foregroundStyle(.cyan)
+ Text("Safety stop 3 min at 5 m").font(.caption2).foregroundStyle(.cyan)
case .done:
- Text("Palier de sécurité fait ✓").font(.caption2).foregroundStyle(.green)
+ Text("Safety stop done ✓").font(.caption2).foregroundStyle(.green)
default:
EmptyView()
}
@@ -186,8 +187,8 @@ private struct Instruction: View {
}
}
-/// Échelle verticale de vitesse de remontée : 5 segments (3, 6, 9, 10, 12 m/min) qui se remplissent du bas ;
-/// vert, jaune au-delà de 10 m/min, rouge au-delà de 12.
+/// Vertical ascent rate scale: 5 segments (3, 6, 9, 10, 12 m/min) that fill from the bottom;
+/// green, yellow above 10 m/min, red above 12.
struct AscentScale: View {
let rate: Double
static let thresholds: [Double] = [3, 6, 9, 10, 12]
@@ -201,7 +202,7 @@ struct AscentScale: View {
.frame(width: 10, height: i >= 3 ? 14 : 10)
}
}
- .accessibilityLabel("Remontée \(Int(max(0, rate))) mètres par minute")
+ .accessibilityLabel("Ascent \(Int(max(0, rate))) metres per minute")
}
private var color: Color { rate > 12 ? .red : rate > 10 ? .yellow : .green }
@@ -222,23 +223,23 @@ private struct DetailsDivePage: View {
cell("Surface", "\(Int((s?.plan.timeToSurface ?? 0).rounded(.up))) min")
}
GridRow {
- cell("ppO2", String(format: "%.2f", s?.ppO2 ?? 0).replacingOccurrences(of: ".", with: ","),
+ cell("ppO2", Format.decimal(s?.ppO2 ?? 0, digits: 2),
color: (s?.ppO2 ?? 0) > store.settings.ppO2Max ? .orange : .primary)
- cell("Mélange", store.settings.gas.description)
+ cell("Gas", store.settings.gas.description)
}
GridRow {
- cell("Heure", Date().formatted(date: .omitted, time: .shortened))
+ cell("Clock", Date().formatted(date: .omitted, time: .shortened))
if let level = session.batteryLevel {
- cell("Batterie", "\(Int((level * 100).rounded())) %", color: level < 0.3 ? .red : .primary)
+ cell("Battery", Format.percent(Int((level * 100).rounded())), color: level < 0.3 ? .red : .primary)
} else {
- cell("Prudence", store.settings.gradientFactors.description)
+ cell("Conservatism", store.settings.gradientFactors.description)
}
}
}
.padding(.horizontal, 6)
}
- private func cell(_ title: String, _ value: String, color: Color = .primary) -> some View {
+ private func cell(_ title: LocalizedStringKey, _ value: String, color: Color = .primary) -> some View {
VStack(spacing: 0) {
Text(title).font(.caption2).foregroundStyle(.secondary)
Text(value).font(.system(size: 20, weight: .semibold, design: .rounded)).monospacedDigit()
@@ -248,7 +249,7 @@ private struct DetailsDivePage: View {
}
}
-// MARK: - Poignet baissé
+// MARK: - Wrist down
private struct DimmedDivePage: View {
let status: DiveComputer.Status?
@@ -264,10 +265,10 @@ private struct DimmedDivePage: View {
}
if let s {
if let stop = s.plan.stops.first {
- Text("PALIER \(Int(stop.depth)) m · \(Format.clock(Double(stop.seconds ?? stop.minutes * 60)))")
+ Text("STOP \(Int(stop.depth)) m · \(Format.clock(Double(stop.seconds ?? stop.minutes * 60)))")
.font(.system(size: 20, weight: .bold, design: .rounded))
} else if case .running(let remaining) = s.safetyStop {
- Text("SÉCURITÉ \(Format.clock(remaining))").font(.system(size: 20, weight: .bold, design: .rounded))
+ Text("SAFETY \(Format.clock(remaining))").font(.system(size: 20, weight: .bold, design: .rounded))
} else {
Text("NDL \(Format.ndl(s.plan.noDecompressionLimit)) min")
.font(.system(size: 20, weight: .bold, design: .rounded))
diff --git a/OpenRemoraWatch/DiveWorkout.swift b/OpenRemoraWatch/DiveWorkout.swift
@@ -1,10 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
@preconcurrency import HealthKit
import RemoraDeco
-/// Séance d'entraînement « plongée » (HealthKit). Deux rôles :
-/// 1. garder l'app au premier plan et active pendant toute la plongée (sans séance, watchOS peut la suspendre) ;
-/// 2. enregistrer la plongée dans Santé, avec la profondeur et la température de l'eau.
+/// Diving workout session (HealthKit). Two roles:
+/// 1. keep the app in the foreground and active for the whole dive (without a session, watchOS may suspend it);
+/// 2. save the dive in Health, with the depth and the water temperature.
@MainActor
final class DiveWorkout {
enum State { case idle, running }
@@ -25,7 +26,7 @@ final class DiveWorkout {
HKQuantityType(.waterTemperature)]
}
- /// Demande l'autorisation d'écrire dans Santé (une seule fois ; refus possible, l'app marche quand même).
+ /// Asks for permission to write to Health (once only; it can be refused, the app still works).
func requestAuthorization() async {
guard Self.isAvailable else { return }
do {
@@ -35,7 +36,7 @@ final class DiveWorkout {
}
}
- /// Démarre la séance (avant la mise à l'eau, ou à l'immersion si le plongeur ne l'a pas fait).
+ /// Starts the session (before getting in the water, or on submersion when the diver did not).
func start() {
guard Self.isAvailable, state == .idle else { return }
let configuration = HKWorkoutConfiguration()
@@ -58,8 +59,8 @@ final class DiveWorkout {
}
}
- /// Termine la séance. Avec une plongée : la séance est enregistrée dans Santé avec son profil ;
- /// sans plongée (annulation, démonstration) : elle est abandonnée, rien n'est écrit.
+ /// Ends the session. With a dive: the session is saved in Health with its profile;
+ /// without a dive (cancelled, demo): it is discarded, nothing is written.
func finish(with dive: DiveLog?) async {
guard state == .running, let session, let builder else { return }
let end = Date()
@@ -73,7 +74,7 @@ final class DiveWorkout {
return
}
do {
- // Santé refuse un échantillon daté avant le début de la séance ou après sa fin.
+ // Health rejects a sample dated before the start of the session or after its end.
let from = startedAt ?? dive.start
let samples = Self.samples(for: dive).filter { $0.startDate >= from && $0.endDate <= end }
if !samples.isEmpty { try await builder.addSamples(samples) }
@@ -85,7 +86,7 @@ final class DiveWorkout {
}
}
- /// Profondeur et température de l'eau, un point toutes les 10 s au plus (Santé n'a pas besoin de plus).
+ /// Depth and water temperature, one point every 10 s at most (Health does not need more).
static func samples(for dive: DiveLog) -> [HKQuantitySample] {
var out: [HKQuantitySample] = []
var lastTime = -Double.infinity
diff --git a/OpenRemoraWatch/InfoPlist.xcstrings b/OpenRemoraWatch/InfoPlist.xcstrings
@@ -0,0 +1,57 @@
+{
+ "sourceLanguage": "en",
+ "strings": {
+ "NSMotionUsageDescription": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora reads the depth and the water temperature during the dive."
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora lit la profondeur et la température de l'eau pendant la plongée."
+ }
+ }
+ }
+ },
+ "NSHealthUpdateUsageDescription": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora saves every dive in Health, with the depth and the water temperature."
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora enregistre chaque plongée dans Santé, avec la profondeur et la température de l'eau."
+ }
+ }
+ }
+ },
+ "NSHealthShareUsageDescription": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora reads no Health data; it only saves your dives there."
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora ne lit aucune donnée de Santé ; il y enregistre seulement vos plongées."
+ }
+ }
+ }
+ }
+ },
+ "version": "1.0"
+}
diff --git a/OpenRemoraWatch/Localizable.xcstrings b/OpenRemoraWatch/Localizable.xcstrings
@@ -0,0 +1,1576 @@
+{
+ "sourceLanguage": "en",
+ "strings": {
+ "%@ m": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%@ m"
+ }
+ }
+ }
+ },
+ "%@ m · %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%@ m · %@"
+ }
+ }
+ }
+ },
+ "%@ · %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%@ · %@"
+ }
+ }
+ }
+ },
+ "%lld m/min ↑": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld m/min ↑"
+ }
+ }
+ }
+ },
+ "%lld °C": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld °C"
+ }
+ }
+ }
+ },
+ "%lld%%": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld %%"
+ }
+ }
+ }
+ },
+ "%lld°": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld°"
+ }
+ }
+ }
+ },
+ "21% (air)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "21 % (air)"
+ }
+ }
+ }
+ },
+ "ACTION BUTTON %lld": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "BOUTON ACTION %lld"
+ }
+ }
+ }
+ },
+ "Action button: %lld presses received": {
+ "localizations": {
+ "en": {
+ "variations": {
+ "plural": {
+ "one": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Action button: %lld press received"
+ }
+ },
+ "other": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Action button: %lld presses received"
+ }
+ }
+ }
+ }
+ },
+ "fr": {
+ "variations": {
+ "plural": {
+ "one": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Bouton Action : %lld pression reçue"
+ }
+ },
+ "other": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Bouton Action : %lld pressions reçues"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "Advanced": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Avancés"
+ }
+ }
+ }
+ },
+ "Advanced settings": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Réglages avancés"
+ }
+ }
+ }
+ },
+ "Alarms": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Alarmes"
+ }
+ }
+ }
+ },
+ "Altitude is measured by the watch: nothing to set.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "L'altitude est mesurée par la montre : rien à régler."
+ }
+ }
+ }
+ },
+ "Always dive with a primary dive computer, and follow it when the two disagree.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plongez toujours avec un ordinateur de plongée principal, et suivez-le en cas d'écart."
+ }
+ }
+ }
+ },
+ "Ascent %lld metres per minute": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Remontée %lld mètres par minute"
+ }
+ }
+ }
+ },
+ "Ascent too fast": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Remontée trop rapide"
+ }
+ }
+ }
+ },
+ "Average depth": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Profondeur moyenne"
+ }
+ }
+ }
+ },
+ "BEARING SET %lld°": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "CAP FIXÉ %lld°"
+ }
+ }
+ }
+ },
+ "Battery": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Batterie"
+ }
+ }
+ }
+ },
+ "Before you dive": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Avant de plonger"
+ }
+ }
+ }
+ },
+ "Below %lld min": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sous %lld min"
+ }
+ }
+ }
+ },
+ "Beyond the sensor limit": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Au-delà de la limite du capteur"
+ }
+ }
+ }
+ },
+ "Cancel": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Annuler"
+ }
+ }
+ }
+ },
+ "Ceiling": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plafond"
+ }
+ }
+ }
+ },
+ "Ceiling broken": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plafond franchi"
+ }
+ }
+ }
+ },
+ "Clear": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Effacer"
+ }
+ }
+ }
+ },
+ "Clock": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Heure"
+ }
+ }
+ }
+ },
+ "Close to the sensor limit": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Limite du capteur proche"
+ }
+ }
+ }
+ },
+ "Coldest water": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Eau au plus froid"
+ }
+ }
+ }
+ },
+ "Compass": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Boussole"
+ }
+ }
+ }
+ },
+ "Compass…": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Boussole…"
+ }
+ }
+ }
+ },
+ "Computer": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Ordinateur"
+ }
+ }
+ }
+ },
+ "Conservatism": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Prudence"
+ }
+ }
+ }
+ },
+ "Critical ppO2": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ppO2 critique"
+ }
+ }
+ }
+ },
+ "Custom": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Personnalisée"
+ }
+ }
+ }
+ },
+ "DEPTH UNKNOWN\nFollow your primary computer": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "PROFONDEUR INCONNUE\nSuivez votre ordinateur principal"
+ }
+ }
+ }
+ },
+ "Demo": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Démonstration"
+ }
+ }
+ }
+ },
+ "Demo dive": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plongée de démonstration"
+ }
+ }
+ }
+ },
+ "Depth": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Profondeur"
+ }
+ }
+ }
+ },
+ "Depth limit": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Profondeur limite"
+ }
+ }
+ }
+ },
+ "Depth sensor error": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Erreur du capteur de profondeur"
+ }
+ }
+ }
+ },
+ "Dive %lld": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plongée %lld"
+ }
+ }
+ }
+ },
+ "Dive action": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Action de plongée"
+ }
+ }
+ }
+ },
+ "Dive session: %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Session de plongée : %@"
+ }
+ }
+ }
+ },
+ "Dive within the limits of your training. You are responsible for your settings and your gas.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plongez dans les limites de votre formation. Vous êtes responsable de vos réglages et de votre mélange."
+ }
+ }
+ }
+ },
+ "Duration": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Durée"
+ }
+ }
+ }
+ },
+ "E": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "E"
+ }
+ }
+ }
+ },
+ "End": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Fin"
+ }
+ }
+ }
+ },
+ "Fast ascent": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Remontée rapide"
+ }
+ }
+ }
+ },
+ "Fresh": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Douce"
+ }
+ }
+ }
+ },
+ "From there, it goes to Sub Rascasse.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "De là, elle passe dans Sub Rascasse."
+ }
+ }
+ }
+ },
+ "GF high %lld%%": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "GF haut %lld %%"
+ }
+ }
+ }
+ },
+ "GF low %lld%%": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "GF bas %lld %%"
+ }
+ }
+ }
+ },
+ "Gas": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Mélange"
+ }
+ }
+ }
+ },
+ "Get in the water: the dive starts by itself": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Entrez dans l'eau : la plongée démarre seule"
+ }
+ }
+ }
+ },
+ "High (GF 30/70)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Élevée (GF 30/70)"
+ }
+ }
+ }
+ },
+ "High ppO2": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ppO2 élevée"
+ }
+ }
+ }
+ },
+ "I understand and accept": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "J'ai compris, j'accepte"
+ }
+ }
+ }
+ },
+ "Last trial": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Dernier essai"
+ }
+ }
+ }
+ },
+ "Logbook": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Carnet"
+ }
+ }
+ }
+ },
+ "Low (GF 50/85)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Faible (GF 50/85)"
+ }
+ }
+ }
+ },
+ "Low NDL": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "NDL bas"
+ }
+ }
+ }
+ },
+ "Low accuracy: draw a figure 8 with your wrist": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Précision faible : faites un 8 avec le poignet"
+ }
+ }
+ }
+ },
+ "Low battery": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Batterie faible"
+ }
+ }
+ }
+ },
+ "Mandatory stops": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Paliers obligatoires"
+ }
+ }
+ }
+ },
+ "Max": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Max"
+ }
+ }
+ }
+ },
+ "Max depth": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Profondeur max"
+ }
+ }
+ }
+ },
+ "Maximum operating depth: %@ m": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Profondeur maximale du mélange : %@ m"
+ }
+ }
+ }
+ },
+ "Maximum ppO2": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ppO2 maximale"
+ }
+ }
+ }
+ },
+ "Medium (GF 40/80)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Moyenne (GF 40/80)"
+ }
+ }
+ }
+ },
+ "N": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "N"
+ }
+ }
+ }
+ },
+ "NDL": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "NDL"
+ }
+ }
+ }
+ },
+ "NDL %@ min": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "NDL %@ min"
+ }
+ }
+ }
+ },
+ "NDL alarm": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Alarme de NDL"
+ }
+ }
+ }
+ },
+ "NDL: time left without a mandatory stop. The watch vibrates and the value blinks below this threshold.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "NDL : temps restant sans palier obligatoire. La montre vibre et la valeur clignote sous ce seuil."
+ }
+ }
+ }
+ },
+ "NE": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "NE"
+ }
+ }
+ }
+ },
+ "NW": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "NO"
+ }
+ }
+ }
+ },
+ "New bearing": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Nouveau cap"
+ }
+ }
+ }
+ },
+ "Next action: %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Action suivante : %@"
+ }
+ }
+ }
+ },
+ "No": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Non"
+ }
+ }
+ }
+ },
+ "No alarms": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aucune alarme"
+ }
+ }
+ }
+ },
+ "No compass on this watch": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Pas de boussole sur cette montre"
+ }
+ }
+ }
+ },
+ "No computation guarantees the absence of decompression sickness.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aucun calcul ne garantit l'absence d'accident de décompression."
+ }
+ }
+ }
+ },
+ "No depth sensor on this watch": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Pas de capteur de profondeur sur cette montre"
+ }
+ }
+ }
+ },
+ "No dives": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aucune plongée"
+ }
+ }
+ }
+ },
+ "No. %lld · %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Nº %lld · %@"
+ }
+ }
+ }
+ },
+ "Off": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Désactivée"
+ }
+ }
+ }
+ },
+ "On the iPhone": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sur l'iPhone"
+ }
+ }
+ }
+ },
+ "Open Rémora": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora"
+ }
+ }
+ }
+ },
+ "Open Rémora is not a certified dive computer.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora n'est pas un ordinateur de plongée certifié."
+ }
+ }
+ }
+ },
+ "Oxygen": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Oxygène"
+ }
+ }
+ }
+ },
+ "Profile": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Profil"
+ }
+ }
+ }
+ },
+ "Ready": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Prêt"
+ }
+ }
+ }
+ },
+ "Ready to dive": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Prêt à plonger"
+ }
+ }
+ }
+ },
+ "S": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "S"
+ }
+ }
+ }
+ },
+ "SAFETY %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "SÉCURITÉ %@"
+ }
+ }
+ }
+ },
+ "SAFETY STOP": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "PALIER DE SÉCURITÉ"
+ }
+ }
+ }
+ },
+ "SE": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "SE"
+ }
+ }
+ }
+ },
+ "STOP %lld m": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "PALIER %lld m"
+ }
+ }
+ }
+ },
+ "STOP %lld m · %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "PALIER %lld m · %@"
+ }
+ }
+ }
+ },
+ "STOPS": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "PALIERS"
+ }
+ }
+ }
+ },
+ "SW": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "SO"
+ }
+ }
+ }
+ },
+ "Safety stop 3 min at 5 m": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Palier de sécurité 3 min à 5 m"
+ }
+ }
+ }
+ },
+ "Safety stop done ✓": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Palier de sécurité fait ✓"
+ }
+ }
+ }
+ },
+ "Safety stop missed": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Palier de sécurité sauté"
+ }
+ }
+ }
+ },
+ "Salt": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Salée"
+ }
+ }
+ }
+ },
+ "Screen locked: long press on the crown": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Écran verrouillé : appui long sur la couronne"
+ }
+ }
+ }
+ },
+ "Secondary computer, not certified. To be used with a primary dive computer.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Ordinateur secondaire, non certifié. À utiliser avec un ordinateur de plongée principal."
+ }
+ }
+ }
+ },
+ "Sensor: %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Capteur : %@"
+ }
+ }
+ }
+ },
+ "Series": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Série"
+ }
+ }
+ }
+ },
+ "Set bearing": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Fixer le cap"
+ }
+ }
+ }
+ },
+ "Settings": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Réglages"
+ }
+ }
+ }
+ },
+ "Site": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Site"
+ }
+ }
+ }
+ },
+ "Standard (EN 13319)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Standard (EN 13319)"
+ }
+ }
+ }
+ },
+ "Start": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Début"
+ }
+ }
+ }
+ },
+ "Starts the dive session and locks the screen (long press on the crown to unlock). Without it, the dive still starts on submersion.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Démarre la séance de plongée et verrouille l'écran (appui long sur la couronne pour déverrouiller). Sans ça, la plongée démarre quand même à l'immersion."
+ }
+ }
+ }
+ },
+ "Surface": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Surface"
+ }
+ }
+ }
+ },
+ "Surface interval": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Intervalle de surface"
+ }
+ }
+ }
+ },
+ "Tap to browse the profile": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Toucher pour parcourir le profil"
+ }
+ }
+ }
+ },
+ "Terms of use": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Conditions d'utilisation"
+ }
+ }
+ }
+ },
+ "The bearing set here stays displayed during the dive (compass page, two crown clicks).": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Le cap posé ici reste affiché pendant la plongée (page boussole, deux crans de couronne)."
+ }
+ }
+ }
+ },
+ "The dive starts on submersion": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "La plongée démarre à l'immersion"
+ }
+ }
+ }
+ },
+ "The watch can fail or measure wrongly during the dive.": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "La montre peut tomber en panne ou mal mesurer pendant la plongée."
+ }
+ }
+ }
+ },
+ "Time": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Temps"
+ }
+ }
+ }
+ },
+ "W": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "O"
+ }
+ }
+ }
+ },
+ "Waiting for the iPhone": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "En attente de l'iPhone"
+ }
+ }
+ }
+ },
+ "Water": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Eau"
+ }
+ }
+ }
+ },
+ "Yes": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Oui"
+ }
+ }
+ }
+ },
+ "about to expire": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "va expirer"
+ }
+ }
+ }
+ },
+ "bearing %lld° · %lld°": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "cap %lld° · %lld°"
+ }
+ }
+ }
+ },
+ "deepest at %@ m": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "la plus profonde à %@ m"
+ }
+ }
+ }
+ },
+ "donated": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "donnée"
+ }
+ }
+ }
+ },
+ "ended": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "terminée"
+ }
+ }
+ }
+ },
+ "ended (reason %lld)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "terminée (raison %lld)"
+ }
+ }
+ }
+ },
+ "ended: the app left the foreground": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "terminée : l'app a quitté le premier plan"
+ }
+ }
+ }
+ },
+ "error": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "erreur"
+ }
+ }
+ }
+ },
+ "expired": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "expirée"
+ }
+ }
+ }
+ },
+ "m": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "m"
+ }
+ }
+ }
+ },
+ "max %@ m": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "max %@ m"
+ }
+ }
+ }
+ },
+ "max %@ m for this gas": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "max %@ m pour ce mélange"
+ }
+ }
+ }
+ },
+ "max 40 m (watch limit)": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "max 40 m (limite de la montre)"
+ }
+ }
+ }
+ },
+ "min": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "min"
+ }
+ }
+ }
+ },
+ "never donated": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "jamais donnée"
+ }
+ }
+ }
+ },
+ "never requested": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "jamais demandée"
+ }
+ }
+ }
+ },
+ "ppO2": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ppO2"
+ }
+ }
+ }
+ },
+ "refused by the system": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "refusée par le système"
+ }
+ }
+ }
+ },
+ "refused: another session is running": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "refusée : une autre session tourne"
+ }
+ }
+ }
+ },
+ "requested": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "demandée"
+ }
+ }
+ }
+ },
+ "running": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "en cours"
+ }
+ }
+ }
+ },
+ "started by the system": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "démarrée par le système"
+ }
+ }
+ }
+ },
+ "stop %lld m · %lld min": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "palier %lld m · %lld min"
+ }
+ }
+ }
+ },
+ "surface in %lld min": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "surface dans %lld min"
+ }
+ }
+ }
+ },
+ "•": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "•"
+ }
+ }
+ }
+ }
+ },
+ "version": "1.0"
+}
diff --git a/OpenRemoraWatch/LogStore.swift b/OpenRemoraWatch/LogStore.swift
@@ -1,16 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Observation
import RemoraDeco
-/// Carnet et réglages, enregistrés en JSON sur la montre.
+/// Logbook and settings, saved as JSON on the watch.
@MainActor @Observable
final class LogStore {
private(set) var logbook = Logbook()
var settings = UserSettings()
- /// Appelé après chaque enregistrement des réglages (envoi vers l'iPhone).
+ /// Called every time the settings are saved (sending to the iPhone).
var onSettingsSaved: (() -> Void)?
private let folder: URL
+ // File names on disk: kept as is, existing installs read them.
private var logbookURL: URL { folder.appendingPathComponent("carnet.json") }
private var settingsURL: URL { folder.appendingPathComponent("reglages.json") }
@@ -23,7 +25,7 @@ final class LogStore {
let saved = try? JSONDecoder().decode(UserSettings.self, from: data) { settings = saved }
}
- /// Plongées les plus récentes d'abord.
+ /// Most recent dives first.
var dives: [DiveLog] { logbook.dives.reversed() }
func add(_ dive: DiveLog) -> DiveLog {
@@ -48,7 +50,7 @@ final class LogStore {
try? data.write(to: logbookURL, options: .atomic)
}
- /// Carnet de démonstration (argument `-demo`) : trois plongées simulées si le carnet est vide.
+ /// Demo logbook (`-demo` argument): three simulated dives when the logbook is empty.
func seedDemo() {
guard logbook.dives.isEmpty else { return }
let day = 86_400.0
@@ -56,7 +58,7 @@ final class LogStore {
let start = Date().addingTimeInterval(-day * Double(3 - i) * 2)
var dive = profile.record(start: start, settings: settings, logbook: Logbook())
dive.source = .simulation
- dive.site = "Démonstration"
+ dive.site = String(localized: "Demo")
logbook.add(dive)
}
}
diff --git a/OpenRemoraWatch/OpenRemoraApp.swift b/OpenRemoraWatch/OpenRemoraApp.swift
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
import SwiftUI
import RemoraDeco
diff --git a/OpenRemoraWatch/PhoneLink.swift b/OpenRemoraWatch/PhoneLink.swift
@@ -1,10 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
@preconcurrency import WatchConnectivity
import RemoraDeco
-/// Envoi vers l'app iPhone : les réglages (contexte d'application, toujours le dernier état) et chaque
-/// plongée réelle (fichier JSON, file d'attente gérée par le système, livrée même si l'iPhone est loin).
-/// Les plongées de démonstration ne partent pas.
+/// Sending to the iPhone app: the settings (application context, always the latest state) and every real
+/// dive (JSON file, queue managed by the system, delivered even when the iPhone is far away).
+/// Demo dives are not sent.
@MainActor
final class PhoneLink: NSObject, WCSessionDelegate {
private let store: LogStore
@@ -23,17 +24,18 @@ final class PhoneLink: NSObject, WCSessionDelegate {
session.activate()
}
- /// Réglages du moment (appelé au démarrage et à chaque changement).
+ /// Current settings (called at startup and at every change).
func sendSettings() {
guard activated, let data = try? PhoneSync.encoder.encode(store.settings) else { return }
try? WCSession.default.updateApplicationContext([PhoneSync.settingsKey: data,
PhoneSync.sentAtKey: Date().timeIntervalSince1970])
}
- /// Envoie les plongées réelles pas encore envoyées (l'iPhone écarte les doublons).
+ /// Sends the real dives not sent yet (the iPhone discards duplicates).
func sendPendingDives() {
guard activated else { return }
var sent = Set(UserDefaults.standard.stringArray(forKey: sentKey) ?? [])
+ // Folder name kept as is: transfers queued by an earlier version still point into it.
let folder = FileManager.default.temporaryDirectory.appendingPathComponent("envoi", isDirectory: true)
try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true)
for dive in store.logbook.dives where dive.source == .remora && !sent.contains(dive.id.uuidString) {
@@ -55,7 +57,7 @@ final class PhoneLink: NSObject, WCSessionDelegate {
}
}
- /// Plongées bien arrivées sur l'iPhone (identifiants séparés par des virgules, lus par le résumé de plongée).
+ /// Dives that reached the iPhone (comma-separated identifiers, read by the dive summary).
static let deliveredKey = "phoneDeliveredDiveIDs"
nonisolated func session(_ session: WCSession, didFinish fileTransfer: WCSessionFileTransfer, error: (any Error)?) {
@@ -69,7 +71,7 @@ final class PhoneLink: NSObject, WCSessionDelegate {
}
return
}
- // Échec : la plongée repartira au prochain lancement.
+ // Failure: the dive will be sent again at the next launch.
let id = fileTransfer.file.fileURL.deletingPathExtension().lastPathComponent
Task { @MainActor in
var sent = Set(UserDefaults.standard.stringArray(forKey: self.sentKey) ?? [])
diff --git a/OpenRemoraWatch/RootView.swift b/OpenRemoraWatch/RootView.swift
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
import SwiftUI
import RemoraDeco
@@ -13,18 +14,18 @@ struct RootView: View {
if session.sensorAvailable {
Section {
Button { session.getReady() } label: {
- Label("Prêt à plonger", systemImage: "figure.open.water.swim")
+ Label("Ready to dive", systemImage: "figure.open.water.swim")
.font(.headline)
}
.listItemTint(.cyan)
} footer: {
- Text("Démarre la séance de plongée et verrouille l'écran (appui long sur la couronne pour déverrouiller). Sans ça, la plongée démarre quand même à l'immersion.")
+ Text("Starts the dive session and locks the screen (long press on the crown to unlock). Without it, the dive still starts on submersion.")
}
}
- Section("Carnet") {
+ Section("Logbook") {
if store.dives.isEmpty {
- Text("Aucune plongée").foregroundStyle(.secondary)
+ Text("No dives").foregroundStyle(.secondary)
}
ForEach(store.dives) { dive in
NavigationLink(value: dive) { DiveRow(dive: dive) }
@@ -37,10 +38,10 @@ struct RootView: View {
Section {
if session.sensorAvailable {
- Label("Entrez dans l'eau : la plongée démarre seule", systemImage: "water.waves")
+ Label("Get in the water: the dive starts by itself", systemImage: "water.waves")
.font(.footnote)
} else {
- Label("Pas de capteur de profondeur sur cette montre", systemImage: "exclamationmark.triangle")
+ Label("No depth sensor on this watch", systemImage: "exclamationmark.triangle")
.font(.footnote)
.foregroundStyle(.orange)
}
@@ -50,17 +51,17 @@ struct RootView: View {
}
Section {
- NavigationLink { CompassScreen() } label: { Label("Boussole", systemImage: "location.north.line") }
- NavigationLink { SettingsView() } label: { Label("Réglages", systemImage: "gearshape") }
+ NavigationLink { CompassScreen() } label: { Label("Compass", systemImage: "location.north.line") }
+ NavigationLink { SettingsView() } label: { Label("Settings", systemImage: "gearshape") }
Button { session.startSimulation() } label: {
- Label("Plongée de démonstration", systemImage: "play.circle")
+ Label("Demo dive", systemImage: "play.circle")
}
} footer: {
- Text("Ordinateur secondaire, non certifié. À utiliser avec un ordinateur de plongée principal.")
+ Text("Secondary computer, not certified. To be used with a primary dive computer.")
}
if session.sensorAvailable || CommandLine.arguments.contains("-demo") {
- Section("Dernier essai") { DiagnosticsRows() }
+ Section("Last trial") { DiagnosticsRows() }
}
}
.navigationTitle("Open Rémora")
@@ -89,7 +90,7 @@ struct RootView: View {
}
}
-/// Une ligne du carnet : l'essentiel d'un coup d'œil.
+/// One logbook row: the essentials at a glance.
struct DiveRow: View {
let dive: DiveLog
@@ -98,7 +99,7 @@ struct DiveRow: View {
VStack(alignment: .leading, spacing: 2) {
Text("\(Format.depth(dive.maxDepth)) m · \(Format.minutes(dive.duration))")
.font(.headline)
- Text("Nº \(dive.number) · \(Format.day(dive.start))")
+ Text("No. \(dive.number) · \(Format.day(dive.start))")
.font(.caption2)
.foregroundStyle(.secondary)
}
@@ -106,13 +107,13 @@ struct DiveRow: View {
if !dive.violations.isEmpty {
Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(.red)
} else if dive.hadDecompression {
- Text("PALIERS").font(.system(size: 9, weight: .bold)).foregroundStyle(.orange)
+ Text("STOPS").font(.system(size: 9, weight: .bold)).foregroundStyle(.orange)
}
}
}
}
-/// En attente de l'immersion : la séance tourne, l'écran rappelle le mélange, la prudence et la batterie.
+/// Waiting for submersion: the session is running, the screen recalls the gas, the conservatism and the battery.
struct ReadyView: View {
@Environment(LogStore.self) private var store
@Environment(DiveSession.self) private var session
@@ -120,50 +121,51 @@ struct ReadyView: View {
var body: some View {
VStack(spacing: 6) {
Image(systemName: "water.waves").font(.title2).foregroundStyle(.cyan)
- Text("Prêt").font(.title3.bold())
- Text("La plongée démarre à l'immersion").font(.footnote).foregroundStyle(.secondary)
+ Text("Ready").font(.title3.bold())
+ Text("The dive starts on submersion").font(.footnote).foregroundStyle(.secondary)
.multilineTextAlignment(.center)
if let action = session.actionMessage {
Text(action).font(.system(size: 14, weight: .heavy, design: .rounded))
.padding(.horizontal, 8).padding(.vertical, 2)
.background(.cyan, in: Capsule()).foregroundStyle(.black)
} else if session.screenLocked {
- Label("Écran verrouillé : appui long sur la couronne", systemImage: "lock.fill")
+ Label("Screen locked: long press on the crown", systemImage: "lock.fill")
.font(.caption2).foregroundStyle(.cyan).multilineTextAlignment(.center)
}
Text("\(store.settings.gas.description) · \(store.settings.gradientFactors.description)")
.font(.footnote)
let mod = store.settings.maximumOperatingDepth()
- Text(mod > 40 ? "max 40 m (limite de la montre)" : "max \(Format.depth(mod)) m pour ce mélange")
+ Text(mod > 40 ? "max 40 m (watch limit)" : "max \(Format.depth(mod)) m for this gas")
.font(.caption2).foregroundStyle(.secondary)
if let level = session.batteryLevel {
- Label("\(Int((level * 100).rounded())) %", systemImage: level < 0.3 ? "battery.25" : "battery.100")
+ Label(Format.percent(Int((level * 100).rounded())), systemImage: level < 0.3 ? "battery.25" : "battery.100")
.font(.footnote)
.foregroundStyle(level < 0.3 ? .red : .secondary)
- if level < 0.3 { Text("Batterie faible").font(.caption2.bold()).foregroundStyle(.red) }
+ if level < 0.3 { Text("Low battery").font(.caption2.bold()).foregroundStyle(.red) }
}
}
.toolbar {
ToolbarItem(placement: .cancellationAction) {
- Button("Annuler") { session.cancelReady() }
+ Button("Cancel") { session.cancelReady() }
}
}
}
}
-/// Résultat du dernier essai : bouton Action reçu par l'app, session de plongée d'Apple.
+/// Result of the last trial: Action button received by the app, Apple's dive session.
struct DiagnosticsRows: View {
@Environment(DiveSession.self) private var session
var body: some View {
let d = session.diagnostics
VStack(alignment: .leading, spacing: 2) {
- Text("Bouton Action : \(d.presses) pression\(d.presses > 1 ? "s" : "") reçue\(d.presses > 1 ? "s" : "")")
+ // Plural forms are in the String Catalog.
+ Text("Action button: \(d.presses) presses received")
if let depth = d.deepestPress {
- Text("la plus profonde à \(Format.depth(depth)) m").foregroundStyle(.secondary)
+ Text("deepest at \(Format.depth(depth)) m").foregroundStyle(.secondary)
}
- Text("Action suivante : \(d.donation)").foregroundStyle(.secondary)
- Text("Session de plongée : \(d.runtime)").foregroundStyle(.secondary)
+ Text("Next action: \(d.donation)").foregroundStyle(.secondary)
+ Text("Dive session: \(d.runtime)").foregroundStyle(.secondary)
if let start = d.startedAt {
Text(start.formatted(date: .abbreviated, time: .shortened)).foregroundStyle(.secondary)
}
diff --git a/OpenRemoraWatch/SettingsView.swift b/OpenRemoraWatch/SettingsView.swift
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
import SwiftUI
import RemoraDeco
@@ -8,35 +9,35 @@ struct SettingsView: View {
@Bindable var store = store
List {
Section {
- Picker("Oxygène", selection: $store.settings.oxygenPercent) {
+ Picker("Oxygen", selection: $store.settings.oxygenPercent) {
ForEach(Array(UserSettings.Limits.oxygenPercent), id: \.self) { p in
- Text(p == 21 ? "21 % (air)" : "\(p) %").tag(p)
+ Text(p == 21 ? "21% (air)" : "\(p)%").tag(p)
}
}
- Picker("Eau", selection: $store.settings.water) {
+ Picker("Water", selection: $store.settings.water) {
ForEach(Water.allCases, id: \.self) { Text($0.label).tag($0) }
}
} footer: {
- Text("Profondeur maximale du mélange : \(Format.depth(store.settings.maximumOperatingDepth())) m")
+ Text("Maximum operating depth: \(Format.depth(store.settings.maximumOperatingDepth())) m")
}
Section {
- Picker("Alarme de NDL", selection: $store.settings.ndlAlarmMinutes) {
+ Picker("NDL alarm", selection: $store.settings.ndlAlarmMinutes) {
ForEach(UserSettings.Limits.ndlAlarmMinutes, id: \.self) { m in
- Text(m == 0 ? "Désactivée" : "Sous \(m) min").tag(m)
+ Text(m == 0 ? "Off" : "Below \(m) min").tag(m)
}
}
} footer: {
- Text("NDL : temps restant sans palier obligatoire. La montre vibre et la valeur clignote sous ce seuil.")
+ Text("NDL: time left without a mandatory stop. The watch vibrates and the value blinks below this threshold.")
}
Section {
- NavigationLink("Réglages avancés") { AdvancedSettingsView() }
+ NavigationLink("Advanced settings") { AdvancedSettingsView() }
} footer: {
- Text("L'altitude est mesurée par la montre : rien à régler.")
+ Text("Altitude is measured by the watch: nothing to set.")
}
}
- .navigationTitle("Réglages")
+ .navigationTitle("Settings")
.onChange(of: store.settings) { store.saveSettings() }
}
}
@@ -47,27 +48,27 @@ struct AdvancedSettingsView: View {
var body: some View {
@Bindable var store = store
List {
- Section("Prudence") {
- Picker("Prudence", selection: $store.settings.conservatism) {
+ Section("Conservatism") {
+ Picker("Conservatism", selection: $store.settings.conservatism) {
ForEach(UserSettings.Conservatism.allCases, id: \.self) { Text($0.label).tag($0) }
}
if store.settings.conservatism == .custom {
- Stepper("GF bas \(store.settings.customGFLowPercent) %",
+ Stepper("GF low \(store.settings.customGFLowPercent)%",
value: $store.settings.customGFLowPercent,
in: UserSettings.Limits.gfLowPercent.lowerBound...store.settings.customGFHighPercent, step: 5)
- Stepper("GF haut \(store.settings.customGFHighPercent) %",
+ Stepper("GF high \(store.settings.customGFHighPercent)%",
value: $store.settings.customGFHighPercent,
in: max(UserSettings.Limits.gfHighPercent.lowerBound, store.settings.customGFLowPercent)...100, step: 5)
}
}
- Section("Oxygène") {
- Picker("ppO2 maximale", selection: $store.settings.ppO2Max) {
+ Section("Oxygen") {
+ Picker("Maximum ppO2", selection: $store.settings.ppO2Max) {
ForEach([1.2, 1.3, 1.4, 1.5, 1.6], id: \.self) { v in
- Text(String(format: "%.1f bar", v).replacingOccurrences(of: ".", with: ",")).tag(v)
+ Text(verbatim: "\(Format.decimal(v, digits: 1)) bar").tag(v)
}
}
}
}
- .navigationTitle("Avancés")
+ .navigationTitle("Advanced")
}
}
diff --git a/OpenRemoraWatch/SubmersionSource.swift b/OpenRemoraWatch/SubmersionSource.swift
@@ -1,12 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
@preconcurrency import CoreMotion
-/// Capteur de profondeur de l'Apple Watch Ultra (Core Motion).
-/// Avec l'autorisation « profondeur faible », les mesures s'arrêtent vers 6 m.
+/// Depth sensor of the Apple Watch Ultra (Core Motion).
+/// With the "shallow depth" entitlement, readings stop at around 6 m.
final class SubmersionSource: NSObject, CMWaterSubmersionManagerDelegate, @unchecked Sendable {
enum Reading: Sendable {
- /// `time` en secondes, pressions en bar. `absolute` est nil hors de l'eau, mais aussi quand le capteur
- /// ne mesure plus sous l'eau (au-delà de sa limite, erreur) : `submerged` fait la différence.
+ /// `time` in seconds, pressures in bar. `absolute` is nil out of the water, but also when the sensor
+ /// no longer measures underwater (beyond its limit, error): `submerged` tells them apart.
case pressure(time: Double, surface: Double, absolute: Double?, submerged: Bool)
case temperature(Double)
case message(String?)
@@ -33,16 +34,16 @@ final class SubmersionSource: NSObject, CMWaterSubmersionManagerDelegate, @unche
func manager(_ manager: CMWaterSubmersionManager, didUpdate measurement: CMWaterSubmersionMeasurement) {
let surface = measurement.surfacePressure.converted(to: .bars).value
var absolute = measurement.pressure?.converted(to: .bars).value
- // Garde-fou : si la pression fournie est relative à la surface, la ramener en absolu.
- // À confirmer au premier essai en piscine.
+ // Safeguard: when the pressure provided is relative to the surface, convert it to absolute.
+ // To be confirmed at the first pool trial.
if let p = absolute, p < surface * 0.8 { absolute = p + surface }
let submerged = measurement.submersionState != .notSubmerged && measurement.submersionState != .unknown
send(.pressure(time: measurement.date.timeIntervalSinceReferenceDate, surface: surface,
absolute: absolute, submerged: submerged))
switch measurement.submersionState {
- case .approachingMaxDepth: send(.message("Limite du capteur proche"))
- case .pastMaxDepth: send(.message("Au-delà de la limite du capteur"))
- case .sensorDepthError: send(.message("Erreur du capteur de profondeur"))
+ case .approachingMaxDepth: send(.message(String(localized: "Close to the sensor limit")))
+ case .pastMaxDepth: send(.message(String(localized: "Beyond the sensor limit")))
+ case .sensorDepthError: send(.message(String(localized: "Depth sensor error")))
default: send(.message(nil))
}
}
@@ -52,6 +53,6 @@ final class SubmersionSource: NSObject, CMWaterSubmersionManagerDelegate, @unche
}
func manager(_ manager: CMWaterSubmersionManager, errorOccurred error: any Error) {
- send(.message("Capteur : \(error.localizedDescription)"))
+ send(.message(String(localized: "Sensor: \(error.localizedDescription)")))
}
}
diff --git a/OpenRemoraWidgets/Localizable.xcstrings b/OpenRemoraWidgets/Localizable.xcstrings
@@ -0,0 +1,66 @@
+{
+ "sourceLanguage": "en",
+ "strings": {
+ "Dive no. %lld · %@ m": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Plongée nº %lld · %@ m"
+ }
+ }
+ }
+ },
+ "Flying": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Avion"
+ }
+ }
+ }
+ },
+ "No flying before %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Pas d'avion avant %@"
+ }
+ }
+ }
+ },
+ "Not above 2000 m before %@": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Pas au-dessus de 2000 m avant %@"
+ }
+ }
+ }
+ },
+ "OK": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "OK"
+ }
+ }
+ }
+ },
+ "Open Rémora · dive no. %lld, %@ m": {
+ "localizations": {
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open Rémora · plongée nº %lld, %@ m"
+ }
+ }
+ }
+ }
+ },
+ "version": "1.0"
+}
diff --git a/OpenRemoraWidgets/NoFlyLiveActivity.swift b/OpenRemoraWidgets/NoFlyLiveActivity.swift
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
import ActivityKit
import SwiftUI
import WidgetKit
@@ -9,7 +10,7 @@ struct OpenRemoraWidgets: WidgetBundle {
}
}
-/// Écran verrouillé et Dynamic Island : compte à rebours jusqu'à l'heure où l'avion redevient possible.
+/// Lock screen and Dynamic Island: countdown to the time when flying becomes possible again.
struct NoFlyLiveActivity: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: NoFlyAttributes.self) { context in
@@ -20,13 +21,13 @@ struct NoFlyLiveActivity: Widget {
} dynamicIsland: { context in
DynamicIsland {
DynamicIslandExpandedRegion(.leading) {
- Label("Avion", systemImage: "airplane").font(.headline)
+ Label("Flying", systemImage: "airplane").font(.headline)
}
DynamicIslandExpandedRegion(.trailing) {
Countdown(until: context.state.until).font(.title3.monospacedDigit())
}
DynamicIslandExpandedRegion(.bottom) {
- Text("Plongée nº \(context.attributes.diveNumber) · \(depth(context.attributes.maxDepth)) m")
+ Text("Dive no. \(context.attributes.diveNumber) · \(depth(context.attributes.maxDepth)) m")
.font(.caption).foregroundStyle(.secondary)
}
} compactLeading: {
@@ -49,13 +50,13 @@ private struct LockScreenView: View {
.font(.title2)
.foregroundStyle(.orange)
VStack(alignment: .leading, spacing: 2) {
- Text("Pas d'avion avant \(context.state.until.formatted(date: .omitted, time: .shortened))")
+ Text("No flying before \(context.state.until.formatted(date: .omitted, time: .shortened))")
.font(.headline)
if let altitude = context.state.altitudeUntil, altitude > .now {
- Text("Pas au-dessus de 2000 m avant \(altitude.formatted(date: .omitted, time: .shortened))")
+ Text("Not above 2000 m before \(altitude.formatted(date: .omitted, time: .shortened))")
.font(.caption)
}
- Text("Open Rémora · plongée nº \(context.attributes.diveNumber), \(depth(context.attributes.maxDepth)) m")
+ Text("Open Rémora · dive no. \(context.attributes.diveNumber), \(depth(context.attributes.maxDepth)) m")
.font(.caption2).foregroundStyle(.secondary)
}
Spacer(minLength: 0)
@@ -67,7 +68,7 @@ private struct LockScreenView: View {
}
}
-/// Compte à rebours tenu à jour par le système, sans réveiller l'app.
+/// Countdown kept up to date by the system, without waking the app.
private struct Countdown: View {
let until: Date
diff --git a/Packages/RemoraDeco/Package.swift b/Packages/RemoraDeco/Package.swift
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
// swift-tools-version: 6.0
import PackageDescription
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/AscentPlanner.swift b/Packages/RemoraDeco/Sources/RemoraDeco/AscentPlanner.swift
@@ -1,17 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Réglages de la remontée et des paliers.
+/// Ascent and stop settings.
public struct DecoSettings: Sendable, Hashable {
public var gradientFactors: GradientFactors = .conservative
public var ascentRate: Double = 9 // m/min
- /// Vitesse supposée pour créditer la désaturation de remontée dans le temps sans palier (m/min).
- /// Volontairement rapide : crédit partiel, calé sur un Shearwater (voir ShearwaterComparisonTests).
+ /// Assumed rate used to credit off-gassing during the ascent in the no-stop time (m/min).
+ /// Deliberately fast: partial credit, matched to a Shearwater (see ShearwaterComparisonTests).
public var noStopAscentRate: Double = 30
public var stopIncrement: Double = 3 // m
public var lastStopDepth: Double = 3 // m
public var safetyStopDepth: Double = 5 // m
public var safetyStopMinutes: Double = 3
- public var safetyStopTriggerDepth: Double = 10 // m de profondeur max atteinte
+ public var safetyStopTriggerDepth: Double = 10 // m of maximum depth reached
public init() {}
}
@@ -19,7 +20,7 @@ public struct DecoSettings: Sendable, Hashable {
public struct DecoStop: Sendable, Hashable {
public let depth: Double // m
public let minutes: Int
- /// Durée du palier à 10 s près (affichage du compte à rebours ; seulement pour le premier palier).
+ /// Stop duration to the nearest 10 s (countdown display; first stop only).
public var seconds: Int?
public init(depth: Double, minutes: Int, seconds: Int? = nil) {
@@ -30,26 +31,26 @@ public struct DecoStop: Sendable, Hashable {
}
public struct AscentPlan: Sendable, Hashable {
- /// Temps sans palier restant à la profondeur actuelle (min) ; `nil` = illimité ; 0 = en décompression.
+ /// Remaining no-stop time at the current depth (min); `nil` = unlimited; 0 = in decompression.
public let noDecompressionLimit: Double?
- /// Paliers obligatoires, du plus profond au moins profond (vide hors décompression).
+ /// Mandatory stops, deepest first (empty outside decompression).
public let stops: [DecoStop]
- /// Durée totale de remontée (paliers obligatoires compris, palier de sécurité exclu), min.
+ /// Total ascent time (mandatory stops included, safety stop excluded), min.
public let timeToSurface: Double
- /// Profondeur de référence du facteur `low` (premier palier), à conserver pendant la plongée.
+ /// Reference depth of the `low` factor (first stop), to be kept for the whole dive.
public let gradientAnchorDepth: Double?
public var inDecompression: Bool { !stops.isEmpty }
}
public enum AscentPlanner {
- /// Calcule la remontée depuis `pressure` avec l'état des tissus actuel.
- /// `anchorDepth` : premier palier déjà fixé plus tôt dans la plongée (le facteur `low` y reste ancré).
+ /// Computes the ascent from `pressure` with the current tissue state.
+ /// `anchorDepth`: first stop already set earlier in the dive (the `low` factor stays anchored there).
///
- /// Hors décompression, le critère est celui des ordinateurs du commerce : une remontée directe doit
- /// arriver en surface sous le facteur `high` (le facteur `low` ne sert qu'à placer les paliers).
- /// Le temps sans palier est le plus long séjour (minutes entières, 99 au plus) à la profondeur actuelle
- /// qui le permet encore ; `nil` = plus de 99 min.
+ /// Outside decompression, the criterion is the one commercial computers use: a direct ascent must
+ /// reach the surface under the `high` factor (the `low` factor only serves to place the stops).
+ /// The no-stop time is the longest stay (whole minutes, 99 at most) at the current depth that still
+ /// allows it; `nil` = more than 99 min.
public static func plan(tissues: TissueState, pressure: Double, gas: Gas,
scale: DepthScale, settings: DecoSettings,
anchorDepth: Double? = nil) -> AscentPlan {
@@ -71,7 +72,7 @@ public enum AscentPlanner {
var limit: Double?
if !surfacesClear(after: 99) {
- var low = 0, high = 99 // `low` passe, `high` ne passe pas
+ var low = 0, high = 99 // `low` passes, `high` does not
while high - low > 1 {
let middle = (low + high) / 2
if surfacesClear(after: middle) { low = middle } else { high = middle }
@@ -82,7 +83,7 @@ public enum AscentPlanner {
gradientAnchorDepth: anchorDepth)
}
- /// Remontée immédiate : paliers nécessaires (aucun = remontée directe possible) et durée.
+ /// Immediate ascent: required stops (none = direct ascent possible) and duration.
static func ascent(tissues: TissueState, pressure: Double, gas: Gas,
scale: DepthScale, settings: DecoSettings,
anchorDepth: Double?) -> AscentPlan {
@@ -117,9 +118,9 @@ public enum AscentPlanner {
state.ceiling(gradientFactor: gfAt(d)) <= scale.pressure(atDepth: d) + 1e-9
}
- // Plongeur entre deux paliers (ou au-dessus du sien) et qui ne peut pas monter au suivant : son palier
- // est sur la grille, à sa profondeur ou plus bas, jamais à une profondeur quelconque. Révision 0.2 :
- // avant, un plongeur remonté à 2,4 m se voyait proposer un « palier à 2 m ».
+ // Diver between two stops (or above their own) who cannot go up to the next one: their stop is on
+ // the grid, at their depth or deeper, never at an arbitrary depth. Revision 0.2: before, a diver
+ // who had come up to 2.4 m was offered a "stop at 2 m".
if depth > 0, !clear(t, at: nextStop(below: depth)) {
let step = settings.stopIncrement
var grid = max(settings.lastStopDepth, (depth / step - 1e-6).rounded(.up) * step)
@@ -132,17 +133,17 @@ public enum AscentPlanner {
while depth > 0 {
let next = nextStop(below: depth)
let trial = ascend(t, from: depth, to: next)
- // Prudence : le palier suivant doit être toléré AVANT de monter (pas de crédit pour le trajet).
+ // Conservative: the next stop must be tolerated BEFORE going up (no credit for the way up).
if clear(t, at: next) {
t = trial
tts += (depth - next) / settings.ascentRate
depth = next
continue
}
- // Palier à `depth` : l'ancre suit le premier (plus profond) palier, puis on attend minute par minute.
+ // Stop at `depth`: the anchor follows the first (deepest) stop, then we wait minute by minute.
if anchor.map({ depth > $0 }) ?? true { anchor = depth }
- // Premier palier : durée à 10 s près, pour le compte à rebours (sur une copie : le plan garde
- // ses minutes entières, plus prudentes).
+ // First stop: duration to the nearest 10 s, for the countdown (on a copy: the plan keeps its
+ // whole minutes, which are more conservative).
var seconds: Int?
if stops.isEmpty {
var fine = t
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/AscentRateMonitor.swift b/Packages/RemoraDeco/Sources/RemoraDeco/AscentRateMonitor.swift
@@ -1,6 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Vitesse de remontée lissée sur une courte fenêtre (le capteur de la montre est échantillonné ~1 Hz).
+/// Ascent rate smoothed over a short window (the watch sensor is sampled at ~1 Hz).
public struct AscentRateMonitor: Sendable {
public enum Level: Sendable, Hashable { case normal, fast, tooFast }
@@ -17,7 +18,7 @@ public struct AscentRateMonitor: Sendable {
samples.removeAll { time - $0.time > window }
}
- /// Vitesse de remontée en m/min (positive en remontée), par moindres carrés sur la fenêtre.
+ /// Ascent rate in m/min (positive when ascending), by least squares over the window.
public var rate: Double {
guard samples.count >= 2 else { return 0 }
let n = Double(samples.count)
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/DiveComputer.swift b/Packages/RemoraDeco/Sources/RemoraDeco/DiveComputer.swift
@@ -1,6 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Ordinateur de plongée : reçoit les échantillons de pression de la montre et tient l'état de la plongée.
+/// Dive computer: receives the pressure samples from the watch and keeps the state of the dive.
public struct DiveComputer: Sendable {
public struct Configuration: Sendable, Hashable {
public var gas: Gas = .air
@@ -8,9 +9,9 @@ public struct DiveComputer: Sendable {
public var deco = DecoSettings()
public var ppO2Warning: Double = 1.4
public var ppO2Alarm: Double = 1.6
- /// Profondeur d'alerte, avant la limite de 40 m de la montre.
+ /// Warning depth, before the 40 m limit of the watch.
public var depthLimit: Double = 38
- /// Alerte quand le NDL (temps sans palier) passe sous cette valeur (min) ; 0 = désactivée.
+ /// Warning when the NDL (no-stop time) drops below this value (min); 0 = off.
public var lowNoDecompression: Double = 5
public init() {}
}
@@ -24,11 +25,11 @@ public struct DiveComputer: Sendable {
case lowNoDecompression
}
- /// Palier de sécurité (3 min entre 3 et 6 m après être descendu sous 10 m, hors décompression).
+ /// Safety stop (3 min between 3 and 6 m after going below 10 m, outside decompression).
public enum SafetyStop: Sendable, Hashable {
case notRequired
case pending
- /// En cours : secondes restantes.
+ /// Running: seconds remaining.
case running(remaining: Double)
case done
case missed
@@ -41,7 +42,7 @@ public struct DiveComputer: Sendable {
public let ascentRate: Double // m/min
public let ppO2: Double
public let plan: AscentPlan
- public let ceilingDepth: Double // m (0 = pas de plafond)
+ public let ceilingDepth: Double // m (0 = no ceiling)
public let safetyStopRecommended: Bool
public let safetyStop: SafetyStop
public let warnings: Set<Warning>
@@ -55,12 +56,12 @@ public struct DiveComputer: Sendable {
private var start: Double?
private var last: (time: Double, pressure: Double)?
private var ascent = AscentRateMonitor()
- private var safetyStopTime = 0.0 // s passées dans la zone du palier de sécurité
+ private var safetyStopTime = 0.0 // s spent in the safety stop zone
private var safetyStopState = SafetyStop.notRequired
private var plan: AscentPlan?
- /// `surfacePressure` : mesurée par la montre juste avant l'immersion.
- /// `tissues` : état hérité de la plongée précédente (plongées successives), sinon saturé à la surface.
+ /// `surfacePressure`: measured by the watch just before submersion.
+ /// `tissues`: state inherited from the previous dive (repetitive dives), otherwise saturated at the surface.
public init(configuration: Configuration = Configuration(), surfacePressure: Double,
tissues: TissueState? = nil) {
self.configuration = configuration
@@ -68,7 +69,7 @@ public struct DiveComputer: Sendable {
self.tissues = tissues ?? .saturated(surfacePressure: surfacePressure)
}
- /// Nouvel échantillon : `time` en secondes (horloge monotone), `pressure` absolue en bar.
+ /// New sample: `time` in seconds (monotonic clock), absolute `pressure` in bar.
public mutating func update(time: Double, pressure: Double) {
let elapsedStep = last.map { max(0, time - $0.time) } ?? 0
if let last, time > last.time {
@@ -84,18 +85,18 @@ public struct DiveComputer: Sendable {
let newPlan = AscentPlanner.plan(tissues: tissues, pressure: pressure, gas: configuration.gas,
scale: scale, settings: configuration.deco,
anchorDepth: gradientAnchorDepth)
- // L'ancre des facteurs de gradient suit le premier palier le plus profond et reste pour la plongée.
+ // The gradient factor anchor follows the deepest first stop and stays for the whole dive.
if let anchor = newPlan.gradientAnchorDepth { gradientAnchorDepth = max(gradientAnchorDepth ?? 0, anchor) }
plan = newPlan
updateSafetyStop(depth: depth, seconds: elapsedStep)
}
- /// Avance le palier de sécurité. Zone : de 3 à 6,5 m ; on repart de zéro si on redescend sous 7 m.
+ /// Advances the safety stop. Zone: 3 to 6.5 m; it restarts from zero when going back below 7 m.
private mutating func updateSafetyStop(depth: Double, seconds: Double) {
let deco = configuration.deco
guard maxDepth >= deco.safetyStopTriggerDepth else { return }
if case .done = safetyStopState { return }
- // Sauté, puis redescente : le palier redevient à faire.
+ // Missed, then back down: the stop is to be done again.
if case .missed = safetyStopState, depth <= deco.safetyStopDepth + 2 { return }
if plan?.inDecompression == true { safetyStopState = .pending; safetyStopTime = 0; return }
let required = deco.safetyStopMinutes * 60
@@ -128,7 +129,7 @@ public struct DiveComputer: Sendable {
case .normal: break
}
if ceiling > 0, depth < ceiling - 0.3 { warnings.insert(.ceilingViolated) }
- // Au-dessus du palier demandé (les paliers sont par tranches de 3 m, plus profonds que le plafond continu).
+ // Above the required stop (stops come in 3 m steps, deeper than the continuous ceiling).
if let stop = plan.stops.first, depth < stop.depth - 0.6 { warnings.insert(.ceilingViolated) }
if ppO2 > configuration.ppO2Alarm { warnings.insert(.ppO2Critical) }
else if ppO2 > configuration.ppO2Warning { warnings.insert(.ppO2High) }
@@ -151,16 +152,16 @@ public struct DiveComputer: Sendable {
return gf.high - (gf.high - gf.low) * min(1, max(0, depth / anchor))
}
- /// Arrivée en altitude : tissus saturés à la pression de départ (par défaut le niveau de la mer),
- /// puis désaturés depuis `hoursAgo` à la pression du lieu. Sans cela, une plongée en lac de montagne
- /// le jour du voyage serait calculée comme si le plongeur y vivait.
+ /// Arrival at altitude: tissues saturated at the origin pressure (sea level by default), then
+ /// off-gassed for `hoursAgo` at the local pressure. Without this, a dive in a mountain lake on the
+ /// day of travel would be computed as if the diver lived there.
public static func arrival(from originPressure: Double = standardSurfacePressure,
to surfacePressure: Double, hoursAgo: Double) -> TissueState {
surfaceInterval(.saturated(surfacePressure: originPressure), minutes: hoursAgo * 60,
surfacePressure: surfacePressure)
}
- /// Désaturation en surface entre deux plongées (à l'air).
+ /// Off-gassing at the surface between two dives (on air).
public static func surfaceInterval(_ tissues: TissueState, minutes: Double,
surfacePressure: Double) -> TissueState {
var t = tissues
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/DiveRecorder.swift b/Packages/RemoraDeco/Sources/RemoraDeco/DiveRecorder.swift
@@ -1,11 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Enregistre une plongée en cours : alimente l'ordinateur et garde le profil pour le carnet.
+/// Records a dive in progress: feeds the computer and keeps the profile for the logbook.
public struct DiveRecorder: Sendable {
public private(set) var computer: DiveComputer
public let start: Date
public let surfaceIntervalBefore: Double?
- /// Écart minimal entre deux points du profil (s). Les alarmes sont notées à chaque échantillon.
+ /// Minimum gap between two profile points (s). Alarms are logged at every sample.
public var sampleInterval: Double = 2
private var t0: Double?
@@ -13,11 +14,11 @@ public struct DiveRecorder: Sendable {
private var events: [DiveEvent] = []
private var activeWarnings = Set<DiveComputer.Warning>()
private var lastLogged: [DiveComputer.Warning: Double] = [:]
- /// Une même alarme qui oscille autour de son seuil n'est notée qu'une fois par période (s).
+ /// An alarm that flickers around its threshold is logged only once per period (s).
public var eventRepeatInterval: Double = 30
private var latest: DiveSample?
- /// Démarre une plongée. Les tissus viennent du carnet (plongée successive) s'il y en a une récente.
+ /// Starts a dive. Tissues come from the logbook (repetitive dive) when it holds a recent one.
public init(configuration: DiveComputer.Configuration, surfacePressure: Double,
start: Date, logbook: Logbook? = nil) {
let previous = logbook?.tissues(at: start, surfacePressure: surfacePressure)
@@ -27,7 +28,7 @@ public struct DiveRecorder: Sendable {
self.surfaceIntervalBefore = previous?.interval
}
- /// `time` : horloge monotone en secondes ; `pressure` : bar absolus ; `temperature` : °C.
+ /// `time`: monotonic clock in seconds; `pressure`: absolute bar; `temperature`: °C.
@discardableResult
public mutating func record(time: Double, pressure: Double, temperature: Double? = nil) -> DiveComputer.Status {
computer.update(time: time, pressure: pressure)
@@ -54,10 +55,10 @@ public struct DiveRecorder: Sendable {
return status
}
- /// Termine la plongée et produit l'entrée du carnet (numéro attribué par `Logbook.add`).
+ /// Ends the dive and produces the logbook entry (number assigned by `Logbook.add`).
public func finish() -> DiveLog {
let c = computer.configuration
- // Le dernier échantillon reçu termine toujours le profil (retour en surface).
+ // The last sample received always closes the profile (back at the surface).
var samples = samples
if let latest, latest.time > (samples.last?.time ?? -1) { samples.append(latest) }
return DiveLog(id: UUID(), source: .remora, computerModel: "Open Rémora", number: 0, start: start, surfacePressure: computer.scale.surfacePressure,
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/Logbook.swift b/Packages/RemoraDeco/Sources/RemoraDeco/Logbook.swift
@@ -1,43 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Un point du profil enregistré (pour le graphe et l'export).
+/// One recorded profile point (for the chart and the export).
public struct DiveSample: Sendable, Hashable, Codable {
- public let time: Double // s depuis le début de la plongée
+ public let time: Double // s since the start of the dive
public let depth: Double // m
- public let temperature: Double? // °C (eau)
- public let ceiling: Double // m (0 = pas de plafond)
- public let noDecompressionLimit: Double? // min ; nil = illimité ; 0 = en décompression
- public let stopDepth: Double? // prochain palier obligatoire, m
+ public let temperature: Double? // °C (water)
+ public let ceiling: Double // m (0 = no ceiling)
+ public let noDecompressionLimit: Double? // min; nil = unlimited; 0 = in decompression
+ public let stopDepth: Double? // next mandatory stop, m
public let stopMinutes: Int?
}
-/// Alarme ou avertissement apparu pendant la plongée.
+/// Alarm or warning raised during the dive.
public struct DiveEvent: Sendable, Hashable, Codable {
public let time: Double // s
public let warning: DiveComputer.Warning
}
-/// Une plongée du carnet.
+/// One dive of the logbook.
public struct DiveLog: Sendable, Hashable, Codable, Identifiable {
- /// D'où vient la plongée : enregistrée par Open Rémora, importée d'un carnet Subsurface,
- /// ou simulée (démonstration : jamais comptée dans la saturation ni les délais).
+ /// Where the dive comes from: recorded by Open Rémora, imported from a Subsurface logbook,
+ /// or simulated (demo: never counted in tissue loading or waiting times).
public enum Source: String, Sendable, Hashable, Codable { case remora, subsurface, simulation }
public var id: UUID
public var source: Source = .remora
- /// Ordinateur qui a enregistré la plongée (importées : modèle noté par Subsurface).
+ /// Computer that recorded the dive (imported dives: model as noted by Subsurface).
public var computerModel: String?
- public var number: Int // numéro dans le carnet (1, 2, …)
+ public var number: Int // number in the logbook (1, 2, …)
public let start: Date
public let surfacePressure: Double // bar
- public let surfaceIntervalBefore: Double? // min ; nil = première plongée (tissus saturés)
+ public let surfaceIntervalBefore: Double? // min; nil = first dive (saturated tissues)
public let gas: Gas
- public let gradientFactors: GradientFactors? // nil : plongée importée
+ public let gradientFactors: GradientFactors? // nil: imported dive
public let water: Water
public let samples: [DiveSample]
public let events: [DiveEvent]
- public let tissuesAfter: TissueState? // nil : plongée importée
- // Saisi après coup dans le carnet
+ public let tissuesAfter: TissueState? // nil: imported dive
+ // Entered afterwards in the logbook
public var site: String?
public var notes: String?
public var latitude: Double?
@@ -47,13 +48,13 @@ public struct DiveLog: Sendable, Hashable, Codable, Identifiable {
public var maxDepth: Double { samples.map(\.depth).max() ?? 0 }
public var minTemperature: Double? { samples.compactMap(\.temperature).min() }
public var hadDecompression: Bool { samples.contains { $0.stopDepth != nil } }
- /// Violations enregistrées : plafond franchi, remontée trop rapide, ppO2 critique.
+ /// Recorded violations: ceiling broken, ascent too fast, critical ppO2.
public var violations: [DiveEvent] {
events.filter { [.ceilingViolated, .ascentTooFast, .ppO2Critical].contains($0.warning) }
}
public var end: Date { start.addingTimeInterval(duration) }
- /// Profondeur moyenne pondérée par le temps.
+ /// Time-weighted average depth.
public var averageDepth: Double {
guard samples.count > 1, duration > 0 else { return samples.first?.depth ?? 0 }
var area = 0.0
@@ -62,13 +63,13 @@ public struct DiveLog: Sendable, Hashable, Codable, Identifiable {
}
}
-/// Le carnet : plongées dans l'ordre, et état des tissus pour la plongée suivante.
+/// The logbook: dives in order, and the tissue state for the next dive.
public struct Logbook: Sendable, Hashable, Codable {
public private(set) var dives: [DiveLog] = []
public init() {}
- /// Plongées réelles (les simulations de démonstration sont exclues des calculs).
+ /// Real dives (demo simulations are excluded from the computations).
public var realDives: [DiveLog] { dives.filter { $0.source != .simulation } }
public mutating func add(_ dive: DiveLog) {
@@ -78,8 +79,8 @@ public struct Logbook: Sendable, Hashable, Codable {
dives.sort { $0.start < $1.start }
}
- /// Ajoute des plongées importées en gardant leur numéro ; ignore celles déjà présentes
- /// (même début à une minute près). Renvoie le nombre de plongées ajoutées.
+ /// Adds imported dives, keeping their number; skips those already present
+ /// (same start within one minute). Returns the number of dives added.
@discardableResult
public mutating func merge(_ imported: [DiveLog]) -> Int {
var added = 0
@@ -98,10 +99,10 @@ public struct Logbook: Sendable, Hashable, Codable {
public mutating func remove(id: UUID) { dives.removeAll { $0.id == id } }
- /// Tissus au moment `date`, d'après la dernière plongée et la pression de surface actuelle.
- /// `nil` si aucune plongée récente (plus de 72 h) : le plongeur est considéré saturé en surface.
+ /// Tissues at `date`, from the last dive and the current surface pressure.
+ /// `nil` when there is no recent dive (more than 72 h): the diver is considered saturated at the surface.
public func tissues(at date: Date, surfacePressure: Double) -> (tissues: TissueState, interval: Double)? {
- // Limite connue : une plongée importée (sans tissus) plus récente n'est pas prise en compte.
+ // Known limitation: a more recent imported dive (without tissues) is not taken into account.
guard let last = realDives.last(where: { $0.tissuesAfter != nil }), let after = last.tissuesAfter
else { return nil }
let minutes = date.timeIntervalSince(last.end) / 60
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/Physics.swift b/Packages/RemoraDeco/Sources/RemoraDeco/Physics.swift
@@ -1,10 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Unités du moteur : pressions en bar (absolues), profondeurs en mètres, durées en minutes.
-/// La montre fournit directement la pression ambiante : la profondeur n'est qu'un affichage.
+/// Engine units: pressures in bar (absolute), depths in metres, durations in minutes.
+/// The watch provides the ambient pressure directly: depth is only a display value.
public enum Water: String, Sendable, Hashable, Codable, CaseIterable {
case fresh // 1000 kg/m³
- case en13319 // 1020 kg/m³, convention des ordinateurs de plongée (EN 13319)
+ case en13319 // 1020 kg/m³, dive computer convention (EN 13319)
case salt // 1025 kg/m³
public var density: Double {
@@ -15,23 +16,23 @@ public enum Water: String, Sendable, Hashable, Codable, CaseIterable {
}
}
- /// Pression ajoutée par mètre d'eau, en bar.
+ /// Pressure added per metre of water, in bar.
public var barPerMetre: Double { density * 9.80665 / 100_000 }
}
-/// Pression de vapeur d'eau dans les poumons (valeur de Bühlmann), en bar.
+/// Water vapour pressure in the lungs (Bühlmann value), in bar.
public let waterVapourPressure = 0.0627
-/// Pression standard au niveau de la mer, en bar.
+/// Standard pressure at sea level, in bar.
public let standardSurfacePressure = 1.01325
-/// Conversion profondeur ↔ pression pour une surface et une eau données.
+/// Depth ↔ pressure conversion for a given surface pressure and water type.
public struct DepthScale: Sendable, Hashable {
public var surfacePressure: Double
public var water: Water
public init(surfacePressure: Double = standardSurfacePressure, water: Water = .en13319) {
- precondition(surfacePressure > 0.5 && surfacePressure < 1.2, "pression de surface invraisemblable")
+ precondition(surfacePressure > 0.5 && surfacePressure < 1.2, "implausible surface pressure")
self.surfacePressure = surfacePressure
self.water = water
}
@@ -45,13 +46,13 @@ public struct DepthScale: Sendable, Hashable {
}
}
-/// Mélange respiré. L'hélium n'est pas géré (plongée loisir à l'air ou au nitrox, 40 m au plus).
+/// Breathing gas. Helium is not supported (recreational diving on air or nitrox, 40 m at most).
public struct Gas: Sendable, Hashable, Codable, CustomStringConvertible {
public let o2: Double
public var n2: Double { 1 - o2 }
public init(o2: Double) {
- precondition(o2 >= 0.16 && o2 <= 1.0, "fraction d'oxygène hors limites")
+ precondition(o2 >= 0.16 && o2 <= 1.0, "oxygen fraction out of range")
self.o2 = o2
}
@@ -60,15 +61,15 @@ public struct Gas: Sendable, Hashable, Codable, CustomStringConvertible {
public var description: String { o2 == 0.21 ? "Air" : "EAN\(Int((o2 * 100).rounded()))" }
- /// Pression partielle d'oxygène à une pression ambiante.
+ /// Partial pressure of oxygen at an ambient pressure.
public func ppO2(atPressure pressure: Double) -> Double { pressure * o2 }
- /// Profondeur maximale d'utilisation pour une ppO2 limite.
+ /// Maximum operating depth for a ppO2 limit.
public func maximumOperatingDepth(ppO2Limit: Double, scale: DepthScale) -> Double {
scale.depth(atPressure: ppO2Limit / o2)
}
- /// Pression partielle d'azote inspirée (dans les alvéoles).
+ /// Inspired partial pressure of nitrogen (in the alveoli).
func inspiredN2(atPressure pressure: Double) -> Double {
max(0, pressure - waterVapourPressure) * n2
}
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/SubsurfaceImport.swift b/Packages/RemoraDeco/Sources/RemoraDeco/SubsurfaceImport.swift
@@ -1,10 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
#if canImport(FoundationXML)
import FoundationXML
#endif
-/// Lecture d'un carnet Subsurface (fichier XML `.ssrf` ou `.xml`) pour le revoir dans Open Rémora.
-/// Seul le premier ordinateur de chaque plongée est lu. Les plongées importées n'ont ni tissus ni GF.
+/// Reads a Subsurface logbook (XML file, `.ssrf` or `.xml`) to review it in Open Rémora.
+/// Only the first dive computer of each dive is read. Imported dives have neither tissues nor GF.
public enum SubsurfaceImport {
public enum Failure: Error { case notSubsurface, malformed(String) }
@@ -13,20 +14,20 @@ public enum SubsurfaceImport {
let parser = XMLParser(data: data)
parser.delegate = delegate
guard parser.parse() else {
- throw Failure.malformed(parser.parserError?.localizedDescription ?? "XML illisible")
+ throw Failure.malformed(parser.parserError?.localizedDescription ?? "unreadable XML")
}
guard delegate.sawDivelog else { throw Failure.notSubsurface }
return delegate.dives.sorted { $0.start < $1.start }
}
- /// « 12.3 m », « 21.0 C », « 1.013 bar », « 32.0% » → nombre.
+ /// "12.3 m", "21.0 C", "1.013 bar", "32.0%" → number.
static func number(_ s: String?) -> Double? {
guard let s else { return nil }
let head = s.prefix { "0123456789.-".contains($0) }
return Double(head)
}
- /// « 45:30 min », « 1:02:03 », « 30 » → secondes.
+ /// "45:30 min", "1:02:03", "30" → seconds.
static func seconds(_ s: String?) -> Double? {
guard let s else { return nil }
let head = s.prefix { "0123456789:".contains($0) }
@@ -112,11 +113,11 @@ public enum SubsurfaceImport {
guard let date = attrs["date"] else { return }
let f = DateFormatter()
f.locale = Locale(identifier: "en_US_POSIX")
- f.timeZone = TimeZone(secondsFromGMT: 0) // Subsurface note l'heure locale, sans fuseau
+ f.timeZone = TimeZone(secondsFromGMT: 0) // Subsurface stores local time, without a time zone
f.dateFormat = "yyyy-MM-dd HH:mm:ss"
guard let start = f.date(from: "\(date) \(attrs["time"] ?? "00:00:00")") else { return }
- // Sans profil (plongée saisie à la main) : deux points suffisent pour la durée.
+ // No profile (dive entered by hand): two points are enough for the duration.
if samples.isEmpty, let duration = SubsurfaceImport.seconds(attrs["duration"]) {
samples = [DiveSample(time: 0, depth: 0, temperature: nil, ceiling: 0, noDecompressionLimit: nil,
stopDepth: nil, stopMinutes: nil),
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/SurfaceAdvice.swift b/Packages/RemoraDeco/Sources/RemoraDeco/SurfaceAdvice.swift
@@ -1,12 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Après la plongée : quand peut-on monter en altitude ou prendre l'avion.
+/// After the dive: when it is possible to go to altitude or to fly.
public enum SurfaceAdvice {
- /// Pression de cabine d'un avion de ligne (≈ 2400 m), bar.
+ /// Cabin pressure of an airliner (≈ 2400 m), bar.
public static let cabinPressure = 0.75
- /// Minutes avant que les tissus tolèrent la pression `target` (facteur de gradient haut),
- /// en restant à `surfacePressure`. 0 = tout de suite ; plafonné à 72 h.
+ /// Minutes before the tissues tolerate the `target` pressure (high gradient factor),
+ /// while staying at `surfacePressure`. 0 = right away; capped at 72 h.
public static func minutesUntilTolerated(_ target: Double, tissues: TissueState,
surfacePressure: Double, gfHigh: Double) -> Double {
var t = tissues
@@ -18,8 +19,8 @@ public enum SurfaceAdvice {
return minutes
}
- /// Délai avant l'avion : le plus long du modèle et de la règle de DAN
- /// (12 h après une plongée sans palier, 18 h après plusieurs dans la journée, 24 h après des paliers).
+ /// No-fly time: the longer of the model and the DAN rule
+ /// (12 h after a single no-stop dive, 18 h after several in the day, 24 h after decompression stops).
public static func noFlyHours(logbook: Logbook, at date: Date, surfacePressure: Double) -> Double {
guard let last = logbook.realDives.last,
let state = logbook.tissues(at: date, surfacePressure: surfacePressure) else { return 0 }
@@ -32,7 +33,7 @@ public enum SurfaceAdvice {
return max(0, max(model, rule - sinceEnd))
}
- /// Heures avant de pouvoir monter à l'altitude donnée (col, route de montagne), selon le modèle.
+ /// Hours before being able to go up to the given altitude (pass, mountain road), according to the model.
public static func hoursBeforeAltitude(_ metres: Double, logbook: Logbook, at date: Date,
surfacePressure: Double) -> Double {
guard let last = logbook.realDives.last,
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/Tissues.swift b/Packages/RemoraDeco/Sources/RemoraDeco/Tissues.swift
@@ -1,6 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Un compartiment du modèle de Bühlmann : demi-vie (min) et coefficients a (bar) et b.
+/// One compartment of the Bühlmann model: half-time (min) and coefficients a (bar) and b.
public struct Compartment: Sendable, Hashable {
public let halfTime: Double
public let a: Double
@@ -9,7 +10,7 @@ public struct Compartment: Sendable, Hashable {
var k: Double { log(2) / halfTime }
}
-/// Bühlmann ZHL-16C, azote (compartiment 1b pour le premier).
+/// Bühlmann ZHL-16C, nitrogen (compartment 1b for the first one).
public enum ZHL16C {
public static let nitrogen: [Compartment] = [
Compartment(halfTime: 5.0, a: 1.1696, b: 0.5578),
@@ -31,37 +32,37 @@ public enum ZHL16C {
]
}
-/// Facteurs de gradient (Baker) : `low` fixe le premier palier, `high` la sortie en surface.
+/// Gradient factors (Baker): `low` sets the first stop, `high` the surfacing.
public struct GradientFactors: Sendable, Hashable, Codable, CustomStringConvertible {
public let low: Double
public let high: Double
public init(low: Double, high: Double) {
- precondition(low > 0 && low <= high && high <= 1, "facteurs de gradient incohérents")
+ precondition(low > 0 && low <= high && high <= 1, "inconsistent gradient factors")
self.low = low
self.high = high
}
- /// Réglage prudent par défaut d'Open Rémora (ordinateur secondaire).
+ /// Conservative default setting of Open Rémora (secondary computer).
public static let conservative = GradientFactors(low: 0.30, high: 0.70)
public static let pureBuhlmann = GradientFactors(low: 1, high: 1)
public var description: String { "GF \(Int((low * 100).rounded()))/\(Int((high * 100).rounded()))" }
}
-/// Saturation en azote des 16 compartiments, en bar.
+/// Nitrogen loading of the 16 compartments, in bar.
public struct TissueState: Sendable, Hashable {
public private(set) var nitrogen: [Double]
let compartments: [Compartment]
- /// Plongeur saturé à la surface, à l'air.
+ /// Diver saturated at the surface, on air.
public static func saturated(surfacePressure: Double = standardSurfacePressure) -> TissueState {
let p = Gas.air.inspiredN2(atPressure: surfacePressure)
return TissueState(nitrogen: Array(repeating: p, count: ZHL16C.nitrogen.count),
compartments: ZHL16C.nitrogen)
}
- /// Séjour à pression constante (équation de Haldane).
+ /// Stay at constant pressure (Haldane equation).
public mutating func stay(atPressure pressure: Double, gas: Gas, minutes: Double) {
guard minutes > 0 else { return }
let pi = gas.inspiredN2(atPressure: pressure)
@@ -71,7 +72,7 @@ public struct TissueState: Sendable, Hashable {
}
}
- /// Variation linéaire de pression (équation de Schreiner) : exacte entre deux échantillons.
+ /// Linear pressure change (Schreiner equation): exact between two samples.
public mutating func change(from start: Double, to end: Double, gas: Gas, minutes: Double) {
guard minutes > 0 else { return }
let pi0 = gas.inspiredN2(atPressure: start)
@@ -83,7 +84,7 @@ public struct TissueState: Sendable, Hashable {
}
}
- /// Pression ambiante tolérée (plafond) avec un facteur de gradient donné, en bar.
+ /// Tolerated ambient pressure (ceiling) with a given gradient factor, in bar.
public func ceiling(gradientFactor gf: Double) -> Double {
var worst = 0.0
for (p, c) in zip(nitrogen, compartments) {
@@ -93,8 +94,8 @@ public struct TissueState: Sendable, Hashable {
return worst
}
- /// Temps restant sans palier à pression constante, en minutes (`nil` = illimité).
- /// Vérifie qu'une remontée directe resterait sous le facteur `gfHigh` en surface.
+ /// Remaining no-stop time at constant pressure, in minutes (`nil` = unlimited).
+ /// Checks that a direct ascent would stay under the `gfHigh` factor at the surface.
public func noDecompressionLimit(atPressure pressure: Double, gas: Gas,
surfacePressure: Double, gfHigh gf: Double) -> Double? {
let pi = gas.inspiredN2(atPressure: pressure)
@@ -110,7 +111,7 @@ public struct TissueState: Sendable, Hashable {
}
}
-/// Enregistrement des tissus avec la plongée (plongées successives, temps avant l'avion).
+/// Tissues saved with the dive (repetitive dives, no-fly time).
extension TissueState: Codable {
enum CodingKeys: String, CodingKey { case nitrogen }
@@ -119,7 +120,7 @@ extension TissueState: Codable {
let n2 = try values.decode([Double].self, forKey: .nitrogen)
guard n2.count == ZHL16C.nitrogen.count else {
throw DecodingError.dataCorruptedError(forKey: .nitrogen, in: values,
- debugDescription: "16 compartiments attendus")
+ debugDescription: "16 compartments expected")
}
self.init(nitrogen: n2, compartments: ZHL16C.nitrogen)
}
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/UDDF.swift b/Packages/RemoraDeco/Sources/RemoraDeco/UDDF.swift
@@ -1,6 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Export du carnet au format UDDF 3.2 (import dans Subsurface, MacDive, etc.). Unités SI : m, s, K, Pa.
+/// Logbook export in UDDF 3.2 format (import into Subsurface, MacDive, etc.). SI units: m, s, K, Pa.
public enum UDDF {
public static func export(_ dives: [DiveLog], generatorVersion: String = "0.1") -> String {
let iso = ISO8601DateFormatter()
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/UserSettings.swift b/Packages/RemoraDeco/Sources/RemoraDeco/UserSettings.swift
@@ -1,15 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
-/// Réglages du plongeur, tels que l'app les enregistre et les affiche.
-/// Réglages : pourcentage d'O2 et type d'eau. Réglages avancés : prudence (dont facteurs de gradient
-/// personnalisés) et ppO2 maximale. L'altitude n'est pas un réglage : la montre mesure la pression de surface.
+/// Diver settings, as the app saves and displays them.
+/// Settings: O2 percentage and water type. Advanced settings: conservatism (including custom gradient
+/// factors) and maximum ppO2. Altitude is not a setting: the watch measures the surface pressure.
public struct UserSettings: Sendable, Hashable, Codable {
- /// Niveaux de prudence proposés à l'écran principal (valeurs propres à Open Rémora).
+ /// Conservatism levels offered on the main screen (values specific to Open Rémora).
public enum Conservatism: String, Sendable, Hashable, Codable, CaseIterable {
- case high // GF 30/70, défaut
+ case high // GF 30/70, default
case medium // GF 40/80
case low // GF 50/85
- case custom // facteurs de gradient saisis
+ case custom // gradient factors entered by the diver
public var gradientFactors: GradientFactors? {
switch self {
@@ -21,33 +22,33 @@ public struct UserSettings: Sendable, Hashable, Codable {
}
}
- /// Bornes des réglages (l'interface ne propose rien en dehors).
+ /// Bounds of the settings (the interface offers nothing outside them).
public enum Limits {
- public static let oxygenPercent = 21...40 // air à EAN40 : un seul mélange, 40 m au plus
+ public static let oxygenPercent = 21...40 // air to EAN40: a single gas, 40 m at most
public static let gfLowPercent = 10...100
public static let gfHighPercent = 50...100
public static let ppO2Max = 1.2...1.6
- /// Alarme de NDL : seuils proposés, en minutes (0 = désactivée).
+ /// NDL alarm: thresholds offered, in minutes (0 = off).
public static let ndlAlarmMinutes = [0, 3, 5, 10, 15]
}
- // Réglages
+ // Settings
public var oxygenPercent: Int = 21
public var water: Water = .en13319
- /// Alarme quand le NDL (temps restant sans palier) passe sous ce nombre de minutes ; 0 = désactivée.
+ /// Alarm when the NDL (remaining no-stop time) drops below this number of minutes; 0 = off.
public var ndlAlarmMinutes: Int = 5
- // Réglages avancés
+ // Advanced settings
public var conservatism: Conservatism = .high
- /// Facteurs de gradient personnalisés (en %), utilisés quand `conservatism == .custom`.
+ /// Custom gradient factors (in %), used when `conservatism == .custom`.
public var customGFLowPercent: Int = 30
public var customGFHighPercent: Int = 70
public var ppO2Max: Double = 1.4
public init() {}
- /// Lecture tolérante : un réglage absent (enregistré par une version plus ancienne, ou envoyé par une
- /// montre pas encore à jour) prend sa valeur par défaut au lieu de faire échouer toute la lecture.
+ /// Lenient decoding: a missing setting (saved by an older version, or sent by a watch that is not
+ /// up to date yet) takes its default value instead of making the whole decoding fail.
public init(from decoder: Decoder) throws {
let v = try decoder.container(keyedBy: CodingKeys.self)
let d = UserSettings()
@@ -67,7 +68,7 @@ public struct UserSettings: Sendable, Hashable, Codable {
case ndlAlarmOutOfRange
}
- /// Ce qui empêche d'appliquer les réglages (vide = valides).
+ /// What prevents the settings from being applied (empty = valid).
public var problems: [Problem] {
var p: [Problem] = []
if !Limits.oxygenPercent.contains(oxygenPercent) { p.append(.oxygenOutOfRange) }
@@ -88,13 +89,13 @@ public struct UserSettings: Sendable, Hashable, Codable {
?? GradientFactors(low: Double(customGFLowPercent) / 100, high: Double(customGFHighPercent) / 100)
}
- /// Profondeur maximale d'utilisation du mélange choisi (affichée à côté du pourcentage).
+ /// Maximum operating depth of the chosen gas (shown next to the percentage).
public func maximumOperatingDepth(surfacePressure: Double = standardSurfacePressure) -> Double {
gas.maximumOperatingDepth(ppO2Limit: ppO2Max,
scale: DepthScale(surfacePressure: surfacePressure, water: water))
}
- /// Configuration de l'ordinateur ; refusée si les réglages ne sont pas valides.
+ /// Computer configuration; refused when the settings are not valid.
public func configuration() throws -> DiveComputer.Configuration {
if let first = problems.first { throw first }
var c = DiveComputer.Configuration()
@@ -103,7 +104,7 @@ public struct UserSettings: Sendable, Hashable, Codable {
c.deco.gradientFactors = gradientFactors
c.ppO2Warning = ppO2Max
c.ppO2Alarm = max(1.6, ppO2Max)
- c.lowNoDecompression = Double(ndlAlarmMinutes) // 0 : jamais sous le seuil, alarme désactivée
+ c.lowNoDecompression = Double(ndlAlarmMinutes) // 0: never below the threshold, alarm off
return c
}
}
diff --git a/Packages/RemoraDeco/Tests/RemoraDecoTests/AltitudeTests.swift b/Packages/RemoraDeco/Tests/RemoraDecoTests/AltitudeTests.swift
@@ -1,15 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Testing
@testable import RemoraDeco
-/// Pression de surface à une altitude (atmosphère standard).
+/// Surface pressure at a given altitude (standard atmosphere).
func pressure(atAltitude metres: Double) -> Double {
standardSurfacePressure * pow(1 - 2.25577e-5 * metres, 5.25588)
}
@Suite("Altitude")
struct AltitudeTests {
- let lake = pressure(atAltitude: 2000) // ≈ 0,795 bar
+ let lake = pressure(atAltitude: 2000) // ≈ 0.795 bar
func ndl(surface: Double, tissues: TissueState, depth: Double = 18) -> Double {
let scale = DepthScale(surfacePressure: surface, water: .fresh)
@@ -35,10 +36,10 @@ struct AltitudeTests {
let after15min = ndl(surface: lake, tissues: DiveComputer.arrival(to: lake, hoursAgo: 0.25))
let deep15 = ndl(surface: lake, tissues: DiveComputer.arrival(to: lake, hoursAgo: 0.25), depth: 30)
let deep48 = ndl(surface: lake, tissues: DiveComputer.arrival(to: lake, hoursAgo: 48), depth: 30)
- print("15 min = \(after15min) ; 30 m : 15 min = \(deep15), 48 h = \(deep48)")
+ print("15 min = \(after15min); 30 m: 15 min = \(deep15), 48 h = \(deep48)")
let after48h = ndl(surface: lake, tissues: DiveComputer.arrival(to: lake, hoursAgo: 48))
- print("NDL 18 m, lac à 2000 m, GF 30/70 : arrivé il y a 2 h = \(after2h), 48 h = \(after48h), acclimaté = \(acclimatised)")
- #expect(after15min < after48h) // effet faible : ~0,4 min à 18 m
+ print("NDL 18 m, lake at 2000 m, GF 30/70: arrived 2 h ago = \(after2h), 48 h = \(after48h), acclimatised = \(acclimatised)")
+ #expect(after15min < after48h) // small effect: ~0.4 min at 18 m
#expect(after2h <= after48h)
#expect(abs(after48h - acclimatised) < 1)
}
diff --git a/Packages/RemoraDeco/Tests/RemoraDecoTests/DecoTests.swift b/Packages/RemoraDeco/Tests/RemoraDecoTests/DecoTests.swift
@@ -1,10 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Testing
@testable import RemoraDeco
let scale = DepthScale(surfacePressure: standardSurfacePressure, water: .salt)
-/// Plongeur saturé en surface, posé instantanément à `depth` puis resté `minutes`.
+/// Diver saturated at the surface, dropped instantly to `depth`, then staying there for `minutes`.
func tissues(after minutes: Double, at depth: Double, gas: Gas = .air) -> TissueState {
var t = TissueState.saturated(surfacePressure: scale.surfacePressure)
t.stay(atPressure: scale.pressure(atDepth: depth), gas: gas, minutes: minutes)
@@ -17,7 +18,7 @@ func ndl(at depth: Double, gf: GradientFactors, gas: Gas = .air) -> Double? {
surfacePressure: scale.surfacePressure, gfHigh: gf.high)
}
-@Suite("Physique")
+@Suite("Physics")
struct PhysicsTests {
@Test func depthRoundTrip() {
let p = scale.pressure(atDepth: 30)
@@ -31,7 +32,7 @@ struct PhysicsTests {
}
}
-@Suite("Tissus")
+@Suite("Tissues")
struct TissueTests {
@Test func surfaceSaturationHasNoCeiling() {
let t = TissueState.saturated(surfacePressure: scale.surfacePressure)
@@ -39,7 +40,7 @@ struct TissueTests {
#expect(t.ceiling(gradientFactor: 0.3) < scale.surfacePressure)
#expect(ndl(at: 0, gf: .conservative) == nil)
#expect(ndl(at: 3, gf: .conservative) == nil)
- #expect(ndl(at: 6, gf: .conservative)! > 24 * 60) // fini mais hors de portée (affiché « >99 »)
+ #expect(ndl(at: 6, gf: .conservative)! > 24 * 60) // finite but out of reach (shown as ">99")
}
@Test func schreinerMatchesFineConstantSteps() {
@@ -69,7 +70,7 @@ struct TissueTests {
}
}
-@Suite("Limite sans palier")
+@Suite("No-decompression limit")
struct NoDecoTests {
@Test func decreasesWithDepth() throws {
var previous = Double.infinity
@@ -92,12 +93,12 @@ struct NoDecoTests {
#expect(ean32 > air)
}
- /// Ordres de grandeur seulement : la validation fine se fera contre Subsurface.
+ /// Orders of magnitude only: fine validation will be done against Subsurface.
@Test func plausibleValues() throws {
let pure30 = try #require(ndl(at: 30, gf: .pureBuhlmann))
let pure18 = try #require(ndl(at: 18, gf: .pureBuhlmann))
- print("NDL air, GF 100/100 : 18 m = \(pure18) min, 30 m = \(pure30) min")
- print("NDL air, GF 30/70 : 18 m = \(ndl(at: 18, gf: .conservative)!) min, 30 m = \(ndl(at: 30, gf: .conservative)!) min")
+ print("NDL air, GF 100/100: 18 m = \(pure18) min, 30 m = \(pure30) min")
+ print("NDL air, GF 30/70: 18 m = \(ndl(at: 18, gf: .conservative)!) min, 30 m = \(ndl(at: 30, gf: .conservative)!) min")
#expect((10...25).contains(pure30))
#expect((40...70).contains(pure18))
}
@@ -110,7 +111,7 @@ struct NoDecoTests {
}
}
-@Suite("Paliers")
+@Suite("Decompression stops")
struct DecoPlanTests {
func plan(minutes: Double, depth: Double, settings: DecoSettings = DecoSettings()) -> AscentPlan {
AscentPlanner.plan(tissues: tissues(after: minutes, at: depth),
@@ -122,12 +123,12 @@ struct DecoPlanTests {
let p = plan(minutes: 5, depth: 18)
#expect(!p.inDecompression)
#expect(p.noDecompressionLimit ?? .infinity > 0)
- #expect(abs(p.timeToSurface - 2) < 1e-9) // 18 m à 9 m/min
+ #expect(abs(p.timeToSurface - 2) < 1e-9) // 18 m at 9 m/min
}
@Test func decoDiveHasOrderedStops() throws {
let p = plan(minutes: 25, depth: 40)
- print("40 m, 25 min, air, GF 30/70 :", p.stops.map { "\(Int($0.depth)) m \($0.minutes) min" }, "TTS", p.timeToSurface)
+ print("40 m, 25 min, air, GF 30/70:", p.stops.map { "\(Int($0.depth)) m \($0.minutes) min" }, "TTS", p.timeToSurface)
#expect(p.inDecompression)
#expect(p.noDecompressionLimit == 0)
let depths = p.stops.map(\.depth)
@@ -163,9 +164,9 @@ struct DecoPlanTests {
}
}
-@Suite("Ordinateur")
+@Suite("Dive computer")
struct DiveComputerTests {
- /// Profil échantillonné à 1 Hz : (profondeur cible, vitesse m/min ou durée au fond).
+ /// Profile sampled at 1 Hz: (target depth, rate in m/min or bottom time).
func run(_ computer: inout DiveComputer, from depth: inout Double, to target: Double,
rate: Double, time: inout Double) {
while abs(depth - target) > 1e-9 {
@@ -227,7 +228,7 @@ struct DiveComputerTests {
let anchor = try #require(c.gradientAnchorDepth)
#expect(anchor == s.plan.stops.first?.depth)
#expect(s.ceilingDepth > 0)
- // Remontée directe au-dessus du plafond : alarme.
+ // Direct ascent above the ceiling: alarm.
run(&c, from: &d, to: 0.5, rate: 9, time: &t)
#expect(c.status.warnings.contains(.ceilingViolated))
}
@@ -244,7 +245,7 @@ struct DiveComputerTests {
}
}
-@Suite("Écran de plongée")
+@Suite("Dive screen")
struct DiveScreenEngineTests {
func computer() -> DiveComputer {
var config = DiveComputer.Configuration()
@@ -252,7 +253,7 @@ struct DiveScreenEngineTests {
return DiveComputer(configuration: config, surfacePressure: scale.surfacePressure)
}
- /// Profil à 1 Hz : (profondeur cible, vitesse m/min, secondes sur place).
+ /// 1 Hz profile: (target depth, rate in m/min, seconds held there).
func run(_ c: inout DiveComputer, _ legs: [(Double, Double, Int)]) {
var t = 0.0, d = 0.0
c.update(time: 0, pressure: scale.surfacePressure)
@@ -271,7 +272,7 @@ struct DiveScreenEngineTests {
let first = try #require(p.stops.first)
let seconds = try #require(first.seconds)
#expect(seconds % 10 == 0)
- #expect(seconds <= first.minutes * 60) // le compte à rebours ne dépasse pas la minute affichée
+ #expect(seconds <= first.minutes * 60) // the countdown never exceeds the displayed minute
#expect(seconds > (first.minutes - 1) * 60)
#expect(p.stops.dropFirst().allSatisfy { $0.seconds == nil })
}
@@ -279,7 +280,7 @@ struct DiveScreenEngineTests {
@Test func safetyStopCountsDownThenDone() {
var c = computer()
run(&c, [(18, 18, 600), (5, 9, 90)])
- guard case .running(let remaining) = c.safetyStop else { Issue.record("attendu en cours : \(c.safetyStop)"); return }
+ guard case .running(let remaining) = c.safetyStop else { Issue.record("expected running: \(c.safetyStop)"); return }
#expect(abs(remaining - 90) < 15)
var d = c
let t0 = 18.0 / 18 * 60 + 600 + 13.0 / 9 * 60 + 90
@@ -313,7 +314,7 @@ struct DiveScreenEngineTests {
}
}
-@Suite("Révision 0.2")
+@Suite("0.2 review")
struct ReviewTests {
@Test func aboveRequiredStopIsAViolation() {
var config = DiveComputer.Configuration(); config.water = .salt
@@ -322,7 +323,7 @@ struct ReviewTests {
c.update(time: 0, pressure: scale.surfacePressure)
while d < 40 { d = min(40, d + 0.3); t += 1; c.update(time: t, pressure: scale.pressure(atDepth: d)) }
for _ in 0..<(25 * 60) { t += 1; c.update(time: t, pressure: scale.pressure(atDepth: d)) }
- // Remontée continue à 9 m/min sans faire les paliers (les premiers s'effacent en route, pas le dernier).
+ // Continuous ascent at 9 m/min, skipping the stops (the first ones clear on the way up, not the last).
var flagged = false
while d > 1 {
d -= 0.15; t += 1
@@ -357,12 +358,12 @@ struct ReviewTests {
start: Date(timeIntervalSince1970: 1_800_000_000))
var t = 0.0
r.record(time: 0, pressure: scale.surfacePressure)
- // Autour de 38 m : au-dessus puis au-dessous de la profondeur limite, toutes les 2 s pendant 40 s.
+ // Around 38 m: above then below the depth limit, every 2 s for 40 s.
for i in 0..<20 {
t += 2
r.record(time: t, pressure: scale.pressure(atDepth: i % 2 == 0 ? 38.2 : 37.8))
}
let count = r.finish().events.filter { $0.warning == .depthLimit }.count
- #expect(count == 2) // à t=2 s, puis une fois passé 30 s
+ #expect(count == 2) // at t=2 s, then once 30 s have passed
}
}
diff --git a/Packages/RemoraDeco/Tests/RemoraDecoTests/LogbookTests.swift b/Packages/RemoraDeco/Tests/RemoraDecoTests/LogbookTests.swift
@@ -1,8 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Testing
@testable import RemoraDeco
-/// Plongée simulée à 1 Hz : descente à 18 m/min, fond, remontée à 9 m/min, palier de sécurité.
+/// Dive simulated at 1 Hz: descent at 18 m/min, bottom time, ascent at 9 m/min, safety stop.
func simulateDive(depth: Double, bottomMinutes: Int, start: Date, logbook: Logbook,
config: DiveComputer.Configuration = DiveComputer.Configuration()) -> DiveLog {
let scale = DepthScale(water: config.water)
@@ -19,7 +20,7 @@ func simulateDive(depth: Double, bottomMinutes: Int, start: Date, logbook: Logbo
return r.finish()
}
-@Suite("Carnet")
+@Suite("Logbook")
struct LogbookTests {
let start = Date(timeIntervalSince1970: 1_800_000_000)
@@ -28,7 +29,7 @@ struct LogbookTests {
#expect(abs(dive.maxDepth - 18) < 1e-6)
#expect(dive.samples.first?.time == 0)
#expect(dive.samples.last?.depth == 0)
- // Un point toutes les 2 s : 26 min de plongée → ~780 points
+ // One sample every 2 s: a 26 min dive → ~780 samples
#expect((770...790).contains(dive.samples.count))
#expect(zip(dive.samples, dive.samples.dropFirst()).allSatisfy { $1.time > $0.time })
#expect(abs(dive.duration / 60 - 26.0) < 0.1)
@@ -49,7 +50,7 @@ struct LogbookTests {
book.add(second)
#expect(book.dives.map(\.number) == [1, 2])
#expect(abs((book.dives[1].surfaceIntervalBefore ?? 0) - 60) < 0.1)
- // Plus court sans palier que la même plongée faite en premier
+ // Shorter no-decompression limit than the same dive done first
let fresh = simulateDive(depth: 18, bottomMinutes: 10, start: start, logbook: Logbook())
let ndlRepeat = try #require(second.samples.first { abs($0.depth - 18) < 1e-6 }?.noDecompressionLimit)
let ndlFresh = try #require(fresh.samples.first { abs($0.depth - 18) < 1e-6 }?.noDecompressionLimit)
@@ -59,7 +60,7 @@ struct LogbookTests {
@Test func decoDiveIsMarkedAndAlarmsLogged() {
let dive = simulateDive(depth: 40, bottomMinutes: 20, start: start, logbook: Logbook())
#expect(dive.hadDecompression)
- // La simulation remonte sans faire les paliers : plafond violé, noté dans les événements.
+ // The simulation ascends without doing the stops: ceiling violated, logged in the events.
#expect(dive.violations.contains { $0.warning == .ceilingViolated })
}
@@ -86,7 +87,7 @@ struct LogbookTests {
#expect(afterDeco >= 24)
let mountain = SurfaceAdvice.hoursBeforeAltitude(2500, logbook: decoBook, at: decoBook.dives[0].end,
surfacePressure: standardSurfacePressure)
- print("Après 40 m × 20 min : avion dans \(afterDeco) h, col à 2500 m dans \(mountain) h")
+ print("After 40 m × 20 min: flying in \(afterDeco) h, 2500 m pass in \(mountain) h")
#expect(mountain > 0)
}
@@ -101,7 +102,7 @@ struct LogbookTests {
#expect(xml.contains("<greatestdepth>18.00</greatestdepth>"))
#expect(xml.contains("Épave <test> & essai"))
#expect(xml.components(separatedBy: "<waypoint>").count - 1 == book.dives[0].samples.count)
- // XML bien formé
+ // Well-formed XML
#expect((try? XMLDocument(xmlString: xml)) != nil)
}
}
diff --git a/Packages/RemoraDeco/Tests/RemoraDecoTests/SampleDiveExportTests.swift b/Packages/RemoraDeco/Tests/RemoraDecoTests/SampleDiveExportTests.swift
@@ -1,11 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Testing
@testable import RemoraDeco
-/// Fabrique une plongée d'essai au format du dossier partagé (JSON + UDDF), pour tester l'import de Sub Rascasse.
-/// Lancé seulement avec SAMPLE_DIVE_DIR (dossier de sortie). Profil calculé, mais `source = remora` pour passer
-/// le filtre des simulations : le site et les notes disent clairement que c'est un essai, à supprimer.
-@Suite("Plongée d'essai")
+/// Builds a test dive in the shared-folder format (JSON + UDDF), to exercise the Sub Rascasse import.
+/// Runs only when SAMPLE_DIVE_DIR (output folder) is set. The profile is computed, but `source = remora` so it
+/// gets past the simulation filter: the site and notes say clearly that it is a test, to be deleted.
+@Suite("Sample dive")
struct SampleDiveExportTests {
static let dir = ProcessInfo.processInfo.environment["SAMPLE_DIVE_DIR"]
@@ -13,8 +14,8 @@ struct SampleDiveExportTests {
func writeSampleDive() throws {
let start = ISO8601DateFormatter().date(from: "2026-11-13T15:00:00Z")!
var dive = simulateDive(depth: 18, bottomMinutes: 25, start: start, logbook: Logbook())
- dive.site = "Essai Open Rémora"
- dive.notes = "Plongée d'essai fabriquée par le moteur d'Open Rémora pour tester l'import (profil calculé, pas une vraie plongée). À supprimer."
+ dive.site = "Open Rémora test"
+ dive.notes = "Test dive generated by the Open Rémora engine to exercise the import (computed profile, not a real dive). Delete it."
dive.number = 1
#expect(dive.source == .remora)
@@ -24,6 +25,6 @@ struct SampleDiveExportTests {
let base = URL(fileURLWithPath: Self.dir!).appendingPathComponent(dive.id.uuidString)
try encoder.encode(dive).write(to: base.appendingPathExtension("json"))
try UDDF.export([dive]).write(to: base.appendingPathExtension("uddf"), atomically: true, encoding: .utf8)
- print("ÉCRIT \(base.path).json et .uddf : \(dive.samples.count) points, \(dive.maxDepth) m, \(Int(dive.duration / 60)) min")
+ print("WROTE \(base.path).json and .uddf: \(dive.samples.count) samples, \(dive.maxDepth) m, \(Int(dive.duration / 60)) min")
}
}
diff --git a/Packages/RemoraDeco/Tests/RemoraDecoTests/SettingsTests.swift b/Packages/RemoraDeco/Tests/RemoraDecoTests/SettingsTests.swift
@@ -1,8 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Testing
@testable import RemoraDeco
-@Suite("Réglages")
+@Suite("Settings")
struct SettingsTests {
@Test func defaultsAreAirAndConservative() throws {
let c = try UserSettings().configuration()
@@ -25,7 +26,7 @@ struct SettingsTests {
s.customGFLowPercent = 45
s.customGFHighPercent = 90
#expect(try s.configuration().deco.gradientFactors == GradientFactors(low: 0.45, high: 0.90))
- s.conservatism = .medium // les valeurs avancées restent en mémoire mais ne s'appliquent plus
+ s.conservatism = .medium // the advanced values are kept but no longer apply
#expect(try s.configuration().deco.gradientFactors == GradientFactors(low: 0.40, high: 0.80))
}
@@ -82,7 +83,7 @@ struct SettingsTests {
}
@Test func olderSavedSettingsStillLoad() throws {
- // Réglages enregistrés par la 0.2 (sans l'alarme de NDL) : ils ne doivent pas être perdus.
+ // Settings saved by 0.2 (without the NDL alarm): they must not be lost.
let old = #"{"oxygenPercent":32,"water":"salt","conservatism":"medium","customGFLowPercent":30,"customGFHighPercent":70,"ppO2Max":1.4}"#
let s = try JSONDecoder().decode(UserSettings.self, from: Data(old.utf8))
#expect(s.oxygenPercent == 32)
diff --git a/Packages/RemoraDeco/Tests/RemoraDecoTests/ShearwaterComparisonTests.swift b/Packages/RemoraDeco/Tests/RemoraDecoTests/ShearwaterComparisonTests.swift
@@ -1,10 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Testing
@testable import RemoraDeco
-/// Compare le moteur à un ordinateur certifié : rejoue des plongées Shearwater (même algorithme, mêmes GF)
-/// et confronte le temps sans palier et les paliers à ceux que l'ordinateur affichait.
-/// Données personnelles hors dépôt : `tools/shearwater_decode.py` produit le JSON, chemin dans SHEARWATER_JSON.
+/// Compares the engine with a certified dive computer: replays Shearwater dives (same algorithm, same GF)
+/// and checks the no-decompression time and the stops against what the computer displayed.
+/// Personal data kept out of the repository: `tools/shearwater_decode.py` produces the JSON, path in SHEARWATER_JSON.
struct ShearwaterDive: Decodable {
struct Sample: Decodable {
let depth: Double
@@ -24,7 +25,7 @@ struct ShearwaterDive: Decodable {
let samples: [Sample]
}
-@Suite("Comparaison Shearwater")
+@Suite("Shearwater comparison")
struct ShearwaterComparisonTests {
static let path = ProcessInfo.processInfo.environment["SHEARWATER_JSON"]
@@ -40,7 +41,7 @@ struct ShearwaterComparisonTests {
var previous: (end: Date, tissues: TissueState)?
var allNDL: [Double] = []
var zeroEarly = 0, liberal = 0
- var shortNDL: [Double] = [] // quand le Shearwater affiche 30 min ou moins : là où ça compte
+ var shortNDL: [Double] = [] // when the Shearwater shows 30 min or less: where it matters
for dive in dives {
let start = try #require(dates.date(from: dive.date))
let surface = Double(dive.surface_mbar) / 1000
@@ -77,7 +78,7 @@ struct ShearwaterComparisonTests {
if s.ndl_or_stop >= 5, (plan.noDecompressionLimit ?? 99) < 1 { zeroEarly += 1 }
if s.ndl_or_stop <= 30, diff >= 5 { liberal += 1 }
if s.ndl_or_stop <= 30, abs(diff) >= 5, i % 6 == 0 {
- print(" écart t=\(Int(Double(i + 1) * step / 60))' \(s.depth) m : Shearwater \(s.ndl_or_stop) min, Rémora \(Int(plan.noDecompressionLimit ?? 99)) min")
+ print(" diff t=\(Int(Double(i + 1) * step / 60))' \(s.depth) m: Shearwater \(s.ndl_or_stop) min, Rémora \(Int(plan.noDecompressionLimit ?? 99)) min")
}
}
let minute = Double(i + 1) * step / 60
@@ -92,8 +93,8 @@ struct ShearwaterComparisonTests {
decoStats.ttsDiffs.append(plan.timeToSurface.rounded(.up) - Double(s.tts))
} else if s.stop_depth > 0 { decoStats.onlyTheirs += 1 } else if plan.inDecompression { decoStats.onlyOurs += 1 }
if s.stop_depth > 0 || plan.inDecompression {
- let ours = plan.stops.first.map { "\(Int($0.depth)) m \($0.minutes) min, surface \(Int(plan.timeToSurface.rounded(.up)))" } ?? "aucun"
- let theirs = s.stop_depth > 0 ? "\(s.stop_depth) m \(s.ndl_or_stop) min, surface \(s.tts)" : "aucun"
+ let ours = plan.stops.first.map { "\(Int($0.depth)) m \($0.minutes) min, surface \(Int(plan.timeToSurface.rounded(.up)))" } ?? "none"
+ let theirs = s.stop_depth > 0 ? "\(s.stop_depth) m \(s.ndl_or_stop) min, surface \(s.tts)" : "none"
if firstDeco == nil { firstDeco = "t=\(Int(Double(i + 1) * step / 60)) min" }
if i % 12 == 0 { stopRows.append(" t=\(Int(Double(i + 1) * step / 60))' \(s.depth) m | Shearwater \(theirs) | Rémora \(ours)") }
}
@@ -101,15 +102,15 @@ struct ShearwaterComparisonTests {
allNDL.append(contentsOf: ndlDiffs)
let mean = ndlDiffs.isEmpty ? 0 : ndlDiffs.reduce(0, +) / Double(ndlDiffs.count)
let worst = ndlDiffs.map { abs($0) }.max() ?? 0
- print("Plongée \(dive.number ?? "?") \(dive.site ?? "") GF \(dive.gf_low)/\(dive.gf_high) O2 \(dive.samples[0].o2) %"
- + (interval.map { " (intervalle \(Int($0)) min)" } ?? "")
- + String(format: " : sans palier, %d points, écart moyen %+.1f min, pire %.0f min", ndlDiffs.count, mean, worst))
+ print("Dive \(dive.number ?? "?") \(dive.site ?? "") GF \(dive.gf_low)/\(dive.gf_high) O2 \(dive.samples[0].o2)%"
+ + (interval.map { " (interval \(Int($0)) min)" } ?? "")
+ + String(format: ": no-deco, %d samples, mean diff %+.1f min, worst %.0f min", ndlDiffs.count, mean, worst))
if enter.theirs != nil || enter.ours != nil {
- func f(_ v: Double?) -> String { v.map { String(format: "%.1f", $0) } ?? "jamais" }
+ func f(_ v: Double?) -> String { v.map { String(format: "%.1f", $0) } ?? "never" }
let m = decoStats.minuteDiffs
let t = decoStats.ttsDiffs
- print(" PALIERS : entrée Shearwater \(f(enter.theirs)) min, Rémora \(f(enter.ours)) min ; sortie \(f(leave.theirs)) / \(f(leave.ours)) min")
- print(String(format: " PALIERS : %d points communs, même profondeur %d, durée du palier %+.2f min en moyenne (pire %+.0f), surface %+.1f min ; Shearwater seul %d points, Rémora seul %d points",
+ print(" DECO: entered Shearwater \(f(enter.theirs)) min, Rémora \(f(enter.ours)) min; left \(f(leave.theirs)) / \(f(leave.ours)) min")
+ print(String(format: " DECO: %d samples in common, same depth %d, stop time %+.2f min on average (worst %+.0f), surface %+.1f min; Shearwater only %d samples, Rémora only %d samples",
decoStats.both, decoStats.sameDepth, m.isEmpty ? 0 : m.reduce(0, +) / Double(m.count),
m.max(by: { abs($0) < abs($1) }) ?? 0, t.isEmpty ? 0 : t.reduce(0, +) / Double(t.count),
decoStats.onlyTheirs, decoStats.onlyOurs))
@@ -120,20 +121,20 @@ struct ShearwaterComparisonTests {
}
let mean = allNDL.reduce(0, +) / Double(max(1, allNDL.count))
let meanAbs = allNDL.map { abs($0) }.reduce(0, +) / Double(max(1, allNDL.count))
- print(String(format: "TOTAL sans palier : %d points, écart moyen %+.2f min, écart absolu moyen %.2f min", allNDL.count, mean, meanAbs))
+ print(String(format: "TOTAL no-deco: %d samples, mean diff %+.2f min, mean absolute diff %.2f min", allNDL.count, mean, meanAbs))
let shortMean = shortNDL.reduce(0, +) / Double(max(1, shortNDL.count))
let shortAbs = shortNDL.map { abs($0) }.reduce(0, +) / Double(max(1, shortNDL.count))
let within2 = Double(shortNDL.filter { abs($0) <= 2 }.count) / Double(max(1, shortNDL.count)) * 100
- print(String(format: "COURT (Shearwater ≤ 30 min) : %d points, écart moyen %+.2f min, absolu moyen %.2f min, pire %.0f min, %.0f %% à 2 min près",
+ print(String(format: "SHORT (Shearwater ≤ 30 min): %d samples, mean diff %+.2f min, mean absolute %.2f min, worst %.0f min, %.0f%% within 2 min",
shortNDL.count, shortMean, shortAbs, shortNDL.map { abs($0) }.max() ?? 0, within2))
- // Résultat du 2026-11-13 (10 plongées d'un Petrel 3) : paliers identiques à une minute près.
- // Temps sans palier, quand le Shearwater affiche 30 min ou moins, selon le crédit de désaturation de remontée :
- // aucun crédit : -1,8 min en moyenne, 77 % à 2 min près, 44 points à zéro trop tôt ;
- // crédit à 30 m/min : -0,3 min, 88 % à 2 min près, 7 points à zéro trop tôt ← retenu (noStopAscentRate) ;
- // crédit à 18 m/min : +0,6 min (moins prudent que le Shearwater) : écarté.
+ // Result of 2026-11-13 (10 dives from a Petrel 3): stops identical to within one minute.
+ // No-decompression time, when the Shearwater shows 30 min or less, depending on the ascent off-gassing credit:
+ // no credit : -1.8 min on average, 77% within 2 min, 44 samples at zero too early;
+ // credit at 30 m/min : -0.3 min, 88% within 2 min, 7 samples at zero too early ← chosen (noStopAscentRate);
+ // credit at 18 m/min : +0.6 min (less conservative than the Shearwater): rejected.
#expect(meanAbs < 3)
#expect(shortAbs < 2)
- #expect(shortMean < 0, "le moteur doit rester du côté prudent par rapport au Shearwater")
+ #expect(shortMean < 0, "the engine must stay on the conservative side of the Shearwater")
#expect(zeroEarly < 15)
}
}
diff --git a/Packages/RemoraDeco/Tests/RemoraDecoTests/SubsurfaceImportTests.swift b/Packages/RemoraDeco/Tests/RemoraDecoTests/SubsurfaceImportTests.swift
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import Testing
@testable import RemoraDeco
@@ -39,7 +40,7 @@ let sampleLog = """
</divelog>
"""
-@Suite("Import Subsurface")
+@Suite("Subsurface import")
struct SubsurfaceImportTests {
@Test func parsesDivesSitesAndProfile() throws {
let dives = try SubsurfaceImport.dives(from: Data(sampleLog.utf8))
@@ -53,11 +54,11 @@ struct SubsurfaceImportTests {
#expect(d.gas == .nitrox(32))
#expect(d.water == .fresh)
#expect(d.surfacePressure == 0.998)
- #expect(d.samples.count == 5) // premier ordinateur seulement
+ #expect(d.samples.count == 5) // first dive computer only
#expect(d.maxDepth == 24.3)
#expect(d.duration == 38 * 60 + 20)
#expect(d.minTemperature == 9)
- #expect(d.samples[2].temperature == 9) // la température se prolonge
+ #expect(d.samples[2].temperature == 9) // temperature carries forward
#expect(d.hadDecompression)
#expect(d.samples[2].stopDepth == 3 && d.samples[2].stopMinutes == 2)
#expect(d.samples[3].stopDepth == nil)
@@ -79,7 +80,7 @@ struct SubsurfaceImportTests {
start: Date(timeIntervalSince1970: 1_800_000_000), logbook: book)
book.add(mine)
#expect(book.dives.map(\.number) == [40, 41, 42])
- // Les tissus viennent de la dernière plongée Open Rémora, pas des importées.
+ // Tissues come from the last Open Rémora dive, not from the imported ones.
#expect(book.tissues(at: book.dives[2].end.addingTimeInterval(600),
surfacePressure: standardSurfacePressure) != nil)
}
diff --git a/README.md b/README.md
@@ -0,0 +1,77 @@
+# Open Rémora
+
+A free dive computer for the Apple Watch Ultra: depth, dive time, no-decompression limit, decompression stops,
+safety stop, ascent rate and alarms, with a logbook on the watch.
+
+**Open Rémora is a secondary dive computer and is not certified.** Always dive with a primary dive computer and
+follow it when the two disagree. No computation guarantees the absence of decompression sickness.
+
+The app is available in English and French.
+
+## What it does
+
+- Starts the dive by itself on submersion, or from "Ready to dive" and the Action button; ends it after one minute
+ at the surface.
+- Bühlmann ZHL-16C with gradient factors (three conservatism levels or custom factors), air or nitrox up to EAN40,
+ fresh, salt or EN 13319 water. Surface pressure is measured by the watch, so altitude needs no setting.
+- Dive screen in three pages turned with the crown (the touch screen is locked underwater): main page, details,
+ compass with a bearing. Alarms flash the whole screen and vibrate; warnings blink the value concerned.
+- Logbook on the watch with the profile of each dive, tissues carried over to repetitive dives, no-fly and
+ altitude waiting times.
+- Each dive is saved in Health as a diving workout and sent to the iPhone app, which hands it to
+ Sub Rascasse (the logbook app) through a shared folder, or exports it as UDDF.
+- On the iPhone: watch status, read-only settings, last dive, "no-fly time" Live Activity and notifications.
+
+The depth sensor entitlement granted by default stops at about 6 m; the 40 m entitlement is requested from Apple
+(see `docs/VALIDATION.md`).
+
+## Layout
+
+- `Packages/RemoraDeco`: the decompression engine, logbook model, UDDF export and Subsurface import. Pure Swift,
+ no user interface, tested on its own.
+- `OpenRemoraWatch`: the watch app (sensor, dive session, screens, logbook, settings).
+- `OpenRemora`: the iPhone companion app. `OpenRemoraWidgets`: its Live Activity.
+- `Shared`: sources compiled into several targets (formatting, sync contract, terms).
+- `docs/DESIGN.md` (design notes), `docs/SHARING.md` (contract with Sub Rascasse), `docs/VALIDATION.md`
+ (validation of the engine against a Shearwater Petrel 3).
+- `tools`: icon generator and scripts used for the Shearwater comparison.
+
+English is the source language. The French translation is in the String Catalogs
+(`OpenRemora/Localizable.xcstrings`, `OpenRemoraWatch/Localizable.xcstrings`,
+`OpenRemoraWidgets/Localizable.xcstrings`, `OpenRemoraWatch/InfoPlist.xcstrings`).
+
+Some names stay in French on purpose because they are stored data or a contract with other apps: the files
+`carnet.json` and `reglages.json` on the watch, `plongees.json` and `reglages-montre.json` on the iPhone, and the
+shared folder `OpenRemora/Plongees/` of the app group `group.org.schurger.dive`.
+
+## Build and test
+
+Requirements: Xcode 16 or later (Swift 6) and [XcodeGen](https://github.com/yonaskolb/XcodeGen).
+
+On a Mac:
+
+ cd Packages/RemoraDeco && swift test # decompression engine, 51 tests
+ xcodegen # generates OpenRemora.xcodeproj from project.yml
+ open OpenRemora.xcodeproj
+
+`project.yml` is the source of truth; the `.xcodeproj` is not versioned.
+
+The Makefile assumes the author's setup: the sources are edited on a Linux host and synced with `rsync` to a Mac
+reachable over SSH as `chunga`, which runs Swift and Xcode. Set `CHUNGA` (the SSH host) and `REMOTE` (the directory
+on the Mac) to adapt it:
+
+ make test-deco # swift test in Packages/RemoraDeco
+ make build-watch # watch app, watchOS simulator, unsigned
+ make build-phone # iPhone app with its widget and the watch app, iOS simulator, unsigned
+ make build-watch CHUNGA=my-mac REMOTE=src/open-remora
+
+`make archive` and `make upload` produce and send a signed build to TestFlight; they need the author's signing
+setup.
+
+Launch arguments used for screenshots and dry runs: `-demo` (demo logbook, simulated compass), `-simulate`
+(accelerated demo dive; with `-deep`, `-slow`), `-ready`, `-showDive`, `-showProfile`, `-page2`, `-page3`,
+`-testAlarm`, `-acceptTerms`, and `-liveActivity` on the iPhone.
+
+## License
+
+GPL-2.0-only. See [LICENSE](LICENSE).
diff --git a/Shared/DemoProfile.swift b/Shared/DemoProfile.swift
@@ -1,16 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import RemoraDeco
-/// Profils simulés : démonstration à sec et captures d'écran.
+/// Simulated profiles: dry demo and screenshots.
struct DemoProfile {
- /// Segments : profondeur visée (m), vitesse pour y aller (m/min), puis durée sur place (s).
+ /// Segments: target depth (m), rate to get there (m/min), then time spent there (s).
var segments: [(depth: Double, rate: Double, hold: Double)]
static let shallow = DemoProfile(segments: [(8, 15, 600), (5, 6, 180), (0, 8, 0)])
static let reef = DemoProfile(segments: [(22, 18, 720), (12, 16, 300), (5, 8, 180), (0, 8, 0)])
static let deep = DemoProfile(segments: [(38, 20, 780), (15, 9, 120), (6, 9, 300), (0, 9, 0)])
- /// Profondeur à chaque seconde, retour en surface compris.
+ /// Depth at every second, including the return to the surface.
var depths: [Double] {
var out: [Double] = [0]
var d = 0.0
@@ -27,7 +28,7 @@ struct DemoProfile {
static func temperature(atDepth depth: Double) -> Double { 21 - min(depth, 30) * 0.4 }
- /// Enregistre le profil d'un coup (carnet de démonstration).
+ /// Records the whole profile at once (demo logbook).
@MainActor
func record(start: Date, settings: UserSettings, logbook: Logbook) -> DiveLog {
let configuration = (try? settings.configuration()) ?? DiveComputer.Configuration()
diff --git a/Shared/Format.swift b/Shared/Format.swift
@@ -1,10 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0-only
import SwiftUI
import RemoraDeco
enum Format {
- static func depth(_ metres: Double) -> String { String(format: "%.1f", metres).replacingOccurrences(of: ".", with: ",") }
+ /// Language the app runs in. The French interface keeps the decimal comma and the date style it always had.
+ static let isFrench = Bundle.main.preferredLocalizations.first?.hasPrefix("fr") ?? false
+ private static let locale: Locale = {
+ if isFrench { return Locale(identifier: "fr_CA") }
+ return Locale.current.language.languageCode == .english ? Locale.current : Locale(identifier: "en_US")
+ }()
- /// Secondes → « 12:34 » (ou « 1:02:03 »).
+ /// Fixed number of decimals, with the decimal separator of the interface language.
+ static func decimal(_ value: Double, digits: Int) -> String {
+ let s = String(format: "%.\(digits)f", value)
+ return isFrench ? s.replacingOccurrences(of: ".", with: ",") : s
+ }
+
+ static func depth(_ metres: Double) -> String { decimal(metres, digits: 1) }
+
+ /// Seconds → "12:34" (or "1:02:03").
static func clock(_ seconds: Double) -> String {
let s = Int(seconds.rounded())
return s >= 3600 ? String(format: "%d:%02d:%02d", s / 3600, s / 60 % 60, s % 60)
@@ -13,46 +27,54 @@ enum Format {
static func minutes(_ seconds: Double) -> String { "\(Int((seconds / 60).rounded())) min" }
+ /// Waiting time in hours → "3 h 05" (or "45 min").
+ static func hours(_ h: Double) -> String {
+ let total = Int((h * 60).rounded(.up))
+ return total >= 60 ? "\(total / 60) h \(String(format: "%02d", total % 60))" : "\(total) min"
+ }
+
+ static func percent(_ value: Int) -> String { String(localized: "\(value)%") }
+
static func ndl(_ minutes: Double?) -> String {
guard let minutes else { return ">99" }
return minutes > 99 ? ">99" : "\(Int(minutes))"
}
static func day(_ date: Date) -> String {
- date.formatted(.dateTime.day().month(.abbreviated).year().locale(Locale(identifier: "fr_CA")))
+ date.formatted(.dateTime.day().month(.abbreviated).year().locale(locale))
}
static func dayTime(_ date: Date) -> String {
- date.formatted(.dateTime.day().month(.abbreviated).hour().minute().locale(Locale(identifier: "fr_CA")))
+ date.formatted(.dateTime.day().month(.abbreviated).hour().minute().locale(locale))
}
}
extension DiveComputer.Warning {
var label: String {
switch self {
- case .ascentFast: "Remontée rapide"
- case .ascentTooFast: "Remontée trop rapide"
- case .ceilingViolated: "Plafond franchi"
- case .ppO2High: "ppO2 élevée"
- case .ppO2Critical: "ppO2 critique"
- case .missedSafetyStop: "Palier de sécurité sauté"
- case .depthLimit: "Profondeur limite"
- case .lowNoDecompression: "NDL bas"
+ case .ascentFast: String(localized: "Fast ascent")
+ case .ascentTooFast: String(localized: "Ascent too fast")
+ case .ceilingViolated: String(localized: "Ceiling broken")
+ case .ppO2High: String(localized: "High ppO2")
+ case .ppO2Critical: String(localized: "Critical ppO2")
+ case .missedSafetyStop: String(localized: "Safety stop missed")
+ case .depthLimit: String(localized: "Depth limit")
+ case .lowNoDecompression: String(localized: "Low NDL")
}
}
var isViolation: Bool { [.ceilingViolated, .ascentTooFast, .ppO2Critical].contains(self) }
var color: Color { isViolation ? .red : .orange }
- /// La plus grave d'abord.
+ /// Most serious first.
var rank: Int { isViolation ? 0 : 1 }
}
extension Water {
var label: String {
switch self {
- case .fresh: "Douce"
- case .en13319: "Standard (EN 13319)"
- case .salt: "Salée"
+ case .fresh: String(localized: "Fresh")
+ case .en13319: String(localized: "Standard (EN 13319)")
+ case .salt: String(localized: "Salt")
}
}
}
@@ -60,10 +82,10 @@ extension Water {
extension UserSettings.Conservatism {
var label: String {
switch self {
- case .high: "Élevée (GF 30/70)"
- case .medium: "Moyenne (GF 40/80)"
- case .low: "Faible (GF 50/85)"
- case .custom: "Personnalisée"
+ case .high: String(localized: "High (GF 30/70)")
+ case .medium: String(localized: "Medium (GF 40/80)")
+ case .low: String(localized: "Low (GF 50/85)")
+ case .custom: String(localized: "Custom")
}
}
}
diff --git a/Shared/NoFlyActivity.swift b/Shared/NoFlyActivity.swift
@@ -1,16 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
#if canImport(ActivityKit) && os(iOS)
import ActivityKit
-/// Activité en direct « délai avant l'avion » : sur l'écran verrouillé et dans la Dynamic Island de l'iPhone,
-/// avec un compte à rebours jusqu'à l'heure où l'avion redevient possible.
-/// Limite d'iOS : une activité en direct reste active 8 h, puis jusqu'à 4 h sur l'écran verrouillé ;
-/// une notification annonce la fin du délai dans tous les cas.
+/// "No-fly time" Live Activity: on the lock screen and in the Dynamic Island of the iPhone, with a countdown
+/// to the time when flying becomes possible again.
+/// iOS limit: a Live Activity stays active for 8 h, then up to 4 h on the lock screen; a notification
+/// announces the end of the no-fly time in every case.
struct NoFlyAttributes: ActivityAttributes {
struct ContentState: Codable, Hashable {
- /// Heure à partir de laquelle l'avion redevient possible.
+ /// Time from which flying becomes possible again.
var until: Date
- /// Heure à partir de laquelle on peut monter à 2000 m (nil : déjà possible).
+ /// Time from which going up to 2000 m is possible (nil: already possible).
var altitudeUntil: Date?
}
diff --git a/Shared/PhoneSync.swift b/Shared/PhoneSync.swift
@@ -1,13 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0-only
import Foundation
import RemoraDeco
-/// Ce que la montre envoie à l'iPhone (WatchConnectivity). La montre est la seule source :
-/// l'iPhone affiche les réglages et range les plongées, il ne renvoie rien.
+/// What the watch sends to the iPhone (WatchConnectivity). The watch is the only source:
+/// the iPhone shows the settings and stores the dives, it sends nothing back.
enum PhoneSync {
- /// Contexte d'application (dernier état, remplacé à chaque envoi) : réglages et date d'envoi.
+ /// Application context (latest state, replaced at every send): settings and send date.
static let settingsKey = "settings"
static let sentAtKey = "sentAt"
- /// Métadonnée d'un fichier transféré : une plongée (`DiveLog` en JSON).
+ /// Metadata of a transferred file: one dive (`DiveLog` as JSON).
static let kindKey = "kind"
static let diveKind = "dive"
@@ -25,29 +26,29 @@ enum PhoneSync {
}()
}
-/// Dossier partagé avec Sub Rascasse (groupe d'apps de l'équipe). Voir `docs/PARTAGE.md`.
+/// Folder shared with Sub Rascasse (app group of the team). See `docs/SHARING.md`.
enum SharedFolder {
static let appGroup = "group.org.schurger.dive"
- /// Plongées d'Open Rémora en attente d'import : un `<id>.json` (DiveLog) et un `<id>.uddf` par plongée.
- /// Sub Rascasse les supprime après import.
+ /// Open Rémora dives waiting to be imported: one `<id>.json` (DiveLog) and one `<id>.uddf` per dive.
+ /// Sub Rascasse deletes them once imported. The folder name is part of the contract: do not rename it.
static let outboxPath = "OpenRemora/Plongees"
}
-/// Avertissement à accepter au premier lancement, sur la montre comme sur l'iPhone.
-/// Changer `version` le fait accepter de nouveau.
+/// Warning to accept at first launch, on the watch as on the iPhone.
+/// Changing `version` makes the user accept it again.
enum Terms {
static let version = 1
static let acceptedKey = "termsAcceptedVersion"
- static let title = "Avant de plonger"
+ static let title = String(localized: "Before you dive")
static let points = [
- "Open Rémora n'est pas un ordinateur de plongée certifié.",
- "Plongez toujours avec un ordinateur de plongée principal, et suivez-le en cas d'écart.",
- "Aucun calcul ne garantit l'absence d'accident de décompression.",
- "La montre peut tomber en panne ou mal mesurer pendant la plongée.",
- "Plongez dans les limites de votre formation. Vous êtes responsable de vos réglages et de votre mélange.",
+ String(localized: "Open Rémora is not a certified dive computer."),
+ String(localized: "Always dive with a primary dive computer, and follow it when the two disagree."),
+ String(localized: "No computation guarantees the absence of decompression sickness."),
+ String(localized: "The watch can fail or measure wrongly during the dive."),
+ String(localized: "Dive within the limits of your training. You are responsible for your settings and your gas."),
]
- static let accept = "J'ai compris, j'accepte"
+ static let accept = String(localized: "I understand and accept")
static let link = URL(string: "https://agora.schurger.org/open-remora/")!
static let privacy = URL(string: "https://agora.schurger.org/open-remora/confidentialite/")!
}
diff --git a/Shared/TermsView.swift b/Shared/TermsView.swift
@@ -1,6 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-only
import SwiftUI
-/// Avertissement à accepter au premier lancement (et après un changement de `Terms.version`).
+/// Warning to accept at first launch (and after a change of `Terms.version`).
struct TermsView: View {
let onAccept: () -> Void
@@ -17,7 +18,7 @@ struct TermsView: View {
}
.font(.footnote)
}
- Link("Conditions d'utilisation", destination: Terms.link)
+ Link("Terms of use", destination: Terms.link)
.font(.footnote)
Button(Terms.accept, action: onAccept)
.buttonStyle(.borderedProminent)
@@ -30,7 +31,7 @@ struct TermsView: View {
}
extension View {
- /// Montre `TermsView` tant que la version en cours n'a pas été acceptée.
+ /// Shows `TermsView` until the current version has been accepted.
func requiresTerms() -> some View { modifier(TermsGate()) }
}
diff --git a/docs/CONCEPTION.md b/docs/CONCEPTION.md
@@ -1,35 +0,0 @@
-# Open Rémora : ordinateur de plongée secondaire pour Apple Watch Ultra
-
-Le rémora accompagne un plus gros poisson sans le remplacer : Open Rémora est un ordinateur
-**secondaire**, non certifié, à porter avec un ordinateur principal. Projet frère : Open Mérou
-(app libre du boîtier Oceanic+). Pas de lien Bluetooth entre les deux sous l'eau (2,4 GHz absorbé) ;
-fusion éventuelle en surface (profil de la montre + photos datées du boîtier).
-
-## Capteurs et autorisations Apple
-
-- `CMWaterSubmersionManager` (Core Motion) : pression, profondeur, température de l'eau, immersion.
-- Autorisation **profondeur faible** (6 m) : libre, pour le développement et la piscine.
-- Autorisation **pleine profondeur** (40 m) : sur demande à Apple (formulaire), refus possible ;
- la demander avec une app 6 m qui fonctionne. Le lancement automatique à l'immersion semble exiger la pleine.
-- Références : <https://developer.apple.com/documentation/coremotion/accessing-submersion-data>,
- apps existantes Oceanic+, Mares, DiveCore.
-
-## Moteur (`Packages/RemoraDeco`, Swift pur, testé sur chunga par `make test-deco`)
-
-- Bühlmann ZHL-16C, azote seul (air et nitrox ; pas d'hélium : 40 m au plus), facteurs de gradient
- de Baker, **GF 30/70 par défaut**. Équations de Haldane (palier) et de Schreiner (entre deux
- échantillons, exacte pour une variation linéaire).
-- Entrée : pression absolue mesurée (bar) ; la profondeur n'est qu'un affichage (eau EN 13319 par défaut).
-- Sorties : limite sans palier, plafond, paliers de 3 m (dernier à 3 m), durée de remontée à 9 m/min,
- palier de sécurité 3 min à 5 m après 10 m, vitesse de remontée lissée sur 5 s (alerte 10, alarme 12 m/min),
- ppO2 (1,4 / 1,6), désaturation entre plongées.
-- Repères (eau salée, plongeur saturé en surface, posé à la profondeur) :
- limite sans palier GF 100/100 = 59 min à 18 m, 16,4 min à 30 m ; GF 30/70 = 28,7 et 8,4 min.
-
-## À faire
-
-1. Valider le moteur contre Subsurface sur une série de profils (écarts de paliers et de durée).
-2. CNS et OTU pour le nitrox.
-3. App watchOS (XcodeGen, comme Open Mérou) : séance d'entraînement de plongée, écrans lisibles avec gants,
- bouton Action et couronne, alarmes haptiques, carnet, export UDDF vers Subsurface.
-4. Essais à 6 m, puis demande de l'autorisation 40 m.
diff --git a/docs/DESIGN.md b/docs/DESIGN.md
@@ -0,0 +1,35 @@
+# Open Rémora: a secondary dive computer for Apple Watch Ultra
+
+The remora travels with a bigger fish without replacing it: Open Rémora is a **secondary**,
+non-certified dive computer, to be worn alongside a primary one. Sister project: Open Mérou
+(free app for the Oceanic+ housing). No Bluetooth link between the two underwater (2.4 GHz is absorbed);
+possibly a merge at the surface (profile from the watch + timestamped photos from the housing).
+
+## Sensors and Apple entitlements
+
+- `CMWaterSubmersionManager` (Core Motion): pressure, depth, water temperature, submersion.
+- **Shallow depth** entitlement (6 m): freely available, for development and the pool.
+- **Full depth** entitlement (40 m): on request to Apple (form), may be refused;
+ apply with a working 6 m app. Automatic launch on submersion seems to require the full one.
+- References: <https://developer.apple.com/documentation/coremotion/accessing-submersion-data>,
+ existing apps Oceanic+, Mares, DiveCore.
+
+## Engine (`Packages/RemoraDeco`, pure Swift, tested on chunga with `make test-deco`)
+
+- Bühlmann ZHL-16C, nitrogen only (air and nitrox; no helium: 40 m at most), Baker gradient
+ factors, **GF 30/70 by default**. Haldane equation (constant depth) and Schreiner equation (between
+ two samples, exact for a linear change).
+- Input: measured absolute pressure (bar); depth is only a display value (EN 13319 water by default).
+- Outputs: no-decompression limit, ceiling, stops every 3 m (last one at 3 m), time to surface at 9 m/min,
+ 3 min safety stop at 5 m after going below 10 m, ascent rate smoothed over 5 s (warning at 10, alarm at 12 m/min),
+ ppO2 (1.4 / 1.6), off-gassing between dives.
+- Reference values (salt water, diver saturated at the surface, dropped at depth):
+ no-decompression limit GF 100/100 = 59 min at 18 m, 16.4 min at 30 m; GF 30/70 = 28.7 and 8.4 min.
+
+## To do
+
+1. Validate the engine against Subsurface on a set of profiles (differences in stops and duration).
+2. CNS and OTU for nitrox.
+3. watchOS app (XcodeGen, like Open Mérou): dive workout session, screens readable with gloves,
+ Action button and Digital Crown, haptic alarms, logbook, UDDF export to Subsurface.
+4. Trials at 6 m, then apply for the 40 m entitlement.
diff --git a/docs/PARTAGE.md b/docs/PARTAGE.md
@@ -1,26 +0,0 @@
-# Plongées d'Open Rémora vers Sub Rascasse
-
-Décision de Jean (2026-11-13) : Sub Rascasse est le carnet. Open Rémora (montre) enregistre, son app iPhone fait le pont.
-
-## Chemin
-
-1. **Montre → iPhone** (WatchConnectivity, `OpenRemoraWatch/PhoneLink.swift`) : à la fin de chaque plongée réelle,
- un fichier JSON (`DiveLog`) par `transferFile`, métadonnée `kind = dive`. Les plongées de démonstration ne partent pas.
- Les réglages partent par le contexte d'application (`settings`, JSON de `UserSettings`) ; l'iPhone les affiche seulement.
-2. **iPhone → dossier partagé** (`OpenRemora/PhoneStore.swift`) : groupe d'apps `group.org.schurger.dive`
- (équipe CM5RQKJH56), dossier `OpenRemora/Plongees/`, deux fichiers par plongée :
- - `<uuid>.json` : la plongée complète (`DiveLog` de `RemoraDeco`, dates ISO 8601) ;
- - `<uuid>.uddf` : la même en UDDF 3.2 (profil, paliers, alarmes), lisible sans `RemoraDeco`.
-3. **Sub Rascasse** (à faire, autre dépôt) :
- - déclarer le même groupe d'apps `group.org.schurger.dive` ;
- - au lancement et au retour au premier plan, lire `OpenRemora/Plongees/*.json` (ou `*.uddf`), ajouter les plongées
- au carnet (et au nuage Subsurface s'il est relié), puis **supprimer les deux fichiers** : l'app Open Rémora compte
- les `.json` restants comme « en attente » ;
- - déclarer le schéma d'URL `subrascasse` ; Open Rémora ouvre `subrascasse://open-remora` (bouton « Ouvrir Sub Rascasse »).
-
-## Champs utiles du JSON
-
-`id` (UUID), `number`, `start`, `surfacePressure` (bar), `surfaceIntervalBefore` (min), `gas.o2`, `gradientFactors.low|high`,
-`water`, `samples[]` (`time` s, `depth` m, `temperature` °C, `ceiling` m, `noDecompressionLimit` min, `stopDepth`,
-`stopMinutes`), `events[]` (`time`, `warning` : ascentFast, ascentTooFast, ceilingViolated, ppO2High, ppO2Critical),
-`tissuesAfter` (16 pressions d'azote, bar), `computerModel` = « Open Rémora ».
diff --git a/docs/SHARING.md b/docs/SHARING.md
@@ -0,0 +1,26 @@
+# Dives from Open Rémora to Sub Rascasse
+
+Jean's decision (2026-11-13): Sub Rascasse is the logbook. Open Rémora (watch) records, its iPhone app is the bridge.
+
+## Path
+
+1. **Watch → iPhone** (WatchConnectivity, `OpenRemoraWatch/PhoneLink.swift`): at the end of each real dive,
+ one JSON file (`DiveLog`) sent with `transferFile`, metadata `kind = dive`. Demo dives are not sent.
+ Settings travel through the application context (`settings`, JSON of `UserSettings`); the iPhone only displays them.
+2. **iPhone → shared folder** (`OpenRemora/PhoneStore.swift`): app group `group.org.schurger.dive`
+ (team CM5RQKJH56), folder `OpenRemora/Plongees/`, two files per dive:
+ - `<uuid>.json`: the complete dive (`DiveLog` from `RemoraDeco`, ISO 8601 dates);
+ - `<uuid>.uddf`: the same dive in UDDF 3.2 (profile, stops, alarms), readable without `RemoraDeco`.
+3. **Sub Rascasse** (to do, other repository):
+ - declare the same app group `group.org.schurger.dive`;
+ - at launch and when returning to the foreground, read `OpenRemora/Plongees/*.json` (or `*.uddf`), add the dives
+ to the logbook (and to the Subsurface cloud if it is linked), then **delete both files**: the Open Rémora app counts
+ the remaining `.json` files as "pending";
+ - declare the `subrascasse` URL scheme; Open Rémora opens `subrascasse://open-remora` ("Open Sub Rascasse" button).
+
+## Useful JSON fields
+
+`id` (UUID), `number`, `start`, `surfacePressure` (bar), `surfaceIntervalBefore` (min), `gas.o2`, `gradientFactors.low|high`,
+`water`, `samples[]` (`time` s, `depth` m, `temperature` °C, `ceiling` m, `noDecompressionLimit` min, `stopDepth`,
+`stopMinutes`), `events[]` (`time`, `warning`: ascentFast, ascentTooFast, ceilingViolated, ppO2High, ppO2Critical),
+`tissuesAfter` (16 nitrogen pressures, bar), `computerModel` = "Open Rémora".
diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md
@@ -1,7 +1,7 @@
# Open Rémora — decompression engine validation against a certified dive computer
Status: 14 November 2026, version 0.2. Written to support the request for the
-full *Submerged Depth and Pressure* entitlement (40 m). The French design notes are in `CONCEPTION.md`.
+full *Submerged Depth and Pressure* entitlement (40 m). The design notes are in `DESIGN.md`.
## Summary
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
@@ -2,7 +2,7 @@ require "tmpdir"
default_platform(:ios)
-# Compte développeur perso (équipe CM5RQKJH56), clé App Store Connect lue dans ~/.zshrc_build de chunga.
+# Personal developer account (team CM5RQKJH56), App Store Connect key read from ~/.zshrc_build on chunga.
APP_ID = "org.schurger.openremora"
def api_key
@@ -33,28 +33,28 @@ platform :ios do
[res.code.to_i, (JSON.parse(res.body) rescue {})]
end
- desc "Capacités des identifiants (lecture seule) : groupe d'apps, HealthKit…"
+ desc "Capabilities of the bundle identifiers (read-only): app group, HealthKit…"
lane :capabilities do
api_key
%w[org.schurger.openremora org.schurger.openremora.watchkitapp org.schurger.subrascasse].each do |id|
b = Spaceship::ConnectAPI::BundleId.find(id)
- next UI.message("CAPS #{id} : absent") unless b
- UI.message("CAPS #{id} (nom « #{b.name} ») : #{b.get_capabilities.map(&:capability_type).join(", ")}")
+ next UI.message("CAPS #{id}: missing") unless b
+ UI.message("CAPS #{id} (name \"#{b.name}\"): #{b.get_capabilities.map(&:capability_type).join(", ")}")
end
end
- desc "Groupe de testeurs internes, textes TestFlight et notes de la dernière build"
+ desc "Internal tester group, TestFlight texts and notes for the latest build"
lane :beta_setup do
api_key
app = Spaceship::ConnectAPI::App.find(APP_ID)
_, groups = asc(:get, "/v1/apps/#{app.id}/betaGroups")
group = groups["data"].find { |g| g["attributes"]["name"] == "Interne" }
unless group
- # POST brut : spaceship envoie publicLinkLimitEnabled, refusé pour un groupe interne.
+ # Raw POST: spaceship sends publicLinkLimitEnabled, which is refused for an internal group.
c, r = asc(:post, "/v1/betaGroups", { data: { type: "betaGroups",
attributes: { name: "Interne", isInternalGroup: true, hasAccessToAllBuilds: true },
relationships: { app: { data: { type: "apps", id: app.id } } } } })
- UI.message("GROUPE Interne -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}")
+ UI.message("GROUP Interne -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}")
group = r["data"]
end
email = ENV["PERSO_APPLE_ID"] || "jean@schurger.org"
@@ -62,9 +62,9 @@ platform :ios do
if testers["data"].empty?
c, r = asc(:post, "/v1/betaTesters", { data: { type: "betaTesters", attributes: { email: email, firstName: "Jean", lastName: "Schurger" },
relationships: { betaGroups: { data: [{ type: "betaGroups", id: group["id"] }] } } } })
- UI.message("TESTEUR #{email} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}")
+ UI.message("TESTER #{email} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}")
else
- UI.message("TESTEUR #{email} déjà présent")
+ UI.message("TESTER #{email} already present")
end
texts = {
"fr-CA" => ["Ordinateur de plongée secondaire, libre et gratuit, pour Apple Watch Ultra. Non certifié : à porter avec un ordinateur principal.",
@@ -86,18 +86,18 @@ platform :ios do
end
_, builds = asc(:get, "/v1/builds?filter[app]=#{app.id}&sort=-uploadedDate&limit=1")
build = builds["data"].first
- UI.user_error!("Aucune build encore visible") unless build
+ UI.user_error!("No build visible yet") unless build
UI.message("BUILD #{build["attributes"]["version"]} #{build["attributes"]["processingState"]}")
- _, blocs = asc(:get, "/v1/builds/#{build["id"]}/betaBuildLocalizations")
+ _, build_locs = asc(:get, "/v1/builds/#{build["id"]}/betaBuildLocalizations")
texts.each do |locale, (_, what)|
- existing = blocs["data"].find { |l| l["attributes"]["locale"] == locale }
+ existing = build_locs["data"].find { |l| l["attributes"]["locale"] == locale }
c, r = if existing
asc(:patch, "/v1/betaBuildLocalizations/#{existing["id"]}", { data: { type: "betaBuildLocalizations", id: existing["id"], attributes: { whatsNew: what } } })
else
asc(:post, "/v1/betaBuildLocalizations", { data: { type: "betaBuildLocalizations", attributes: { locale: locale, whatsNew: what },
relationships: { build: { data: { type: "builds", id: build["id"] } } } } })
end
- UI.message("A TESTER #{locale} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}")
+ UI.message("WHAT TO TEST #{locale} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}")
end
end
end
diff --git a/project.yml b/project.yml
@@ -1,8 +1,9 @@
-# Projet Xcode généré par XcodeGen (`xcodegen` sur chunga) : modifier ce fichier, pas le .xcodeproj.
+# Xcode project generated by XcodeGen (`xcodegen`): edit this file, not the .xcodeproj.
+# English is the source language; French lives in the String Catalogs (Localizable.xcstrings, InfoPlist.xcstrings).
name: OpenRemora
options:
bundleIdPrefix: org.schurger
- developmentLanguage: fr
+ developmentLanguage: en
deploymentTarget:
iOS: "17.0"
watchOS: "11.0"
@@ -16,6 +17,8 @@ settings:
MARKETING_VERSION: "0.4"
CURRENT_PROJECT_VERSION: "1"
SWIFT_VERSION: "6.0"
+ SWIFT_EMIT_LOC_STRINGS: YES
+ LOCALIZATION_PREFERS_STRING_CATALOGS: YES
targets:
OpenRemora:
type: application
@@ -42,20 +45,21 @@ targets:
CFBundleDisplayName: Open Rémora
CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: $(CURRENT_PROJECT_VERSION)
+ CFBundleLocalizations: [en, fr]
ITSAppUsesNonExemptEncryption: false
UILaunchScreen: {}
UISupportedInterfaceOrientations: [UIInterfaceOrientationPortrait]
- # Ouvrir Sub Rascasse (le carnet) s'il est installé.
+ # Open Sub Rascasse (the logbook) when it is installed.
LSApplicationQueriesSchemes: [subrascasse]
- # Activité en direct « délai avant l'avion ».
+ # "No-fly time" Live Activity.
NSSupportsLiveActivities: true
entitlements:
path: OpenRemora/OpenRemora.entitlements
properties:
- # Dossier partagé avec Sub Rascasse (même équipe) : voir docs/PARTAGE.md.
- # Groupe créé et rattaché à la main sur le portail développeur (la clé API ne peut pas le faire).
+ # Folder shared with Sub Rascasse (same team): see docs/SHARING.md.
+ # Group created and attached by hand on the developer portal (the API key cannot do it).
com.apple.security.application-groups: [group.org.schurger.dive]
- # Activité en direct « délai avant l'avion » (écran verrouillé, Dynamic Island).
+ # "No-fly time" Live Activity (lock screen, Dynamic Island).
OpenRemoraWidgets:
type: app-extension
platform: iOS
@@ -74,6 +78,7 @@ targets:
CFBundleDisplayName: Open Rémora
CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: $(CURRENT_PROJECT_VERSION)
+ CFBundleLocalizations: [en, fr]
NSExtension:
NSExtensionPointIdentifier: com.apple.widgetkit-extension
OpenRemoraWatch:
@@ -96,19 +101,21 @@ targets:
CFBundleDisplayName: Open Rémora
CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: $(CURRENT_PROJECT_VERSION)
+ CFBundleLocalizations: [en, fr]
WKApplication: true
WKCompanionAppBundleIdentifier: org.schurger.openremora
WKRunsIndependentlyOfCompanionApp: true
WKBackgroundModes: [underwater-depth, workout-processing]
- NSMotionUsageDescription: Open Rémora lit la profondeur et la température de l'eau pendant la plongée.
- NSHealthUpdateUsageDescription: Open Rémora enregistre chaque plongée dans Santé, avec la profondeur et la température de l'eau.
- NSHealthShareUsageDescription: Open Rémora ne lit aucune donnée de Santé ; il y enregistre seulement vos plongées.
+ # French translations in OpenRemoraWatch/InfoPlist.xcstrings.
+ NSMotionUsageDescription: Open Rémora reads the depth and the water temperature during the dive.
+ NSHealthUpdateUsageDescription: Open Rémora saves every dive in Health, with the depth and the water temperature.
+ NSHealthShareUsageDescription: Open Rémora reads no Health data; it only saves your dives there.
entitlements:
path: OpenRemoraWatch/OpenRemoraWatch.entitlements
properties:
- # 6 m : libre. 40 m (submerged-depth-and-pressure) : sur demande à Apple.
+ # 6 m: free. 40 m (submerged-depth-and-pressure): on request to Apple.
com.apple.developer.submerged-shallow-depth-and-pressure: true
- # Séance d'entraînement « plongée » (app active pendant la plongée) et enregistrement dans Santé.
+ # Diving workout session (app active during the dive) and saving to Health.
com.apple.developer.healthkit: true
schemes:
OpenRemora:
diff --git a/tools/icon.swift b/tools/icon.swift
@@ -1,4 +1,5 @@
-// Dessine l'icône (1024 px, opaque) : `swift tools/icon.swift sortie.png` sur chunga.
+// SPDX-License-Identifier: GPL-2.0-only
+// Draws the icon (1024 px, opaque): `swift tools/icon.swift output.png` on chunga.
import CoreGraphics
import Foundation
import ImageIO
@@ -10,12 +11,12 @@ let ctx = CGContext(data: nil, width: size, height: size, bitsPerComponent: 8, b
bitmapInfo: CGImageAlphaInfo.noneSkipLast.rawValue)!
func color(_ r: Double, _ g: Double, _ b: Double, _ a: Double = 1) -> CGColor { CGColor(red: r, green: g, blue: b, alpha: a) }
-// Eau : clair en surface (haut), sombre au fond.
+// Water: light at the surface (top), dark at the bottom.
let gradient = CGGradient(colorsSpace: space, colors: [color(0.02, 0.10, 0.25), color(0.03, 0.33, 0.60), color(0.20, 0.72, 0.90)] as CFArray,
locations: [0, 0.6, 1])!
ctx.drawLinearGradient(gradient, start: CGPoint(x: 0, y: 0), end: CGPoint(x: 0, y: size), options: [])
-// Profil de plongée : descente, fond, remontée avec un palier.
+// Dive profile: descent, bottom, ascent with one stop.
let pts: [(Double, Double)] = [(130, 830), (300, 330), (560, 330), (700, 640), (820, 640), (894, 830)]
let profile = CGMutablePath()
profile.move(to: CGPoint(x: pts[0].0, y: pts[0].1))
@@ -26,7 +27,7 @@ ctx.addPath(fill); ctx.setFillColor(color(1, 1, 1, 0.14)); ctx.fillPath()
ctx.addPath(profile); ctx.setStrokeColor(color(1, 1, 1)); ctx.setLineWidth(44)
ctx.setLineJoin(.round); ctx.setLineCap(.round); ctx.strokePath()
-// Le rémora : petit poisson qui suit le profil, au fond.
+// The remora: a small fish following the profile, at the bottom.
ctx.setFillColor(color(1.0, 0.72, 0.20))
ctx.fillEllipse(in: CGRect(x: 360, y: 180, width: 230, height: 96))
let tail = CGMutablePath()
diff --git a/tools/shearwater_decode.py b/tools/shearwater_decode.py
@@ -1,6 +1,7 @@
-"""Décode l'export Shearwater Cloud (dive_data.db, format sw-pnf) en JSON.
-Usage : python3 -I shearwater_decode.py chemin/dive_data.db [sortie.json] [--dump N]
-Champs des échantillons d'après libdivecomputer (shearwater_predator_parser.c, format PNF)."""
+# SPDX-License-Identifier: GPL-2.0-only
+"""Decodes the Shearwater Cloud export (dive_data.db, sw-pnf format) to JSON.
+Usage: python3 -I shearwater_decode.py path/dive_data.db [output.json] [--dump N]
+Sample fields as per libdivecomputer (shearwater_predator_parser.c, PNF format)."""
import gzip, json, sqlite3, struct, sys
def records(blob):
@@ -49,9 +50,9 @@ if __name__ == "__main__":
for d in dives:
s = d["samples"]
print(d["number"], d["date"], d["site"], "GF", d["gf_low"], d["gf_high"], "surf", d["surface_mbar"],
- "pas", d["sample_ms"], "n", len(s), "max", max(x["depth"] for x in s), "cloud", d["cloud_max_depth"],
+ "step", d["sample_ms"], "n", len(s), "max", max(x["depth"] for x in s), "cloud", d["cloud_max_depth"],
"O2", sorted({x["o2"] for x in s}), "NDLmin", min(x["ndl_or_stop"] for x in s if x["stop_depth"] == 0),
"stops", sorted({x["stop_depth"] for x in s}), "temp", min(x["temp"] for x in s))
if len(sys.argv) > 2 and not sys.argv[2].startswith("--"):
json.dump(dives, open(sys.argv[2], "w"))
- print("écrit", sys.argv[2])
+ print("wrote", sys.argv[2])
diff --git a/tools/shearwater_fit.py b/tools/shearwater_fit.py
@@ -1,5 +1,6 @@
-"""Cale le modèle sur les tissus que le Shearwater note pendant la plongée (enregistrements 0x70-0x75, ~toutes les 5 min)
-puis cherche le critère de son temps sans palier. Usage : python3 -I shearwater_fit.py chemin/dive_data.db"""
+# SPDX-License-Identifier: GPL-2.0-only
+"""Fits the model to the tissues the Shearwater logs during the dive (records 0x70-0x75, ~every 5 min),
+then looks for the criterion behind its no-decompression time. Usage: python3 -I shearwater_fit.py path/dive_data.db"""
import gzip, math, sqlite3, struct, sys
HALF = [5.0, 8.0, 12.5, 18.5, 27.0, 38.3, 54.3, 77.0, 109.0, 146.0, 187.0, 239.0, 305.0, 390.0, 498.0, 635.0]
@@ -47,7 +48,7 @@ def fit(dives):
diff = [a - b for a, b in zip(t, d["snaps"][nxt][1])]
errs += diff; fast.append(diff[0]); nxt += 1
rms = math.sqrt(sum(e * e for e in errs) / len(errs))
- print(f"vapeur {vapour} densité {density} t½₁ {half0} : moyen {sum(errs)/len(errs):+.4f} bar, quadratique {rms:.4f}, pire {max(abs(e) for e in errs):.4f}, compartiment 1 moyen {sum(fast)/len(fast):+.4f} ({len(errs)//16} relevés)")
+ print(f"vapour {vapour} density {density} t½₁ {half0}: mean {sum(errs)/len(errs):+.4f} bar, RMS {rms:.4f}, worst {max(abs(e) for e in errs):.4f}, compartment 1 mean {sum(fast)/len(fast):+.4f} ({len(errs)//16} snapshots)")
if __name__ == "__main__":
fit(load(sys.argv[1]))
@@ -56,7 +57,7 @@ def ceiling(t, gf):
return max((p - a * gf) / (gf / b - gf + 1) for p, a, b in zip(t, A, B))
def ndl(t, p, surface, fn2, gf_high, vapour, credit, bar_m, rate=10.0, limit=99):
- """Plus long séjour (min entières) après lequel on sort encore sous GF haut ; credit = désaturation de remontée comptée."""
+ """Longest stay (whole minutes) after which one still surfaces under GF high; credit = ascent off-gassing counted."""
def ok(m):
x = step_tissues(t, p, p, fn2, m, vapour, HALF) if m else list(t)
if credit:
@@ -81,7 +82,7 @@ def criteria(dives, vapour, density):
rows[credit].append((ndl(t, p, d["surface"], 1 - s["o2"], d["gf"][1], vapour, credit, bar_m) - s["ndl"], s["ndl"], s["depth"], d["name"]))
for credit, r in rows.items():
e = [x[0] for x in r]
- print(f"vapeur {vapour} densité {density} {'avec' if credit else 'sans'} désaturation de remontée : {len(e)} relevés, écart moyen {sum(e)/len(e):+.2f} min, absolu {sum(abs(x) for x in e)/len(e):.2f}, pire {max(e, key=abs):+d}")
+ print(f"vapour {vapour} density {density} {'with' if credit else 'without'} ascent off-gassing: {len(e)} snapshots, mean diff {sum(e)/len(e):+.2f} min, absolute {sum(abs(x) for x in e)/len(e):.2f}, worst {max(e, key=abs):+d}")
return rows
if __name__ == "__main__":
@@ -89,4 +90,4 @@ if __name__ == "__main__":
for vapour, density in ((0.0627, 1000), (0.0493, 1000), (0.0627, 1020)):
rows = criteria(dives, vapour, density)
for credit in (False, True):
- print("détail", "avec" if credit else "sans", [(x[0], x[1], x[2]) for x in rows[credit]][:40])
+ print("detail", "with" if credit else "without", [(x[0], x[1], x[2]) for x in rows[credit]][:40])
diff --git a/tools/shearwater_implied.py b/tools/shearwater_implied.py
@@ -1,7 +1,8 @@
-"""GF de sortie implicite : pour chaque relevé de tissus, quel GF reproduit le temps sans palier affiché ?
-Usage : python3 -I shearwater_implied.py chemin/dive_data.db"""
+# SPDX-License-Identifier: GPL-2.0-only
+"""Implied surfacing GF: for each tissue snapshot, which GF reproduces the displayed no-decompression time?
+Usage: python3 -I shearwater_implied.py path/dive_data.db"""
import os, sys
-sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # dossier des outils, distinct des données
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # tools folder, separate from the data
from shearwater_fit import load, ndl
dives = load(sys.argv[1])
@@ -22,5 +23,5 @@ for d in dives:
v = ndl(snaps[i], p, d["surface"], 1 - s["o2"], g / 100, vapour, credit, bar_m)
if best is None or abs(v - s["ndl"]) < abs(best[1] - s["ndl"]): best = (g, v)
res.append(best[0])
- out.append(f"{'APRÈS' if seen_deco else ''}{s['depth']}m/{s['ndl']}min→{res[0]}|{res[1]}")
+ out.append(f"{'AFTER' if seen_deco else ''}{s['depth']}m/{s['ndl']}min→{res[0]}|{res[1]}")
print(d["name"], "GF", d["gf"], " ".join(out))
diff --git a/tools/shearwater_probe.py b/tools/shearwater_probe.py
@@ -1,4 +1,5 @@
-"""Sonde de l'export Shearwater Cloud (dive_data.db) : usage python3 -I shearwater_probe.py chemin/dive_data.db"""
+# SPDX-License-Identifier: GPL-2.0-only
+"""Probe of the Shearwater Cloud export (dive_data.db). Usage: python3 -I shearwater_probe.py path/dive_data.db"""
import sqlite3, sys, zlib, gzip, binascii
db = sqlite3.connect(f"file:{sys.argv[1]}?mode=ro", uri=True)
row = db.execute("select log_id, file_name, data_bytes_1, data_bytes_2, data_bytes_3 from log_data order by log_id desc limit 1").fetchone()
@@ -11,9 +12,9 @@ for name, f in (("zlib", zlib.decompress), ("gzip", gzip.decompress), ("raw-defl
try:
out = f(b); print(name, "OK", len(out)); break
except Exception as e:
- print(name, "non:", str(e)[:50]); out = None
+ print(name, "no:", str(e)[:50]); out = None
data = out or b
-print("taille", len(data), "reste/32", len(data) % 32)
+print("size", len(data), "remainder/32", len(data) % 32)
for k in range(0, min(len(data), 32 * 14), 32):
print(binascii.hexlify(data[k:k + 32], " ").decode())
print(row[3][:107]); print(row[4][:200])
diff --git a/tools/shearwater_rate.py b/tools/shearwater_rate.py
@@ -1,6 +1,7 @@
-"""Quelle vitesse de remontée le Shearwater suppose-t-il pour son temps sans palier ? python3 -I shearwater_rate.py dive_data.db"""
+# SPDX-License-Identifier: GPL-2.0-only
+"""Which ascent rate does the Shearwater assume for its no-decompression time? Usage: python3 -I shearwater_rate.py dive_data.db"""
import os, sys
-sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # dossier des outils, distinct des données
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # tools folder, separate from the data
from shearwater_fit import load, ndl
dives = load(sys.argv[1])
@@ -16,5 +17,5 @@ for vapour, density in ((0.0627, 1020), (0.0627, 1000), (0.0493, 1000)):
p = d["surface"] + s["depth"] * bar_m
v = ndl(snaps[i], p, d["surface"], 1 - s["o2"], d["gf"][1], vapour, rate is not None, bar_m, rate or 10.0)
(post if seen else errs).append(v - s["ndl"])
- f = lambda e: f"{len(e)} pts moyen {sum(e)/len(e):+.2f} absolu {sum(abs(x) for x in e)/len(e):.2f} pire {max(e, key=abs):+d}" if e else "—"
- print(f"vapeur {vapour} densité {density} remontée {rate or 'non comptée'} : avant paliers {f(errs)} | après paliers {f(post)}")
+ f = lambda e: f"{len(e)} pts mean {sum(e)/len(e):+.2f} absolute {sum(abs(x) for x in e)/len(e):.2f} worst {max(e, key=abs):+d}" if e else "—"
+ print(f"vapour {vapour} density {density} ascent {rate or 'not counted'}: before deco {f(errs)} | after deco {f(post)}")
diff --git a/tools/shearwater_tissues.py b/tools/shearwater_tissues.py
@@ -1,4 +1,5 @@
-"""Tissus de départ notés par le Shearwater (enregistrements 0x70-0x74) : python3 -I shearwater_tissues.py dives.json"""
+# SPDX-License-Identifier: GPL-2.0-only
+"""Starting tissues logged by the Shearwater (records 0x70-0x74). Usage: python3 -I shearwater_tissues.py dives.json"""
import json, struct, sys
for d in json.load(open(sys.argv[1])):
raw = b"".join(bytes.fromhex(d["raw_opening"][k])[4:32] for k in ("70", "71", "72", "73", "74") if k in d["raw_opening"]) if "70" in d["raw_opening"] else b""
diff --git a/tools/upload.sh b/tools/upload.sh
@@ -1,5 +1,6 @@
#!/bin/zsh
-# Envoi de l'IPA archivée sur TestFlight, à lancer sur chunga depuis la racine du dépôt (voir `make upload`).
+# SPDX-License-Identifier: GPL-2.0-only
+# Uploads the archived IPA to TestFlight; run on chunga from the repository root (see `make upload`).
source ~/.zshrc_build
export API_PRIVATE_KEYS_DIR=${PERSO_ASC_KEY_PATH:h}
xcrun altool --upload-app -f build/ipa/OpenRemora.ipa -t ios --apiKey $PERSO_ASC_KEY_ID --apiIssuer $PERSO_ASC_ISSUER_ID