fix(#278): restore swipe-to-exit gesture in posts without breaking image galleries#306
Open
mozzerai wants to merge 1 commit into
Open
fix(#278): restore swipe-to-exit gesture in posts without breaking image galleries#306mozzerai wants to merge 1 commit into
mozzerai wants to merge 1 commit into
Conversation
…breaking image galleries The interactive pop gesture was lost in post details because navigationBarBackButtonHidden(true) disables it, while posts opened from search results kept the gesture and conflicted with image galleries. MMWebView now restores the pop gesture even with a hidden back button and suspends it while an in-page image gallery (PhotoSwipe/Powerkit, fancybox, magnific) is open, detected via an injected MutationObserver that reports lightbox state to a script message handler. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema (#278)
O gesto de deslizar para sair de posts foi perdido na v5 e, ao mesmo tempo, continuava ativo em posts abertos pela busca — conflitando com as galerias de imagens.
Causa raiz (dois lados):
NewsViewusa.navigationBarBackButtonHidden(true)para o botão de voltar customizado — isso desativa silenciosamente o gesto interativo de pop do SwiftUI. Por isso o gesto sumiu nos posts.SearchViewnunca escondeu o back button — o gesto continuou vivo lá e conflitava com as galerias, exatamente como relatado.disableGallery/disableNewGallerysó anulam ohrefdos links, mas a galeria do Powerkit (PhotoSwipe) registra handlers de clique via JS — então as galerias continuam abrindo no app.Solução
InteractivePopGesture.swift(novo): bridge UIKit que restaura ointeractivePopGestureRecognizermesmo com o back button escondido. Protegido: só dispara com a stack de navegação acima da raiz e sem transição em andamento; restaura o delegate original ao desaparecer.MMWebViewUserScripts.galleryStateObserver(novo script): MutationObserver que detecta lightbox aberto (.pswp--openPhotoSwipe/Powerkit, fancybox, magnific) e notifica o lado nativo.GalleryStateMessageHandler.swift(novo): recebe as mensagens de estado da galeria.MMWebView: galeria aberta ⇒ gesto suspenso; galeria fechada ⇒ deslizar para sair funciona.Comportamento unificado em: detalhe de notícias, resultados de busca e links internos aninhados. WebViews na raiz (Live, Instagram) não são afetadas pelo guard de profundidade da stack.
Testes
Fixes #278
🤖 Generated with Claude Code