From ef30fb2d760bd76e671a5fee788649ec806f7a45 Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Fri, 9 Feb 2024 19:33:25 -0700 Subject: [PATCH 1/2] Updates: Fixed callbacks for client creation --- src/screens/OnboardingEnableIdentityScreen.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/screens/OnboardingEnableIdentityScreen.tsx b/src/screens/OnboardingEnableIdentityScreen.tsx index 401763e..a81c7ab 100644 --- a/src/screens/OnboardingEnableIdentityScreen.tsx +++ b/src/screens/OnboardingEnableIdentityScreen.tsx @@ -57,10 +57,10 @@ export const OnboardingEnableIdentityScreen = () => { enableAlphaMls: AppConfig.GROUPS_ENABLED, env: AppConfig.XMTP_ENV, preEnableIdentityCallback: async () => { - await enableIdentityPromise; + await enableIdentityPromise(); }, preCreateIdentityCallback: async () => { - await createIdentityPromise; + await createIdentityPromise(); }, codecs: [new RemoteAttachmentCodec()], }); From 6b9ae95fa6980618c6a30ef45aad5e84a60e9b4f Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Fri, 9 Feb 2024 22:21:46 -0700 Subject: [PATCH 2/2] Fixes Fixes Dev screen Config fix --- .github/workflows/release.yml | 23 +++ .vscode/settings.json | 1 + android/app/build.gradle | 1 + src/components/ConversationMessageContent.tsx | 4 +- src/components/GroupListItem.tsx | 4 +- src/components/ImageMessage.tsx | 3 +- .../{ => modals}/AddGroupParticipantModal.tsx | 22 +-- .../{ => modals}/GroupInfoModal.tsx | 16 +- src/i18n/locales/en.json | 13 +- src/navigation/AppNavigation.tsx | 10 + src/navigation/ScreenNames.ts | 1 + src/navigation/StackParams.ts | 1 + src/queries/useListQuery.ts | 3 +- src/screens/ConversationListScreen.tsx | 14 +- src/screens/ConversationScreen.tsx | 16 +- src/screens/DevScreen.tsx | 173 ++++++++++++++++++ src/screens/GroupScreen.tsx | 4 +- src/utils/getAllListMessages.ts | 84 +++++---- 18 files changed, 319 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/release.yml rename src/components/{ => modals}/AddGroupParticipantModal.tsx (89%) rename src/components/{ => modals}/GroupInfoModal.tsx (88%) create mode 100644 src/screens/DevScreen.tsx diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fe36ed6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Release +on: + workflow_dispatch: + +jobs: + android: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'zulu' + - uses: actions/setup-node@v3 + - run: yarn + - run: cd android && ./gradlew assembleRelease + - name: Archive code coverage results + uses: actions/upload-artifact@v4 + with: + name: APK + path: ./android/app/build/outputs/apk/release/app-release.apk diff --git a/.vscode/settings.json b/.vscode/settings.json index 526a1b0..d0e96bc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,4 +3,5 @@ "editor.codeActionsOnSave": { "source.organizeImports": "explicit" }, + "java.compile.nullAnalysis.mode": "automatic", } \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 33036f0..aa9c5b9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,6 +1,7 @@ apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" +apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" /** * This is the configuration block to customize your React Native Android app. diff --git a/src/components/ConversationMessageContent.tsx b/src/components/ConversationMessageContent.tsx index e311fb7..e8f122e 100644 --- a/src/components/ConversationMessageContent.tsx +++ b/src/components/ConversationMessageContent.tsx @@ -38,7 +38,9 @@ export const ConversationMessageContent: FC< if (message.contentTypeId === ContentTypes.RemoteStaticAttachment) { return ( - + + + ); } diff --git a/src/components/GroupListItem.tsx b/src/components/GroupListItem.tsx index 5d7ec33..271b2f8 100644 --- a/src/components/GroupListItem.tsx +++ b/src/components/GroupListItem.tsx @@ -21,7 +21,7 @@ export const GroupListItem: FC = ({ display, lastMessageTime, }) => { - const {data: addresses} = useGroupParticipantsQuery(group.id); + const {data: addresses} = useGroupParticipantsQuery(group?.id); const {navigate} = useTypedNavigation(); const {data, groupDisplayName} = useGroupContactInfo(addresses ?? []); @@ -29,7 +29,7 @@ export const GroupListItem: FC = ({ { navigate(ScreenNames.Group, { - id: group.id, + id: group?.id, }); }}> diff --git a/src/components/ImageMessage.tsx b/src/components/ImageMessage.tsx index aabf96f..a0364a2 100644 --- a/src/components/ImageMessage.tsx +++ b/src/components/ImageMessage.tsx @@ -48,9 +48,10 @@ export const ImageMessage: FC = ({content}) => { resizeMethod="auto" resizeMode="cover" source={{uri: downloadedUri}} - // source={require('../../assets/images/discover1.png')} height={40} width={40} + borderRadius={10} + alt="image message" /> ); }; diff --git a/src/components/AddGroupParticipantModal.tsx b/src/components/modals/AddGroupParticipantModal.tsx similarity index 89% rename from src/components/AddGroupParticipantModal.tsx rename to src/components/modals/AddGroupParticipantModal.tsx index c29049b..bd892d4 100644 --- a/src/components/AddGroupParticipantModal.tsx +++ b/src/components/modals/AddGroupParticipantModal.tsx @@ -2,17 +2,17 @@ import {Group} from '@xmtp/react-native-sdk/build/lib/Group'; import {Box, FlatList, HStack, Input, Pressable, VStack} from 'native-base'; import React, {FC, useCallback, useMemo, useState} from 'react'; import {ListRenderItem, useWindowDimensions} from 'react-native'; -import {TestIds} from '../consts/TestIds'; -import {useContactInfo} from '../hooks/useContactInfo'; -import {useContacts} from '../hooks/useContacts'; -import {translate} from '../i18n'; -import {colors} from '../theme/colors'; -import {formatAddress} from '../utils/formatAddress'; -import {AvatarWithFallback} from './AvatarWithFallback'; -import {Button} from './common/Button'; -import {Icon} from './common/Icon'; -import {Modal} from './common/Modal'; -import {Text} from './common/Text'; +import {TestIds} from '../../consts/TestIds'; +import {useContactInfo} from '../../hooks/useContactInfo'; +import {useContacts} from '../../hooks/useContacts'; +import {translate} from '../../i18n'; +import {colors} from '../../theme/colors'; +import {formatAddress} from '../../utils/formatAddress'; +import {AvatarWithFallback} from '../AvatarWithFallback'; +import {Button} from '../common/Button'; +import {Icon} from '../common/Icon'; +import {Modal} from '../common/Modal'; +import {Text} from '../common/Text'; export interface GroupInfoModalProps { shown: boolean; diff --git a/src/components/GroupInfoModal.tsx b/src/components/modals/GroupInfoModal.tsx similarity index 88% rename from src/components/GroupInfoModal.tsx rename to src/components/modals/GroupInfoModal.tsx index bb5f5f5..281973b 100644 --- a/src/components/GroupInfoModal.tsx +++ b/src/components/modals/GroupInfoModal.tsx @@ -1,14 +1,14 @@ import {Group} from '@xmtp/react-native-sdk/build/lib/Group'; import {HStack, Pressable, VStack} from 'native-base'; import React, {FC, useCallback} from 'react'; -import {useContactInfo} from '../hooks/useContactInfo'; -import {translate} from '../i18n'; -import {colors} from '../theme/colors'; -import {AvatarWithFallback} from './AvatarWithFallback'; -import {Button} from './common/Button'; -import {Icon} from './common/Icon'; -import {Modal} from './common/Modal'; -import {Text} from './common/Text'; +import {useContactInfo} from '../../hooks/useContactInfo'; +import {translate} from '../../i18n'; +import {colors} from '../../theme/colors'; +import {AvatarWithFallback} from '../AvatarWithFallback'; +import {Button} from '../common/Button'; +import {Icon} from '../common/Icon'; +import {Modal} from '../common/Modal'; +import {Text} from '../common/Text'; export interface GroupInfoModalProps { shown: boolean; diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index ec187ee..0ef0786 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -57,5 +57,16 @@ "guest_wallet": "Guest Wallet", "group_changed": "Group Changed", "add_to_group": "Add", - "group": "Group" + "group": "Group", + + "dev_screen": "Dev Screen", + "client": "Client", + "address": "Address", + "list_queries": "List Queries", + "conversation_messages_queries": "Conversation Messages", + "group_messages_queries": "Group Messages Queries", + "group_members_queries": "Group Members Queries", + "get_conversations": "Get Conversations", + "get_groups": "Get Groups", + "get_contacts": "Get Contacts" } \ No newline at end of file diff --git a/src/navigation/AppNavigation.tsx b/src/navigation/AppNavigation.tsx index 890fdaf..478489d 100644 --- a/src/navigation/AppNavigation.tsx +++ b/src/navigation/AppNavigation.tsx @@ -6,6 +6,7 @@ import {useClientContext} from '../context/ClientContext'; import {AccountSettingsScreen} from '../screens/AccountSettingsScreen'; import {ConversationListScreen} from '../screens/ConversationListScreen'; import {ConversationScreen} from '../screens/ConversationScreen'; +import {DevScreen} from '../screens/DevScreen'; import {DiscoverScreen} from '../screens/DiscoverScreen'; import {GroupScreen} from '../screens/GroupScreen'; import {LoadingScreen} from '../screens/LoadingScreen'; @@ -111,6 +112,15 @@ export const AppNavigation = () => { presentation: 'modal', }} /> + {__DEV__ && ( + + )} )} diff --git a/src/navigation/ScreenNames.ts b/src/navigation/ScreenNames.ts index c10d755..1dd7e16 100644 --- a/src/navigation/ScreenNames.ts +++ b/src/navigation/ScreenNames.ts @@ -15,4 +15,5 @@ export enum ScreenNames { Search = 'search', QRCode = 'qr_code', UserProfiles = 'user_profiles', + Dev = 'dev', } diff --git a/src/navigation/StackParams.ts b/src/navigation/StackParams.ts index 5e10e72..41bafa3 100644 --- a/src/navigation/StackParams.ts +++ b/src/navigation/StackParams.ts @@ -19,6 +19,7 @@ export type AuthenticatedStackParams = { [ScreenNames.Search]: undefined; [ScreenNames.QRCode]: undefined; [ScreenNames.UserProfiles]: {address: string}; + [ScreenNames.Dev]: undefined; }; export type RootStackParams = LoadingStackParams & diff --git a/src/queries/useListQuery.ts b/src/queries/useListQuery.ts index ff369ab..206586c 100644 --- a/src/queries/useListQuery.ts +++ b/src/queries/useListQuery.ts @@ -5,10 +5,9 @@ import {QueryKeys} from './QueryKeys'; export const useListQuery = () => { const {client} = useClient(); - return useQuery({ queryKey: [QueryKeys.List, client?.address], queryFn: () => getAllListMessages(client), - enabled: !!client, + enabled: Boolean(client), }); }; diff --git a/src/screens/ConversationListScreen.tsx b/src/screens/ConversationListScreen.tsx index 6cbd5f5..621c0e5 100644 --- a/src/screens/ConversationListScreen.tsx +++ b/src/screens/ConversationListScreen.tsx @@ -27,11 +27,12 @@ import {colors} from '../theme/colors'; const EmptyBackground = require('../../assets/images/Bg_asset.svg').default; const keyExtractor = (item: ListConversation | ListGroup) => - 'conversation' in item ? item.conversation.topic : item.group.id; + 'conversation' in item ? item.conversation?.topic : item.group?.id ?? ''; const useData = () => { const {client} = useClient(); - const {data, isLoading, refetch, isRefetching} = useListMessages(); + const {data, isLoading, refetch, isRefetching, isError, error} = + useListMessages(); const {listItems, requests} = useMemo(() => { const listMessages: ListMessages = []; @@ -58,6 +59,8 @@ const useData = () => { isLoading, refetch, isRefetching, + isError, + error, }; }; @@ -85,6 +88,11 @@ const ListHeader: FC = ({ const handleAccountPress = useCallback(() => { navigate(ScreenNames.Account); }, [navigate]); + const navigateToDev = useCallback(() => { + if (__DEV__) { + navigate(ScreenNames.Dev); + } + }, [navigate]); return ( = ({ shadow={4}>