open-merou

Open Mérou, a free iOS app for the Oceanic+ underwater iPhone housing
git clone https://git.schurger.org/open-merou.git
Log | Files | Refs | README | LICENSE

commit 0c8d9f2eea6c01d4d1bfcbc13b46aa8942ae4470
parent 58f0128572efd7d160ab616401acbdc2bb849aac
Author: Jean Schurger <jean@schurger.org>
Date:   Fri, 13 Nov 2026 15:26:25 -0500

0.11: compact scrolling menu, Menu → Information, -demoMenu argument

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

Diffstat:
MOpenMerou/App/AppModel.swift | 10++++++++++
MOpenMerou/Camera/CameraSettings.swift | 6++++--
MOpenMerou/UI/CameraScreen.swift | 65++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
MOpenMerouTests/CameraMenuTests.swift | 4++--
Mfastlane/Fastfile | 4++--
Mproject.yml | 2+-
6 files changed, 77 insertions(+), 14 deletions(-)

diff --git a/OpenMerou/App/AppModel.swift b/OpenMerou/App/AppModel.swift @@ -13,6 +13,8 @@ final class AppModel { private(set) var settings = CameraSettings.load() private(set) var menu = CameraMenu() private(set) var sleeping = false + /// Panneau d'informations ouvert par le menu ; n'importe quel bouton le referme. + private(set) var showingInfo = false /// Batterie de l'iPhone, en % (nil si inconnue). private(set) var phoneBattery: Int? @ObservationIgnored private var lastActivity = Date() @@ -50,6 +52,12 @@ final class AppModel { housing.cameraButton = { [weak self] event in self?.button(event) } // Lancement avec « -simulation » : boîtier simulé d'emblée (captures d'écran, démonstrations). if ProcessInfo.processInfo.arguments.contains("-simulation") { housing.startSimulation() } + // « -demoMenu » : ouvre les réglages sur leur dernière ligne (captures d'écran). + if ProcessInfo.processInfo.arguments.contains("-demoMenu") { + housing.bypassVacuum() + menu.open() + for press in [HousingButton.down, .down, .down, .right, .up] { _ = menu.handle(press, settings: &settings, caps: camera.capabilities) } + } sleepTask = Task { [weak self] in while !Task.isCancelled { try? await Task.sleep(for: .seconds(1)) @@ -84,6 +92,7 @@ final class AppModel { func button(_ event: ButtonEvent) { if sleeping { wake(); return } // le premier appui ne fait que réveiller l'écran lastActivity = Date() + if showingInfo { showingInfo = false; return } if menu.isOpen { guard !event.isLong else { return } let before = settings @@ -91,6 +100,7 @@ final class AppModel { case .setMode(let mode): settings.mode = mode case .sleepNow: sleep() + case .showInfo: showingInfo = true case .none, .close, .changed: break } if settings != before { diff --git a/OpenMerou/Camera/CameraSettings.swift b/OpenMerou/Camera/CameraSettings.swift @@ -184,7 +184,7 @@ extension CameraSettings { /// Menu : droite ouvre et valide, haut et bas déplacent, gauche remonte d'un niveau ou ferme. struct CameraMenu: Equatable, Sendable { enum RootItem: Sendable, CaseIterable { - case photo, video, sleep, settings + case photo, video, sleep, settings, info var title: String { switch self { @@ -192,6 +192,7 @@ struct CameraMenu: Equatable, Sendable { case .video: "Vidéo" case .sleep: "Veille" case .settings: "Réglages" + case .info: "Informations" } } } @@ -202,7 +203,7 @@ struct CameraMenu: Equatable, Sendable { case options(CameraSetting, Int) } - enum Action: Equatable, Sendable { case none, close, setMode(CaptureMode), sleepNow, changed } + enum Action: Equatable, Sendable { case none, close, setMode(CaptureMode), sleepNow, changed, showInfo } private(set) var level: Level? = nil var isOpen: Bool { level != nil } @@ -226,6 +227,7 @@ struct CameraMenu: Equatable, Sendable { case .video: self.level = nil; return .setMode(.video) case .sleep: self.level = nil; return .sleepNow case .settings: self.level = .settings(0) + case .info: self.level = nil; return .showInfo } } case .settings(let i): diff --git a/OpenMerou/UI/CameraScreen.swift b/OpenMerou/UI/CameraScreen.swift @@ -67,6 +67,8 @@ struct CameraScreen: View { } Text(housing.status.label).font(.footnote).foregroundStyle(.secondary) } + } else if model.showingInfo { + InfoPanel(model: model) } else if model.menu.isOpen { MenuView(model: model) } @@ -200,25 +202,36 @@ struct MenuView: View { var body: some View { let (title, rows, selected) = content - VStack(alignment: .leading, spacing: 4) { - Text(title).font(.headline).padding(.bottom, 6) - ForEach(rows.indices, id: \.self) { i in + // En paysage, l'écran est bas : on montre une fenêtre de lignes qui suit la sélection. + let visible = 5 + let first = max(0, min(selected - visible / 2, rows.count - visible)) + let shown = Array(rows.indices).filter { $0 >= first && $0 < first + visible } + VStack(alignment: .leading, spacing: 2) { + HStack { + Text(title).font(.headline) + Spacer() + Text("\(selected + 1)/\(rows.count)").font(.caption).foregroundStyle(.secondary) + } + .padding(.bottom, 4) + if first > 0 { Image(systemName: "chevron.compact.up").frame(maxWidth: .infinity).foregroundStyle(.secondary) } + ForEach(shown, id: \.self) { i in HStack { Text(rows[i].0) Spacer() if let value = rows[i].1 { Text(value).foregroundStyle(i == selected ? .black : .secondary) } } - .padding(.horizontal, 12).padding(.vertical, 8) + .padding(.horizontal, 12).padding(.vertical, 6) .background(i == selected ? Color.yellow : .clear, in: RoundedRectangle(cornerRadius: 10)) .foregroundStyle(i == selected ? .black : .white) } + if first + visible < rows.count { Image(systemName: "chevron.compact.down").frame(maxWidth: .infinity).foregroundStyle(.secondary) } Text("Haut, bas : choisir · droite : valider · gauche : retour") - .font(.caption).foregroundStyle(.secondary).padding(.top, 6) + .font(.caption2).foregroundStyle(.secondary).padding(.top, 4) } - .padding(20) + .padding(.horizontal, 16).padding(.vertical, 12) .frame(maxWidth: 420) .background(.black.opacity(0.8), in: RoundedRectangle(cornerRadius: 20)) - .padding() + .padding(8) } private var content: (String, [(String, String?)], Int) { @@ -277,3 +290,41 @@ struct SimulatedButtons: View { .accessibilityLabel(button.label) } } + +/// Informations du boîtier, ouvertes par le menu (le bouton ⓘ n'est pas atteignable sous l'eau). +struct InfoPanel: View { + let model: AppModel + + private var rows: [(String, String)] { + let housing = model.housing, r = housing.readings + func n(_ value: Double?, _ format: String) -> String { value.map { String(format: format, $0) } ?? "—" } + return [ + ("Boîtier", housing.status.label), + ("Pression intérieure", n(r.internalPressurePa.map { $0 / 100 }, "%.1f hPa")), + ("Pression extérieure (hypothèse)", n(r.externalPressurePa.map { $0 / 100 }, "%.1f hPa")), + ("Température intérieure", n(r.temperatureC, "%.1f °C")), + ("Batteries", "boîtier \(r.batteryPercent.map { "\($0) %" } ?? "—") · iPhone \(model.phoneBattery.map { "\($0) %" } ?? "—")"), + ("Couleurs", model.camera.gains?.label ?? "iPhone"), + ("Micrologiciel", housing.deviceInfo["Micrologiciel"] ?? "—"), + ] + } + + var body: some View { + let housing = model.housing + VStack(alignment: .leading, spacing: 3) { + Text("Informations").font(.headline).padding(.bottom, 2) + ForEach(rows, id: \.0) { row in + HStack { Text(row.0).foregroundStyle(.secondary); Spacer(); Text(row.1).monospacedDigit() } + } + ForEach(housing.log.prefix(3)) { line in + Text(line.text).font(.caption2).foregroundStyle(.secondary).lineLimit(1) + } + Text("N'importe quel bouton : fermer").font(.caption2).foregroundStyle(.secondary).padding(.top, 2) + } + .font(.footnote) + .padding(.horizontal, 16).padding(.vertical, 12) + .frame(maxWidth: 480) + .background(.black.opacity(0.8), in: RoundedRectangle(cornerRadius: 20)) + .padding(8) + } +} diff --git a/OpenMerouTests/CameraMenuTests.swift b/OpenMerouTests/CameraMenuTests.swift @@ -18,7 +18,7 @@ struct CameraMenuTests { var menu = CameraMenu(), settings = CameraSettings() settings.videoQuality = VideoQuality(height: 1080, fps: 30) menu.open() - _ = menu.handle(.up, settings: &settings, caps: caps) // boucle vers Réglages + for _ in 0..<3 { _ = menu.handle(.down, settings: &settings, caps: caps) } // Réglages _ = menu.handle(.right, settings: &settings, caps: caps) for _ in 0..<4 { _ = menu.handle(.down, settings: &settings, caps: caps) } // Qualité vidéo _ = menu.handle(.right, settings: &settings, caps: caps) @@ -33,7 +33,7 @@ struct CameraMenuTests { @Test func leftCancelsAnOption() { var menu = CameraMenu(), settings = CameraSettings() menu.open() - _ = menu.handle(.up, settings: &settings, caps: caps) + for _ in 0..<3 { _ = menu.handle(.down, settings: &settings, caps: caps) } _ = menu.handle(.right, settings: &settings, caps: caps) _ = menu.handle(.down, settings: &settings, caps: caps) _ = menu.handle(.right, settings: &settings, caps: caps) // Format photo diff --git a/fastlane/Fastfile b/fastlane/Fastfile @@ -122,9 +122,9 @@ platform :ios do end texts = { "fr-CA" => ["App libre et gratuite pour boîtier de plongée compatible : boutons, pompe à vide, capteurs, caméra.", - "0.10 : batteries du boîtier et de l'iPhone affichées séparément ; toutes les autorisations (caméra, micro, photothèque) demandées au lancement, avant de fermer le boîtier. Correction des couleurs par le capteur. Réglages → Couleurs : iPhone, sous l'eau automatique (par défaut), ou calibrées. Appui long sur le bouton bas : calibrer sur ce que l'on vise (sable, ardoise blanche). Témoin « ROUGE MAX » quand le capteur est au bout de sa correction. À essayer dans l'eau avec le mode développement."], + "0.11 : Menu → Informations (remplace le bouton ⓘ sous l'eau) ; menu compact qui défile (lisible en paysage) ; batteries du boîtier et de l'iPhone affichées séparément ; toutes les autorisations (caméra, micro, photothèque) demandées au lancement, avant de fermer le boîtier. Correction des couleurs par le capteur. Réglages → Couleurs : iPhone, sous l'eau automatique (par défaut), ou calibrées. Appui long sur le bouton bas : calibrer sur ce que l'on vise (sable, ardoise blanche). Témoin « ROUGE MAX » quand le capteur est au bout de sa correction. À essayer dans l'eau avec le mode développement."], "en-CA" => ["Free, open-source app for compatible dive housings: buttons, vacuum pump, sensors, camera.", - "0.10: housing and iPhone batteries shown separately; all permissions (camera, microphone, photo library) requested at launch, before closing the housing. On-sensor color correction. Settings → Colors: iPhone, underwater automatic (default), or calibrated. Long press on the down button: calibrate on what you aim at (sand, white slate). RED MAX indicator when the sensor reaches its limit. Please try in water with developer mode on."], + "0.11: Menu → Information (replaces the ⓘ button underwater); compact scrolling menu (readable in landscape); housing and iPhone batteries shown separately; all permissions (camera, microphone, photo library) requested at launch, before closing the housing. On-sensor color correction. Settings → Colors: iPhone, underwater automatic (default), or calibrated. Long press on the down button: calibrate on what you aim at (sand, white slate). RED MAX indicator when the sensor reaches its limit. Please try in water with developer mode on."], } _, locs = asc(:get, "/v1/apps/#{app.id}/betaAppLocalizations") texts.each do |locale, (description, _)| diff --git a/project.yml b/project.yml @@ -9,7 +9,7 @@ settings: base: DEVELOPMENT_TEAM: CM5RQKJH56 CODE_SIGN_STYLE: Automatic - MARKETING_VERSION: "0.10" + MARKETING_VERSION: "0.11" CURRENT_PROJECT_VERSION: "1" SWIFT_VERSION: "6.0" targets: