From 064af2eccfd720e1454ef3468695300fb022fc31 Mon Sep 17 00:00:00 2001 From: Sakul Budhathoki Date: Sun, 23 Jul 2023 02:13:06 -0600 Subject: [PATCH] fix: lint --- .github/workflows/js.yml | 2 +- README.md | 2 +- declarations.d.ts | 2 +- modules/weshd/index.ts | 2 +- modules/weshd/src/WeshdModule.ts | 4 +- modules/weshd/src/WeshdModule.web.ts | 6 +-- modules/weshd/src/WeshdView.tsx | 8 ++-- modules/weshd/src/WeshdView.web.tsx | 4 +- packages/components/Dropdown.tsx | 9 ++-- packages/components/FilePreview/ImageView.tsx | 4 +- packages/components/NetworkIcon.tsx | 2 +- packages/components/NetworkSelector.tsx | 10 ++--- .../components/ScreenContainer/Header.tsx | 1 - .../ScreenContainer/Notification.tsx | 27 ++---------- .../ScreenContainer/ScreenContainerMobile.tsx | 29 +------------ packages/components/ScreenContainer/index.tsx | 2 +- .../components/ShareScreen/ShareScreen.tsx | 12 ++---- .../components/addfriend/AddFriendList.tsx | 1 - packages/components/cards/MessageCard.tsx | 2 +- packages/components/friends/FriendsList.tsx | 7 ++-- packages/components/modals/ModalBase.tsx | 3 +- packages/components/navigation/Sidebar.tsx | 3 -- .../components/navigation/SidebarMobile.tsx | 4 +- .../navigation/components/SidebarButton.tsx | 1 - .../components/SidebarNestedButton.tsx | 1 - packages/components/requests/Request.tsx | 34 ++++----------- .../socialFeed/NewsFeed/NewsFeedInput.tsx | 1 - packages/components/tabs/Tabs.tsx | 1 - .../context/WalletsProvider/keplr.native.ts | 18 +++----- packages/hooks/useCheckNameAvailability.ts | 1 - packages/screens/Message/MessageScreen.tsx | 17 +++----- .../screens/Message/components/Calendar.tsx | 10 ++--- .../screens/Message/components/ChatHeader.tsx | 42 ++++++------------- .../Message/components/ChatSection.tsx | 32 +++++--------- .../Message/components/CheckboxGroup.tsx | 5 +-- .../Message/components/Conversation.tsx | 18 ++++---- .../Message/components/CreateConversation.tsx | 8 +--- .../Message/components/CreateGroup.tsx | 28 +++---------- .../Message/components/FileRenderer.tsx | 6 +-- .../screens/Message/components/Friends.tsx | 9 ++-- .../Message/components/FriendshipManager.tsx | 3 -- .../components/GroupInvitationAction.tsx | 39 ++--------------- .../Message/components/MessagePopup.tsx | 17 ++++---- .../screens/Message/components/Requests.tsx | 4 -- .../Message/components/ShareScreen.tsx | 13 +----- .../Message/components/UploadImage.tsx | 20 ++++----- packages/utils/astilectron.ts | 21 ++++------ packages/utils/fee.ts | 2 - packages/utils/navigation.ts | 1 - packages/utils/tns.ts | 1 - packages/utils/types/message.ts | 9 +--- packages/weshnet/client/processData.ts | 4 +- packages/weshnet/client/subscribers.ts | 2 - 53 files changed, 139 insertions(+), 375 deletions(-) diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index 21d008acd9..73364c6fdb 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -27,7 +27,7 @@ jobs: run: make validate-networks - name: Build web app - run: yarn expo build:web + run: yarn expo export:web - name: Check that there is no diff run: git diff --exit-code diff --git a/README.md b/README.md index 48187e6f4a..244cbcf6fa 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ npx expo-electron start ### Build web app ``` -npx expo-optimize && npx expo build:web +npx expo-optimize && npx expo export:web ``` The site is in `web-build/` diff --git a/declarations.d.ts b/declarations.d.ts index d246d31d62..96e1ed39ea 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -4,7 +4,7 @@ declare module "*.svg" { const content: React.FC; export default content; } - + declare module "*.png" { const value: any; diff --git a/modules/weshd/index.ts b/modules/weshd/index.ts index 6e0050c442..05a2b21f61 100644 --- a/modules/weshd/index.ts +++ b/modules/weshd/index.ts @@ -6,9 +6,9 @@ import { // Import the native module. On web, it will be resolved to Weshd.web.ts // and on native platforms to Weshd.ts +import { ChangeEventPayload, WeshdViewProps } from "./src/Weshd.types"; import WeshdModule from "./src/WeshdModule"; import WeshdView from "./src/WeshdView"; -import { ChangeEventPayload, WeshdViewProps } from "./src/Weshd.types"; // Get the native constant value. export const PI = WeshdModule.PI; diff --git a/modules/weshd/src/WeshdModule.ts b/modules/weshd/src/WeshdModule.ts index 2a9433310e..354291a7b8 100644 --- a/modules/weshd/src/WeshdModule.ts +++ b/modules/weshd/src/WeshdModule.ts @@ -1,5 +1,5 @@ -import { requireNativeModule } from 'expo-modules-core'; +import { requireNativeModule } from "expo-modules-core"; // It loads the native module object from the JSI or falls back to // the bridge module (from NativeModulesProxy) if the remote debugger is on. -export default requireNativeModule('Weshd'); +export default requireNativeModule("Weshd"); diff --git a/modules/weshd/src/WeshdModule.web.ts b/modules/weshd/src/WeshdModule.web.ts index be76495bbf..360a27fe1b 100644 --- a/modules/weshd/src/WeshdModule.web.ts +++ b/modules/weshd/src/WeshdModule.web.ts @@ -1,13 +1,13 @@ -import { EventEmitter } from 'expo-modules-core'; +import { EventEmitter } from "expo-modules-core"; const emitter = new EventEmitter({} as any); export default { PI: Math.PI, async setValueAsync(value: string): Promise { - emitter.emit('onChange', { value }); + emitter.emit("onChange", { value }); }, hello() { - return 'Hello world! 👋'; + return "Hello world! 👋"; }, }; diff --git a/modules/weshd/src/WeshdView.tsx b/modules/weshd/src/WeshdView.tsx index 0a42a0b689..e12f24890e 100644 --- a/modules/weshd/src/WeshdView.tsx +++ b/modules/weshd/src/WeshdView.tsx @@ -1,10 +1,10 @@ -import { requireNativeViewManager } from 'expo-modules-core'; -import * as React from 'react'; +import { requireNativeViewManager } from "expo-modules-core"; +import * as React from "react"; -import { WeshdViewProps } from './Weshd.types'; +import { WeshdViewProps } from "./Weshd.types"; const NativeView: React.ComponentType = - requireNativeViewManager('Weshd'); + requireNativeViewManager("Weshd"); export default function WeshdView(props: WeshdViewProps) { return ; diff --git a/modules/weshd/src/WeshdView.web.tsx b/modules/weshd/src/WeshdView.web.tsx index 9264e862bc..87603f98a8 100644 --- a/modules/weshd/src/WeshdView.web.tsx +++ b/modules/weshd/src/WeshdView.web.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; +import * as React from "react"; -import { WeshdViewProps } from './Weshd.types'; +import { WeshdViewProps } from "./Weshd.types"; export default function WeshdView(props: WeshdViewProps) { return ( diff --git a/packages/components/Dropdown.tsx b/packages/components/Dropdown.tsx index 8ae5af5078..9339f2f386 100644 --- a/packages/components/Dropdown.tsx +++ b/packages/components/Dropdown.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useLayoutEffect, useRef, useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { LayoutChangeEvent, TouchableOpacity, @@ -7,7 +7,6 @@ import { } from "react-native"; import { DefaultValue, useDropdowns } from "../context/DropdownsProvider"; -type Position = "top" | "bottom" | "left" | "right" | "auto"; interface DropdownProps { children: @@ -26,7 +25,7 @@ export const Dropdown = ({ onDropdownClosed, positionStyle = {}, }: DropdownProps) => { - const [layout, setLayout] = useState({ + const [, setLayout] = useState({ height: 0, width: 0, }); @@ -47,7 +46,7 @@ export const Dropdown = ({ if (!copyDropdownOpen && isDropdownOpen(dropdownRef)) { setCopyDropdownOpen(true); } - }, [openedDropdownRef]); + }, [copyDropdownOpen, isDropdownOpen, onDropdownClosed, openedDropdownRef]); const handleLayout = ({ nativeEvent: { layout } }: LayoutChangeEvent) => { setLayout(layout); @@ -55,7 +54,7 @@ export const Dropdown = ({ useEffect(() => { !triggerComponent && onPressDropdownButton(dropdownRef); - }, []); + }, [onPressDropdownButton, triggerComponent]); return ( ; diff --git a/packages/components/ScreenContainer/Header.tsx b/packages/components/ScreenContainer/Header.tsx index cd8cc5db08..213c814c5c 100644 --- a/packages/components/ScreenContainer/Header.tsx +++ b/packages/components/ScreenContainer/Header.tsx @@ -1,7 +1,6 @@ import React from "react"; import { View, ViewStyle, StyleProp } from "react-native"; -import { Notification } from "./Notification"; import { neutral33 } from "../../utils/style/colors"; import { headerHeight, layout } from "../../utils/style/layout"; import { BackButton } from "../navigation/components/BackButton"; diff --git a/packages/components/ScreenContainer/Notification.tsx b/packages/components/ScreenContainer/Notification.tsx index 972912b626..93b311e246 100644 --- a/packages/components/ScreenContainer/Notification.tsx +++ b/packages/components/ScreenContainer/Notification.tsx @@ -4,28 +4,14 @@ import { useSelector } from "react-redux"; import notificationIcon from "../../../assets/icons/badge.svg"; import { useDropdowns } from "../../context/DropdownsProvider"; -import { - getNetwork, - NetworkInfo, - NetworkKind, - selectableNetworks, -} from "../../networks"; +import { NetworkKind } from "../../networks"; import { selectNotification } from "../../store/slices/notification"; -import { - setSelectedWalletId, - setSelectedNetworkId, - selectAreTestnetsEnabled, -} from "../../store/slices/settings"; -import { useAppDispatch } from "../../store/store"; import { neutral17, secondaryColor } from "../../utils/style/colors"; import { fontSemibold12 } from "../../utils/style/fonts"; import { layout } from "../../utils/style/layout"; -import { WalletProvider } from "../../utils/walletProvider"; import { BrandText } from "../BrandText"; -import { NetworkIcon } from "../NetworkIcon"; import { SVG } from "../SVG"; import { TertiaryBox } from "../boxes/TertiaryBox"; -import { SpacerRow } from "../spacer"; export const Notification: React.FC<{ style?: StyleProp; @@ -34,17 +20,10 @@ export const Notification: React.FC<{ hideDropdown?: string; iconHide?: string; }> = ({ style, forceNetworkId, forceNetworkKind, hideDropdown, iconHide }) => { - const { onPressDropdownButton, isDropdownOpen, closeOpenedDropdown } = - useDropdowns(); + const { onPressDropdownButton, isDropdownOpen } = useDropdowns(); const dropdownRef = useRef(null); - const dispatch = useAppDispatch(); - const notifications = useSelector(selectNotification); - - const onPressNetwork = (networkId: string) => { - closeOpenedDropdown(); - }; - const fontSize = 14; + const notifications = useSelector(selectNotification); return ( diff --git a/packages/components/ScreenContainer/ScreenContainerMobile.tsx b/packages/components/ScreenContainer/ScreenContainerMobile.tsx index 8e265cbb7e..9c6515d0f5 100644 --- a/packages/components/ScreenContainer/ScreenContainerMobile.tsx +++ b/packages/components/ScreenContainer/ScreenContainerMobile.tsx @@ -1,4 +1,4 @@ -import React, { FC, useCallback } from "react"; +import React, { FC } from "react"; import { Platform, SafeAreaView, @@ -6,7 +6,6 @@ import { StyleSheet, useWindowDimensions, View, - Text, } from "react-native"; import { HeaderMobile } from "./HeaderMobile"; @@ -14,7 +13,6 @@ import { useSearchBar } from "../../context/SearchBarProvider"; import { useMaxResolution } from "../../hooks/useMaxResolution"; import { NetworkFeature, NetworkInfo, NetworkKind } from "../../networks"; import { DAppStoreData } from "../../screens/DAppStore/components/DAppStoreData"; -import SideBarChats from "../../screens/Message/components/SideBarChats"; import { neutral33, neutral77 } from "../../utils/style/colors"; import { fontBold12 } from "../../utils/style/fonts"; import { @@ -70,31 +68,6 @@ export const ScreenContainerMobile: FC<{ const { isSearchModalMobileOpen, setSearchModalMobileOpen } = useSearchBar(); const { height: windowHeight, width: windowWidth } = useWindowDimensions(); - const Children: FC = useCallback(() => { - return ( - <> - {!!mobileTitle && Platform.OS === "web" ? ( - - - {mobileTitle} - - - ) : null} - {children} - - ); - }, [mobileTitle, children, windowWidth]); - return ( diff --git a/packages/components/ScreenContainer/index.tsx b/packages/components/ScreenContainer/index.tsx index ba3cfe99a2..d8fc6e49b5 100644 --- a/packages/components/ScreenContainer/index.tsx +++ b/packages/components/ScreenContainer/index.tsx @@ -31,7 +31,7 @@ import { ConnectWalletButton } from "../TopMenu/ConnectWalletButton"; import { Footer } from "../footers/Footer"; import { Sidebar } from "../navigation/Sidebar"; import { CartIconButtonBadge } from "../navigation/components/CartIconButtonBadge"; -import { SpacerColumn, SpacerRow } from "../spacer"; +import { SpacerRow } from "../spacer"; export const ScreenContainer: React.FC<{ headerChildren?: JSX.Element; diff --git a/packages/components/ShareScreen/ShareScreen.tsx b/packages/components/ShareScreen/ShareScreen.tsx index 9f60deea6e..659278cde6 100644 --- a/packages/components/ShareScreen/ShareScreen.tsx +++ b/packages/components/ShareScreen/ShareScreen.tsx @@ -1,21 +1,16 @@ import React from "react"; import { View } from "react-native"; import { TouchableOpacity } from "react-native-gesture-handler"; -import { Avatar, Badge } from "react-native-paper"; +import { Avatar } from "react-native-paper"; import { Separator } from "../../components/Separator"; import { neutral22, neutral30, - neutralA3, primaryColor, secondaryColor, } from "../../utils/style/colors"; -import { - fontSemibold11, - fontSemibold13, - fontSemibold14, -} from "../../utils/style/fonts"; +import { fontSemibold13, fontSemibold14 } from "../../utils/style/fonts"; import { BrandText } from "../BrandText"; import FlexRow from "../FlexRow"; import { TertiaryBox } from "../boxes/TertiaryBox"; @@ -27,8 +22,7 @@ type Props = { avatar: any; }; -const ScreenShare: React.FC = ({ avatar, name, isOnline }) => { - const onlineStatusBadgeColor = isOnline ? "green" : "yellow"; +const ScreenShare: React.FC = ({ avatar, name }) => { return ( diff --git a/packages/components/addfriend/AddFriendList.tsx b/packages/components/addfriend/AddFriendList.tsx index a1ea781bcd..c0dd8a0cea 100644 --- a/packages/components/addfriend/AddFriendList.tsx +++ b/packages/components/addfriend/AddFriendList.tsx @@ -16,7 +16,6 @@ import { fontSemibold13, fontSemibold14, } from "../../utils/style/fonts"; -import { weshClient } from "../../weshnet/client"; import { BrandText } from "../BrandText"; import FlexRow from "../FlexRow"; import { TertiaryBox } from "../boxes/TertiaryBox"; diff --git a/packages/components/cards/MessageCard.tsx b/packages/components/cards/MessageCard.tsx index f2465efd08..52832fb48d 100644 --- a/packages/components/cards/MessageCard.tsx +++ b/packages/components/cards/MessageCard.tsx @@ -1,5 +1,5 @@ import React, { FC } from "react"; -import { Text, StyleSheet } from "react-native"; +import { StyleSheet } from "react-native"; import { neutral00, diff --git a/packages/components/friends/FriendsList.tsx b/packages/components/friends/FriendsList.tsx index 1756552a5f..3b0024b663 100644 --- a/packages/components/friends/FriendsList.tsx +++ b/packages/components/friends/FriendsList.tsx @@ -1,14 +1,13 @@ import React from "react"; -import { View, Image, StyleSheet } from "react-native"; +import { View } from "react-native"; import { TouchableOpacity } from "react-native-gesture-handler"; import { Avatar, Badge } from "react-native-paper"; import chaticon from "../../../assets/icons/chaticon.svg"; import dots from "../../../assets/icons/dots.svg"; import { Separator } from "../../components/Separator"; -import { useNSUserInfo } from "../../hooks/useNSUserInfo"; -import { neutral22, neutralA3, secondaryColor } from "../../utils/style/colors"; -import { fontSemibold13, fontSemibold11 } from "../../utils/style/fonts"; +import { neutral22, secondaryColor } from "../../utils/style/colors"; +import { fontSemibold13 } from "../../utils/style/fonts"; import { Conversation } from "../../utils/types/message"; import { getConversationAvatar, diff --git a/packages/components/modals/ModalBase.tsx b/packages/components/modals/ModalBase.tsx index d6a3433129..2084a82306 100644 --- a/packages/components/modals/ModalBase.tsx +++ b/packages/components/modals/ModalBase.tsx @@ -7,8 +7,8 @@ import { ViewStyle, useWindowDimensions, StyleProp, - } from "react-native"; +import { TouchableOpacity } from "react-native-gesture-handler"; import chevronLeft from "../../../assets/icons/chevron-left.svg"; import closeSVG from "../../../assets/icons/hamburger-button-cross.svg"; @@ -21,7 +21,6 @@ import { SVG } from "../SVG"; import { SeparatorGradient } from "../SeparatorGradient"; import { TertiaryBox } from "../boxes/TertiaryBox"; import { SpacerColumn } from "../spacer"; -import { TouchableOpacity } from "react-native-gesture-handler"; // TODO: Simplify this component (Useless childrenBottom ?. Better to let the parent totally decides which children to use ? Used in WalletManager.tsx, be careful !) diff --git a/packages/components/navigation/Sidebar.tsx b/packages/components/navigation/Sidebar.tsx index af7019d15f..8aa765e0d3 100644 --- a/packages/components/navigation/Sidebar.tsx +++ b/packages/components/navigation/Sidebar.tsx @@ -18,7 +18,6 @@ import addSVG from "../../../assets/icons/add-circle.svg"; import chevronRightSVG from "../../../assets/icons/chevron-right.svg"; import { useSidebar } from "../../context/SidebarProvider"; import { useCurrentRouteName } from "../../hooks/useCurrentRouteName"; -import { useNSUserInfo } from "../../hooks/useNSUserInfo"; import { useSelectedNetworkKind } from "../../hooks/useSelectedNetwork"; import useSelectedWallet from "../../hooks/useSelectedWallet"; import { NetworkKind } from "../../networks"; @@ -60,9 +59,7 @@ interface SidebarProps extends DrawerContentComponentProps { export const Sidebar = (props: SidebarProps) => { const selectedWallet = useSelectedWallet(); - const userInfo = useNSUserInfo(selectedWallet?.userId); const selectedNetworkKind = useSelectedNetworkKind(); - const connected = selectedWallet?.connected; const { top, bottom } = useSafeAreaInsets(); // variables diff --git a/packages/components/navigation/SidebarMobile.tsx b/packages/components/navigation/SidebarMobile.tsx index fa58cec084..89e85ec745 100644 --- a/packages/components/navigation/SidebarMobile.tsx +++ b/packages/components/navigation/SidebarMobile.tsx @@ -6,6 +6,8 @@ import Animated, { WithSpringConfig, } from "react-native-reanimated"; +import { SidebarButton } from "./components/SidebarButton"; +import { SidebarType } from "./types"; import addSVG from "../../../assets/icons/add-circle.svg"; import { useSidebar } from "../../context/SidebarProvider"; import { useSelectedNetworkKind } from "../../hooks/useSelectedNetwork"; @@ -18,8 +20,6 @@ import { MOBILE_SIDEBAR_MAX_WIDTH, } from "../../utils/style/layout"; import { SpacerColumn } from "../spacer"; -import { SidebarButton } from "./components/SidebarButton"; -import { SidebarType } from "./types"; const SpringConfig: WithSpringConfig = { stiffness: 100, diff --git a/packages/components/navigation/components/SidebarButton.tsx b/packages/components/navigation/components/SidebarButton.tsx index 9fbc18b822..3462bb511e 100644 --- a/packages/components/navigation/components/SidebarButton.tsx +++ b/packages/components/navigation/components/SidebarButton.tsx @@ -15,7 +15,6 @@ import chevronDownSVG from "../../../../assets/icons/chevron-down.svg"; import chevronUpSVG from "../../../../assets/icons/chevron-up.svg"; import { useSidebar } from "../../../context/SidebarProvider"; import { useCurrentRouteName } from "../../../hooks/useCurrentRouteName/index.native"; -import { useAppRoute } from "../../../utils/navigation"; import { neutral17, neutral33, diff --git a/packages/components/navigation/components/SidebarNestedButton.tsx b/packages/components/navigation/components/SidebarNestedButton.tsx index 8769ab4a9c..7cdeaf8321 100644 --- a/packages/components/navigation/components/SidebarNestedButton.tsx +++ b/packages/components/navigation/components/SidebarNestedButton.tsx @@ -1,4 +1,3 @@ -import { useRoute } from "@react-navigation/native"; import { StyleSheet, View } from "react-native"; import Animated, { useAnimatedStyle, diff --git a/packages/components/requests/Request.tsx b/packages/components/requests/Request.tsx index f81198097b..1037844913 100644 --- a/packages/components/requests/Request.tsx +++ b/packages/components/requests/Request.tsx @@ -1,42 +1,21 @@ -import React, { useEffect, useState } from "react"; +import React, { useState } from "react"; import { View } from "react-native"; -import { TouchableOpacity } from "react-native-gesture-handler"; import { Avatar, Badge } from "react-native-paper"; import { Separator } from "../../components/Separator"; import { useFeedbacks } from "../../context/FeedbacksProvider"; -import { useTNS } from "../../context/TNSProvider"; -import { useNSUserInfo } from "../../hooks/useNSUserInfo"; -import { - neutral22, - neutral30, - neutralA3, - primaryColor, - primaryTextColor, - secondaryColor, -} from "../../utils/style/colors"; -import { - fontSemibold11, - fontSemibold13, - fontSemibold14, -} from "../../utils/style/fonts"; +import { neutral22, secondaryColor } from "../../utils/style/colors"; +import { fontSemibold13 } from "../../utils/style/fonts"; import { ContactRequest } from "../../utils/types/message"; -import { GroupMetadataEvent } from "../../weshnet"; import { weshClient } from "../../weshnet/client"; import { acceptFriendRequest, activateGroup, sendMessage, } from "../../weshnet/client/services"; -import { - bytesFromString, - decode, - decodeJSON, - stringFromBytes, -} from "../../weshnet/client/utils"; +import { bytesFromString } from "../../weshnet/client/utils"; import { BrandText } from "../BrandText"; import FlexRow from "../FlexRow"; -import { TertiaryBox } from "../boxes/TertiaryBox"; import { PrimaryButton } from "../buttons/PrimaryButton"; import { SecondaryButton } from "../buttons/SecondaryButton"; import { SpacerColumn, SpacerRow } from "../spacer"; @@ -48,7 +27,7 @@ type Props = { }; const RequestList = ({ isOnline, data }: Props) => { - const { setToastSuccess, setToastError } = useFeedbacks(); + const { setToastError } = useFeedbacks(); const [addLoading, setAddLoading] = useState(false); const [rejectLoading, setRejectLoading] = useState(false); @@ -82,7 +61,8 @@ const RequestList = ({ isOnline, data }: Props) => { await weshClient.client.ContactRequestDiscard({ contactPk: bytesFromString(data?.contactId), }); - } catch (err) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + } catch (e) { setToastError({ title: "Failed", message: "Failed to reject contact. Please try again later.", diff --git a/packages/components/socialFeed/NewsFeed/NewsFeedInput.tsx b/packages/components/socialFeed/NewsFeed/NewsFeedInput.tsx index 22e50f0c8c..a6b2a5f8b6 100644 --- a/packages/components/socialFeed/NewsFeed/NewsFeedInput.tsx +++ b/packages/components/socialFeed/NewsFeed/NewsFeedInput.tsx @@ -42,7 +42,6 @@ import { useSelectedNetworkId } from "../../../hooks/useSelectedNetwork"; import useSelectedWallet from "../../../hooks/useSelectedWallet"; import { getUserId, mustGetCosmosNetwork } from "../../../networks"; import { prettyPrice } from "../../../utils/coins"; -import { env } from "../../../utils/env"; import { defaultSocialFeedFee } from "../../../utils/fee"; import { AUDIO_MIME_TYPES, diff --git a/packages/components/tabs/Tabs.tsx b/packages/components/tabs/Tabs.tsx index b0b5cdc2b4..3a7e7f462e 100644 --- a/packages/components/tabs/Tabs.tsx +++ b/packages/components/tabs/Tabs.tsx @@ -22,7 +22,6 @@ import { import { fontSemibold14 } from "../../utils/style/fonts"; import { layout } from "../../utils/style/layout"; import { BrandText } from "../BrandText"; -import { SVG } from "../SVG"; import { PrimaryBadge } from "../badges/PrimaryBadge"; import { TertiaryBadge } from "../badges/TertiaryBadge"; import { GradientText } from "../gradientText"; diff --git a/packages/context/WalletsProvider/keplr.native.ts b/packages/context/WalletsProvider/keplr.native.ts index 69633ca244..083555db54 100644 --- a/packages/context/WalletsProvider/keplr.native.ts +++ b/packages/context/WalletsProvider/keplr.native.ts @@ -1,15 +1,9 @@ -import { Window as KeplrWindow } from "@keplr-wallet/types"; -import { useEffect, useMemo, useState } from "react"; -import { useSelector } from "react-redux"; +import { useMemo, useState } from "react"; import { Wallet } from "./wallet"; import { useSelectedNetworkInfo } from "../../hooks/useSelectedNetwork"; import { NetworkKind, getUserId } from "../../networks"; -import { - selectIsKeplrConnected, - setIsKeplrConnected, - setSelectedWalletId, -} from "../../store/slices/settings"; +import { setSelectedWalletId } from "../../store/slices/settings"; import { useAppDispatch } from "../../store/store"; import { WalletProvider } from "../../utils/walletProvider"; @@ -18,13 +12,13 @@ export type UseKeplrResult = | [false, boolean, undefined]; export const useKeplr: () => UseKeplrResult = () => { - const isKeplrConnected = useSelector(selectIsKeplrConnected); - const [hasKeplr, setHasKeplr] = useState(false); + // const isKeplrConnected = useSelector(selectIsKeplrConnected); + const [hasKeplr] = useState(false); const selectedNetworkInfo = useSelectedNetworkInfo(); const dispatch = useAppDispatch(); - const [addresses, setAddresses] = useState([]); - const [ready, setReady] = useState(false); + const [addresses] = useState([]); + const [ready] = useState(false); // useEffect(() => { // const handleLoad = () => { diff --git a/packages/hooks/useCheckNameAvailability.ts b/packages/hooks/useCheckNameAvailability.ts index 1205d4ca00..bb158315c8 100644 --- a/packages/hooks/useCheckNameAvailability.ts +++ b/packages/hooks/useCheckNameAvailability.ts @@ -4,7 +4,6 @@ import { useEffect, useState } from "react"; import { useSelectedNetworkId } from "./useSelectedNetwork"; import { useFeedbacks } from "../context/FeedbacksProvider"; import { mustGetNonSigningCosmWasmClient } from "../networks"; -import { env } from "../utils/env"; import { isTokenOwnedByUser } from "../utils/tns"; // TNS : From a given name, returns if it exists through a queryContractSmart() with an unsigned cosmWasmClient export const useCheckNameAvailability = (name: string, tokens: string[]) => { diff --git a/packages/screens/Message/MessageScreen.tsx b/packages/screens/Message/MessageScreen.tsx index 1c4928fb11..18eb6e0f67 100644 --- a/packages/screens/Message/MessageScreen.tsx +++ b/packages/screens/Message/MessageScreen.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useState } from "react"; import { View, TouchableOpacity, Platform, ScrollView } from "react-native"; import { ChatSection } from "./components/ChatSection"; @@ -17,21 +17,14 @@ import { Separator } from "../../components/Separator"; import { MessageBlankFiller } from "../../components/blankFiller/MessageBlankFiller"; import MessageCard from "../../components/cards/MessageCard"; import { SpacerColumn, SpacerRow } from "../../components/spacer"; -import { useNSUserInfo } from "../../hooks/useNSUserInfo"; -import useSelectedWallet from "../../hooks/useSelectedWallet"; import { useAppNavigation, ScreenFC } from "../../utils/navigation"; import { layout } from "../../utils/style/layout"; -import { weshServices } from "../../weshnet/client"; export const MessageScreen: ScreenFC<"Message"> = () => { const [isCreateGroup, setIsCreateGroup] = useState(false); const [isCreateConversation, setIsCreateConversation] = useState(false); - const selectedWallet = useSelectedWallet(); const [activeConversation, setActiveConversation] = useState(false); - const [activeTab, setActiveTab] = useState<"chat" | "add-friend">("chat"); - const userInfo = useNSUserInfo(selectedWallet?.userId); - const navigation = useAppNavigation(); const HEADER_CONFIG = [ @@ -56,9 +49,11 @@ export const MessageScreen: ScreenFC<"Message"> = () => { title: "Add a friend", icon: friend, onPress() { - ["android", "ios"].includes(Platform.OS) - ? navigation.navigate("FriendshipManager") - : setActiveTab("add-friend"); + if (["android", "ios"].includes(Platform.OS)) { + navigation.navigate("FriendshipManager"); + } else { + setActiveTab("add-friend"); + } }, }, { diff --git a/packages/screens/Message/components/Calendar.tsx b/packages/screens/Message/components/Calendar.tsx index cb10522c75..b7597a0259 100644 --- a/packages/screens/Message/components/Calendar.tsx +++ b/packages/screens/Message/components/Calendar.tsx @@ -23,18 +23,14 @@ export const Calendar = () => { console.log("selectedDate", selected); const [currentMonth, setCurrentMonth] = useState(new Date()); - const weeks = []; - const monthDays = []; + const weeks: React.ReactElement[] = []; + const monthStart = new Date( currentMonth.getFullYear(), currentMonth.getMonth(), 1 ); - const monthEnd = new Date( - currentMonth.getFullYear(), - currentMonth.getMonth() + 1, - 0 - ); + const startDate = new Date( monthStart.getFullYear(), monthStart.getMonth(), diff --git a/packages/screens/Message/components/ChatHeader.tsx b/packages/screens/Message/components/ChatHeader.tsx index 681dda2cdc..bca6f3b1c2 100644 --- a/packages/screens/Message/components/ChatHeader.tsx +++ b/packages/screens/Message/components/ChatHeader.tsx @@ -1,44 +1,26 @@ import React, { useState } from "react"; -import { - View, - StyleSheet, - Image, - TouchableOpacity, - Platform, - TextInput, -} from "react-native"; +import { View, StyleSheet, TouchableOpacity, TextInput } from "react-native"; import { AudioCall } from "./AudioCall"; import { Calendar } from "./Calendar"; import { ConversationAvatar } from "./ConversationAvatar"; import VideoCallScreen from "./VideoCall"; -import audiocell from "../../../../assets/icons/audiocell.svg"; -import avatar from "../../../../assets/icons/avatar.svg"; import calender from "../../../../assets/icons/calendar.svg"; import close from "../../../../assets/icons/close.svg"; import dots from "../../../../assets/icons/dots.svg"; -import search from "../../../../assets/icons/search.svg"; import searchSVG from "../../../../assets/icons/search.svg"; -import videocall from "../../../../assets/icons/videocall.svg"; import { BrandText } from "../../../components/BrandText"; import FlexRow from "../../../components/FlexRow"; import { SVG } from "../../../components/SVG"; -import { Separator } from "../../../components/Separator"; -import { SpacerColumn, SpacerRow } from "../../../components/spacer"; +import { SpacerRow } from "../../../components/spacer"; import { neutral17, neutral33, - neutralA3, secondaryColor, neutral55, successColor, } from "../../../utils/style/colors"; -import { - fontSemibold13, - fontSemibold11, - fontMedium10, - fontMedium14, -} from "../../../utils/style/fonts"; +import { fontSemibold13, fontMedium14 } from "../../../utils/style/fonts"; import { getConversationName } from "../../../weshnet/client/messageHelpers"; export const ChatHeader = ({ searchInput, @@ -64,14 +46,14 @@ export const ChatHeader = ({ setSearchInput(text); }; - const handleAudio = () => { - setAudioCall(true); - setVideoCall(false); - }; - const handleVideo = () => { - setVideoCall(true); - setAudioCall(false); - }; + // const handleAudio = () => { + // setAudioCall(true); + // setVideoCall(false); + // }; + // const handleVideo = () => { + // setVideoCall(true); + // setAudioCall(false); + // }; return ( <> @@ -131,7 +113,7 @@ export const ChatHeader = ({ { - const { width } = useWindowDimensions(); const [message, setMessage] = useState(""); const [inputHeight, setInputHeight] = useState(40); const [replyTo, setReplyTo] = useState(); @@ -89,11 +90,8 @@ export const ChatSectionContent = ({ conversation }: ChatSectionProps) => { ); }, [messages, searchInput]); - const [subsId, setSubsId] = useState(); - - const getGroupInfo = async () => { + const getGroupInfo = useCallback(async () => { let _group: GroupInfo_Reply; - let subsId; try { if (conversation.type === "group") { @@ -113,27 +111,17 @@ export const ChatSectionContent = ({ conversation }: ChatSectionProps) => { } setGroupInfo(_group); - // subsId = await subscribeMessages( - // string groupPk: _group.group?.publicKey, - - // ); - // await subscribeMetadata(_group.group?.publicKey); - - setSubsId(subsId); } catch (err) { setToastError({ title: "Failed to get group info", message: err?.message, }); } - }; + }, [conversation.id, conversation.members, conversation.type, setToastError]); useEffect(() => { getGroupInfo(); - return () => { - subsId?.unsubscribe(); - }; - }, [conversation.id]); + }, [getGroupInfo]); const handleSend = async (data?: HandleSendParams) => { if (!message && !data?.message) { diff --git a/packages/screens/Message/components/CheckboxGroup.tsx b/packages/screens/Message/components/CheckboxGroup.tsx index 4983b66204..28e9ceb33d 100644 --- a/packages/screens/Message/components/CheckboxGroup.tsx +++ b/packages/screens/Message/components/CheckboxGroup.tsx @@ -1,11 +1,9 @@ import React, { useState } from "react"; -import { View, Text, TouchableOpacity, Image } from "react-native"; +import { View, TouchableOpacity } from "react-native"; import { Avatar } from "react-native-paper"; -import avatar from "../../../../assets/icons/avatar.svg"; import { BrandText } from "../../../components/BrandText"; import FlexRow from "../../../components/FlexRow"; -import { SVG } from "../../../components/SVG"; import { SpacerColumn, SpacerRow } from "../../../components/spacer"; import { secondaryColor } from "../../../utils/style/colors"; import { fontSemibold14 } from "../../../utils/style/fonts"; @@ -26,7 +24,6 @@ export const CheckboxGroup: React.FC = ({ onChange, }) => { const [checkboxItems, setCheckboxItems] = useState(items); - const [isChecked, setChecked] = useState(true); const handleCheckboxPress = (index: number) => { const newItems = [...checkboxItems]; newItems[index].checked = !newItems[index].checked; diff --git a/packages/screens/Message/components/Conversation.tsx b/packages/screens/Message/components/Conversation.tsx index 33bc769b97..7e51097729 100644 --- a/packages/screens/Message/components/Conversation.tsx +++ b/packages/screens/Message/components/Conversation.tsx @@ -7,7 +7,6 @@ import { Avatar } from "react-native-paper"; import { FileRenderer } from "./FileRenderer"; import { GroupInvitationAction } from "./GroupInvitationAction"; import { MessagePopup } from "./MessagePopup"; -import avatar from "../../../../assets/icons/avatar.svg"; import reply from "../../../../assets/icons/reply.svg"; import { BrandText } from "../../../components/BrandText"; import { Dropdown } from "../../../components/Dropdown"; @@ -16,7 +15,6 @@ import FlexRow from "../../../components/FlexRow"; import { SVG } from "../../../components/SVG"; import { EmojiSelector } from "../../../components/socialFeed/EmojiSelector"; import { Reactions } from "../../../components/socialFeed/SocialActions/Reactions"; -import { DateTime } from "../../../components/socialFeed/SocialThread/DateTime"; import { SpacerRow } from "../../../components/spacer"; import { neutral77, @@ -76,13 +74,13 @@ export const Conversation = ({ return []; } return chain(message.reactions || []) - .groupBy(message.payload.message) + .groupBy(message?.payload.message) .map((value, key) => ({ icon: value?.[0]?.payload?.message || "", count: value.length, })) .value(); - }, [message?.reactions]); + }, [message?.payload?.message, message?.reactions]); const onEmojiSelected = async (emoji: string | null) => { if (emoji) { @@ -195,7 +193,7 @@ export const Conversation = ({ }} /> - {parentMessage.payload.message} + {parentMessage?.payload?.message} )} @@ -205,7 +203,7 @@ export const Conversation = ({ {message?.payload?.message} - {!!message.payload?.files?.length && ( + {!!message?.payload?.files?.length && ( )} - {!!message.payload.files?.[0]?.type === "image" && ( + {!!message?.payload?.files?.[0]?.type === "image" && ( )} @@ -275,11 +273,11 @@ export const Conversation = ({ setShowMenu(false)} - message={message.payload.message} + message={message?.payload.message} onReply={() => onReply({ id: message.id, - message: message.payload.message, + message: message?.payload.message, }) } isForwarding={isForwarding} diff --git a/packages/screens/Message/components/CreateConversation.tsx b/packages/screens/Message/components/CreateConversation.tsx index dfaeaad86e..ba537b674a 100644 --- a/packages/screens/Message/components/CreateConversation.tsx +++ b/packages/screens/Message/components/CreateConversation.tsx @@ -13,8 +13,6 @@ import { TextInputCustom } from "../../../components/inputs/TextInputCustom"; import ModalBase from "../../../components/modals/ModalBase"; import { SpacerColumn, SpacerRow } from "../../../components/spacer"; import { useIsMobile } from "../../../hooks/useIsMobile"; -import { useNSUserInfo } from "../../../hooks/useNSUserInfo"; -import useSelectedWallet from "../../../hooks/useSelectedWallet"; import { MessageState, selectContactInfo, @@ -23,7 +21,7 @@ import { import { neutral00, secondaryColor } from "../../../utils/style/colors"; import { fontSemibold16 } from "../../../utils/style/fonts"; import { layout } from "../../../utils/style/layout"; -import { weshClient, weshConfig, weshServices } from "../../../weshnet/client"; +import { weshServices } from "../../../weshnet/client"; import { createSharableLink } from "../../../weshnet/client/services"; interface CreateConversationProps { onClose: () => void; @@ -37,8 +35,6 @@ export const CreateConversation = ({ onClose }: CreateConversationProps) => { const isMobile = useIsMobile(); const dispatch = useDispatch(); - const selectedWallet = useSelectedWallet(); - const userInfo = useNSUserInfo(selectedWallet?.userId); const handleAddContact = async () => { setAddContactLoading(true); @@ -74,7 +70,7 @@ export const CreateConversation = ({ onClose }: CreateConversationProps) => { shareLink, }) ); - }, [contactInfo?.name, contactInfo?.avatar]); + }, [contactInfo.name, contactInfo.avatar, contactInfo, dispatch]); return ( void; @@ -56,7 +39,7 @@ export const CreateGroup = ({ onClose }: CreateGroupProps) => { const [groupName, setGroupName] = useState(""); const [checkedContacts, setCheckedContacts] = useState([]); const contactInfo = useSelector(selectContactInfo); - const { setToastError, setToastSuccess } = useFeedbacks(); + const { setToastError } = useFeedbacks(); const [loading, setLoading] = useState(false); const conversations = useSelector(selectConversationList); const handleChange = (items: CheckboxItem[]) => { @@ -193,6 +176,7 @@ export const CreateGroup = ({ onClose }: CreateGroupProps) => { { - console.log(files); - - const { width } = useWindowDimensions(); const audioFiles = useMemo( () => files?.filter((file) => file.fileType === "audio"), [files] @@ -28,7 +25,6 @@ export const FileRenderer = ({ files, maxWidth, waveFormMaxWidth }: Props) => { ) .map((file) => ({ ...file, - // url: file.url.split(",")[1], })), [files] ); diff --git a/packages/screens/Message/components/Friends.tsx b/packages/screens/Message/components/Friends.tsx index 73e2574b8a..2c70b3ac87 100644 --- a/packages/screens/Message/components/Friends.tsx +++ b/packages/screens/Message/components/Friends.tsx @@ -1,15 +1,12 @@ import React, { useState } from "react"; -import { View, ScrollView } from "react-native"; +import { View } from "react-native"; -import nullIcon from "../../../assets/icons/illustration.svg"; -import { SVG } from "../../../components/SVG"; -import { Separator } from "../../../components/Separator"; import { MessageBlankFiller } from "../../../components/blankFiller/MessageBlankFiller"; import FriendList from "../../../components/friends/FriendsList"; import { TextInputCustomBorder } from "../../../components/inputs/TextInputCustomBorder"; import { SpacerColumn } from "../../../components/spacer"; -import { neutral00, neutral33 } from "../../../utils/style/colors"; -import { Conversation, ConversationList } from "../../../utils/types/message"; +import { neutral00 } from "../../../utils/style/colors"; +import { Conversation } from "../../../utils/types/message"; interface FriendsProps { items: Conversation[]; setActiveConversation: () => void; diff --git a/packages/screens/Message/components/FriendshipManager.tsx b/packages/screens/Message/components/FriendshipManager.tsx index 977845301e..06aee2314a 100644 --- a/packages/screens/Message/components/FriendshipManager.tsx +++ b/packages/screens/Message/components/FriendshipManager.tsx @@ -1,6 +1,5 @@ import React, { useMemo, useState } from "react"; import { View, Platform } from "react-native"; -import { SafeAreaView } from "react-native-safe-area-context"; import { useSelector } from "react-redux"; import { AddFriend } from "./AddFriend"; @@ -9,7 +8,6 @@ import { Requests } from "./Requests"; import plus from "../../../../assets/icons/Addplus.svg"; import { ScreenContainer } from "../../../components/ScreenContainer"; import { Separator } from "../../../components/Separator"; -import requestData from "../../../components/requests/data"; import { SpacerColumn } from "../../../components/spacer"; import { Tabs } from "../../../components/tabs/Tabs"; import { @@ -17,7 +15,6 @@ import { selectConversationList, } from "../../../store/slices/message"; import { layout } from "../../../utils/style/layout"; -import friendData from "../../components/friends/data"; export const FriendshipManager = ({ setActiveConversation }) => { const conversations = useSelector(selectConversationList); diff --git a/packages/screens/Message/components/GroupInvitationAction.tsx b/packages/screens/Message/components/GroupInvitationAction.tsx index 740f912e19..50da660ad0 100644 --- a/packages/screens/Message/components/GroupInvitationAction.tsx +++ b/packages/screens/Message/components/GroupInvitationAction.tsx @@ -1,35 +1,14 @@ import React, { useEffect, useState } from "react"; -import { View, StyleSheet, TouchableOpacity, Image } from "react-native"; import { useSelector } from "react-redux"; -import { FileRenderer } from "./FileRenderer"; -import { MessagePopup } from "./MessagePopup"; -import avatar from "../../../../assets/icons/avatar.svg"; -import reply from "../../../../assets/icons/reply.svg"; import { BrandText } from "../../../components/BrandText"; import FlexRow from "../../../components/FlexRow"; -import { SVG } from "../../../components/SVG"; import { PrimaryButton } from "../../../components/buttons/PrimaryButton"; -import { SecondaryButton } from "../../../components/buttons/SecondaryButton"; -import { TertiaryButton } from "../../../components/buttons/TertiaryButton"; -import { EmojiSelector } from "../../../components/socialFeed/EmojiSelector"; -import { SocialMessageContent } from "../../../components/socialFeed/SocialThread/SocialMessageContent"; import { SpacerColumn, SpacerRow } from "../../../components/spacer"; import { useFeedbacks } from "../../../context/FeedbacksProvider"; import { selectConversationList } from "../../../store/slices/message"; -import { - neutral77, - secondaryColor, - purpleDark, - neutral17, - neutralA3, - successColor, -} from "../../../utils/style/colors"; -import { - fontBold10, - fontMedium10, - fontSemibold11, -} from "../../../utils/style/fonts"; +import { purpleDark, successColor } from "../../../utils/style/colors"; +import { fontMedium10 } from "../../../utils/style/fonts"; import { layout } from "../../../utils/style/layout"; import { Message } from "../../../utils/types/message"; import { GroupInfo_Reply } from "../../../weshnet"; @@ -44,7 +23,7 @@ interface GroupInvitationActionProps { export const GroupInvitationAction = ({ message, }: GroupInvitationActionProps) => { - const { setToastError, setToastSuccess } = useFeedbacks(); + const { setToastError } = useFeedbacks(); const conversations = useSelector(selectConversationList); const [isAccepted, setIsAccepted] = useState(false); @@ -62,7 +41,7 @@ export const GroupInvitationAction = ({ setIsAccepted(true); } } - }, [conversations]); + }, [conversations, message.payload?.metadata?.group]); const handleAcceptGroup = async () => { try { @@ -103,10 +82,6 @@ export const GroupInvitationAction = ({ } }; - const handleRejectGroup = async () => { - await weshClient.client.MultiMemberGroupLeave({}); - }; - if (isAccepted) { return ( - {/* */} ); diff --git a/packages/screens/Message/components/MessagePopup.tsx b/packages/screens/Message/components/MessagePopup.tsx index e2d9548dd7..e3d906a743 100644 --- a/packages/screens/Message/components/MessagePopup.tsx +++ b/packages/screens/Message/components/MessagePopup.tsx @@ -1,8 +1,7 @@ import * as Clipboard from "expo-clipboard"; -import React, { useState, useMemo } from "react"; +import React, { useState } from "react"; import { View, - Text, StyleSheet, TouchableOpacity, TextInput, @@ -11,14 +10,14 @@ import { import avatar from "../../../../assets/icons/avatar.svg"; import copy from "../../../../assets/icons/copy.svg"; -import deleteicon from "../../../../assets/icons/delete.svg"; +// import deleteicon from "../../../../assets/icons/delete.svg"; +// import select from "../../../../assets/icons/select.svg"; +// import forwardToSVG from "../../../assets/icons/forward-to.svg"; +// import { AudioView } from "../../../components/FilePreview/AudioView"; import nullIcon from "../../../../assets/icons/illustration.svg"; import reply from "../../../../assets/icons/reply.svg"; import searchSVG from "../../../../assets/icons/search.svg"; -import select from "../../../../assets/icons/select.svg"; -import forwardToSVG from "../../../assets/icons/forward-to.svg"; import { BrandText } from "../../../components/BrandText"; -import { AudioView } from "../../../components/FilePreview/AudioView"; import FlexRow from "../../../components/FlexRow"; import { SVG } from "../../../components/SVG"; import { Separator } from "../../../components/Separator"; @@ -74,11 +73,9 @@ export const MessagePopup = ({ onClose, }: MessagePopupProps) => { const { setToastSuccess } = useFeedbacks(); - const handleForwardClick = () => { - setIsForwarding(true); - }; + const handleSearch = () => { - setIsForwarding(false); + // setIsForwarding(false); }; const ITEM_HEIGHT = 50; const [searchQuery, setSearchQuery] = useState(""); diff --git a/packages/screens/Message/components/Requests.tsx b/packages/screens/Message/components/Requests.tsx index 7d2116e268..d1172675d6 100644 --- a/packages/screens/Message/components/Requests.tsx +++ b/packages/screens/Message/components/Requests.tsx @@ -2,15 +2,11 @@ import React, { useState } from "react"; import { ScrollView, View } from "react-native"; import { useSelector } from "react-redux"; -import nullIcon from "../../../assets/icons/illustration.svg"; -import { SVG } from "../../../components/SVG"; -import { Separator } from "../../../components/Separator"; import { MessageBlankFiller } from "../../../components/blankFiller/MessageBlankFiller"; import { TextInputCustomBorder } from "../../../components/inputs/TextInputCustomBorder"; import RequestList from "../../../components/requests/Request"; import { SpacerColumn } from "../../../components/spacer"; import { selectContactRequestList } from "../../../store/slices/message"; -import { neutral33 } from "../../../utils/style/colors"; import { ContactRequest } from "../../../utils/types/message"; interface RequestProps { diff --git a/packages/screens/Message/components/ShareScreen.tsx b/packages/screens/Message/components/ShareScreen.tsx index eba73fb93c..afd5f1ff60 100644 --- a/packages/screens/Message/components/ShareScreen.tsx +++ b/packages/screens/Message/components/ShareScreen.tsx @@ -1,11 +1,5 @@ import React, { useState } from "react"; -import { - View, - Text, - TouchableOpacity, - ScrollView, - Platform, -} from "react-native"; +import { View, TouchableOpacity, ScrollView, Platform } from "react-native"; import avatar from "../../../../assets/icons/avatar.svg"; import copy from "../../../../assets/icons/copy.svg"; @@ -19,19 +13,16 @@ import ScreenShare from "../../../components/ShareScreen/ShareScreen"; import data from "../../../components/ShareScreen/data"; import { TertiaryBox } from "../../../components/boxes/TertiaryBox"; import { TextInputCustom } from "../../../components/inputs/TextInputCustom"; -import { TextInputCustomBorder } from "../../../components/inputs/TextInputCustomBorder"; import ModalBase from "../../../components/modals/ModalBase"; import { SearchInput } from "../../../components/sorts/SearchInput"; import { SpacerColumn, SpacerRow } from "../../../components/spacer"; import { neutral00, - neutral17, neutral33, neutral77, primaryTextColor, } from "../../../utils/style/colors"; import { fontSemibold14 } from "../../../utils/style/fonts"; -import { layout } from "../../../utils/style/layout"; const ShareScreen = ({ setShowTertiaryBox }) => { const [searchQuery, setSearchQuery] = useState(""); @@ -95,7 +86,7 @@ const ShareScreen = ({ setShowTertiaryBox }) => { placeholderTextColor={neutral77} squaresBackgroundColor={neutral00} fullWidth - width={Platform.OS == "web" ? 370 : 305} + width={Platform.OS === "web" ? 370 : 305} /> diff --git a/packages/screens/Message/components/UploadImage.tsx b/packages/screens/Message/components/UploadImage.tsx index c12c6fbd8e..adaec96298 100644 --- a/packages/screens/Message/components/UploadImage.tsx +++ b/packages/screens/Message/components/UploadImage.tsx @@ -34,17 +34,15 @@ export const UploadImage = ({ onClose, setFile }: UploadImageProps) => { const [hasFile, setHasFile] = useState(false); const checkUploadCancel = () => { - try { - if (Platform.OS !== "web") { - window.onfocus = () => { - setTimeout(() => { - if (!hasFile) { - onClose(); - } - }, 1000); - }; - } - } catch (err) {} + if (Platform.OS === "web") { + window.onfocus = () => { + setTimeout(() => { + if (!hasFile) { + onClose(); + } + }, 1000); + }; + } }; const handleUpload = async (file: LocalFileData) => { diff --git a/packages/utils/astilectron.ts b/packages/utils/astilectron.ts index ae96db123e..d700dead39 100644 --- a/packages/utils/astilectron.ts +++ b/packages/utils/astilectron.ts @@ -1,21 +1,18 @@ import { weshClient } from "../weshnet/client/client"; export const messageHandler = (message: { name: string; payload: any }) => { - console.log("electronmessage", message); - try { - switch (message.name) { - case "weshnet.port": { - console.log("weshnet port received", message); + switch (message.name) { + case "weshnet.port": { + console.log("weshnet port received", message); - weshClient.createClient(message.payload); + weshClient.createClient(message.payload); - break; - } - default: - console.log("unknown event received from Go:", message); - break; + break; } - } catch (err) {} + default: + console.log("unknown event received from Go:", message); + break; + } }; export const handleAstilectronMessages = () => { diff --git a/packages/utils/fee.ts b/packages/utils/fee.ts index d15ada54d8..d065f5e913 100644 --- a/packages/utils/fee.ts +++ b/packages/utils/fee.ts @@ -1,8 +1,6 @@ import { StdFee } from "@cosmjs/amino"; import { coins } from "@cosmjs/stargate"; -import { env } from "./env"; - export const defaultSocialFeedFee: StdFee = { amount: coins(5000, process.env.PUBLIC_STAKING_DENOM!), gas: "30010000", diff --git a/packages/utils/navigation.ts b/packages/utils/navigation.ts index 9c51e10396..fd28e82360 100644 --- a/packages/utils/navigation.ts +++ b/packages/utils/navigation.ts @@ -2,7 +2,6 @@ import { RouteProp, useNavigation, useRoute } from "@react-navigation/native"; import { NativeStackNavigationProp } from "@react-navigation/native-stack"; import React from "react"; -import { PickByValue } from "./types/helper"; import { NewPostFormValues } from "../components/socialFeed/NewsFeed/NewsFeed.type"; export type RouteName = keyof RootStackParamList; diff --git a/packages/utils/tns.ts b/packages/utils/tns.ts index 7e82dff072..cadf3c2d99 100644 --- a/packages/utils/tns.ts +++ b/packages/utils/tns.ts @@ -1,4 +1,3 @@ -import { env } from "./env"; // Get the tld at the end of a token (TNS) (.xxxx) export const tldFromNSToken = (str: string): string => str.substring(str.lastIndexOf(".")); diff --git a/packages/utils/types/message.ts b/packages/utils/types/message.ts index f8327d67b8..e04ab40110 100644 --- a/packages/utils/types/message.ts +++ b/packages/utils/types/message.ts @@ -1,4 +1,4 @@ -import { AudioFileMetadata, RemoteFileData } from "./feed"; +import { RemoteFileData } from "./feed"; export type MessageType = | "message" @@ -12,13 +12,6 @@ export type MessageType = | "contact-request"; export type ConversationType = "contact" | "group"; -interface MessageFile { - name: string; - url: string; - mimeType: string; - type: "image" | "audio" | "video"; - audioMetadata?: AudioFileMetadata; -} interface MessagePayload { files: RemoteFileData[]; diff --git a/packages/weshnet/client/processData.ts b/packages/weshnet/client/processData.ts index d7a4e0dd98..ea4780d6e0 100644 --- a/packages/weshnet/client/processData.ts +++ b/packages/weshnet/client/processData.ts @@ -1,5 +1,5 @@ import { weshClient } from "./client"; -import { subscribeMessages, subscribeMetadata } from "./subscribers"; +import { subscribeMessages } from "./subscribers"; import { bytesFromString, decodeJSON, stringFromBytes } from "./utils"; import { selectContactRequestList, @@ -7,9 +7,7 @@ import { setConversationList, setLastId, } from "../../store/slices/message"; -import { setNotification } from "../../store/slices/notification"; import { store } from "../../store/store"; -import { ContactRequest } from "../../utils/types/message"; import { EventType, GroupMetadataEvent, diff --git a/packages/weshnet/client/subscribers.ts b/packages/weshnet/client/subscribers.ts index 38b243d425..ae9f37d7c8 100644 --- a/packages/weshnet/client/subscribers.ts +++ b/packages/weshnet/client/subscribers.ts @@ -4,9 +4,7 @@ import { weshClient } from "./client"; import { handleMetadata } from "./processData"; import { bytesFromString, decodeJSON, stringFromBytes } from "./utils"; import { - selectConversationList, selectLastIdByKey, - setConversationList, setLastId, setMessageList, updateConversationById,