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 ce3b45287e71dd3e497c6783884ff919ac478882
parent 987e2378299291d8f6ca01e0308555054befbf46
Author: Jean Schurger <jean@schurger.org>
Date:   Fri, 13 Nov 2026 15:35:57 -0500

0.14: shutter blink, shot counter, transient messages

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

Diffstat:
MOpenMerou/App/AppModel.swift | 23+++++++++++++++++++++--
MOpenMerou/Camera/CameraEngine.swift | 7+++++--
MOpenMerou/UI/CameraScreen.swift | 13++++++++++++-
Mfastlane/Fastfile | 4++--
Mproject.yml | 2+-
5 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/OpenMerou/App/AppModel.swift b/OpenMerou/App/AppModel.swift @@ -13,6 +13,11 @@ final class AppModel { private(set) var settings = CameraSettings.load() private(set) var menu = CameraMenu() private(set) var sleeping = false + /// Message passager (erreurs, calibrage) ; s'efface tout seul. + private(set) var toast: String? + /// Augmente à chaque déclenchement : l'écran clignote comme un obturateur. + private(set) var shutterFlash = 0 + @ObservationIgnored private var toastTask: Task<Void, Never>? /// 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). @@ -28,9 +33,11 @@ final class AppModel { DevLog.shared.set(enabled: settings.developer) engine.onState = { [weak self] state in guard let self else { return } - if state.message != camera.message || state.shots != camera.shots, let message = state.message { + if state.messageCount != camera.messageCount, let message = state.message { DevLog.shared.event("caméra : \(message)") + show(message) } + if state.shots != camera.shots { DevLog.shared.event("enregistré dans la photothèque (\(state.shots))") } if state.zoomIndex != camera.zoomIndex, state.capabilities.zoomLabels.indices.contains(state.zoomIndex) { DevLog.shared.event("objectif \(state.capabilities.zoomLabels[state.zoomIndex])") } @@ -82,6 +89,15 @@ final class AppModel { sleeping = true } + private func show(_ message: String) { + toast = message + toastTask?.cancel() + toastTask = Task { [weak self] in + try? await Task.sleep(for: .seconds(3)) + if !Task.isCancelled { self?.toast = nil } + } + } + func wake() { lastActivity = Date() guard sleeping else { return } @@ -119,7 +135,10 @@ final class AppModel { } switch event.button { case .shutter: - if settings.mode == .photo { DevLog.shared.event("photo demandée") } + if settings.mode == .photo { + DevLog.shared.event("photo demandée") + shutterFlash += 1 + } settings.mode == .photo ? engine.capturePhoto() : engine.toggleRecording() case .up: engine.cycleLens(1) case .down: engine.cycleLens(-1) diff --git a/OpenMerou/Camera/CameraEngine.swift b/OpenMerou/Camera/CameraEngine.swift @@ -13,6 +13,8 @@ struct CameraState: Equatable, Sendable { var recordingSince: Date? var shots = 0 var message: String? + /// Change à chaque message, même répété, pour que l'écran le réaffiche. + var messageCount = 0 /// Gains de couleur appliqués au capteur (nil : balance des blancs de l'iPhone). var gains: ColorGains? var gainsSaturated = false @@ -51,6 +53,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { private func say(_ text: String) { state.message = text + state.messageCount += 1 publish() } @@ -309,7 +312,7 @@ final class CameraEngine: NSObject, @unchecked Sendable { self?.queue.async { self?.photoDelegates[id] = nil switch result { - case .success: self?.state.shots += 1; self?.say("Photo enregistrée") + case .success: self?.state.shots += 1; self?.publish() case .failure(let error): self?.say("Photo : \(error.localizedDescription)") } } @@ -363,7 +366,7 @@ extension CameraEngine: AVCaptureFileOutputRecordingDelegate { } done: { [weak self] problem in self?.queue.async { if problem == nil { self?.state.shots += 1 } - self?.say(problem.map { "Vidéo : \($0)" } ?? "Vidéo enregistrée") + if let problem { self?.say("Vidéo : \(problem)") } else { self?.publish() } } } } diff --git a/OpenMerou/UI/CameraScreen.swift b/OpenMerou/UI/CameraScreen.swift @@ -29,6 +29,7 @@ struct CameraScreen: View { let model: AppModel @Environment(\.scenePhase) private var scenePhase @State private var showDiagnostics = false + @State private var flashing = false private var housing: HousingClient { model.housing } @@ -37,11 +38,14 @@ struct CameraScreen: View { Color.black.ignoresSafeArea() PreviewView(layer: model.engine.previewLayer).ignoresSafeArea() + // Clignotement d'obturateur : l'image s'éteint un instant à chaque photo. + Color.black.ignoresSafeArea().opacity(flashing ? 1 : 0).allowsHitTesting(false) + VStack { topBar if model.settings.developer { devOverlay } Spacer() - if let message = model.camera.message, !model.menu.isOpen { + if let message = model.toast, !model.menu.isOpen { Text(message).font(.footnote).padding(8).background(.black.opacity(0.5), in: Capsule()) } bottomBar @@ -84,6 +88,10 @@ struct CameraScreen: View { .preferredColorScheme(.dark) .statusBarHidden() .persistentSystemOverlays(.hidden) + .onChange(of: model.shutterFlash) { + flashing = true + withAnimation(.easeOut(duration: 0.25).delay(0.08)) { flashing = false } + } .sheet(isPresented: $showDiagnostics) { HousingView(housing: housing) } .onChange(of: scenePhase) { _, phase in if phase != .active { @@ -184,6 +192,9 @@ struct CameraScreen: View { } if model.camera.gainsSaturated { Label("ROUGE MAX", systemImage: "exclamationmark.triangle.fill").foregroundStyle(.orange) } if model.settings.exposureBias != 0 { Text(String(format: "%+.1f EV", model.settings.exposureBias)) } + Label("\(model.camera.shots)", systemImage: "photo.on.rectangle") + .contentTransition(.numericText()) + .animation(.default, value: model.camera.shots) Spacer() let labels = model.camera.capabilities.zoomLabels ForEach(labels.indices, id: \.self) { i in 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.13 : la simulation va droit à la caméra ; écran ⓘ avec bouton Retour et « Se déconnecter » seulement si un boîtier est connecté ; « Essai à sec » retiré, « Simuler un boîtier » est un vrai bouton. 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."], + "0.14 : à chaque photo, l'image clignote comme un obturateur et le compteur augmente une fois la photo enregistrée ; les messages s'effacent seuls. La simulation va droit à la caméra ; écran ⓘ avec bouton Retour et « Se déconnecter » seulement si un boîtier est connecté ; « Essai à sec » retiré, « Simuler un boîtier » est un vrai bouton. 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.13: simulation goes straight to the camera; ⓘ screen has a Back button and shows Disconnect only when a housing is connected; Dry run removed, Simulate a housing is now a proper button. 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."], + "0.14: on each photo the image blinks like a shutter and the counter goes up once saved; messages clear by themselves. Simulation goes straight to the camera; ⓘ screen has a Back button and shows Disconnect only when a housing is connected; Dry run removed, Simulate a housing is now a proper button. 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.13" + MARKETING_VERSION: "0.14" CURRENT_PROJECT_VERSION: "1" SWIFT_VERSION: "6.0" targets: