Skip to content

Commit

Permalink
Small deps and util cleanup (keybase#25603)
Browse files Browse the repository at this point in the history
* small dep changes and cleanup utils a bit
  • Loading branch information
chrisnojima authored Apr 5, 2023
1 parent 6fd9d54 commit 56dece3
Show file tree
Hide file tree
Showing 23 changed files with 123 additions and 171 deletions.
7 changes: 3 additions & 4 deletions shared/actions/chat2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import * as UsersGen from '../users-gen'
import * as WaitingGen from '../waiting-gen'
import * as WalletTypes from '../../constants/types/wallets'
import * as WalletsGen from '../wallets-gen'
import {findLast} from '../../util/arrays'
import KB2 from '../../util/electron'
import NotifyPopup from '../../util/notify-popup'
import logger from '../../logger'
Expand Down Expand Up @@ -2351,8 +2352,7 @@ const markThreadAsRead = async (
const mmap = state.chat2.messageMap.get(conversationIDKey)
if (mmap) {
const ordinals = Constants.getMessageOrdinals(state, conversationIDKey)
// @ts-ignore this exists in our js and in ts 5
const ordinal = [...ordinals].findLast((o: Types.Ordinal) => {
const ordinal = findLast([...ordinals], (o: Types.Ordinal) => {
const m = mmap.get(o)
return m ? !!m.id : false
})
Expand Down Expand Up @@ -2398,8 +2398,7 @@ const markAsUnread = async (
const ordinals = state.chat2.messageOrdinals.get(conversationIDKey) ?? []
const ord =
messageMap &&
// @ts-ignore this exists in our js and in ts 5
[...ordinals].findLast((o: Types.Ordinal) => {
findLast([...ordinals], (o: Types.Ordinal) => {
const message = messageMap.get(o)
return !!(message && message.id < unreadLineID)
})
Expand Down
2 changes: 1 addition & 1 deletion shared/actions/fs/common.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as FsGen from '../fs-gen'
import * as Types from '../../constants/types/fs'
import * as Constants from '../../constants/fs'
import * as Container from '../../util/container'
import {parseUri, launchImageLibraryAsync} from '../../util/expo-image-picker'
import {parseUri, launchImageLibraryAsync} from '../../util/expo-image-picker.native'
import {errorToActionOrThrow} from './shared'
import {saveAttachmentToCameraRoll, showShareActionSheet} from '../platform-specific'

Expand Down
2 changes: 1 addition & 1 deletion shared/actions/platform-specific/index.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {RPCError} from '../../util/errors'
import {_getNavigator} from '../../constants/router2'
import {getEngine} from '../../engine'
import {isLinux, isWindows, defaultUseNativeFrame} from '../../constants/platform.desktop'
import {kbfsNotification} from '../../util/kbfs-notifications'
import {kbfsNotification} from './kbfs-notifications'
import {skipAppFocusActions} from '../../local-debug.desktop'
import NotifyPopup from '../../util/notify-popup'

Expand Down
2 changes: 1 addition & 1 deletion shared/actions/platform-specific/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {Alert, Linking, ActionSheetIOS} from 'react-native'
import {_getNavigator} from '../../constants/router2'
import {getEngine} from '../../engine/require'
import {isIOS, isAndroid} from '../../constants/platform'
import {launchImageLibraryAsync} from '../../util/expo-image-picker'
import {launchImageLibraryAsync} from '../../util/expo-image-picker.native'
import {
getDefaultCountryCode,
androidOpenSettings,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import capitalize from 'lodash/capitalize'
import {FSErrorType, FSNotificationType, FSStatusCode, type FSNotification} from '../constants/types/rpc-gen'
import {parseFolderNameToUsers} from './kbfs'
import {pathSep} from '../constants/platform'
import type {TypedState} from '../constants/reducer'
import {
FSErrorType,
FSNotificationType,
FSStatusCode,
type FSNotification,
} from '../../constants/types/rpc-gen'
import {parseFolderNameToUsers} from '../../util/kbfs'
import {pathSep} from '../../constants/platform'
import type {TypedState} from '../../constants/reducer'

type DecodedKBFSError = {
title: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {Props} from './platform-input'
import {NativeKeyboard} from '../../../../common-adapters/mobile.native'
import {formatDurationShort} from '../../../../util/timestamp'
import {isOpen} from '../../../../util/keyboard'
import {parseUri, launchCameraAsync, launchImageLibraryAsync} from '../../../../util/expo-image-picker'
import {parseUri, launchCameraAsync, launchImageLibraryAsync} from '../../../../util/expo-image-picker.native'
import {standardTransformer} from '../suggestors/common'
import {useSuggestors} from '../suggestors'
import {type PastedFile} from '@mattermost/react-native-paste-input'
Expand Down
2 changes: 1 addition & 1 deletion shared/desktop/remote/component-loader.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as Styles from '../../styles'
import * as ReactDOM from 'react-dom/client'
import RemoteStore from './store.desktop'
import Root from '../renderer/container.desktop'
import {disable as disableDragDrop} from '../../util/drag-drop'
import {disableDragDrop} from '../../util/drag-drop.desktop'
import ErrorBoundary from '../../common-adapters/error-boundary'
import {initDesktopStyles} from '../../styles/index.desktop'
import {enableMapSet} from 'immer'
Expand Down
2 changes: 1 addition & 1 deletion shared/desktop/renderer/main2.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import RemoteProxies from '../remote/proxies.desktop'
import Root from './container.desktop'
import makeStore from '../../store/configure-store'
import {makeEngine} from '../../engine'
import {disable as disableDragDrop} from '../../util/drag-drop'
import {disableDragDrop} from '../../util/drag-drop.desktop'
import flags from '../../util/feature-flags'
import {dumpLogs} from '../../actions/platform-specific/index.desktop'
import {initDesktopStyles} from '../../styles/index.desktop'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion shared/engine/transport-shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import rpc from 'framed-msgpack-rpc'
import {printRPC, printRPCWaitingSession} from '../local-debug'
import {requestIdleCallback} from '../util/idle-callback'
import * as LocalConsole from '../util/local-console'
import * as LocalConsole from './local-console'
import * as Stats from './stats'

const RobustTransport = rpc.transport.RobustTransport
Expand Down
8 changes: 0 additions & 8 deletions shared/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ target 'Keybase' do
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)

# fix pods xcode 14 losing signing team
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings['CODE_SIGN_IDENTITY'] = ''
end
end
end
end

Expand Down
14 changes: 7 additions & 7 deletions shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@react-navigation/core": "6.4.6",
"@react-navigation/native": "6.1.3",
"@react-navigation/native-stack": "6.9.10",
"@reduxjs/toolkit": "1.9.2",
"@reduxjs/toolkit": "1.9.3",
"@shopify/flash-list": "1.4.2",
"base64-js": "1.5.1",
"buffer": "6.0.3",
Expand Down Expand Up @@ -120,7 +120,7 @@
"react-is": "18.1.0",
"react-list": "0.8.17",
"react-measure": "2.5.2",
"react-native": "0.70.7",
"react-native": "0.70.8",
"react-native-fast-image": "8.6.3",
"react-native-gesture-handler": "2.9.0",
"react-native-hw-keyboard-event": "0.0.4",
Expand Down Expand Up @@ -182,8 +182,8 @@
"@types/unidecode": "0.1.1",
"@types/url-parse": "1.4.8",
"@types/webpack-env": "1.18.0",
"@typescript-eslint/eslint-plugin": "5.55.0",
"@typescript-eslint/parser": "5.55.0",
"@typescript-eslint/eslint-plugin": "5.57.1",
"@typescript-eslint/parser": "5.57.1",
"@welldone-software/why-did-you-render": "7.0.1",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "9.1.2",
Expand All @@ -193,7 +193,7 @@
"css-loader": "6.7.3",
"electron": "22.1.0",
"electron-packager": "17.1.1",
"eslint": "8.36.0",
"eslint": "8.37.0",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
Expand All @@ -207,7 +207,7 @@
"net": "keybase/nullModule",
"null-loader": "4.0.1",
"patch-package": "6.5.1",
"prettier": "2.8.3",
"prettier": "2.8.7",
"purepack": "keybase/nullModule",
"react-native-flipper-performance-plugin": "0.3.1",
"react-refresh": "0.14.0",
Expand All @@ -217,7 +217,7 @@
"terser-webpack-plugin": "5.3.6",
"tls": "keybase/nullModule",
"ts-toolbelt": "9.6.0",
"typescript": "5.0.2",
"typescript": "5.0.3",
"webpack": "5.75.0",
"webpack-cli": "5.0.1",
"webpack-dev-server": "4.11.1",
Expand Down
2 changes: 1 addition & 1 deletion shared/profile/edit-avatar/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component} from 'react'
import {ImageInfo} from '../../util/expo-image-picker'
import {ImageInfo} from '../../util/expo-image-picker.native'
import * as RPCTypes from '../../constants/types/rpc-gen'
import * as Types from '../../constants/types/teams'

Expand Down
2 changes: 1 addition & 1 deletion shared/profile/edit-avatar/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Kb from '../../common-adapters/mobile.native'
import * as Styles from '../../styles'
import {isIOS, isTablet} from '../../constants/platform'
import {type Props} from '.'
import {parseUri, launchImageLibraryAsync} from '../../util/expo-image-picker'
import {parseUri, launchImageLibraryAsync} from '../../util/expo-image-picker.native'
import {ModalTitle} from '../../teams/common'
import * as Container from '../../util/container'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
function disable() {
export function disableDragDrop() {
document.addEventListener('dragover', (event: DragEvent) => event.preventDefault())
document.addEventListener('drop', (event: DragEvent) => event.preventDefault())
}

export {disable}
4 changes: 1 addition & 3 deletions shared/util/email-address.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/**
* Returns true if the string is a valid email address, false otherwise.
*/
function validateEmailAddress(str: string): boolean {
export function validateEmailAddress(str: string): boolean {
const emailRegex = /^(\S+@\S+\.\S+)$/
return str.length > 3 && emailRegex.test(str)
}

export {validateEmailAddress}
27 changes: 0 additions & 27 deletions shared/util/errors.d.ts

This file was deleted.

9 changes: 0 additions & 9 deletions shared/util/errors.desktop.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions shared/util/errors.native.tsx

This file was deleted.

File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions shared/util/pick-files.native.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {parseUri, launchImageLibraryAsync} from './expo-image-picker'
import {type OpenDialogOptions, type SaveDialogOptions} from './electron.desktop'
import {parseUri, launchImageLibraryAsync} from './expo-image-picker.native'
import type {OpenDialogOptions, SaveDialogOptions} from './electron.desktop'

export const pickImages = async (_: string): Promise<Array<string>> => {
const result = await launchImageLibraryAsync('photo')
Expand Down
Loading

0 comments on commit 56dece3

Please sign in to comment.