Skip to content

Commit 4424091

Browse files
authored
fix modals and pdf sharing (#28806)
* need to sub since this changes * fix mobile pdf
1 parent 5ec25db commit 4424091

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

shared/chat/conversation/messages/attachment/file.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const FileContainer = React.memo(function FileContainer(p: OwnProps) {
6666
const navigateAppend = C.useRouterState(s => s.dispatch.navigateAppend)
6767
const onDownload = React.useCallback(() => {
6868
if (C.isMobile) {
69-
messageAttachmentNativeShare(ordinal)
69+
messageAttachmentNativeShare(ordinal, true)
7070
} else if (!downloadPath) {
7171
if (fileType === 'application/pdf') {
7272
navigateAppend({

shared/constants/chat2/convostate.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export interface ConvoState extends ConvoStore {
250250
markThreadAsRead: (force?: boolean) => void
251251
markTeamAsRead: (teamID: T.Teams.TeamID) => void
252252
messageAttachmentNativeSave: (ordinal: T.Chat.Ordinal) => void
253-
messageAttachmentNativeShare: (ordinal: T.Chat.Ordinal) => void
253+
messageAttachmentNativeShare: (ordinal: T.Chat.Ordinal, fromDownload?: boolean) => void
254254
messageDelete: (ordinal: T.Chat.Ordinal) => void
255255
messageDeleteHistory: () => void
256256
messageReplyPrivately: (ordinal: T.Chat.Ordinal) => void
@@ -1851,7 +1851,7 @@ const createSlice: Z.ImmerStateCreator<ConvoState> = (set, get) => {
18511851
}
18521852
ignorePromise(f())
18531853
},
1854-
messageAttachmentNativeShare: ordinal => {
1854+
messageAttachmentNativeShare: (ordinal, fromDownload = false) => {
18551855
const message = get().messageMap.get(ordinal)
18561856
if (message?.type !== 'attachment') {
18571857
throw new Error('Invalid share message')
@@ -1864,7 +1864,8 @@ const createSlice: Z.ImmerStateCreator<ConvoState> = (set, get) => {
18641864
return
18651865
}
18661866

1867-
if (isIOS && message.fileName.endsWith('.pdf')) {
1867+
// kinda hacky, on download we need to download and showing
1868+
if (isIOS && message.fileName.endsWith('.pdf') && fromDownload) {
18681869
navigateAppend({
18691870
props: {
18701871
conversationIDKey: get().id,

shared/router-v2/left-tab-navigator.desktop.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as React from 'react'
22
import * as Kb from '@/common-adapters'
3-
import * as C from '@/constants'
43
import TabBar from './tab-bar.desktop'
54
import {useNavigationBuilder, TabRouter, createNavigatorFactory} from '@react-navigation/core'
65
import type {TypedNavigator, NavigatorTypeBagBase, StaticConfig} from '@react-navigation/native'
76
import type * as Tabs from '@/constants/tabs'
7+
import * as Router2 from '@/constants/router2'
88

99
type BackBehavior = Parameters<typeof TabRouter>[0]['backBehavior']
1010
type Props = Parameters<typeof useNavigationBuilder>[1] & {backBehavior: BackBehavior}
@@ -50,7 +50,7 @@ const LeftTabNavigator = React.memo(function LeftTabNavigator({
5050
setRendered(next)
5151
}, [selectedRoute, rendered])
5252

53-
const hasModals = C.Router2.getModalStack().length > 0
53+
const hasModals = Router2.useRouterState(() => Router2.getModalStack().length > 0)
5454

5555
return (
5656
<NavigationContent>

0 commit comments

Comments
 (0)