Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions shared/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ gem 'bigdecimal'
gem 'logger'
gem 'benchmark'
gem 'mutex_m'
gem 'nkf'
4 changes: 2 additions & 2 deletions shared/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ react {

/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
// debuggableVariants = ["liteDebug", "prodDebug"]
// debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]

/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
Expand Down
2 changes: 1 addition & 1 deletion shared/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Mon May 06 15:15:57 PDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 0 additions & 3 deletions shared/android/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions shared/android/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion shared/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
},
"android": {
"package": "io.keybase.ossifrage"
}
},
"plugins": [
"expo-asset",
"expo-audio",
"expo-image",
"expo-localization",
"expo-mail-composer",
"expo-video"
]
}
}
2 changes: 1 addition & 1 deletion shared/chat/conversation/input-area/normal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const doInjectText = (inputRef: React.RefObject<InputRef | null>, text: string,
}

const ConnectedPlatformInput = function ConnectedPlatformInput() {
const route = useRoute<RootRouteProps<'chatConversation'> | RootRouteProps<'chatRoot'>>()
const route = useRoute() as RootRouteProps<'chatConversation'> | RootRouteProps<'chatRoot'>
const params = getRouteParamsFromRoute<'chatConversation' | 'chatRoot'>(route)
const infoPanelShowing = !!(params && typeof params === 'object' && 'infoPanel' in params && params.infoPanel)
const uiData = InputState.useConversationInput(
Expand Down
85 changes: 0 additions & 85 deletions shared/chat/conversation/thread-load-status-context.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as T from '@/constants/types'
import {notifyEngineActionListeners} from '@/engine/action-listener'
import {resetAllStores} from '@/util/zustand'
import {useCurrentUserState} from '@/stores/current-user'
import {useShellState} from '@/stores/shell'
import {
ConversationThreadLoadStatusProvider,
useThreadLoadStatus,
Expand All @@ -15,20 +14,6 @@ import {
} from './thread-load-status-context'
import {ConversationThreadProvider} from './thread-context'

let mockRouteFocused = true
let mockVisibleScreenName: string | undefined
jest.mock('@react-navigation/core', () => ({
createNavigationContainerRef: jest.fn(() => ({current: null})),
useIsFocused: () => mockRouteFocused,
}))
jest.mock('@/constants/router', () => {
const actual = jest.requireActual('@/constants/router')
return {
...actual,
getVisibleScreen: () => (mockVisibleScreenName ? {name: mockVisibleScreenName} : undefined),
}
})

jest.mock('@/stores/inbox-rows', () => ({
flushInboxRowUpdates: jest.fn(),
getInboxRowTrustedState: jest.fn(() => undefined),
Expand All @@ -53,8 +38,6 @@ const flushPromises = async () => {
}

beforeEach(() => {
mockRouteFocused = true
mockVisibleScreenName = undefined
jest.spyOn(T.RPCChat, 'localRequestInboxUnboxRpcPromise').mockResolvedValue(undefined)
useCurrentUserState.getState().dispatch.setBootstrap({
deviceID: 'device-id',
Expand Down Expand Up @@ -143,71 +126,3 @@ test('mounted stale-thread reload reports status through the provider', async ()

expect(result.current).toBe(T.RPCChat.UIChatThreadStatusTyp.server)
})

test('mounted route focus reload reports status through the provider', async () => {
mockRouteFocused = false
jest.spyOn(T.RPCChat, 'localGetThreadNonblockRpcListener').mockImplementation(async p => {
p.incomingCallMap['chat.1.chatUi.chatThreadStatus']?.({
status: {typ: T.RPCChat.UIChatThreadStatusTyp.server},
})
await Promise.resolve()
return {offline: false}
})
const {rerender, result} = renderHook(() => useThreadLoadStatus(), {wrapper})

act(() => {
mockRouteFocused = true
rerender()
})
await act(async () => {
await flushPromises()
})

expect(result.current).toBe(T.RPCChat.UIChatThreadStatusTyp.server)
})

test('mounted route focus skips reload after returning from emoji picker', async () => {
mockRouteFocused = false
mockVisibleScreenName = 'chatChooseEmoji'
const getThread = jest.spyOn(T.RPCChat, 'localGetThreadNonblockRpcListener').mockResolvedValue({
offline: false,
})
const {rerender} = renderHook(() => useThreadLoadStatus(), {wrapper})

act(() => {
mockRouteFocused = true
mockVisibleScreenName = undefined
rerender()
})
await act(async () => {
await flushPromises()
})

expect(getThread).not.toHaveBeenCalled()
})

test('mounted app foreground does not reload the thread', async () => {
const getThread = jest.spyOn(T.RPCChat, 'localGetThreadNonblockRpcListener').mockImplementation(async p => {
p.incomingCallMap['chat.1.chatUi.chatThreadStatus']?.({
status: {typ: T.RPCChat.UIChatThreadStatusTyp.server},
})
await Promise.resolve()
return {offline: false}
})
renderHook(() => useThreadLoadStatus(), {wrapper})

act(() => {
useShellState.getState().dispatch.changedFocus(false)
})
await act(async () => {
await flushPromises()
})
act(() => {
useShellState.getState().dispatch.changedFocus(true)
})
await act(async () => {
await flushPromises()
})

expect(getThread).not.toHaveBeenCalled()
})
1 change: 0 additions & 1 deletion shared/chat/conversation/thread-load-status-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export const ConversationThreadLoadStatusProvider = (
})
}


useEngineActionListener('chat.1.NotifyChat.ChatThreadsStale', action => {
const hasStaleThread = (action.payload.params.updates ?? []).some(
update => T.Chat.conversationIDToKey(update.convID) === id
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/thread-search-route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const isThreadSearchRouteParams = (
Object.prototype.hasOwnProperty.call(params, 'inputAction'))

export const useChatThreadRouteParams = (): ThreadSearchRouteProps | undefined => {
const route = useRoute<RootRouteProps<'chatConversation'> | RootRouteProps<'chatRoot'>>()
const route = useRoute() as RootRouteProps<'chatConversation'> | RootRouteProps<'chatRoot'>
const params = getRouteParamsFromRoute<'chatConversation' | 'chatRoot'>(route)
return isThreadSearchRouteParams(params) ? params : undefined
}
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/inbox-and-conversation-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Header = () => {
}

const Header2 = () => {
const {params} = useRoute<ChatRootRoute>()
const {params} = useRoute() as ChatRootRoute
const username = useCurrentUserState(s => s.username)
const infoPanelShowing = !!params.infoPanel
const conversationIDKey = params.conversationIDKey ?? Chat.noConversationIDKey
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/inbox/get-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const desktopOptions = {
}

export default {
freezeOnBlur: false,
inactiveBehavior: 'none' as const,
...(Kb.Styles.isMobile ? mobileOptions : desktopOptions),
headerTitle: () => (
<Kb.Text type="BodyBig" center={true}>
Expand Down
6 changes: 3 additions & 3 deletions shared/chat/inbox/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as React from 'react'
import {isLiquidGlassSupported as _isLiquidGlassSupported} from '@callstack/liquid-glass'
import {useChosenChannelsTeamnames} from '@/chat/conversation/manage-channels-badge'
import {useNavigation, type NavigationProp} from '@react-navigation/native'
import type {NativeBottomTabNavigationProp} from '@react-navigation/bottom-tabs/unstable'
import type {BottomTabNavigationProp} from '@react-navigation/bottom-tabs'
import {PerfProfiler} from '@/perf/react-profiler'
import * as RowSizes from './row/sizes'
import BigTeamsDivider from './row/big-teams-divider'
Expand Down Expand Up @@ -85,7 +85,7 @@ function InboxBody(p: ControlledInboxProps) {
const {unreadIndices, unreadTotal, rows, smallTeamsExpanded, isSearching, allowShowFloatingButton} = inbox
const {neverLoaded, onNewChat, inboxNumSmallRows, setInboxNumSmallRows} = inbox
const headComponent = C.isTablet ? null : <SearchRow search={search} showSearch={C.isMobile} />
const navigation = useNavigation<NavigationProp<RootParamList, 'chatRoot'>>()
const navigation = useNavigation() as NavigationProp<RootParamList, 'chatRoot'>
const chosenChannelsTeamnames = useChosenChannelsTeamnames()
const listExtraData = React.useMemo(
() => ({
Expand Down Expand Up @@ -196,7 +196,7 @@ function InboxBody(p: ControlledInboxProps) {
if (!useTabBottomAccessory) {
return
}
const parent = navigation.getParent<NativeBottomTabNavigationProp<RootParamList> | undefined>()
const parent = navigation.getParent() as BottomTabNavigationProp<RootParamList> | undefined
parent?.setOptions({bottomAccessory: showFloatingDivider ? renderBottomAccessory : undefined})
return () => {
parent?.setOptions({bottomAccessory: undefined})
Expand Down
4 changes: 2 additions & 2 deletions shared/crypto/decrypt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const useDecryptState = (params?: CryptoInputRouteParams) => {
}

export const DecryptInput = (_props: unknown) => {
const {params} = useRoute<RootRouteProps<'decryptTab'>>()
const {params} = useRoute() as RootRouteProps<'decryptTab'>
const controller = useDecryptState(params)
const navigateAppend = C.Router2.navigateAppend

Expand Down Expand Up @@ -207,7 +207,7 @@ export const DecryptOutput = ({route}: {route: {params: CommonOutputRouteParams}
}

export const DecryptIO = () => {
const {params} = useRoute<RootRouteProps<'decryptTab'>>()
const {params} = useRoute() as RootRouteProps<'decryptTab'>
const controller = useDecryptState(params)
return (
<DragAndDrop
Expand Down
4 changes: 2 additions & 2 deletions shared/crypto/encrypt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ const EncryptOutputBody = ({params}: {params: EncryptOutputRouteParams}) => (
)

export const EncryptInput = (_props: unknown) => {
const {params} = useRoute<RootRouteProps<'encryptTab'>>()
const {params} = useRoute() as RootRouteProps<'encryptTab'>
return <EncryptInputBody params={params} />
}

Expand All @@ -564,7 +564,7 @@ export const EncryptOutput = ({route}: {route: {params: EncryptOutputRouteParams
}

export const EncryptIO = () => {
const {params} = useRoute<RootRouteProps<'encryptTab'>>()
const {params} = useRoute() as RootRouteProps<'encryptTab'>
const controller = useEncryptScreenState(params)
const appendEncryptRecipientsBuilder = C.Router2.appendEncryptRecipientsBuilder

Expand Down
4 changes: 2 additions & 2 deletions shared/crypto/sign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const SignOutputBanner = ({state}: {state: CommonOutputRouteParams}) => (
)

export const SignInput = (_props: unknown) => {
const {params} = useRoute<RootRouteProps<'signTab'>>()
const {params} = useRoute() as RootRouteProps<'signTab'>
const controller = useSignState(params)
const blurCBRef = React.useRef(() => {})
const navigateAppend = C.Router2.navigateAppend
Expand Down Expand Up @@ -217,7 +217,7 @@ export const SignOutput = ({route}: {route: {params: CommonOutputRouteParams}})
}

export const SignIO = () => {
const {params} = useRoute<RootRouteProps<'signTab'>>()
const {params} = useRoute() as RootRouteProps<'signTab'>
const controller = useSignState(params)
return (
<DragAndDrop
Expand Down
4 changes: 2 additions & 2 deletions shared/crypto/verify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const useVerifyState = (params?: CryptoInputRouteParams) => {
}

export const VerifyInput = (_props: unknown) => {
const {params} = useRoute<RootRouteProps<'verifyTab'>>()
const {params} = useRoute() as RootRouteProps<'verifyTab'>
const controller = useVerifyState(params)
const navigateAppend = C.Router2.navigateAppend

Expand Down Expand Up @@ -204,7 +204,7 @@ export const VerifyOutput = ({route}: {route: {params: CommonOutputRouteParams}}
}

export const VerifyIO = () => {
const {params} = useRoute<RootRouteProps<'verifyTab'>>()
const {params} = useRoute() as RootRouteProps<'verifyTab'>
const controller = useVerifyState(params)
return (
<DragAndDrop
Expand Down
2 changes: 1 addition & 1 deletion shared/devices/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const splitAndSortDevices = (devices: ReadonlyArray<T.Devices.Device>) =>
const itemHeight = {height: 48, type: 'fixed'} as const

function ReloadableDevices() {
const navigation = useNavigation<NativeStackNavigationProp<DevicesRootParamList, 'devicesRoot'>>()
const navigation = useNavigation() as unknown as NativeStackNavigationProp<DevicesRootParamList, 'devicesRoot'>
const [devices, setDevices] = React.useState<Array<T.Devices.Device>>([])
const waiting = C.Waiting.useAnyWaiting(C.waitingKeyDevices)
const loadDevicesRPC = C.useRPC(T.RPCGen.deviceDeviceHistoryListRpcPromise)
Expand Down
4 changes: 2 additions & 2 deletions shared/fs/footer/upload-container.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as T from '@/constants/types'
import {useColorScheme, Image} from 'react-native'
import {useNavigation} from '@react-navigation/native'
import {useIsFocused} from '@react-navigation/core'
import type {NativeBottomTabNavigationProp} from '@react-navigation/bottom-tabs/unstable'
import type {BottomTabNavigationProp} from '@react-navigation/bottom-tabs'
import {isLiquidGlassSupported as _isLiquidGlassSupported} from '@callstack/liquid-glass'
import type {RootParamList} from '@/router-v2/route-params'
import Upload from './upload'
Expand Down Expand Up @@ -79,7 +79,7 @@ const UploadContainer = () => {

React.useEffect(() => {
if (!useTabBottomAccessory || !isFocused) return
const parent = navigation.getParent<NativeBottomTabNavigationProp<RootParamList> | undefined>()
const parent = navigation.getParent() as BottomTabNavigationProp<RootParamList> | undefined
parent?.setOptions({bottomAccessory: np.showing ? renderBottomAccessory : undefined})
return () => {
parent?.setOptions({bottomAccessory: undefined})
Expand Down
Loading