Skip to content
Merged
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
2 changes: 1 addition & 1 deletion shared/app/global-errors/hook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const useData = () => {
navigateAppend('feedback')
}
}, [navigateAppend, clearModals, loggedIn, setGlobalError])
const copyToClipboard = useConfigState(s => s.dispatch.dynamic.copyToClipboard)
const copyToClipboard = useConfigState(s => s.dispatch.defer.copyToClipboard)
const onDismiss = React.useCallback(() => {
setGlobalError()
}, [setGlobalError])
Expand Down
2 changes: 1 addition & 1 deletion shared/app/out-of-date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const OutOfDate = () => {
C.ignorePromise(f())
})

const onOpenAppStore = useConfigState(s => s.dispatch.dynamic.openAppStore)
const onOpenAppStore = useConfigState(s => s.dispatch.defer.openAppStore)

return status !== 'critical' ? null : (
<Kb.Box2 direction="vertical" fullWidth={true} gap="small" style={styles.container}>
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/attachment-fullscreen/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const useData = (initialOrdinal: T.Chat.Ordinal) => {
}, [onSwitchAttachment])

const openLocalPathInSystemFileManagerDesktop = useFSState(
s => s.dispatch.dynamic.openLocalPathInSystemFileManagerDesktop
s => s.dispatch.defer.openLocalPathInSystemFileManagerDesktop
)
const navigateUp = C.useRouterState(s => s.dispatch.navigateUp)
const showInfoPanel = Chat.useChatContext(s => s.dispatch.showInfoPanel)
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/command-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Container = () => {
const info = Chat.useChatContext(s => s.commandStatus)
const _info = info || empty

const onOpenAppSettings = useConfigState(s => s.dispatch.dynamic.openAppSettings)
const onOpenAppSettings = useConfigState(s => s.dispatch.defer.openAppSettings)
const setCommandStatusInfo = Chat.useChatContext(s => s.dispatch.setCommandStatusInfo)
const onCancel = () => {
setCommandStatusInfo()
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/info-panel/attachments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export const useAttachmentSections = (
}

const openLocalPathInSystemFileManagerDesktop = useFSState(
s => s.dispatch.dynamic.openLocalPathInSystemFileManagerDesktop
s => s.dispatch.defer.openLocalPathInSystemFileManagerDesktop
)
const onShowInFinder = (message: T.Chat.MessageAttachment) =>
message.downloadPath && openLocalPathInSystemFileManagerDesktop?.(message.downloadPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const LocationPopup = () => {
const onClose = () => {
clearModals()
}
const onSettings = useConfigState(s => s.dispatch.dynamic.openAppSettings)
const onSettings = useConfigState(s => s.dispatch.defer.openAppSettings)
const sendMessage = Chat.useChatContext(s => s.dispatch.sendMessage)
const onLocationShare = (duration: string) => {
onClose()
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/list-area/index.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ const ThreadWrapper = React.memo(function ThreadWrapper() {
)
const {conversationIDKey, editingOrdinal, centeredOrdinal} = data
const {containsLatestMessage, messageOrdinals, loaded, messageTypeMap} = data
const copyToClipboard = useConfigState(s => s.dispatch.dynamic.copyToClipboard)
const copyToClipboard = useConfigState(s => s.dispatch.defer.copyToClipboard)
const listRef = React.useRef<HTMLDivElement | null>(null)
const _setListRef = React.useCallback((r: HTMLDivElement | null) => {
listRef.current = r
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/messages/attachment/audio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const AudioAttachment = () => {
const progressLabel = Chat.messageAttachmentTransferStateToProgressLabel(message.transferState)
const hasProgress = messageAttachmentHasProgress(message)
const openLocalPathInSystemFileManagerDesktop = useFSState(
s => s.dispatch.dynamic.openLocalPathInSystemFileManagerDesktop
s => s.dispatch.defer.openLocalPathInSystemFileManagerDesktop
)
const onShowInFinder = () => {
message.downloadPath && openLocalPathInSystemFileManagerDesktop?.(message.downloadPath)
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/messages/attachment/file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const FileContainer = React.memo(function FileContainer(p: OwnProps) {
[switchTab, saltpackOpenFile]
)
const openLocalPathInSystemFileManagerDesktop = useFSState(
s => s.dispatch.dynamic.openLocalPathInSystemFileManagerDesktop
s => s.dispatch.defer.openLocalPathInSystemFileManagerDesktop
)
const _onShowInFinder = React.useCallback(() => {
downloadPath && openLocalPathInSystemFileManagerDesktop?.(downloadPath)
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/messages/attachment/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const TransferIcon = (p: {style: Kb.Styles.StylesCrossPlatform}) => {
download(ordinal)
}, [ordinal, download])

const openFinder = useFSState(s => s.dispatch.dynamic.openLocalPathInSystemFileManagerDesktop)
const openFinder = useFSState(s => s.dispatch.defer.openLocalPathInSystemFileManagerDesktop)
const onFinder = React.useCallback(() => {
downloadPath && openFinder?.(downloadPath)
}, [openFinder, downloadPath])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const PopAttach = (ownProps: OwnProps) => {
const onShareAttachment = C.isMobile ? _onShareAttachment : undefined

const openLocalPathInSystemFileManagerDesktop = useFSState(
s => s.dispatch.dynamic.openLocalPathInSystemFileManagerDesktop
s => s.dispatch.defer.openLocalPathInSystemFileManagerDesktop
)
const _onShowInFinder = React.useCallback(() => {
downloadPath && openLocalPathInSystemFileManagerDesktop?.(downloadPath)
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/messages/message-popup/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const useItems = (ordinal: T.Chat.Ordinal, onHidden: () => void) => {
: []

const convLabel = getConversationLabel(participantInfo, meta, true)
const copyToClipboard = useConfigState(s => s.dispatch.dynamic.copyToClipboard)
const copyToClipboard = useConfigState(s => s.dispatch.defer.copyToClipboard)
const onCopyLink = React.useCallback(() => {
copyToClipboard(linkFromConvAndMessage(convLabel, id))
}, [copyToClipboard, id, convLabel])
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/conversation/messages/message-popup/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const PopText = (ownProps: OwnProps) => {
// you can reply privately *if* text message, someone else's message, and not in a 1-on-1 chat
const canReplyPrivately = ['small', 'big'].includes(teamType) || numPart > 2
const navigateAppend = C.useRouterState(s => s.dispatch.navigateAppend)
const copyToClipboard = useConfigState(s => s.dispatch.dynamic.copyToClipboard)
const copyToClipboard = useConfigState(s => s.dispatch.defer.copyToClipboard)
const onCopy = React.useCallback(() => {
text && copyToClipboard(text)
}, [copyToClipboard, text])
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/pdf/index.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ChatPDF = (props: Props) => {
const title = message?.title || message?.fileName || 'PDF'
const url = message?.fileURL
const openLocalPathInSystemFileManagerDesktop = useFSState(
s => s.dispatch.dynamic.openLocalPathInSystemFileManagerDesktop
s => s.dispatch.defer.openLocalPathInSystemFileManagerDesktop
)

const attachmentDownload = Chat.useChatContext(s => s.dispatch.attachmentDownload)
Expand Down
2 changes: 1 addition & 1 deletion shared/chat/pdf/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const ChatPDF = (props: Props) => {
const [error, setError] = React.useState('')
const navigateUp = C.useRouterState(s => s.dispatch.navigateUp)
const onBack = () => navigateUp()
const showShareActionSheet = useConfigState(s => s.dispatch.dynamic.showShareActionSheet)
const showShareActionSheet = useConfigState(s => s.dispatch.defer.showShareActionSheet)
const onShare = () => {
showShareActionSheet?.(url ?? '', '', 'application/pdf')
}
Expand Down
4 changes: 2 additions & 2 deletions shared/common-adapters/copy-text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const CopyText = (props: Props) => {

const popupAnchor = React.useRef<MeasureRef | null>(null)
const textRef = React.useRef<TextMeasureRef | null>(null)
const copyToClipboard = useConfigState(s => s.dispatch.dynamic.copyToClipboard)
const showShareActionSheet = useConfigState(s => s.dispatch.dynamic.showShareActionSheet)
const copyToClipboard = useConfigState(s => s.dispatch.defer.copyToClipboard)
const showShareActionSheet = useConfigState(s => s.dispatch.defer.showShareActionSheet)
const copy = React.useCallback(() => {
if (!text) {
if (!loadText) {
Expand Down
54 changes: 27 additions & 27 deletions shared/constants/init/index.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const fuseStatusToActions =
if (status.kextStarted && previousStatusType === T.FS.DriverStatusType.Disabled) {
useFSState
.getState()
.dispatch.dynamic.openPathInSystemFileManagerDesktop?.(T.FS.stringToPath('/keybase'))
.dispatch.defer.openPathInSystemFileManagerDesktop?.(T.FS.stringToPath('/keybase'))
}
}

Expand All @@ -198,7 +198,7 @@ const driverEnableFuse = async (isRetry: boolean) => {
} else {
await T.RPCGen.installInstallKBFSRpcPromise() // restarts kbfsfuse
await T.RPCGen.kbfsMountWaitForMountsRpcPromise()
useFSState.getState().dispatch.dynamic.refreshDriverStatusDesktop?.()
useFSState.getState().dispatch.defer.refreshDriverStatusDesktop?.()
}
}

Expand All @@ -223,7 +223,7 @@ const uninstallDokanConfirm = async () => {
}
if (!driverStatus.dokanUninstallExecPath) {
await uninstallDokanDialog?.()
useFSState.getState().dispatch.dynamic.refreshDriverStatusDesktop?.()
useFSState.getState().dispatch.defer.refreshDriverStatusDesktop?.()
return
}
useFSState.getState().dispatch.driverDisabling()
Expand All @@ -237,7 +237,7 @@ const onUninstallDokan = async () => {
try {
await uninstallDokan?.(execPath)
} catch {}
useFSState.getState().dispatch.dynamic.refreshDriverStatusDesktop?.()
useFSState.getState().dispatch.defer.refreshDriverStatusDesktop?.()
}

// Invoking the cached installer package has to happen from the topmost process
Expand All @@ -246,18 +246,18 @@ const onUninstallDokan = async () => {
const onInstallCachedDokan = async () => {
try {
await installCachedDokan?.()
useFSState.getState().dispatch.dynamic.refreshDriverStatusDesktop?.()
useFSState.getState().dispatch.defer.refreshDriverStatusDesktop?.()
} catch (e) {
errorToActionOrThrow(e)
}
}

export const initPlatformListener = () => {
useConfigState.setState(s => {
s.dispatch.dynamic.dumpLogsNative = dumpLogs
s.dispatch.dynamic.showMainNative = wrapErrors(() => showMainWindow?.())
s.dispatch.dynamic.copyToClipboard = wrapErrors((s: string) => copyToClipboard?.(s))
s.dispatch.dynamic.onEngineConnectedDesktop = wrapErrors(() => {
s.dispatch.defer.dumpLogsNative = dumpLogs
s.dispatch.defer.showMainNative = wrapErrors(() => showMainWindow?.())
s.dispatch.defer.copyToClipboard = wrapErrors((s: string) => copyToClipboard?.(s))
s.dispatch.defer.onEngineConnectedDesktop = wrapErrors(() => {
// Introduce ourselves to the service
const f = async () => {
await T.RPCGen.configHelloIAmRpcPromise({details: KB2.constants.helloDetails})
Expand Down Expand Up @@ -410,7 +410,7 @@ export const initPlatformListener = () => {
})

useFSState.setState(s => {
s.dispatch.dynamic.uploadFromDragAndDropDesktop = wrapErrors(
s.dispatch.defer.uploadFromDragAndDropDesktop = wrapErrors(
(parentPath: T.FS.Path, localPaths: string[]) => {
const {upload} = useFSState.getState().dispatch
const f = async () => {
Expand All @@ -428,7 +428,7 @@ export const initPlatformListener = () => {
}
)

s.dispatch.dynamic.openLocalPathInSystemFileManagerDesktop = wrapErrors((localPath: string) => {
s.dispatch.defer.openLocalPathInSystemFileManagerDesktop = wrapErrors((localPath: string) => {
const f = async () => {
try {
if (getPathType) {
Expand All @@ -442,7 +442,7 @@ export const initPlatformListener = () => {
ignorePromise(f())
})

s.dispatch.dynamic.openPathInSystemFileManagerDesktop = wrapErrors((path: T.FS.Path) => {
s.dispatch.defer.openPathInSystemFileManagerDesktop = wrapErrors((path: T.FS.Path) => {
const f = async () => {
const {sfmi, pathItems} = useFSState.getState()
return sfmi.driverStatus.type === T.FS.DriverStatusType.Enabled && sfmi.directMountDir
Expand All @@ -466,7 +466,7 @@ export const initPlatformListener = () => {
ignorePromise(f())
})

s.dispatch.dynamic.refreshDriverStatusDesktop = wrapErrors(() => {
s.dispatch.defer.refreshDriverStatusDesktop = wrapErrors(() => {
const f = async () => {
let status = await T.RPCGen.installFuseStatusRpcPromise({
bundleVersion: '',
Expand All @@ -480,7 +480,7 @@ export const initPlatformListener = () => {
ignorePromise(f())
})

s.dispatch.dynamic.refreshMountDirsDesktop = wrapErrors(() => {
s.dispatch.defer.refreshMountDirsDesktop = wrapErrors(() => {
const f = async () => {
const {sfmi, dispatch} = useFSState.getState()
const driverStatus = sfmi.driverStatus
Expand All @@ -495,16 +495,16 @@ export const initPlatformListener = () => {
ignorePromise(f())
})

s.dispatch.dynamic.setSfmiBannerDismissedDesktop = wrapErrors((dismissed: boolean) => {
s.dispatch.defer.setSfmiBannerDismissedDesktop = wrapErrors((dismissed: boolean) => {
const f = async () => {
await T.RPCGen.SimpleFSSimpleFSSetSfmiBannerDismissedRpcPromise({dismissed})
}
ignorePromise(f())
})

s.dispatch.dynamic.afterDriverEnabled = wrapErrors((isRetry: boolean) => {
s.dispatch.defer.afterDriverEnabled = wrapErrors((isRetry: boolean) => {
const f = async () => {
useFSState.getState().dispatch.dynamic.setSfmiBannerDismissedDesktop?.(false)
useFSState.getState().dispatch.defer.setSfmiBannerDismissedDesktop?.(false)
if (isWindows) {
await onInstallCachedDokan()
} else {
Expand All @@ -514,9 +514,9 @@ export const initPlatformListener = () => {
ignorePromise(f())
})

s.dispatch.dynamic.afterDriverDisable = wrapErrors(() => {
s.dispatch.defer.afterDriverDisable = wrapErrors(() => {
const f = async () => {
useFSState.getState().dispatch.dynamic.setSfmiBannerDismissedDesktop?.(false)
useFSState.getState().dispatch.defer.setSfmiBannerDismissedDesktop?.(false)
if (isWindows) {
await uninstallDokanConfirm()
} else {
Expand All @@ -526,7 +526,7 @@ export const initPlatformListener = () => {
ignorePromise(f())
})

s.dispatch.dynamic.afterDriverDisabling = wrapErrors(() => {
s.dispatch.defer.afterDriverDisabling = wrapErrors(() => {
const f = async () => {
if (isWindows) {
await onUninstallDokan()
Expand All @@ -537,14 +537,14 @@ export const initPlatformListener = () => {
ignorePromise(f())
})

s.dispatch.dynamic.openSecurityPreferencesDesktop = wrapErrors(() => {
s.dispatch.defer.openSecurityPreferencesDesktop = wrapErrors(() => {
const f = async () => {
await openURL?.('x-apple.systempreferences:com.apple.preference.security?General', {activate: true})
}
ignorePromise(f())
})

s.dispatch.dynamic.openFilesFromWidgetDesktop = wrapErrors((path: T.FS.Path) => {
s.dispatch.defer.openFilesFromWidgetDesktop = wrapErrors((path: T.FS.Path) => {
useConfigState.getState().dispatch.showMain()
if (path) {
Constants.navToPath(path)
Expand All @@ -553,7 +553,7 @@ export const initPlatformListener = () => {
}
})

s.dispatch.dynamic.openAndUploadDesktop = wrapErrors(
s.dispatch.defer.openAndUploadDesktop = wrapErrors(
(type: T.FS.OpenDialogType, parentPath: T.FS.Path) => {
const f = async () => {
const localPaths = await (selectFilesToUploadDialog?.(type, parentPath ?? undefined) ??
Expand All @@ -565,15 +565,15 @@ export const initPlatformListener = () => {
)

if (!isLinux) {
s.dispatch.dynamic.afterKbfsDaemonRpcStatusChanged = wrapErrors(() => {
s.dispatch.defer.afterKbfsDaemonRpcStatusChanged = wrapErrors(() => {
const {kbfsDaemonStatus, dispatch} = useFSState.getState()
if (kbfsDaemonStatus.rpcStatus === T.FS.KbfsDaemonRpcStatus.Connected) {
dispatch.dynamic.refreshDriverStatusDesktop?.()
dispatch.defer.refreshDriverStatusDesktop?.()
}
dispatch.dynamic.refreshMountDirsDesktop?.()
dispatch.defer.refreshMountDirsDesktop?.()
})
// force call as it could have happened already
s.dispatch.dynamic.afterKbfsDaemonRpcStatusChanged()
s.dispatch.defer.afterKbfsDaemonRpcStatusChanged()
}
})

Expand Down
Loading