├── assets ├── images │ ├── BG.png │ ├── icon.png │ ├── splash.png │ └── favicon.png └── fonts │ └── SpaceMono-Regular.ttf ├── amplify ├── backend │ ├── api │ │ └── whatsappclone │ │ │ ├── transform.conf.json │ │ │ ├── parameters.json │ │ │ ├── schema.graphql │ │ │ └── stacks │ │ │ └── CustomResources.json │ ├── backend-config.json │ └── auth │ │ └── whatsappclonea764e33c │ │ ├── parameters.json │ │ └── whatsappclonea764e33c-cloudformation-template.yml ├── .config │ └── project-config.json └── team-provider-info.json ├── .idea ├── .gitignore ├── codeStyles │ └── codeStyleConfig.xml ├── misc.xml ├── vcs.xml ├── graphql-settings.xml ├── jsLibraryMappings.xml ├── modules.xml └── WhatsappClone.iml ├── babel.config.js ├── amplify.json ├── components ├── StyledText.tsx ├── __tests__ │ └── StyledText-test.js ├── NewMessageButton │ ├── styles.ts │ └── index.tsx ├── ChatMessage │ ├── styles.ts │ └── index.tsx ├── ContactListItem │ ├── style.ts │ └── index.tsx ├── ChatListItem │ ├── style.ts │ └── index.tsx ├── InputBox │ ├── styles.ts │ └── index.tsx ├── Themed.tsx └── EditScreenInfo.tsx ├── hooks ├── useColorScheme.web.ts ├── useColorScheme.ts └── useCachedResources.ts ├── constants ├── Layout.ts └── Colors.ts ├── tsconfig.json ├── .expo-shared └── assets.json ├── .graphqlconfig.yml ├── navigation ├── LinkingConfiguration.ts ├── MainTabNavigator.tsx └── index.tsx ├── .gitignore ├── app.json ├── types.tsx ├── screens ├── TabTwoScreen.tsx ├── queries.ts ├── NotFoundScreen.tsx ├── ContactsScreen.tsx ├── ChatsScreen.tsx └── ChatRoomScreen.tsx ├── LICENSE ├── package.json ├── data ├── Chats.ts ├── Users.ts └── ChatRooms.ts ├── App.tsx └── src ├── graphql ├── queries.ts ├── subscriptions.ts └── mutations.ts └── API.ts /assets/images/BG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VadimNotJustDev/WhatsappClone/HEAD/assets/images/BG.png -------------------------------------------------------------------------------- /assets/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VadimNotJustDev/WhatsappClone/HEAD/assets/images/icon.png -------------------------------------------------------------------------------- /assets/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VadimNotJustDev/WhatsappClone/HEAD/assets/images/splash.png -------------------------------------------------------------------------------- /assets/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VadimNotJustDev/WhatsappClone/HEAD/assets/images/favicon.png -------------------------------------------------------------------------------- /amplify/backend/api/whatsappclone/transform.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 5, 3 | "ElasticsearchWarning": true 4 | } -------------------------------------------------------------------------------- /assets/fonts/SpaceMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VadimNotJustDev/WhatsappClone/HEAD/assets/fonts/SpaceMono-Regular.ttf -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | api.cache(true); 3 | return { 4 | presets: ['babel-preset-expo'], 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /amplify.json: -------------------------------------------------------------------------------- 1 | { 2 | "features": 3 | { 4 | "graphqltransformer": 5 | { 6 | "transformerversion": 5 7 | }, 8 | "keytransformer": 9 | { 10 | "defaultquery": true 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /.idea/graphql-settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /components/StyledText.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | import { Text, TextProps } from './Themed'; 4 | 5 | export function MonoText(props: TextProps) { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /hooks/useColorScheme.web.ts: -------------------------------------------------------------------------------- 1 | // useColorScheme from react-native does not support web currently. You can replace 2 | // this with react-native-appearance if you would like theme support on web. 3 | export default function useColorScheme() { 4 | return 'light'; 5 | } -------------------------------------------------------------------------------- /constants/Layout.ts: -------------------------------------------------------------------------------- 1 | import { Dimensions } from 'react-native'; 2 | 3 | const width = Dimensions.get('window').width; 4 | const height = Dimensions.get('window').height; 5 | 6 | export default { 7 | window: { 8 | width, 9 | height, 10 | }, 11 | isSmallDevice: width < 375, 12 | }; 13 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "jsx": "react-native", 5 | "lib": ["dom", "esnext"], 6 | "moduleResolution": "node", 7 | "noEmit": true, 8 | "skipLibCheck": true, 9 | "resolveJsonModule": true, 10 | "strict": true 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.expo-shared/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "e997a5256149a4b76e6bfd6cbf519c5e5a0f1d278a3d8fa1253022b03c90473b": true, 3 | "af683c96e0ffd2cf81287651c9433fa44debc1220ca7cb431fe482747f34a505": true, 4 | "12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, 5 | "40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true 6 | } 7 | -------------------------------------------------------------------------------- /components/__tests__/StyledText-test.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import renderer from 'react-test-renderer'; 3 | 4 | import { MonoText } from '../StyledText'; 5 | 6 | it(`renders correctly`, () => { 7 | const tree = renderer.create(Snapshot test!).toJSON(); 8 | 9 | expect(tree).toMatchSnapshot(); 10 | }); 11 | -------------------------------------------------------------------------------- /amplify/backend/api/whatsappclone/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "AppSyncApiName": "whatsappclone", 3 | "DynamoDBBillingMode": "PAY_PER_REQUEST", 4 | "DynamoDBEnableServerSideEncryption": false, 5 | "AuthCognitoUserPoolId": { 6 | "Fn::GetAtt": [ 7 | "authwhatsappclonea764e33c", 8 | "Outputs.UserPoolId" 9 | ] 10 | } 11 | } -------------------------------------------------------------------------------- /.graphqlconfig.yml: -------------------------------------------------------------------------------- 1 | projects: 2 | whatsappclone: 3 | schemaPath: src/graphql/schema.json 4 | includes: 5 | - src/graphql/**/*.ts 6 | excludes: 7 | - ./amplify/** 8 | extensions: 9 | amplify: 10 | codeGenTarget: typescript 11 | generatedFileName: src/API.ts 12 | docsFilePath: src/graphql 13 | extensions: 14 | amplify: 15 | version: 3 16 | -------------------------------------------------------------------------------- /hooks/useColorScheme.ts: -------------------------------------------------------------------------------- 1 | import { ColorSchemeName, useColorScheme as _useColorScheme } from 'react-native'; 2 | 3 | // The useColorScheme value is always either light or dark, but the built-in 4 | // type suggests that it can be null. This will not happen in practice, so this 5 | // makes it a bit easier to work with. 6 | export default function useColorScheme(): NonNullable { 7 | return _useColorScheme() as NonNullable; 8 | } 9 | -------------------------------------------------------------------------------- /constants/Colors.ts: -------------------------------------------------------------------------------- 1 | const tintColorLight = '#0C6157'; 2 | const tintColorDark = '#fff'; 3 | 4 | export default { 5 | light: { 6 | text: '#000', 7 | background: '#fff', 8 | tint: tintColorLight, 9 | tabIconDefault: '#ccc', 10 | tabIconSelected: tintColorLight, 11 | }, 12 | dark: { 13 | text: '#fff', 14 | background: '#000', 15 | tint: tintColorDark, 16 | tabIconDefault: '#ccc', 17 | tabIconSelected: tintColorDark, 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /components/NewMessageButton/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | import Colors from "../../constants/Colors"; 3 | 4 | const styles = StyleSheet.create({ 5 | container: { 6 | backgroundColor: Colors.light.tint, 7 | width: 50, 8 | height: 50, 9 | borderRadius: 25, 10 | justifyContent: 'center', 11 | alignItems: 'center', 12 | position: 'absolute', 13 | bottom: 20, 14 | right: 20, 15 | } 16 | }) 17 | 18 | export default styles; 19 | -------------------------------------------------------------------------------- /amplify/.config/project-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "WhatsappClone", 3 | "version": "3.0", 4 | "frontend": "javascript", 5 | "javascript": { 6 | "framework": "react-native", 7 | "config": { 8 | "SourceDir": "/", 9 | "DistributionDir": "/", 10 | "BuildCommand": "npm run-script build", 11 | "StartCommand": "npm run-script start" 12 | } 13 | }, 14 | "providers": [ 15 | "awscloudformation" 16 | ] 17 | } -------------------------------------------------------------------------------- /.idea/WhatsappClone.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /navigation/LinkingConfiguration.ts: -------------------------------------------------------------------------------- 1 | import * as Linking from 'expo-linking'; 2 | 3 | export default { 4 | prefixes: [Linking.makeUrl('/')], 5 | config: { 6 | screens: { 7 | Root: { 8 | screens: { 9 | TabOne: { 10 | screens: { 11 | TabOneScreen: 'one', 12 | }, 13 | }, 14 | TabTwo: { 15 | screens: { 16 | TabTwoScreen: 'two', 17 | }, 18 | }, 19 | }, 20 | }, 21 | NotFound: '*', 22 | }, 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /components/ChatMessage/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | import Colors from "../../constants/Colors"; 3 | 4 | const styles = StyleSheet.create({ 5 | container: { 6 | padding: 10, 7 | }, 8 | messageBox: { 9 | borderRadius: 5, 10 | padding: 10, 11 | }, 12 | name: { 13 | color: Colors.light.tint, 14 | fontWeight: "bold", 15 | marginBottom: 5, 16 | }, 17 | message: { 18 | 19 | }, 20 | time: { 21 | alignSelf: "flex-end", 22 | color: 'grey' 23 | } 24 | }); 25 | 26 | export default styles; 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/**/* 2 | .expo/* 3 | npm-debug.* 4 | *.jks 5 | *.p8 6 | *.p12 7 | *.key 8 | *.mobileprovision 9 | *.orig.* 10 | web-build/ 11 | 12 | # macOS 13 | .DS_Store 14 | 15 | #amplify 16 | amplify/\#current-cloud-backend 17 | amplify/.config/local-* 18 | amplify/mock-data 19 | amplify/backend/amplify-meta.json 20 | amplify/backend/awscloudformation 21 | build/ 22 | dist/ 23 | node_modules/ 24 | aws-exports.js 25 | awsconfiguration.json 26 | amplifyconfiguration.json 27 | amplify-build-config.json 28 | amplify-gradle-config.json 29 | amplifytools.xcconfig -------------------------------------------------------------------------------- /amplify/backend/backend-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "auth": { 3 | "whatsappclonea764e33c": { 4 | "service": "Cognito", 5 | "providerPlugin": "awscloudformation", 6 | "dependsOn": [], 7 | "customAuth": false 8 | } 9 | }, 10 | "api": { 11 | "whatsappclone": { 12 | "service": "AppSync", 13 | "providerPlugin": "awscloudformation", 14 | "output": { 15 | "authConfig": { 16 | "defaultAuthentication": { 17 | "authenticationType": "AMAZON_COGNITO_USER_POOLS", 18 | "userPoolConfig": { 19 | "userPoolId": "authwhatsappclonea764e33c" 20 | } 21 | }, 22 | "additionalAuthenticationProviders": [] 23 | } 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /components/ContactListItem/style.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | const styles = StyleSheet.create({ 4 | container: { 5 | flexDirection: 'row', 6 | width: "100%", 7 | justifyContent: 'space-between', 8 | padding: 10, 9 | }, 10 | lefContainer: { 11 | flexDirection: 'row', 12 | }, 13 | midContainer: { 14 | justifyContent: 'space-around' 15 | }, 16 | avatar: { 17 | width: 60, 18 | height: 60, 19 | borderRadius: 50, 20 | marginRight: 15, 21 | }, 22 | username: { 23 | fontWeight: 'bold', 24 | fontSize: 16, 25 | }, 26 | status: { 27 | fontSize: 16, 28 | color: 'grey', 29 | }, 30 | }); 31 | 32 | export default styles; 33 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "WhatsappClone", 4 | "slug": "WhatsappClone", 5 | "version": "1.0.0", 6 | "orientation": "portrait", 7 | "icon": "./assets/images/icon.png", 8 | "scheme": "myapp", 9 | "userInterfaceStyle": "automatic", 10 | "splash": { 11 | "image": "./assets/images/splash.png", 12 | "resizeMode": "contain", 13 | "backgroundColor": "#ffffff" 14 | }, 15 | "updates": { 16 | "fallbackToCacheTimeout": 0 17 | }, 18 | "assetBundlePatterns": [ 19 | "**/*" 20 | ], 21 | "ios": { 22 | "supportsTablet": true 23 | }, 24 | "web": { 25 | "favicon": "./assets/images/favicon.png" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /components/ChatListItem/style.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | const styles = StyleSheet.create({ 4 | container: { 5 | flexDirection: 'row', 6 | width: "100%", 7 | justifyContent: 'space-between', 8 | padding: 10, 9 | }, 10 | lefContainer: { 11 | flexDirection: 'row', 12 | }, 13 | midContainer: { 14 | justifyContent: 'space-around' 15 | }, 16 | avatar: { 17 | width: 60, 18 | height: 60, 19 | borderRadius: 50, 20 | marginRight: 15, 21 | }, 22 | username: { 23 | fontWeight: 'bold', 24 | fontSize: 16, 25 | }, 26 | lastMessage: { 27 | fontSize: 16, 28 | color: 'grey', 29 | }, 30 | time: { 31 | fontSize: 14, 32 | color: 'grey' 33 | }, 34 | }); 35 | 36 | export default styles; 37 | -------------------------------------------------------------------------------- /components/NewMessageButton/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {TouchableOpacity, View} from "react-native"; 3 | import { MaterialCommunityIcons } from "@expo/vector-icons"; 4 | import styles from "./styles"; 5 | import { useNavigation } from '@react-navigation/native'; 6 | 7 | const NewMessageButton = () => { 8 | 9 | const navigation = useNavigation(); 10 | 11 | const onPress = () => { 12 | navigation.navigate('Contacts'); 13 | } 14 | 15 | return ( 16 | 17 | 18 | 23 | 24 | 25 | ) 26 | } 27 | 28 | export default NewMessageButton; 29 | -------------------------------------------------------------------------------- /types.tsx: -------------------------------------------------------------------------------- 1 | export type RootStackParamList = { 2 | Root: undefined; 3 | NotFound: undefined; 4 | Contacts: undefined; 5 | ChatRoom: undefined; 6 | }; 7 | 8 | export type MainTabParamList = { 9 | Camera: undefined; 10 | Chats: undefined; 11 | Status: undefined; 12 | Calls: undefined; 13 | }; 14 | 15 | export type TabOneParamList = { 16 | TabOneScreen: undefined; 17 | }; 18 | 19 | export type TabTwoParamList = { 20 | TabTwoScreen: undefined; 21 | }; 22 | 23 | export type User = { 24 | id: String; 25 | name: String; 26 | imageUri: String; 27 | status: String; 28 | } 29 | 30 | export type Message = { 31 | id: String; 32 | content: string; 33 | createdAt: string; 34 | user: User; 35 | } 36 | 37 | export type ChatRoom = { 38 | id: String; 39 | users: User[]; 40 | lastMessage: Message; 41 | } 42 | -------------------------------------------------------------------------------- /components/InputBox/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | import Colors from "../../constants/Colors"; 3 | 4 | const styles = StyleSheet.create({ 5 | container: { 6 | flexDirection: 'row', 7 | margin: 10, 8 | alignItems: 'flex-end', 9 | }, 10 | mainContainer: { 11 | flexDirection: 'row', 12 | backgroundColor: 'white', 13 | padding: 10, 14 | borderRadius: 25, 15 | marginRight: 10, 16 | flex: 1, 17 | alignItems: 'flex-end', 18 | }, 19 | textInput: { 20 | flex: 1, 21 | marginHorizontal: 10 22 | }, 23 | icon: { 24 | marginHorizontal: 5, 25 | }, 26 | buttonContainer: { 27 | backgroundColor: Colors.light.tint, 28 | borderRadius: 25, 29 | width: 50, 30 | height: 50, 31 | justifyContent: 'center', 32 | alignItems: 'center', 33 | } 34 | }) 35 | 36 | export default styles; 37 | -------------------------------------------------------------------------------- /screens/TabTwoScreen.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | 4 | import EditScreenInfo from '../components/EditScreenInfo'; 5 | import { Text, View } from '../components/Themed'; 6 | 7 | export default function TabTwoScreen() { 8 | return ( 9 | 10 | Tab Two 11 | 12 | 13 | 14 | ); 15 | } 16 | 17 | const styles = StyleSheet.create({ 18 | container: { 19 | flex: 1, 20 | alignItems: 'center', 21 | justifyContent: 'center', 22 | }, 23 | title: { 24 | fontSize: 20, 25 | fontWeight: 'bold', 26 | }, 27 | separator: { 28 | marginVertical: 30, 29 | height: 1, 30 | width: '80%', 31 | }, 32 | }); 33 | -------------------------------------------------------------------------------- /screens/queries.ts: -------------------------------------------------------------------------------- 1 | export const getUser = /* GraphQL */ ` 2 | query GetUser($id: ID!) { 3 | getUser(id: $id) { 4 | id 5 | name 6 | imageUri 7 | status 8 | chatRoomUser { 9 | items { 10 | id 11 | userID 12 | chatRoomID 13 | createdAt 14 | updatedAt 15 | chatRoom { 16 | id 17 | chatRoomUsers { 18 | items { 19 | user { 20 | id 21 | name 22 | imageUri 23 | status 24 | } 25 | } 26 | } 27 | lastMessage { 28 | id 29 | content 30 | updatedAt 31 | user { 32 | id 33 | name 34 | } 35 | } 36 | } 37 | } 38 | nextToken 39 | } 40 | createdAt 41 | updatedAt 42 | } 43 | } 44 | `; 45 | -------------------------------------------------------------------------------- /amplify/team-provider-info.json: -------------------------------------------------------------------------------- 1 | { 2 | "dev": { 3 | "awscloudformation": { 4 | "AuthRoleName": "amplify-whatsappclone-dev-162004-authRole", 5 | "UnauthRoleArn": "arn:aws:iam::704219588443:role/amplify-whatsappclone-dev-162004-unauthRole", 6 | "AuthRoleArn": "arn:aws:iam::704219588443:role/amplify-whatsappclone-dev-162004-authRole", 7 | "Region": "eu-west-1", 8 | "DeploymentBucketName": "amplify-whatsappclone-dev-162004-deployment", 9 | "UnauthRoleName": "amplify-whatsappclone-dev-162004-unauthRole", 10 | "StackName": "amplify-whatsappclone-dev-162004", 11 | "StackId": "arn:aws:cloudformation:eu-west-1:704219588443:stack/amplify-whatsappclone-dev-162004/4f7c17a0-0fb2-11eb-b1c9-0a8a5e60739b", 12 | "AmplifyAppId": "dtpv0mytmuh66" 13 | }, 14 | "categories": { 15 | "auth": { 16 | "whatsappclonea764e33c": {} 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /hooks/useCachedResources.ts: -------------------------------------------------------------------------------- 1 | import { Ionicons } from '@expo/vector-icons'; 2 | import * as Font from 'expo-font'; 3 | import * as SplashScreen from 'expo-splash-screen'; 4 | import * as React from 'react'; 5 | 6 | export default function useCachedResources() { 7 | const [isLoadingComplete, setLoadingComplete] = React.useState(false); 8 | 9 | // Load any resources or data that we need prior to rendering the app 10 | React.useEffect(() => { 11 | async function loadResourcesAndDataAsync() { 12 | try { 13 | SplashScreen.preventAutoHideAsync(); 14 | 15 | // Load fonts 16 | await Font.loadAsync({ 17 | ...Ionicons.font, 18 | 'space-mono': require('../assets/fonts/SpaceMono-Regular.ttf'), 19 | }); 20 | } catch (e) { 21 | // We might want to provide this error information to an error reporting service 22 | console.warn(e); 23 | } finally { 24 | setLoadingComplete(true); 25 | SplashScreen.hideAsync(); 26 | } 27 | } 28 | 29 | loadResourcesAndDataAsync(); 30 | }, []); 31 | 32 | return isLoadingComplete; 33 | } 34 | -------------------------------------------------------------------------------- /components/ChatMessage/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Text, View} from 'react-native'; 3 | import { Message } from "../../types"; 4 | import moment from "moment"; 5 | import styles from './styles'; 6 | 7 | export type ChatMessageProps = { 8 | message: Message; 9 | myId: String, 10 | } 11 | 12 | const ChatMessage = (props: ChatMessageProps) => { 13 | const { message, myId } = props; 14 | 15 | const isMyMessage = () => { 16 | return message.user.id === myId; 17 | } 18 | 19 | return ( 20 | 21 | 28 | {!isMyMessage() && {message.user.name}} 29 | {message.content} 30 | {moment(message.createdAt).fromNow()} 31 | 32 | 33 | ) 34 | } 35 | 36 | export default ChatMessage; 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Vadim Savin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /screens/NotFoundScreen.tsx: -------------------------------------------------------------------------------- 1 | import { StackScreenProps } from '@react-navigation/stack'; 2 | import * as React from 'react'; 3 | import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; 4 | 5 | import { RootStackParamList } from '../types'; 6 | 7 | export default function NotFoundScreen({ 8 | navigation, 9 | }: StackScreenProps) { 10 | return ( 11 | 12 | This screen doesn't exist. 13 | navigation.replace('Root')} style={styles.link}> 14 | Go to home screen! 15 | 16 | 17 | ); 18 | } 19 | 20 | const styles = StyleSheet.create({ 21 | container: { 22 | flex: 1, 23 | backgroundColor: '#fff', 24 | alignItems: 'center', 25 | justifyContent: 'center', 26 | padding: 20, 27 | }, 28 | title: { 29 | fontSize: 20, 30 | fontWeight: 'bold', 31 | }, 32 | link: { 33 | marginTop: 15, 34 | paddingVertical: 15, 35 | }, 36 | linkText: { 37 | fontSize: 14, 38 | color: '#2e78b7', 39 | }, 40 | }); 41 | -------------------------------------------------------------------------------- /amplify/backend/api/whatsappclone/schema.graphql: -------------------------------------------------------------------------------- 1 | type User @model { 2 | id: ID! 3 | name: String! 4 | imageUri: String 5 | status: String 6 | chatRoomUser: [ChatRoomUser] @connection(keyName: "byUser", fields: ["id"]) 7 | } 8 | 9 | type ChatRoomUser 10 | @model 11 | @key(name: "byUser", fields: ["userID", "chatRoomID"]) 12 | @key(name: "byChatRoom", fields: ["chatRoomID", "userID"]) { 13 | id: ID! 14 | userID: ID! 15 | chatRoomID: ID! 16 | user: User @connection(fields: ["userID"]) 17 | chatRoom: ChatRoom @connection(fields: ["chatRoomID"]) 18 | } 19 | 20 | type ChatRoom @model { 21 | id: ID! 22 | chatRoomUsers: [ChatRoomUser] @connection(keyName: "byChatRoom", fields: ["id"]) 23 | messages: [Message] @connection(keyName: "byChatRoom", fields: ["id"]) 24 | lastMessageID: ID! 25 | lastMessage: Message @connection(fields: ["lastMessageID"]) 26 | } 27 | 28 | type Message 29 | @model 30 | @key( 31 | name: "byChatRoom", 32 | fields: ["chatRoomID", "createdAt"], 33 | queryField: "messagesByChatRoom") { 34 | id: ID! 35 | createdAt: String! 36 | content: String! 37 | userID: ID! 38 | chatRoomID: ID! 39 | user: User @connection(fields: ["userID"]) 40 | chatRoom: ChatRoom @connection(fields: ["chatRoomID"]) 41 | } 42 | -------------------------------------------------------------------------------- /screens/ContactsScreen.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import {FlatList, StyleSheet} from 'react-native'; 3 | import { API, graphqlOperation } from 'aws-amplify'; 4 | import { View } from '../components/Themed'; 5 | import ContactListItem from '../components/ContactListItem'; 6 | 7 | import { listUsers } from '../src/graphql/queries'; 8 | import {useEffect, useState} from "react"; 9 | 10 | export default function ContactsScreen() { 11 | 12 | const [users, setUsers] = useState([]); 13 | 14 | useEffect(() => { 15 | const fetchUsers = async () => { 16 | try { 17 | const usersData = await API.graphql( 18 | graphqlOperation( 19 | listUsers 20 | ) 21 | ) 22 | setUsers(usersData.data.listUsers.items); 23 | } catch (e) { 24 | console.log(e); 25 | } 26 | } 27 | fetchUsers(); 28 | }, []) 29 | 30 | return ( 31 | 32 | } 36 | keyExtractor={(item) => item.id} 37 | /> 38 | 39 | ); 40 | } 41 | 42 | const styles = StyleSheet.create({ 43 | container: { 44 | flex: 1, 45 | alignItems: 'center', 46 | justifyContent: 'center', 47 | }, 48 | }); 49 | -------------------------------------------------------------------------------- /components/Themed.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Text as DefaultText, View as DefaultView } from 'react-native'; 3 | 4 | import Colors from '../constants/Colors'; 5 | import useColorScheme from '../hooks/useColorScheme'; 6 | 7 | export function useThemeColor( 8 | props: { light?: string; dark?: string }, 9 | colorName: keyof typeof Colors.light & keyof typeof Colors.dark 10 | ) { 11 | const theme = useColorScheme(); 12 | const colorFromProps = props[theme]; 13 | 14 | if (colorFromProps) { 15 | return colorFromProps; 16 | } else { 17 | return Colors[theme][colorName]; 18 | } 19 | } 20 | 21 | type ThemeProps = { 22 | lightColor?: string; 23 | darkColor?: string; 24 | }; 25 | 26 | export type TextProps = ThemeProps & DefaultText['props']; 27 | export type ViewProps = ThemeProps & DefaultView['props']; 28 | 29 | export function Text(props: TextProps) { 30 | const { style, lightColor, darkColor, ...otherProps } = props; 31 | const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text'); 32 | 33 | return ; 34 | } 35 | 36 | export function View(props: ViewProps) { 37 | const { style, lightColor, darkColor, ...otherProps } = props; 38 | const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background'); 39 | 40 | return ; 41 | } 42 | -------------------------------------------------------------------------------- /screens/ChatsScreen.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import {FlatList, StyleSheet} from 'react-native'; 3 | import { View } from '../components/Themed'; 4 | import ChatListItem from '../components/ChatListItem'; 5 | import { 6 | API, 7 | graphqlOperation, 8 | Auth, 9 | } from 'aws-amplify'; 10 | 11 | import chatRooms from '../data/ChatRooms'; 12 | import NewMessageButton from "../components/NewMessageButton"; 13 | import {useEffect, useState} from "react"; 14 | 15 | import { getUser } from './queries'; 16 | 17 | export default function ChatsScreen() { 18 | 19 | const [chatRooms, setChatRooms] = useState([]); 20 | 21 | useEffect(() => { 22 | const fetchChatRooms = async () => { 23 | try { 24 | const userInfo = await Auth.currentAuthenticatedUser(); 25 | 26 | const userData = await API.graphql( 27 | graphqlOperation( 28 | getUser, { 29 | id: userInfo.attributes.sub, 30 | } 31 | ) 32 | ) 33 | 34 | setChatRooms(userData.data.getUser.chatRoomUser.items) 35 | } catch (e) { 36 | console.log(e); 37 | } 38 | } 39 | fetchChatRooms(); 40 | }, []); 41 | 42 | return ( 43 | 44 | } 48 | keyExtractor={(item) => item.id} 49 | /> 50 | 51 | 52 | ); 53 | } 54 | 55 | const styles = StyleSheet.create({ 56 | container: { 57 | flex: 1, 58 | alignItems: 'center', 59 | justifyContent: 'center', 60 | }, 61 | 62 | }); 63 | -------------------------------------------------------------------------------- /amplify/backend/api/whatsappclone/stacks/CustomResources.json: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion": "2010-09-09", 3 | "Description": "An auto-generated nested stack.", 4 | "Metadata": {}, 5 | "Parameters": { 6 | "AppSyncApiId": { 7 | "Type": "String", 8 | "Description": "The id of the AppSync API associated with this project." 9 | }, 10 | "AppSyncApiName": { 11 | "Type": "String", 12 | "Description": "The name of the AppSync API", 13 | "Default": "AppSyncSimpleTransform" 14 | }, 15 | "env": { 16 | "Type": "String", 17 | "Description": "The environment name. e.g. Dev, Test, or Production", 18 | "Default": "NONE" 19 | }, 20 | "S3DeploymentBucket": { 21 | "Type": "String", 22 | "Description": "The S3 bucket containing all deployment assets for the project." 23 | }, 24 | "S3DeploymentRootKey": { 25 | "Type": "String", 26 | "Description": "An S3 key relative to the S3DeploymentBucket that points to the root\nof the deployment directory." 27 | } 28 | }, 29 | "Resources": { 30 | "EmptyResource": { 31 | "Type": "Custom::EmptyResource", 32 | "Condition": "AlwaysFalse" 33 | } 34 | }, 35 | "Conditions": { 36 | "HasEnvironmentParameter": { 37 | "Fn::Not": [ 38 | { 39 | "Fn::Equals": [ 40 | { 41 | "Ref": "env" 42 | }, 43 | "NONE" 44 | ] 45 | } 46 | ] 47 | }, 48 | "AlwaysFalse": { 49 | "Fn::Equals": ["true", "false"] 50 | } 51 | }, 52 | "Outputs": { 53 | "EmptyOutput": { 54 | "Description": "An empty output. You may delete this if you have at least one resource above.", 55 | "Value": "" 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /amplify/backend/auth/whatsappclonea764e33c/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "identityPoolName": "whatsappclonea764e33c_identitypool_a764e33c", 3 | "allowUnauthenticatedIdentities": false, 4 | "resourceNameTruncated": "whatsaa764e33c", 5 | "userPoolName": "whatsappclonea764e33c_userpool_a764e33c", 6 | "autoVerifiedAttributes": [ 7 | "email" 8 | ], 9 | "mfaConfiguration": "OFF", 10 | "mfaTypes": [ 11 | "SMS Text Message" 12 | ], 13 | "smsAuthenticationMessage": "Your authentication code is {####}", 14 | "smsVerificationMessage": "Your verification code is {####}", 15 | "emailVerificationSubject": "Your verification code", 16 | "emailVerificationMessage": "Your verification code is {####}", 17 | "defaultPasswordPolicy": false, 18 | "passwordPolicyMinLength": 8, 19 | "passwordPolicyCharacters": [], 20 | "requiredAttributes": [ 21 | "email" 22 | ], 23 | "userpoolClientGenerateSecret": true, 24 | "userpoolClientRefreshTokenValidity": 30, 25 | "userpoolClientWriteAttributes": [ 26 | "email" 27 | ], 28 | "userpoolClientReadAttributes": [ 29 | "email" 30 | ], 31 | "userpoolClientLambdaRole": "whatsaa764e33c_userpoolclient_lambda_role", 32 | "userpoolClientSetAttributes": false, 33 | "sharedId": "a764e33c", 34 | "resourceName": "whatsappclonea764e33c", 35 | "authSelections": "identityPoolAndUserPool", 36 | "authRoleArn": { 37 | "Fn::GetAtt": [ 38 | "AuthRole", 39 | "Arn" 40 | ] 41 | }, 42 | "unauthRoleArn": { 43 | "Fn::GetAtt": [ 44 | "UnauthRole", 45 | "Arn" 46 | ] 47 | }, 48 | "useDefault": "default", 49 | "userPoolGroupList": [], 50 | "dependsOn": [] 51 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "node_modules/expo/AppEntry.js", 3 | "scripts": { 4 | "start": "expo start", 5 | "android": "expo start --android", 6 | "ios": "expo start --ios", 7 | "web": "expo start --web", 8 | "eject": "expo eject", 9 | "test": "jest --watchAll" 10 | }, 11 | "jest": { 12 | "preset": "jest-expo" 13 | }, 14 | "dependencies": { 15 | "@expo/vector-icons": "^10.0.0", 16 | "@react-native-community/masked-view": "0.1.10", 17 | "@react-native-community/netinfo": "^5.9.7", 18 | "@react-navigation/bottom-tabs": "^5.8.0", 19 | "@react-navigation/material-top-tabs": "^5.2.19", 20 | "@react-navigation/native": "^5.7.3", 21 | "@react-navigation/stack": "^5.9.0", 22 | "aws-amplify": "^3.3.4", 23 | "aws-amplify-react-native": "^4.2.7", 24 | "expo": "~39.0.2", 25 | "expo-asset": "~8.2.0", 26 | "expo-constants": "~9.2.0", 27 | "expo-font": "~8.3.0", 28 | "expo-linking": "^1.0.1", 29 | "expo-splash-screen": "~0.6.2", 30 | "expo-status-bar": "~1.0.2", 31 | "expo-web-browser": "~8.5.0", 32 | "moment": "^2.29.1", 33 | "react": "16.13.1", 34 | "react-dom": "16.13.1", 35 | "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz", 36 | "react-native-gesture-handler": "~1.7.0", 37 | "react-native-reanimated": "^1.13.1", 38 | "react-native-safe-area-context": "3.1.4", 39 | "react-native-screens": "~2.10.1", 40 | "react-native-tab-view": "^2.15.2", 41 | "react-native-web": "~0.13.12" 42 | }, 43 | "devDependencies": { 44 | "@babel/core": "~7.9.0", 45 | "@types/react": "~16.9.35", 46 | "@types/react-native": "~0.63.2", 47 | "jest-expo": "~39.0.0", 48 | "typescript": "~3.9.5" 49 | }, 50 | "private": true 51 | } 52 | -------------------------------------------------------------------------------- /components/ChatListItem/index.tsx: -------------------------------------------------------------------------------- 1 | import React, {useEffect, useState} from 'react'; 2 | import { 3 | View, 4 | Text, 5 | Image, 6 | TouchableWithoutFeedback 7 | } from "react-native"; 8 | import { ChatRoom } from "../../types"; 9 | import styles from "./style"; 10 | import moment from "moment"; 11 | import { useNavigation } from '@react-navigation/native'; 12 | import { 13 | Auth, 14 | } from 'aws-amplify'; 15 | 16 | export type ChatListItemProps = { 17 | chatRoom: ChatRoom; 18 | } 19 | 20 | const ChatListItem = (props: ChatListItemProps) => { 21 | const { chatRoom } = props; 22 | const [ otherUser, setOtherUser] = useState(null); 23 | 24 | const navigation = useNavigation(); 25 | 26 | useEffect(() => { 27 | const getOtherUser = async () => { 28 | const userInfo = await Auth.currentAuthenticatedUser(); 29 | if (chatRoom.chatRoomUsers.items[0].user.id === userInfo.attributes.sub) { 30 | setOtherUser(chatRoom.chatRoomUsers.items[1].user); 31 | } else { 32 | setOtherUser(chatRoom.chatRoomUsers.items[0].user); 33 | } 34 | } 35 | getOtherUser(); 36 | }, []) 37 | 38 | const onClick = () => { 39 | navigation.navigate('ChatRoom', { 40 | id: chatRoom.id, 41 | name: otherUser.name, 42 | }) 43 | } 44 | 45 | if (!otherUser) { 46 | return null; 47 | } 48 | 49 | return ( 50 | 51 | 52 | 53 | 54 | 55 | 56 | {otherUser.name} 57 | 60 | {chatRoom.lastMessage 61 | ? `${chatRoom.lastMessage.user.name}: ${chatRoom.lastMessage.content}` 62 | : ""} 63 | 64 | 65 | 66 | 67 | 68 | 69 | {chatRoom.lastMessage && moment(chatRoom.lastMessage.createdAt).format("DD/MM/YYYY")} 70 | 71 | 72 | 73 | ) 74 | }; 75 | 76 | export default ChatListItem; 77 | -------------------------------------------------------------------------------- /data/Chats.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | id: '1', 3 | users: [{ 4 | id: 'u1', 5 | name: 'Vadim', 6 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 7 | }, { 8 | id: 'u2', 9 | name: 'Lukas', 10 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.0-1/p200x200/107443858_3074598385966770_1929559809312242379_n.jpg?_nc_cat=107&_nc_sid=7206a8&_nc_eui2=AeGly5fZLQUfAKei_EiACEq5Dfw2T_M-BQMN_DZP8z4FA_aLEVK_8e0dKvl_5vxVO0Zn-4OPzQ9pKS0c0XeXd898&_nc_ohc=z1ydC_UL4KsAX_tfrbv&_nc_oc=AQknywM4y1IAQaQZaZkPdtkUmaem060LXSByeTx3pdQXWfxW2_tdzfgRsQIXQK_zV94&_nc_ht=scontent.fkiv3-1.fna&tp=6&oh=69508c88f073f64f432fc1f1ab9299e8&oe=5F9C5FD5', 11 | }], 12 | messages: [{ 13 | id: 'm1', 14 | content: 'How are you, Lukas!', 15 | createdAt: '2020-10-10T12:48:00.000Z', 16 | user: { 17 | id: 'u1', 18 | name: 'Vadim', 19 | }, 20 | }, { 21 | id: 'm2', 22 | content: 'I am good, good', 23 | createdAt: '2020-10-03T14:49:00.000Z', 24 | user: { 25 | id: 'u2', 26 | name: 'Lukas', 27 | }, 28 | }, { 29 | id: 'm3', 30 | content: 'What about you?', 31 | createdAt: '2020-10-03T14:49:40.000Z', 32 | user: { 33 | id: 'u2', 34 | name: 'Lukas', 35 | }, 36 | }, { 37 | id: 'm4', 38 | content: 'Good as well, preparing for the stream now.', 39 | createdAt: '2020-10-03T14:50:00.000Z', 40 | user: { 41 | id: 'u1', 42 | name: 'Vadim', 43 | }, 44 | }, { 45 | id: 'm5', 46 | content: 'How is your uni going?', 47 | createdAt: '2020-10-03T14:51:00.000Z', 48 | user: { 49 | id: 'u1', 50 | name: 'Vadim', 51 | }, 52 | }, { 53 | id: 'm6', 54 | content: 'It is a bit tough, as I have 2 specializations. How about yours? Do you enjoy it?', 55 | createdAt: '2020-10-03T14:49:00.000Z', 56 | user: { 57 | id: 'u2', 58 | name: 'Lukas', 59 | }, 60 | }, { 61 | id: 'm7', 62 | content: 'Big Data is really interesting. Cannot wait to go through all the material.', 63 | createdAt: '2020-10-03T14:53:00.000Z', 64 | user: { 65 | id: 'u1', 66 | name: 'Vadim', 67 | }, 68 | }] 69 | } 70 | 71 | -------------------------------------------------------------------------------- /screens/ChatRoomScreen.tsx: -------------------------------------------------------------------------------- 1 | import React, {useEffect, useState} from 'react'; 2 | import {FlatList, Text, ImageBackground, KeyboardAvoidingView } from 'react-native'; 3 | 4 | import { useRoute } from '@react-navigation/native'; 5 | import { 6 | API, 7 | graphqlOperation, 8 | Auth, 9 | } from 'aws-amplify'; 10 | 11 | import { messagesByChatRoom } from '../src/graphql/queries'; 12 | import { onCreateMessage } from '../src/graphql/subscriptions'; 13 | 14 | 15 | import ChatMessage from "../components/ChatMessage"; 16 | import BG from '../assets/images/BG.png'; 17 | import InputBox from "../components/InputBox"; 18 | 19 | const ChatRoomScreen = () => { 20 | 21 | const [messages, setMessages] = useState([]); 22 | const [myId, setMyId] = useState(null); 23 | 24 | const route = useRoute(); 25 | 26 | const fetchMessages = async () => { 27 | const messagesData = await API.graphql( 28 | graphqlOperation( 29 | messagesByChatRoom, { 30 | chatRoomID: route.params.id, 31 | sortDirection: "DESC", 32 | } 33 | ) 34 | ) 35 | 36 | console.log("FETCH MESSAGES") 37 | setMessages(messagesData.data.messagesByChatRoom.items); 38 | } 39 | 40 | useEffect(() => { 41 | fetchMessages(); 42 | }, []) 43 | 44 | useEffect(() => { 45 | const getMyId = async () => { 46 | const userInfo = await Auth.currentAuthenticatedUser(); 47 | setMyId(userInfo.attributes.sub); 48 | } 49 | getMyId(); 50 | }, []) 51 | 52 | useEffect(() => { 53 | const subscription = API.graphql( 54 | graphqlOperation(onCreateMessage) 55 | ).subscribe({ 56 | next: (data) => { 57 | const newMessage = data.value.data.onCreateMessage; 58 | 59 | if (newMessage.chatRoomID !== route.params.id) { 60 | console.log("Message is in another room!") 61 | return; 62 | } 63 | 64 | fetchMessages(); 65 | // setMessages([newMessage, ...messages]); 66 | } 67 | }); 68 | 69 | return () => subscription.unsubscribe(); 70 | }, []) 71 | 72 | console.log(`messages in state: ${messages.length}`) 73 | 74 | return ( 75 | 76 | } 79 | inverted 80 | /> 81 | 82 | 83 | 84 | ); 85 | } 86 | 87 | export default ChatRoomScreen; 88 | -------------------------------------------------------------------------------- /App.tsx: -------------------------------------------------------------------------------- 1 | import { StatusBar } from 'expo-status-bar'; 2 | import React, {useEffect} from 'react'; 3 | import { SafeAreaProvider } from 'react-native-safe-area-context'; 4 | 5 | import useCachedResources from './hooks/useCachedResources'; 6 | import useColorScheme from './hooks/useColorScheme'; 7 | import Navigation from './navigation'; 8 | 9 | import { 10 | Auth, 11 | API, 12 | graphqlOperation, 13 | } from 'aws-amplify'; 14 | import { getUser } from './src/graphql/queries'; 15 | import { createUser } from './src/graphql/mutations'; 16 | 17 | import { withAuthenticator } from 'aws-amplify-react-native' 18 | import Amplify from 'aws-amplify' 19 | import config from './aws-exports' 20 | Amplify.configure(config) 21 | 22 | const randomImages = [ 23 | 'https://hieumobile.com/wp-content/uploads/avatar-among-us-2.jpg', 24 | 'https://hieumobile.com/wp-content/uploads/avatar-among-us-3.jpg', 25 | 'https://hieumobile.com/wp-content/uploads/avatar-among-us-6.jpg', 26 | 'https://hieumobile.com/wp-content/uploads/avatar-among-us-9.jpg', 27 | ] 28 | 29 | function App() { 30 | const isLoadingComplete = useCachedResources(); 31 | const colorScheme = useColorScheme(); 32 | 33 | const getRandomImage = () => { 34 | return randomImages[Math.floor(Math.random() * randomImages.length)]; 35 | } 36 | 37 | // run this snippet only when App is first mounted 38 | useEffect( () => { 39 | const fetchUser = async () => { 40 | const userInfo = await Auth.currentAuthenticatedUser({ bypassCache: true }); 41 | 42 | if (userInfo) { 43 | const userData = await API.graphql( 44 | graphqlOperation( 45 | getUser, 46 | { id: userInfo.attributes.sub } 47 | ) 48 | ) 49 | 50 | if (userData.data.getUser) { 51 | console.log("User is already registered in database"); 52 | return; 53 | } 54 | 55 | const newUser = { 56 | id: userInfo.attributes.sub, 57 | name: userInfo.username, 58 | imageUri: getRandomImage(), 59 | status: 'Hey, I am using WhatsApp', 60 | } 61 | 62 | await API.graphql( 63 | graphqlOperation( 64 | createUser, 65 | { input: newUser } 66 | ) 67 | ) 68 | } 69 | } 70 | 71 | fetchUser(); 72 | }, []) 73 | 74 | if (!isLoadingComplete) { 75 | return null; 76 | } else { 77 | return ( 78 | 79 | 80 | 81 | 82 | ); 83 | } 84 | } 85 | 86 | export default withAuthenticator(App) 87 | -------------------------------------------------------------------------------- /components/ContactListItem/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | View, 4 | Text, 5 | Image, 6 | TouchableWithoutFeedback 7 | } from "react-native"; 8 | import { User } from "../../types"; 9 | import styles from "./style"; 10 | import { useNavigation } from '@react-navigation/native'; 11 | 12 | import { 13 | API, 14 | graphqlOperation, 15 | Auth, 16 | } from "aws-amplify"; 17 | import { 18 | createChatRoom, 19 | createChatRoomUser 20 | } from '../../src/graphql/mutations'; 21 | 22 | export type ContactListItemProps = { 23 | user: User; 24 | } 25 | 26 | const ContactListItem = (props: ContactListItemProps) => { 27 | const { user } = props; 28 | 29 | const navigation = useNavigation(); 30 | 31 | const onClick = async () => { 32 | try { 33 | 34 | // 1. Create a new Chat Room 35 | const newChatRoomData = await API.graphql( 36 | graphqlOperation( 37 | createChatRoom, { 38 | input: { 39 | lastMessageID: "zz753fca-e8c3-473b-8e85-b14196e84e16" 40 | } 41 | } 42 | ) 43 | ) 44 | 45 | if (!newChatRoomData.data) { 46 | console.log(" Failed to create a chat room"); 47 | return; 48 | } 49 | 50 | const newChatRoom = newChatRoomData.data.createChatRoom; 51 | 52 | // 2. Add `user` to the Chat Room 53 | await API.graphql( 54 | graphqlOperation( 55 | createChatRoomUser, { 56 | input: { 57 | userID: user.id, 58 | chatRoomID: newChatRoom.id, 59 | } 60 | } 61 | ) 62 | ) 63 | 64 | // 3. Add authenticated user to the Chat Room 65 | const userInfo = await Auth.currentAuthenticatedUser(); 66 | await API.graphql( 67 | graphqlOperation( 68 | createChatRoomUser, { 69 | input: { 70 | userID: userInfo.attributes.sub, 71 | chatRoomID: newChatRoom.id, 72 | } 73 | } 74 | ) 75 | ) 76 | 77 | navigation.navigate('ChatRoom', { 78 | id: newChatRoom.id, 79 | name: "Hardcoded name", 80 | }) 81 | 82 | } catch (e) { 83 | console.log(e); 84 | } 85 | } 86 | 87 | return ( 88 | 89 | 90 | 91 | 92 | 93 | 94 | {user.name} 95 | {user.status} 96 | 97 | 98 | 99 | 100 | ) 101 | }; 102 | 103 | export default ContactListItem; 104 | -------------------------------------------------------------------------------- /navigation/MainTabNavigator.tsx: -------------------------------------------------------------------------------- 1 | import { Ionicons } from '@expo/vector-icons'; 2 | import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs'; 3 | import { createStackNavigator } from '@react-navigation/stack'; 4 | import * as React from 'react'; 5 | 6 | import { Fontisto } from "@expo/vector-icons"; 7 | 8 | import Colors from '../constants/Colors'; 9 | import useColorScheme from '../hooks/useColorScheme'; 10 | import ChatsScreen from '../screens/ChatsScreen'; 11 | import TabTwoScreen from '../screens/TabTwoScreen'; 12 | import { MainTabParamList, TabOneParamList, TabTwoParamList } from '../types'; 13 | 14 | const MainTab = createMaterialTopTabNavigator(); 15 | 16 | export default function MainTabNavigator() { 17 | const colorScheme = useColorScheme(); 18 | 19 | return ( 20 | 36 | , 41 | tabBarLabel: () => null 42 | }} 43 | /> 44 | 48 | 52 | 56 | 57 | ); 58 | } 59 | 60 | // You can explore the built-in icon families and icons on the web at: 61 | // https://icons.expo.fyi/ 62 | function TabBarIcon(props: { name: string; color: string }) { 63 | return ; 64 | } 65 | 66 | // Each tab has its own navigation stack, you can read more about this pattern here: 67 | // https://reactnavigation.org/docs/tab-based-navigation#a-stack-navigator-for-each-tab 68 | const TabOneStack = createStackNavigator(); 69 | 70 | function TabOneNavigator() { 71 | return ( 72 | 73 | 78 | 79 | ); 80 | } 81 | 82 | const TabTwoStack = createStackNavigator(); 83 | 84 | function TabTwoNavigator() { 85 | return ( 86 | 87 | 92 | 93 | ); 94 | } 95 | -------------------------------------------------------------------------------- /components/EditScreenInfo.tsx: -------------------------------------------------------------------------------- 1 | import * as WebBrowser from 'expo-web-browser'; 2 | import React from 'react'; 3 | import { StyleSheet, TouchableOpacity } from 'react-native'; 4 | 5 | import Colors from '../constants/Colors'; 6 | import { MonoText } from './StyledText'; 7 | import { Text, View } from './Themed'; 8 | 9 | export default function EditScreenInfo({ path }: { path: string }) { 10 | return ( 11 | 12 | 13 | 17 | Open up the code for this screen: 18 | 19 | 20 | 24 | {path} 25 | 26 | 27 | 31 | Change any of the text, save the file, and your app will automatically update. 32 | 33 | 34 | 35 | 36 | 37 | 38 | Tap here if your app doesn't automatically update after making changes 39 | 40 | 41 | 42 | 43 | ); 44 | } 45 | 46 | function handleHelpPress() { 47 | WebBrowser.openBrowserAsync( 48 | 'https://docs.expo.io/get-started/create-a-new-app/#opening-the-app-on-your-phonetablet' 49 | ); 50 | } 51 | 52 | const styles = StyleSheet.create({ 53 | container: { 54 | flex: 1, 55 | backgroundColor: '#fff', 56 | }, 57 | developmentModeText: { 58 | marginBottom: 20, 59 | fontSize: 14, 60 | lineHeight: 19, 61 | textAlign: 'center', 62 | }, 63 | contentContainer: { 64 | paddingTop: 30, 65 | }, 66 | welcomeContainer: { 67 | alignItems: 'center', 68 | marginTop: 10, 69 | marginBottom: 20, 70 | }, 71 | welcomeImage: { 72 | width: 100, 73 | height: 80, 74 | resizeMode: 'contain', 75 | marginTop: 3, 76 | marginLeft: -10, 77 | }, 78 | getStartedContainer: { 79 | alignItems: 'center', 80 | marginHorizontal: 50, 81 | }, 82 | homeScreenFilename: { 83 | marginVertical: 7, 84 | }, 85 | codeHighlightText: { 86 | color: 'rgba(96,100,109, 0.8)', 87 | }, 88 | codeHighlightContainer: { 89 | borderRadius: 3, 90 | paddingHorizontal: 4, 91 | }, 92 | getStartedText: { 93 | fontSize: 17, 94 | lineHeight: 24, 95 | textAlign: 'center', 96 | }, 97 | helpContainer: { 98 | marginTop: 15, 99 | marginHorizontal: 20, 100 | alignItems: 'center', 101 | }, 102 | helpLink: { 103 | paddingVertical: 15, 104 | }, 105 | helpLinkText: { 106 | textAlign: 'center', 107 | }, 108 | }); 109 | -------------------------------------------------------------------------------- /navigation/index.tsx: -------------------------------------------------------------------------------- 1 | import { NavigationContainer, DefaultTheme, DarkTheme } from '@react-navigation/native'; 2 | import { createStackNavigator } from '@react-navigation/stack'; 3 | import * as React from 'react'; 4 | import {ColorSchemeName, View} from 'react-native'; 5 | import { 6 | Octicons, 7 | MaterialCommunityIcons, 8 | MaterialIcons, 9 | FontAwesome5, 10 | } from '@expo/vector-icons'; 11 | 12 | import NotFoundScreen from '../screens/NotFoundScreen'; 13 | import ChatRoomScreen from '../screens/ChatRoomScreen'; 14 | import { RootStackParamList } from '../types'; 15 | import MainTabNavigator from './MainTabNavigator'; 16 | import LinkingConfiguration from './LinkingConfiguration'; 17 | import Colors from "../constants/Colors"; 18 | import ContactsScreen from "../screens/ContactsScreen"; 19 | 20 | // If you are not familiar with React Navigation, we recommend going through the 21 | // "Fundamentals" guide: https://reactnavigation.org/docs/getting-started 22 | export default function Navigation({ colorScheme }: { colorScheme: ColorSchemeName }) { 23 | return ( 24 | 27 | 28 | 29 | ); 30 | } 31 | 32 | // A root stack navigator is often used for displaying modals on top of all other content 33 | // Read more here: https://reactnavigation.org/docs/modal 34 | const Stack = createStackNavigator(); 35 | 36 | function RootNavigator() { 37 | return ( 38 | 50 | ( 56 | 62 | 63 | 64 | 65 | ) 66 | }} 67 | /> 68 | ({ 72 | title: route.params.name, 73 | headerRight: () => ( 74 | 80 | 81 | 82 | 83 | 84 | ) 85 | })} 86 | /> 87 | 91 | 92 | 93 | ); 94 | } 95 | -------------------------------------------------------------------------------- /components/InputBox/index.tsx: -------------------------------------------------------------------------------- 1 | import React, {useEffect, useState} from 'react'; 2 | import {View, Text, TextInput, TouchableOpacity, KeyboardAvoidingView, Platform,} from "react-native"; 3 | import styles from './styles'; 4 | 5 | import { 6 | API, 7 | Auth, 8 | graphqlOperation, 9 | } from 'aws-amplify'; 10 | 11 | import { 12 | createMessage, 13 | updateChatRoom, 14 | } from '../../src/graphql/mutations'; 15 | 16 | import { 17 | MaterialCommunityIcons, 18 | MaterialIcons, 19 | FontAwesome5, 20 | Entypo, 21 | Fontisto, 22 | } from '@expo/vector-icons'; 23 | 24 | const InputBox = (props) => { 25 | 26 | const { chatRoomID } = props; 27 | 28 | const [message, setMessage] = useState(''); 29 | const [myUserId, setMyUserId] = useState(null); 30 | 31 | useEffect(() => { 32 | const fetchUser = async () => { 33 | const userInfo = await Auth.currentAuthenticatedUser(); 34 | setMyUserId(userInfo.attributes.sub); 35 | } 36 | fetchUser(); 37 | }, []) 38 | 39 | const onMicrophonePress = () => { 40 | console.warn('Microphone') 41 | } 42 | 43 | const updateChatRoomLastMessage = async (messageId: string) => { 44 | try { 45 | await API.graphql( 46 | graphqlOperation( 47 | updateChatRoom, { 48 | input: { 49 | id: chatRoomID, 50 | lastMessageID: messageId, 51 | } 52 | } 53 | ) 54 | ); 55 | } catch (e) { 56 | console.log(e); 57 | } 58 | } 59 | 60 | const onSendPress = async () => { 61 | try { 62 | const newMessageData = await API.graphql( 63 | graphqlOperation( 64 | createMessage, { 65 | input: { 66 | content: message, 67 | userID: myUserId, 68 | chatRoomID 69 | } 70 | } 71 | ) 72 | ) 73 | 74 | await updateChatRoomLastMessage(newMessageData.data.createMessage.id) 75 | } catch (e) { 76 | console.log(e); 77 | } 78 | 79 | setMessage(''); 80 | } 81 | 82 | const onPress = () => { 83 | if (!message) { 84 | onMicrophonePress(); 85 | } else { 86 | onSendPress(); 87 | } 88 | } 89 | 90 | return ( 91 | 96 | 97 | 98 | 99 | 106 | 107 | {!message && } 108 | 109 | 110 | 111 | {!message 112 | ? 113 | : } 114 | 115 | 116 | 117 | 118 | ) 119 | } 120 | 121 | export default InputBox; 122 | -------------------------------------------------------------------------------- /data/Users.ts: -------------------------------------------------------------------------------- 1 | export default [{ 2 | id: 'u1', 3 | name: 'Vadim', 4 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 5 | status: "Hello there, how are you" 6 | }, { 7 | id: 'u2', 8 | name: 'Lukas', 9 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.0-1/p200x200/107443858_3074598385966770_1929559809312242379_n.jpg?_nc_cat=107&_nc_sid=7206a8&_nc_eui2=AeGly5fZLQUfAKei_EiACEq5Dfw2T_M-BQMN_DZP8z4FA_aLEVK_8e0dKvl_5vxVO0Zn-4OPzQ9pKS0c0XeXd898&_nc_ohc=z1ydC_UL4KsAX_tfrbv&_nc_oc=AQknywM4y1IAQaQZaZkPdtkUmaem060LXSByeTx3pdQXWfxW2_tdzfgRsQIXQK_zV94&_nc_ht=scontent.fkiv3-1.fna&tp=6&oh=69508c88f073f64f432fc1f1ab9299e8&oe=5F9C5FD5', 10 | }, { 11 | id: 'u3', 12 | name: 'Daniil', 13 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-8/14242257_122280314893965_2111799435851825649_o.jpg?_nc_cat=100&_nc_sid=09cbfe&_nc_eui2=AeH1OfzTrJPQ6gm8y5chASx9XduE6cDoPWBd24TpwOg9YB3iQXtk3WFlfnz5Z8K89WDuLYc3YgooGcmFvcn5fpBL&_nc_ohc=HZKFqosOM-IAX_SsXhT&_nc_oc=AQksp486WazJyCTMR5esRx51kZ8He2qUotQP7EAtzySMJl7i9H2Pv4PpULir6W5Eglk&_nc_ht=scontent.fkiv3-1.fna&oh=b45419e5106747d75fdd548392517a3c&oe=5F9FB4DD', 14 | }, { 15 | id: 'u4', 16 | name: 'Alex', 17 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.0-9/120265890_2659046234308755_83273782629061168_n.jpg?_nc_cat=109&_nc_sid=09cbfe&_nc_eui2=AeFydVcQHwdfhPgKavejHgTkZj50mLqkTwRmPnSYuqRPBBjekO0sZKdUNlELv62Htps4xAUKslo4tD8g8YyTPQ50&_nc_ohc=YcnPR2BvKUgAX_rSMDJ&_nc_ht=scontent.fkiv3-1.fna&oh=ea3bcd9c21e5538c744e4cb19464713b&oe=5F9E4002', 18 | }, { 19 | id: 'u5', 20 | name: 'Vlad', 21 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.15752-9/120640479_2760477844167786_6938949653508389840_n.jpg?_nc_cat=108&_nc_sid=ae9488&_nc_eui2=AeGVhYmC95nNnVy1xOf6ArJ2jSXP0lcbAsGNJc_SVxsCwevGmgj2fByDCyiWY8iQK-k-KkqYMmK-pPRahQiFUqAT&_nc_ohc=0d4q0ZI3HTgAX_0LSog&_nc_ht=scontent.fkiv3-1.fna&oh=c9155df4d012070901bce3e8f0e2d877&oe=5F9F9DF5', 22 | }, { 23 | id: 'u6', 24 | name: 'Elon Musk', 25 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.0-9/117929133_107809907710190_7419805747453745280_n.jpg?_nc_cat=103&_nc_sid=09cbfe&_nc_eui2=AeHyr9m8dMUXCyqgYiDxTTMqypeilYrkr1_Kl6KViuSvX2aKglh0TaInpI6Uqbk8nRSKq6iOQuTncbpb6Uik2iH8&_nc_ohc=YusbV4P7yQMAX9ptPAN&_nc_ht=scontent.fkiv3-1.fna&oh=ebee2db09b2a70c9dbef1bdad876c09c&oe=5F9D4112', 26 | }, { 27 | id: 'u7', 28 | name: 'Adrian', 29 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-8/12185020_10206884996416284_5116038671917824834_o.jpg?_nc_cat=101&_nc_sid=174925&_nc_eui2=AeGr_NhJtwGWWfHbkoBSmifLKzIg47DpEF0rMiDjsOkQXf7yavDd4m-3CLbl5nqAMGcj2nn0Dqg7beNAzuZMzTFK&_nc_ohc=KOCn_AYCJxkAX_ZcLBP&_nc_ht=scontent.fkiv3-1.fna&oh=8cc4e5445ce4633db9d6234f42ccb368&oe=5F9C24D1', 30 | }, { 31 | id: 'u8', 32 | name: 'Borja', 33 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.0-9/14639688_10154618563394501_7732414502546927586_n.jpg?_nc_cat=111&_nc_sid=09cbfe&_nc_eui2=AeHoAmU6vBHtxse4pY5lCxy5mE72isysx5eYTvaKzKzHl0wF5HhppdSbpFTEnGVXBMLig16R9B4iHrsuAOk_V_fY&_nc_ohc=Sit1NLT0GMsAX9baI56&_nc_ht=scontent.fkiv3-1.fna&oh=16d88a54bb1629c24e77afed0c49f869&oe=5F9EAC05', 34 | }, { 35 | id: 'u9', 36 | name: 'Mom', 37 | imageUri: 'https://image.shutterstock.com/image-vector/super-mom-hero-superhero-cartoon-600w-720015928.jpg', 38 | }, { 39 | id: 'u10', 40 | name: 'Angelina Jolie', 41 | imageUri: 'https://lkbkspro.s3.amazonaws.com/atelier-management/gs_58d933b8-98b4-468e-b229-43100a9620a7.jpg', 42 | }] 43 | -------------------------------------------------------------------------------- /src/graphql/queries.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // this is an auto generated file. This will be overwritten 4 | 5 | export const getUser = /* GraphQL */ ` 6 | query GetUser($id: ID!) { 7 | getUser(id: $id) { 8 | id 9 | name 10 | imageUri 11 | status 12 | chatRoomUser { 13 | items { 14 | id 15 | userID 16 | chatRoomID 17 | createdAt 18 | updatedAt 19 | } 20 | nextToken 21 | } 22 | createdAt 23 | updatedAt 24 | } 25 | } 26 | `; 27 | export const listUsers = /* GraphQL */ ` 28 | query ListUsers( 29 | $filter: ModelUserFilterInput 30 | $limit: Int 31 | $nextToken: String 32 | ) { 33 | listUsers(filter: $filter, limit: $limit, nextToken: $nextToken) { 34 | items { 35 | id 36 | name 37 | imageUri 38 | status 39 | chatRoomUser { 40 | nextToken 41 | } 42 | createdAt 43 | updatedAt 44 | } 45 | nextToken 46 | } 47 | } 48 | `; 49 | export const getChatRoomUser = /* GraphQL */ ` 50 | query GetChatRoomUser($id: ID!) { 51 | getChatRoomUser(id: $id) { 52 | id 53 | userID 54 | chatRoomID 55 | user { 56 | id 57 | name 58 | imageUri 59 | status 60 | chatRoomUser { 61 | nextToken 62 | } 63 | createdAt 64 | updatedAt 65 | } 66 | chatRoom { 67 | id 68 | chatRoomUsers { 69 | nextToken 70 | } 71 | messages { 72 | nextToken 73 | } 74 | lastMessageID 75 | lastMessage { 76 | id 77 | createdAt 78 | content 79 | userID 80 | chatRoomID 81 | updatedAt 82 | } 83 | createdAt 84 | updatedAt 85 | } 86 | createdAt 87 | updatedAt 88 | } 89 | } 90 | `; 91 | export const listChatRoomUsers = /* GraphQL */ ` 92 | query ListChatRoomUsers( 93 | $filter: ModelChatRoomUserFilterInput 94 | $limit: Int 95 | $nextToken: String 96 | ) { 97 | listChatRoomUsers(filter: $filter, limit: $limit, nextToken: $nextToken) { 98 | items { 99 | id 100 | userID 101 | chatRoomID 102 | user { 103 | id 104 | name 105 | imageUri 106 | status 107 | createdAt 108 | updatedAt 109 | } 110 | chatRoom { 111 | id 112 | lastMessageID 113 | createdAt 114 | updatedAt 115 | } 116 | createdAt 117 | updatedAt 118 | } 119 | nextToken 120 | } 121 | } 122 | `; 123 | export const getChatRoom = /* GraphQL */ ` 124 | query GetChatRoom($id: ID!) { 125 | getChatRoom(id: $id) { 126 | id 127 | chatRoomUsers { 128 | items { 129 | id 130 | userID 131 | chatRoomID 132 | createdAt 133 | updatedAt 134 | } 135 | nextToken 136 | } 137 | messages { 138 | items { 139 | id 140 | createdAt 141 | content 142 | userID 143 | chatRoomID 144 | updatedAt 145 | } 146 | nextToken 147 | } 148 | lastMessageID 149 | lastMessage { 150 | id 151 | createdAt 152 | content 153 | userID 154 | chatRoomID 155 | user { 156 | id 157 | name 158 | imageUri 159 | status 160 | createdAt 161 | updatedAt 162 | } 163 | chatRoom { 164 | id 165 | lastMessageID 166 | createdAt 167 | updatedAt 168 | } 169 | updatedAt 170 | } 171 | createdAt 172 | updatedAt 173 | } 174 | } 175 | `; 176 | export const listChatRooms = /* GraphQL */ ` 177 | query ListChatRooms( 178 | $filter: ModelChatRoomFilterInput 179 | $limit: Int 180 | $nextToken: String 181 | ) { 182 | listChatRooms(filter: $filter, limit: $limit, nextToken: $nextToken) { 183 | items { 184 | id 185 | chatRoomUsers { 186 | nextToken 187 | } 188 | messages { 189 | nextToken 190 | } 191 | lastMessageID 192 | lastMessage { 193 | id 194 | createdAt 195 | content 196 | userID 197 | chatRoomID 198 | updatedAt 199 | } 200 | createdAt 201 | updatedAt 202 | } 203 | nextToken 204 | } 205 | } 206 | `; 207 | export const getMessage = /* GraphQL */ ` 208 | query GetMessage($id: ID!) { 209 | getMessage(id: $id) { 210 | id 211 | createdAt 212 | content 213 | userID 214 | chatRoomID 215 | user { 216 | id 217 | name 218 | imageUri 219 | status 220 | chatRoomUser { 221 | nextToken 222 | } 223 | createdAt 224 | updatedAt 225 | } 226 | chatRoom { 227 | id 228 | chatRoomUsers { 229 | nextToken 230 | } 231 | messages { 232 | nextToken 233 | } 234 | lastMessageID 235 | lastMessage { 236 | id 237 | createdAt 238 | content 239 | userID 240 | chatRoomID 241 | updatedAt 242 | } 243 | createdAt 244 | updatedAt 245 | } 246 | updatedAt 247 | } 248 | } 249 | `; 250 | export const listMessages = /* GraphQL */ ` 251 | query ListMessages( 252 | $filter: ModelMessageFilterInput 253 | $limit: Int 254 | $nextToken: String 255 | ) { 256 | listMessages(filter: $filter, limit: $limit, nextToken: $nextToken) { 257 | items { 258 | id 259 | createdAt 260 | content 261 | userID 262 | chatRoomID 263 | user { 264 | id 265 | name 266 | imageUri 267 | status 268 | createdAt 269 | updatedAt 270 | } 271 | chatRoom { 272 | id 273 | lastMessageID 274 | createdAt 275 | updatedAt 276 | } 277 | updatedAt 278 | } 279 | nextToken 280 | } 281 | } 282 | `; 283 | export const messagesByChatRoom = /* GraphQL */ ` 284 | query MessagesByChatRoom( 285 | $chatRoomID: ID 286 | $createdAt: ModelStringKeyConditionInput 287 | $sortDirection: ModelSortDirection 288 | $filter: ModelMessageFilterInput 289 | $limit: Int 290 | $nextToken: String 291 | ) { 292 | messagesByChatRoom( 293 | chatRoomID: $chatRoomID 294 | createdAt: $createdAt 295 | sortDirection: $sortDirection 296 | filter: $filter 297 | limit: $limit 298 | nextToken: $nextToken 299 | ) { 300 | items { 301 | id 302 | createdAt 303 | content 304 | userID 305 | chatRoomID 306 | user { 307 | id 308 | name 309 | imageUri 310 | status 311 | createdAt 312 | updatedAt 313 | } 314 | chatRoom { 315 | id 316 | lastMessageID 317 | createdAt 318 | updatedAt 319 | } 320 | updatedAt 321 | } 322 | nextToken 323 | } 324 | } 325 | `; 326 | -------------------------------------------------------------------------------- /data/ChatRooms.ts: -------------------------------------------------------------------------------- 1 | export default [{ 2 | id: '1', 3 | users: [{ 4 | id: 'u1', 5 | name: 'Vadim', 6 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 7 | }, { 8 | id: 'u2', 9 | name: 'Lukas', 10 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.0-1/p200x200/107443858_3074598385966770_1929559809312242379_n.jpg?_nc_cat=107&_nc_sid=7206a8&_nc_eui2=AeGly5fZLQUfAKei_EiACEq5Dfw2T_M-BQMN_DZP8z4FA_aLEVK_8e0dKvl_5vxVO0Zn-4OPzQ9pKS0c0XeXd898&_nc_ohc=z1ydC_UL4KsAX_tfrbv&_nc_oc=AQknywM4y1IAQaQZaZkPdtkUmaem060LXSByeTx3pdQXWfxW2_tdzfgRsQIXQK_zV94&_nc_ht=scontent.fkiv3-1.fna&tp=6&oh=69508c88f073f64f432fc1f1ab9299e8&oe=5F9C5FD5', 11 | }], 12 | lastMessage: { 13 | id: 'm1', 14 | content: 'Well done this sprint, guys!', 15 | createdAt: '2020-10-03T14:48:00.000Z', 16 | } 17 | }, { 18 | id: '2', 19 | users: [{ 20 | id: 'u1', 21 | name: 'Vadim', 22 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 23 | }, { 24 | id: 'u3', 25 | name: 'Daniil', 26 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-8/14242257_122280314893965_2111799435851825649_o.jpg?_nc_cat=100&_nc_sid=09cbfe&_nc_eui2=AeH1OfzTrJPQ6gm8y5chASx9XduE6cDoPWBd24TpwOg9YB3iQXtk3WFlfnz5Z8K89WDuLYc3YgooGcmFvcn5fpBL&_nc_ohc=HZKFqosOM-IAX_SsXhT&_nc_oc=AQksp486WazJyCTMR5esRx51kZ8He2qUotQP7EAtzySMJl7i9H2Pv4PpULir6W5Eglk&_nc_ht=scontent.fkiv3-1.fna&oh=b45419e5106747d75fdd548392517a3c&oe=5F9FB4DD', 27 | }], 28 | lastMessage: { 29 | id: 'm2', 30 | content: 'How are you doing?', 31 | createdAt: '2020-10-02T15:40:00.000Z', 32 | } 33 | }, { 34 | id: '3', 35 | users: [{ 36 | id: 'u1', 37 | name: 'Vadim', 38 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 39 | }, { 40 | id: 'u4', 41 | name: 'Alex', 42 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.0-9/120265890_2659046234308755_83273782629061168_n.jpg?_nc_cat=109&_nc_sid=09cbfe&_nc_eui2=AeFydVcQHwdfhPgKavejHgTkZj50mLqkTwRmPnSYuqRPBBjekO0sZKdUNlELv62Htps4xAUKslo4tD8g8YyTPQ50&_nc_ohc=YcnPR2BvKUgAX_rSMDJ&_nc_ht=scontent.fkiv3-1.fna&oh=ea3bcd9c21e5538c744e4cb19464713b&oe=5F9E4002', 43 | }], 44 | lastMessage: { 45 | id: 'm3', 46 | content: 'Hi, Vadim.', 47 | createdAt: '2020-10-02T14:48:00.000Z', 48 | } 49 | }, { 50 | id: '4', 51 | users: [{ 52 | id: 'u1', 53 | name: 'Vadim', 54 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 55 | }, { 56 | id: 'u5', 57 | name: 'Vlad', 58 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.15752-9/120640479_2760477844167786_6938949653508389840_n.jpg?_nc_cat=108&_nc_sid=ae9488&_nc_eui2=AeGVhYmC95nNnVy1xOf6ArJ2jSXP0lcbAsGNJc_SVxsCwevGmgj2fByDCyiWY8iQK-k-KkqYMmK-pPRahQiFUqAT&_nc_ohc=0d4q0ZI3HTgAX_0LSog&_nc_ht=scontent.fkiv3-1.fna&oh=c9155df4d012070901bce3e8f0e2d877&oe=5F9F9DF5', 59 | }], 60 | lastMessage: { 61 | id: 'm4', 62 | content: 'Can you review my last merge', 63 | createdAt: '2020-09-29T14:48:00.000Z', 64 | } 65 | }, { 66 | id: '5', 67 | users: [{ 68 | id: 'u1', 69 | name: 'Vadim', 70 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 71 | }, { 72 | id: 'u6', 73 | name: 'Elon Musk', 74 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.0-9/117929133_107809907710190_7419805747453745280_n.jpg?_nc_cat=103&_nc_sid=09cbfe&_nc_eui2=AeHyr9m8dMUXCyqgYiDxTTMqypeilYrkr1_Kl6KViuSvX2aKglh0TaInpI6Uqbk8nRSKq6iOQuTncbpb6Uik2iH8&_nc_ohc=YusbV4P7yQMAX9ptPAN&_nc_ht=scontent.fkiv3-1.fna&oh=ebee2db09b2a70c9dbef1bdad876c09c&oe=5F9D4112', 75 | }], 76 | lastMessage: { 77 | id: 'm5', 78 | content: 'I would be happy', 79 | createdAt: '2020-09-30T14:48:00.000Z', 80 | } 81 | }, { 82 | id: '6', 83 | users: [{ 84 | id: 'u1', 85 | name: 'Vadim', 86 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 87 | }, { 88 | id: 'u7', 89 | name: 'Adrian', 90 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-8/12185020_10206884996416284_5116038671917824834_o.jpg?_nc_cat=101&_nc_sid=174925&_nc_eui2=AeGr_NhJtwGWWfHbkoBSmifLKzIg47DpEF0rMiDjsOkQXf7yavDd4m-3CLbl5nqAMGcj2nn0Dqg7beNAzuZMzTFK&_nc_ohc=KOCn_AYCJxkAX_ZcLBP&_nc_ht=scontent.fkiv3-1.fna&oh=8cc4e5445ce4633db9d6234f42ccb368&oe=5F9C24D1', 91 | }], 92 | lastMessage: { 93 | id: 'm6', 94 | content: 'I have a solution', 95 | createdAt: '2020-10-02T15:40:00.000Z', 96 | } 97 | }, { 98 | id: '7', 99 | users: [{ 100 | id: 'u1', 101 | name: 'Vadim', 102 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 103 | }, { 104 | id: 'u8', 105 | name: 'Borja', 106 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t1.0-9/14639688_10154618563394501_7732414502546927586_n.jpg?_nc_cat=111&_nc_sid=09cbfe&_nc_eui2=AeHoAmU6vBHtxse4pY5lCxy5mE72isysx5eYTvaKzKzHl0wF5HhppdSbpFTEnGVXBMLig16R9B4iHrsuAOk_V_fY&_nc_ohc=Sit1NLT0GMsAX9baI56&_nc_ht=scontent.fkiv3-1.fna&oh=16d88a54bb1629c24e77afed0c49f869&oe=5F9EAC05', 107 | }], 108 | lastMessage: { 109 | id: 'm7', 110 | content: 'How are you doing?', 111 | createdAt: '2020-10-02T15:40:00.000Z', 112 | } 113 | }, { 114 | id: '8', 115 | users: [{ 116 | id: 'u1', 117 | name: 'Vadim', 118 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 119 | }, { 120 | id: 'u9', 121 | name: 'Mom', 122 | imageUri: 'https://image.shutterstock.com/image-vector/super-mom-hero-superhero-cartoon-600w-720015928.jpg', 123 | }], 124 | lastMessage: { 125 | id: 'm8', 126 | content: 'Dear, did you eat?', 127 | createdAt: '2020-09-27T15:40:00.000Z', 128 | } 129 | }, { 130 | id: '9', 131 | users: [{ 132 | id: 'u1', 133 | name: 'Vadim', 134 | imageUri: 'https://scontent.fkiv3-1.fna.fbcdn.net/v/t31.0-1/s200x200/22256588_1932617800312085_5686197942193420542_o.jpg?_nc_cat=110&_nc_sid=7206a8&_nc_eui2=AeF3UwtnAs3QLEJRnLSp4-hQxlokCBJZ6JPGWiQIElnok9HafHyjqv9D4bW9zeNFfNJlg5jLsvbewM7j5OD-OFy-&_nc_ohc=IxycgYSpqQEAX8EcTqI&_nc_ht=scontent.fkiv3-1.fna&tp=7&oh=640a83293bb75378958d22b633302f1b&oe=5F9F4BB7', 135 | }, { 136 | id: 'u10', 137 | name: 'Angelina Jolie', 138 | imageUri: 'https://lkbkspro.s3.amazonaws.com/atelier-management/gs_58d933b8-98b4-468e-b229-43100a9620a7.jpg', 139 | }], 140 | lastMessage: { 141 | id: 'm9', 142 | content: 'Meet me at the same place', 143 | createdAt: '2020-09-25T15:40:00.000Z', 144 | }, 145 | }] 146 | -------------------------------------------------------------------------------- /src/graphql/subscriptions.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // this is an auto generated file. This will be overwritten 4 | 5 | export const onCreateUser = /* GraphQL */ ` 6 | subscription OnCreateUser { 7 | onCreateUser { 8 | id 9 | name 10 | imageUri 11 | status 12 | chatRoomUser { 13 | items { 14 | id 15 | userID 16 | chatRoomID 17 | createdAt 18 | updatedAt 19 | } 20 | nextToken 21 | } 22 | createdAt 23 | updatedAt 24 | } 25 | } 26 | `; 27 | export const onUpdateUser = /* GraphQL */ ` 28 | subscription OnUpdateUser { 29 | onUpdateUser { 30 | id 31 | name 32 | imageUri 33 | status 34 | chatRoomUser { 35 | items { 36 | id 37 | userID 38 | chatRoomID 39 | createdAt 40 | updatedAt 41 | } 42 | nextToken 43 | } 44 | createdAt 45 | updatedAt 46 | } 47 | } 48 | `; 49 | export const onDeleteUser = /* GraphQL */ ` 50 | subscription OnDeleteUser { 51 | onDeleteUser { 52 | id 53 | name 54 | imageUri 55 | status 56 | chatRoomUser { 57 | items { 58 | id 59 | userID 60 | chatRoomID 61 | createdAt 62 | updatedAt 63 | } 64 | nextToken 65 | } 66 | createdAt 67 | updatedAt 68 | } 69 | } 70 | `; 71 | export const onCreateChatRoomUser = /* GraphQL */ ` 72 | subscription OnCreateChatRoomUser { 73 | onCreateChatRoomUser { 74 | id 75 | userID 76 | chatRoomID 77 | user { 78 | id 79 | name 80 | imageUri 81 | status 82 | chatRoomUser { 83 | nextToken 84 | } 85 | createdAt 86 | updatedAt 87 | } 88 | chatRoom { 89 | id 90 | chatRoomUsers { 91 | nextToken 92 | } 93 | messages { 94 | nextToken 95 | } 96 | lastMessageID 97 | lastMessage { 98 | id 99 | createdAt 100 | content 101 | userID 102 | chatRoomID 103 | updatedAt 104 | } 105 | createdAt 106 | updatedAt 107 | } 108 | createdAt 109 | updatedAt 110 | } 111 | } 112 | `; 113 | export const onUpdateChatRoomUser = /* GraphQL */ ` 114 | subscription OnUpdateChatRoomUser { 115 | onUpdateChatRoomUser { 116 | id 117 | userID 118 | chatRoomID 119 | user { 120 | id 121 | name 122 | imageUri 123 | status 124 | chatRoomUser { 125 | nextToken 126 | } 127 | createdAt 128 | updatedAt 129 | } 130 | chatRoom { 131 | id 132 | chatRoomUsers { 133 | nextToken 134 | } 135 | messages { 136 | nextToken 137 | } 138 | lastMessageID 139 | lastMessage { 140 | id 141 | createdAt 142 | content 143 | userID 144 | chatRoomID 145 | updatedAt 146 | } 147 | createdAt 148 | updatedAt 149 | } 150 | createdAt 151 | updatedAt 152 | } 153 | } 154 | `; 155 | export const onDeleteChatRoomUser = /* GraphQL */ ` 156 | subscription OnDeleteChatRoomUser { 157 | onDeleteChatRoomUser { 158 | id 159 | userID 160 | chatRoomID 161 | user { 162 | id 163 | name 164 | imageUri 165 | status 166 | chatRoomUser { 167 | nextToken 168 | } 169 | createdAt 170 | updatedAt 171 | } 172 | chatRoom { 173 | id 174 | chatRoomUsers { 175 | nextToken 176 | } 177 | messages { 178 | nextToken 179 | } 180 | lastMessageID 181 | lastMessage { 182 | id 183 | createdAt 184 | content 185 | userID 186 | chatRoomID 187 | updatedAt 188 | } 189 | createdAt 190 | updatedAt 191 | } 192 | createdAt 193 | updatedAt 194 | } 195 | } 196 | `; 197 | export const onCreateChatRoom = /* GraphQL */ ` 198 | subscription OnCreateChatRoom { 199 | onCreateChatRoom { 200 | id 201 | chatRoomUsers { 202 | items { 203 | id 204 | userID 205 | chatRoomID 206 | createdAt 207 | updatedAt 208 | } 209 | nextToken 210 | } 211 | messages { 212 | items { 213 | id 214 | createdAt 215 | content 216 | userID 217 | chatRoomID 218 | updatedAt 219 | } 220 | nextToken 221 | } 222 | lastMessageID 223 | lastMessage { 224 | id 225 | createdAt 226 | content 227 | userID 228 | chatRoomID 229 | user { 230 | id 231 | name 232 | imageUri 233 | status 234 | createdAt 235 | updatedAt 236 | } 237 | chatRoom { 238 | id 239 | lastMessageID 240 | createdAt 241 | updatedAt 242 | } 243 | updatedAt 244 | } 245 | createdAt 246 | updatedAt 247 | } 248 | } 249 | `; 250 | export const onUpdateChatRoom = /* GraphQL */ ` 251 | subscription OnUpdateChatRoom { 252 | onUpdateChatRoom { 253 | id 254 | chatRoomUsers { 255 | items { 256 | id 257 | userID 258 | chatRoomID 259 | createdAt 260 | updatedAt 261 | } 262 | nextToken 263 | } 264 | messages { 265 | items { 266 | id 267 | createdAt 268 | content 269 | userID 270 | chatRoomID 271 | updatedAt 272 | } 273 | nextToken 274 | } 275 | lastMessageID 276 | lastMessage { 277 | id 278 | createdAt 279 | content 280 | userID 281 | chatRoomID 282 | user { 283 | id 284 | name 285 | imageUri 286 | status 287 | createdAt 288 | updatedAt 289 | } 290 | chatRoom { 291 | id 292 | lastMessageID 293 | createdAt 294 | updatedAt 295 | } 296 | updatedAt 297 | } 298 | createdAt 299 | updatedAt 300 | } 301 | } 302 | `; 303 | export const onDeleteChatRoom = /* GraphQL */ ` 304 | subscription OnDeleteChatRoom { 305 | onDeleteChatRoom { 306 | id 307 | chatRoomUsers { 308 | items { 309 | id 310 | userID 311 | chatRoomID 312 | createdAt 313 | updatedAt 314 | } 315 | nextToken 316 | } 317 | messages { 318 | items { 319 | id 320 | createdAt 321 | content 322 | userID 323 | chatRoomID 324 | updatedAt 325 | } 326 | nextToken 327 | } 328 | lastMessageID 329 | lastMessage { 330 | id 331 | createdAt 332 | content 333 | userID 334 | chatRoomID 335 | user { 336 | id 337 | name 338 | imageUri 339 | status 340 | createdAt 341 | updatedAt 342 | } 343 | chatRoom { 344 | id 345 | lastMessageID 346 | createdAt 347 | updatedAt 348 | } 349 | updatedAt 350 | } 351 | createdAt 352 | updatedAt 353 | } 354 | } 355 | `; 356 | export const onCreateMessage = /* GraphQL */ ` 357 | subscription OnCreateMessage { 358 | onCreateMessage { 359 | id 360 | createdAt 361 | content 362 | userID 363 | chatRoomID 364 | user { 365 | id 366 | name 367 | imageUri 368 | status 369 | chatRoomUser { 370 | nextToken 371 | } 372 | createdAt 373 | updatedAt 374 | } 375 | chatRoom { 376 | id 377 | chatRoomUsers { 378 | nextToken 379 | } 380 | messages { 381 | nextToken 382 | } 383 | lastMessageID 384 | lastMessage { 385 | id 386 | createdAt 387 | content 388 | userID 389 | chatRoomID 390 | updatedAt 391 | } 392 | createdAt 393 | updatedAt 394 | } 395 | updatedAt 396 | } 397 | } 398 | `; 399 | export const onUpdateMessage = /* GraphQL */ ` 400 | subscription OnUpdateMessage { 401 | onUpdateMessage { 402 | id 403 | createdAt 404 | content 405 | userID 406 | chatRoomID 407 | user { 408 | id 409 | name 410 | imageUri 411 | status 412 | chatRoomUser { 413 | nextToken 414 | } 415 | createdAt 416 | updatedAt 417 | } 418 | chatRoom { 419 | id 420 | chatRoomUsers { 421 | nextToken 422 | } 423 | messages { 424 | nextToken 425 | } 426 | lastMessageID 427 | lastMessage { 428 | id 429 | createdAt 430 | content 431 | userID 432 | chatRoomID 433 | updatedAt 434 | } 435 | createdAt 436 | updatedAt 437 | } 438 | updatedAt 439 | } 440 | } 441 | `; 442 | export const onDeleteMessage = /* GraphQL */ ` 443 | subscription OnDeleteMessage { 444 | onDeleteMessage { 445 | id 446 | createdAt 447 | content 448 | userID 449 | chatRoomID 450 | user { 451 | id 452 | name 453 | imageUri 454 | status 455 | chatRoomUser { 456 | nextToken 457 | } 458 | createdAt 459 | updatedAt 460 | } 461 | chatRoom { 462 | id 463 | chatRoomUsers { 464 | nextToken 465 | } 466 | messages { 467 | nextToken 468 | } 469 | lastMessageID 470 | lastMessage { 471 | id 472 | createdAt 473 | content 474 | userID 475 | chatRoomID 476 | updatedAt 477 | } 478 | createdAt 479 | updatedAt 480 | } 481 | updatedAt 482 | } 483 | } 484 | `; 485 | -------------------------------------------------------------------------------- /src/graphql/mutations.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // this is an auto generated file. This will be overwritten 4 | 5 | export const createUser = /* GraphQL */ ` 6 | mutation CreateUser( 7 | $input: CreateUserInput! 8 | $condition: ModelUserConditionInput 9 | ) { 10 | createUser(input: $input, condition: $condition) { 11 | id 12 | name 13 | imageUri 14 | status 15 | chatRoomUser { 16 | items { 17 | id 18 | userID 19 | chatRoomID 20 | createdAt 21 | updatedAt 22 | } 23 | nextToken 24 | } 25 | createdAt 26 | updatedAt 27 | } 28 | } 29 | `; 30 | export const updateUser = /* GraphQL */ ` 31 | mutation UpdateUser( 32 | $input: UpdateUserInput! 33 | $condition: ModelUserConditionInput 34 | ) { 35 | updateUser(input: $input, condition: $condition) { 36 | id 37 | name 38 | imageUri 39 | status 40 | chatRoomUser { 41 | items { 42 | id 43 | userID 44 | chatRoomID 45 | createdAt 46 | updatedAt 47 | } 48 | nextToken 49 | } 50 | createdAt 51 | updatedAt 52 | } 53 | } 54 | `; 55 | export const deleteUser = /* GraphQL */ ` 56 | mutation DeleteUser( 57 | $input: DeleteUserInput! 58 | $condition: ModelUserConditionInput 59 | ) { 60 | deleteUser(input: $input, condition: $condition) { 61 | id 62 | name 63 | imageUri 64 | status 65 | chatRoomUser { 66 | items { 67 | id 68 | userID 69 | chatRoomID 70 | createdAt 71 | updatedAt 72 | } 73 | nextToken 74 | } 75 | createdAt 76 | updatedAt 77 | } 78 | } 79 | `; 80 | export const createChatRoomUser = /* GraphQL */ ` 81 | mutation CreateChatRoomUser( 82 | $input: CreateChatRoomUserInput! 83 | $condition: ModelChatRoomUserConditionInput 84 | ) { 85 | createChatRoomUser(input: $input, condition: $condition) { 86 | id 87 | userID 88 | chatRoomID 89 | user { 90 | id 91 | name 92 | imageUri 93 | status 94 | chatRoomUser { 95 | nextToken 96 | } 97 | createdAt 98 | updatedAt 99 | } 100 | chatRoom { 101 | id 102 | chatRoomUsers { 103 | nextToken 104 | } 105 | messages { 106 | nextToken 107 | } 108 | lastMessageID 109 | lastMessage { 110 | id 111 | createdAt 112 | content 113 | userID 114 | chatRoomID 115 | updatedAt 116 | } 117 | createdAt 118 | updatedAt 119 | } 120 | createdAt 121 | updatedAt 122 | } 123 | } 124 | `; 125 | export const updateChatRoomUser = /* GraphQL */ ` 126 | mutation UpdateChatRoomUser( 127 | $input: UpdateChatRoomUserInput! 128 | $condition: ModelChatRoomUserConditionInput 129 | ) { 130 | updateChatRoomUser(input: $input, condition: $condition) { 131 | id 132 | userID 133 | chatRoomID 134 | user { 135 | id 136 | name 137 | imageUri 138 | status 139 | chatRoomUser { 140 | nextToken 141 | } 142 | createdAt 143 | updatedAt 144 | } 145 | chatRoom { 146 | id 147 | chatRoomUsers { 148 | nextToken 149 | } 150 | messages { 151 | nextToken 152 | } 153 | lastMessageID 154 | lastMessage { 155 | id 156 | createdAt 157 | content 158 | userID 159 | chatRoomID 160 | updatedAt 161 | } 162 | createdAt 163 | updatedAt 164 | } 165 | createdAt 166 | updatedAt 167 | } 168 | } 169 | `; 170 | export const deleteChatRoomUser = /* GraphQL */ ` 171 | mutation DeleteChatRoomUser( 172 | $input: DeleteChatRoomUserInput! 173 | $condition: ModelChatRoomUserConditionInput 174 | ) { 175 | deleteChatRoomUser(input: $input, condition: $condition) { 176 | id 177 | userID 178 | chatRoomID 179 | user { 180 | id 181 | name 182 | imageUri 183 | status 184 | chatRoomUser { 185 | nextToken 186 | } 187 | createdAt 188 | updatedAt 189 | } 190 | chatRoom { 191 | id 192 | chatRoomUsers { 193 | nextToken 194 | } 195 | messages { 196 | nextToken 197 | } 198 | lastMessageID 199 | lastMessage { 200 | id 201 | createdAt 202 | content 203 | userID 204 | chatRoomID 205 | updatedAt 206 | } 207 | createdAt 208 | updatedAt 209 | } 210 | createdAt 211 | updatedAt 212 | } 213 | } 214 | `; 215 | export const createChatRoom = /* GraphQL */ ` 216 | mutation CreateChatRoom( 217 | $input: CreateChatRoomInput! 218 | $condition: ModelChatRoomConditionInput 219 | ) { 220 | createChatRoom(input: $input, condition: $condition) { 221 | id 222 | chatRoomUsers { 223 | items { 224 | id 225 | userID 226 | chatRoomID 227 | createdAt 228 | updatedAt 229 | } 230 | nextToken 231 | } 232 | messages { 233 | items { 234 | id 235 | createdAt 236 | content 237 | userID 238 | chatRoomID 239 | updatedAt 240 | } 241 | nextToken 242 | } 243 | lastMessageID 244 | lastMessage { 245 | id 246 | createdAt 247 | content 248 | userID 249 | chatRoomID 250 | user { 251 | id 252 | name 253 | imageUri 254 | status 255 | createdAt 256 | updatedAt 257 | } 258 | chatRoom { 259 | id 260 | lastMessageID 261 | createdAt 262 | updatedAt 263 | } 264 | updatedAt 265 | } 266 | createdAt 267 | updatedAt 268 | } 269 | } 270 | `; 271 | export const updateChatRoom = /* GraphQL */ ` 272 | mutation UpdateChatRoom( 273 | $input: UpdateChatRoomInput! 274 | $condition: ModelChatRoomConditionInput 275 | ) { 276 | updateChatRoom(input: $input, condition: $condition) { 277 | id 278 | chatRoomUsers { 279 | items { 280 | id 281 | userID 282 | chatRoomID 283 | createdAt 284 | updatedAt 285 | } 286 | nextToken 287 | } 288 | messages { 289 | items { 290 | id 291 | createdAt 292 | content 293 | userID 294 | chatRoomID 295 | updatedAt 296 | } 297 | nextToken 298 | } 299 | lastMessageID 300 | lastMessage { 301 | id 302 | createdAt 303 | content 304 | userID 305 | chatRoomID 306 | user { 307 | id 308 | name 309 | imageUri 310 | status 311 | createdAt 312 | updatedAt 313 | } 314 | chatRoom { 315 | id 316 | lastMessageID 317 | createdAt 318 | updatedAt 319 | } 320 | updatedAt 321 | } 322 | createdAt 323 | updatedAt 324 | } 325 | } 326 | `; 327 | export const deleteChatRoom = /* GraphQL */ ` 328 | mutation DeleteChatRoom( 329 | $input: DeleteChatRoomInput! 330 | $condition: ModelChatRoomConditionInput 331 | ) { 332 | deleteChatRoom(input: $input, condition: $condition) { 333 | id 334 | chatRoomUsers { 335 | items { 336 | id 337 | userID 338 | chatRoomID 339 | createdAt 340 | updatedAt 341 | } 342 | nextToken 343 | } 344 | messages { 345 | items { 346 | id 347 | createdAt 348 | content 349 | userID 350 | chatRoomID 351 | updatedAt 352 | } 353 | nextToken 354 | } 355 | lastMessageID 356 | lastMessage { 357 | id 358 | createdAt 359 | content 360 | userID 361 | chatRoomID 362 | user { 363 | id 364 | name 365 | imageUri 366 | status 367 | createdAt 368 | updatedAt 369 | } 370 | chatRoom { 371 | id 372 | lastMessageID 373 | createdAt 374 | updatedAt 375 | } 376 | updatedAt 377 | } 378 | createdAt 379 | updatedAt 380 | } 381 | } 382 | `; 383 | export const createMessage = /* GraphQL */ ` 384 | mutation CreateMessage( 385 | $input: CreateMessageInput! 386 | $condition: ModelMessageConditionInput 387 | ) { 388 | createMessage(input: $input, condition: $condition) { 389 | id 390 | createdAt 391 | content 392 | userID 393 | chatRoomID 394 | user { 395 | id 396 | name 397 | imageUri 398 | status 399 | chatRoomUser { 400 | nextToken 401 | } 402 | createdAt 403 | updatedAt 404 | } 405 | chatRoom { 406 | id 407 | chatRoomUsers { 408 | nextToken 409 | } 410 | messages { 411 | nextToken 412 | } 413 | lastMessageID 414 | lastMessage { 415 | id 416 | createdAt 417 | content 418 | userID 419 | chatRoomID 420 | updatedAt 421 | } 422 | createdAt 423 | updatedAt 424 | } 425 | updatedAt 426 | } 427 | } 428 | `; 429 | export const updateMessage = /* GraphQL */ ` 430 | mutation UpdateMessage( 431 | $input: UpdateMessageInput! 432 | $condition: ModelMessageConditionInput 433 | ) { 434 | updateMessage(input: $input, condition: $condition) { 435 | id 436 | createdAt 437 | content 438 | userID 439 | chatRoomID 440 | user { 441 | id 442 | name 443 | imageUri 444 | status 445 | chatRoomUser { 446 | nextToken 447 | } 448 | createdAt 449 | updatedAt 450 | } 451 | chatRoom { 452 | id 453 | chatRoomUsers { 454 | nextToken 455 | } 456 | messages { 457 | nextToken 458 | } 459 | lastMessageID 460 | lastMessage { 461 | id 462 | createdAt 463 | content 464 | userID 465 | chatRoomID 466 | updatedAt 467 | } 468 | createdAt 469 | updatedAt 470 | } 471 | updatedAt 472 | } 473 | } 474 | `; 475 | export const deleteMessage = /* GraphQL */ ` 476 | mutation DeleteMessage( 477 | $input: DeleteMessageInput! 478 | $condition: ModelMessageConditionInput 479 | ) { 480 | deleteMessage(input: $input, condition: $condition) { 481 | id 482 | createdAt 483 | content 484 | userID 485 | chatRoomID 486 | user { 487 | id 488 | name 489 | imageUri 490 | status 491 | chatRoomUser { 492 | nextToken 493 | } 494 | createdAt 495 | updatedAt 496 | } 497 | chatRoom { 498 | id 499 | chatRoomUsers { 500 | nextToken 501 | } 502 | messages { 503 | nextToken 504 | } 505 | lastMessageID 506 | lastMessage { 507 | id 508 | createdAt 509 | content 510 | userID 511 | chatRoomID 512 | updatedAt 513 | } 514 | createdAt 515 | updatedAt 516 | } 517 | updatedAt 518 | } 519 | } 520 | `; 521 | -------------------------------------------------------------------------------- /amplify/backend/auth/whatsappclonea764e33c/whatsappclonea764e33c-cloudformation-template.yml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: 2010-09-09 2 | 3 | Parameters: 4 | env: 5 | Type: String 6 | authRoleArn: 7 | Type: String 8 | unauthRoleArn: 9 | Type: String 10 | 11 | 12 | 13 | 14 | identityPoolName: 15 | Type: String 16 | 17 | allowUnauthenticatedIdentities: 18 | Type: String 19 | 20 | resourceNameTruncated: 21 | Type: String 22 | 23 | userPoolName: 24 | Type: String 25 | 26 | autoVerifiedAttributes: 27 | Type: CommaDelimitedList 28 | 29 | mfaConfiguration: 30 | Type: String 31 | 32 | mfaTypes: 33 | Type: CommaDelimitedList 34 | 35 | smsAuthenticationMessage: 36 | Type: String 37 | 38 | smsVerificationMessage: 39 | Type: String 40 | 41 | emailVerificationSubject: 42 | Type: String 43 | 44 | emailVerificationMessage: 45 | Type: String 46 | 47 | defaultPasswordPolicy: 48 | Type: String 49 | 50 | passwordPolicyMinLength: 51 | Type: Number 52 | 53 | passwordPolicyCharacters: 54 | Type: CommaDelimitedList 55 | 56 | requiredAttributes: 57 | Type: CommaDelimitedList 58 | 59 | userpoolClientGenerateSecret: 60 | Type: String 61 | 62 | userpoolClientRefreshTokenValidity: 63 | Type: Number 64 | 65 | userpoolClientWriteAttributes: 66 | Type: CommaDelimitedList 67 | 68 | userpoolClientReadAttributes: 69 | Type: CommaDelimitedList 70 | 71 | userpoolClientLambdaRole: 72 | Type: String 73 | 74 | userpoolClientSetAttributes: 75 | Type: String 76 | 77 | sharedId: 78 | Type: String 79 | 80 | resourceName: 81 | Type: String 82 | 83 | authSelections: 84 | Type: String 85 | 86 | useDefault: 87 | Type: String 88 | 89 | userPoolGroupList: 90 | Type: CommaDelimitedList 91 | 92 | dependsOn: 93 | Type: CommaDelimitedList 94 | 95 | Conditions: 96 | ShouldNotCreateEnvResources: !Equals [ !Ref env, NONE ] 97 | 98 | Resources: 99 | 100 | 101 | # BEGIN SNS ROLE RESOURCE 102 | SNSRole: 103 | # Created to allow the UserPool SMS Config to publish via the Simple Notification Service during MFA Process 104 | Type: AWS::IAM::Role 105 | Properties: 106 | RoleName: !If [ShouldNotCreateEnvResources, 'whatsaa764e33c_sns-role', !Join ['',[ 'sns', 'a764e33c', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]] 107 | AssumeRolePolicyDocument: 108 | Version: "2012-10-17" 109 | Statement: 110 | - Sid: "" 111 | Effect: "Allow" 112 | Principal: 113 | Service: "cognito-idp.amazonaws.com" 114 | Action: 115 | - "sts:AssumeRole" 116 | Condition: 117 | StringEquals: 118 | sts:ExternalId: whatsaa764e33c_role_external_id 119 | Policies: 120 | - 121 | PolicyName: whatsaa764e33c-sns-policy 122 | PolicyDocument: 123 | Version: "2012-10-17" 124 | Statement: 125 | - 126 | Effect: "Allow" 127 | Action: 128 | - "sns:Publish" 129 | Resource: "*" 130 | # BEGIN USER POOL RESOURCES 131 | UserPool: 132 | # Created upon user selection 133 | # Depends on SNS Role for Arn if MFA is enabled 134 | Type: AWS::Cognito::UserPool 135 | UpdateReplacePolicy: Retain 136 | Properties: 137 | UserPoolName: !If [ShouldNotCreateEnvResources, !Ref userPoolName, !Join ['',[!Ref userPoolName, '-', !Ref env]]] 138 | 139 | Schema: 140 | 141 | - 142 | Name: email 143 | Required: true 144 | Mutable: true 145 | 146 | 147 | 148 | 149 | AutoVerifiedAttributes: !Ref autoVerifiedAttributes 150 | 151 | 152 | EmailVerificationMessage: !Ref emailVerificationMessage 153 | EmailVerificationSubject: !Ref emailVerificationSubject 154 | 155 | Policies: 156 | PasswordPolicy: 157 | MinimumLength: !Ref passwordPolicyMinLength 158 | RequireLowercase: false 159 | RequireNumbers: false 160 | RequireSymbols: false 161 | RequireUppercase: false 162 | 163 | MfaConfiguration: !Ref mfaConfiguration 164 | SmsVerificationMessage: !Ref smsVerificationMessage 165 | SmsConfiguration: 166 | SnsCallerArn: !GetAtt SNSRole.Arn 167 | ExternalId: whatsaa764e33c_role_external_id 168 | 169 | 170 | UserPoolClientWeb: 171 | # Created provide application access to user pool 172 | # Depends on UserPool for ID reference 173 | Type: "AWS::Cognito::UserPoolClient" 174 | Properties: 175 | ClientName: whatsaa764e33c_app_clientWeb 176 | 177 | RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity 178 | UserPoolId: !Ref UserPool 179 | DependsOn: UserPool 180 | UserPoolClient: 181 | # Created provide application access to user pool 182 | # Depends on UserPool for ID reference 183 | Type: "AWS::Cognito::UserPoolClient" 184 | Properties: 185 | ClientName: whatsaa764e33c_app_client 186 | 187 | GenerateSecret: !Ref userpoolClientGenerateSecret 188 | RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity 189 | UserPoolId: !Ref UserPool 190 | DependsOn: UserPool 191 | # BEGIN USER POOL LAMBDA RESOURCES 192 | UserPoolClientRole: 193 | # Created to execute Lambda which gets userpool app client config values 194 | Type: 'AWS::IAM::Role' 195 | Properties: 196 | RoleName: !If [ShouldNotCreateEnvResources, !Ref userpoolClientLambdaRole, !Join ['',['upClientLambdaRole', 'a764e33c', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]] 197 | AssumeRolePolicyDocument: 198 | Version: '2012-10-17' 199 | Statement: 200 | - Effect: Allow 201 | Principal: 202 | Service: 203 | - lambda.amazonaws.com 204 | Action: 205 | - 'sts:AssumeRole' 206 | DependsOn: UserPoolClient 207 | UserPoolClientLambda: 208 | # Lambda which gets userpool app client config values 209 | # Depends on UserPool for id 210 | # Depends on UserPoolClientRole for role ARN 211 | Type: 'AWS::Lambda::Function' 212 | Properties: 213 | Code: 214 | ZipFile: !Join 215 | - |+ 216 | - - 'const response = require(''cfn-response'');' 217 | - 'const aws = require(''aws-sdk'');' 218 | - 'const identity = new aws.CognitoIdentityServiceProvider();' 219 | - 'exports.handler = (event, context, callback) => {' 220 | - ' if (event.RequestType == ''Delete'') { ' 221 | - ' response.send(event, context, response.SUCCESS, {})' 222 | - ' }' 223 | - ' if (event.RequestType == ''Update'' || event.RequestType == ''Create'') {' 224 | - ' const params = {' 225 | - ' ClientId: event.ResourceProperties.clientId,' 226 | - ' UserPoolId: event.ResourceProperties.userpoolId' 227 | - ' };' 228 | - ' identity.describeUserPoolClient(params).promise()' 229 | - ' .then((res) => {' 230 | - ' response.send(event, context, response.SUCCESS, {''appSecret'': res.UserPoolClient.ClientSecret});' 231 | - ' })' 232 | - ' .catch((err) => {' 233 | - ' response.send(event, context, response.FAILED, {err});' 234 | - ' });' 235 | - ' }' 236 | - '};' 237 | Handler: index.handler 238 | Runtime: nodejs10.x 239 | Timeout: '300' 240 | Role: !GetAtt 241 | - UserPoolClientRole 242 | - Arn 243 | DependsOn: UserPoolClientRole 244 | UserPoolClientLambdaPolicy: 245 | # Sets userpool policy for the role that executes the Userpool Client Lambda 246 | # Depends on UserPool for Arn 247 | # Marked as depending on UserPoolClientRole for easier to understand CFN sequencing 248 | Type: 'AWS::IAM::Policy' 249 | Properties: 250 | PolicyName: whatsaa764e33c_userpoolclient_lambda_iam_policy 251 | Roles: 252 | - !Ref UserPoolClientRole 253 | PolicyDocument: 254 | Version: '2012-10-17' 255 | Statement: 256 | - Effect: Allow 257 | Action: 258 | - 'cognito-idp:DescribeUserPoolClient' 259 | Resource: !GetAtt UserPool.Arn 260 | DependsOn: UserPoolClientLambda 261 | UserPoolClientLogPolicy: 262 | # Sets log policy for the role that executes the Userpool Client Lambda 263 | # Depends on UserPool for Arn 264 | # Marked as depending on UserPoolClientLambdaPolicy for easier to understand CFN sequencing 265 | Type: 'AWS::IAM::Policy' 266 | Properties: 267 | PolicyName: whatsaa764e33c_userpoolclient_lambda_log_policy 268 | Roles: 269 | - !Ref UserPoolClientRole 270 | PolicyDocument: 271 | Version: 2012-10-17 272 | Statement: 273 | - Effect: Allow 274 | Action: 275 | - 'logs:CreateLogGroup' 276 | - 'logs:CreateLogStream' 277 | - 'logs:PutLogEvents' 278 | Resource: !Sub 279 | - arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:* 280 | - { region: !Ref "AWS::Region", account: !Ref "AWS::AccountId", lambda: !Ref UserPoolClientLambda} 281 | DependsOn: UserPoolClientLambdaPolicy 282 | UserPoolClientInputs: 283 | # Values passed to Userpool client Lambda 284 | # Depends on UserPool for Id 285 | # Depends on UserPoolClient for Id 286 | # Marked as depending on UserPoolClientLambdaPolicy for easier to understand CFN sequencing 287 | Type: 'Custom::LambdaCallout' 288 | Properties: 289 | ServiceToken: !GetAtt UserPoolClientLambda.Arn 290 | clientId: !Ref UserPoolClient 291 | userpoolId: !Ref UserPool 292 | DependsOn: UserPoolClientLogPolicy 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | # BEGIN IDENTITY POOL RESOURCES 301 | 302 | 303 | IdentityPool: 304 | # Always created 305 | Type: AWS::Cognito::IdentityPool 306 | Properties: 307 | IdentityPoolName: !If [ShouldNotCreateEnvResources, 'whatsappclonea764e33c_identitypool_a764e33c', !Join ['',['whatsappclonea764e33c_identitypool_a764e33c', '__', !Ref env]]] 308 | 309 | CognitoIdentityProviders: 310 | - ClientId: !Ref UserPoolClient 311 | ProviderName: !Sub 312 | - cognito-idp.${region}.amazonaws.com/${client} 313 | - { region: !Ref "AWS::Region", client: !Ref UserPool} 314 | - ClientId: !Ref UserPoolClientWeb 315 | ProviderName: !Sub 316 | - cognito-idp.${region}.amazonaws.com/${client} 317 | - { region: !Ref "AWS::Region", client: !Ref UserPool} 318 | 319 | AllowUnauthenticatedIdentities: !Ref allowUnauthenticatedIdentities 320 | 321 | 322 | DependsOn: UserPoolClientInputs 323 | 324 | 325 | IdentityPoolRoleMap: 326 | # Created to map Auth and Unauth roles to the identity pool 327 | # Depends on Identity Pool for ID ref 328 | Type: AWS::Cognito::IdentityPoolRoleAttachment 329 | Properties: 330 | IdentityPoolId: !Ref IdentityPool 331 | Roles: 332 | unauthenticated: !Ref unauthRoleArn 333 | authenticated: !Ref authRoleArn 334 | DependsOn: IdentityPool 335 | 336 | 337 | Outputs : 338 | 339 | IdentityPoolId: 340 | Value: !Ref 'IdentityPool' 341 | Description: Id for the identity pool 342 | IdentityPoolName: 343 | Value: !GetAtt IdentityPool.Name 344 | 345 | 346 | 347 | 348 | UserPoolId: 349 | Value: !Ref 'UserPool' 350 | Description: Id for the user pool 351 | UserPoolName: 352 | Value: !Ref userPoolName 353 | AppClientIDWeb: 354 | Value: !Ref 'UserPoolClientWeb' 355 | Description: The user pool app client id for web 356 | AppClientID: 357 | Value: !Ref 'UserPoolClient' 358 | Description: The user pool app client id 359 | AppClientSecret: 360 | Value: !GetAtt UserPoolClientInputs.appSecret 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | -------------------------------------------------------------------------------- /src/API.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // This file was automatically generated and should not be edited. 4 | 5 | export type CreateUserInput = { 6 | id?: string | null, 7 | name: string, 8 | imageUri?: string | null, 9 | status?: string | null, 10 | }; 11 | 12 | export type ModelUserConditionInput = { 13 | name?: ModelStringInput | null, 14 | imageUri?: ModelStringInput | null, 15 | status?: ModelStringInput | null, 16 | and?: Array< ModelUserConditionInput | null > | null, 17 | or?: Array< ModelUserConditionInput | null > | null, 18 | not?: ModelUserConditionInput | null, 19 | }; 20 | 21 | export type ModelStringInput = { 22 | ne?: string | null, 23 | eq?: string | null, 24 | le?: string | null, 25 | lt?: string | null, 26 | ge?: string | null, 27 | gt?: string | null, 28 | contains?: string | null, 29 | notContains?: string | null, 30 | between?: Array< string | null > | null, 31 | beginsWith?: string | null, 32 | attributeExists?: boolean | null, 33 | attributeType?: ModelAttributeTypes | null, 34 | size?: ModelSizeInput | null, 35 | }; 36 | 37 | export enum ModelAttributeTypes { 38 | binary = "binary", 39 | binarySet = "binarySet", 40 | bool = "bool", 41 | list = "list", 42 | map = "map", 43 | number = "number", 44 | numberSet = "numberSet", 45 | string = "string", 46 | stringSet = "stringSet", 47 | _null = "_null", 48 | } 49 | 50 | 51 | export type ModelSizeInput = { 52 | ne?: number | null, 53 | eq?: number | null, 54 | le?: number | null, 55 | lt?: number | null, 56 | ge?: number | null, 57 | gt?: number | null, 58 | between?: Array< number | null > | null, 59 | }; 60 | 61 | export type UpdateUserInput = { 62 | id: string, 63 | name?: string | null, 64 | imageUri?: string | null, 65 | status?: string | null, 66 | }; 67 | 68 | export type DeleteUserInput = { 69 | id?: string | null, 70 | }; 71 | 72 | export type CreateChatRoomUserInput = { 73 | id?: string | null, 74 | userID: string, 75 | chatRoomID: string, 76 | }; 77 | 78 | export type ModelChatRoomUserConditionInput = { 79 | userID?: ModelIDInput | null, 80 | chatRoomID?: ModelIDInput | null, 81 | and?: Array< ModelChatRoomUserConditionInput | null > | null, 82 | or?: Array< ModelChatRoomUserConditionInput | null > | null, 83 | not?: ModelChatRoomUserConditionInput | null, 84 | }; 85 | 86 | export type ModelIDInput = { 87 | ne?: string | null, 88 | eq?: string | null, 89 | le?: string | null, 90 | lt?: string | null, 91 | ge?: string | null, 92 | gt?: string | null, 93 | contains?: string | null, 94 | notContains?: string | null, 95 | between?: Array< string | null > | null, 96 | beginsWith?: string | null, 97 | attributeExists?: boolean | null, 98 | attributeType?: ModelAttributeTypes | null, 99 | size?: ModelSizeInput | null, 100 | }; 101 | 102 | export type UpdateChatRoomUserInput = { 103 | id: string, 104 | userID?: string | null, 105 | chatRoomID?: string | null, 106 | }; 107 | 108 | export type DeleteChatRoomUserInput = { 109 | id?: string | null, 110 | }; 111 | 112 | export type CreateChatRoomInput = { 113 | id?: string | null, 114 | lastMessageID: string, 115 | }; 116 | 117 | export type ModelChatRoomConditionInput = { 118 | lastMessageID?: ModelIDInput | null, 119 | and?: Array< ModelChatRoomConditionInput | null > | null, 120 | or?: Array< ModelChatRoomConditionInput | null > | null, 121 | not?: ModelChatRoomConditionInput | null, 122 | }; 123 | 124 | export type UpdateChatRoomInput = { 125 | id: string, 126 | lastMessageID?: string | null, 127 | }; 128 | 129 | export type DeleteChatRoomInput = { 130 | id?: string | null, 131 | }; 132 | 133 | export type CreateMessageInput = { 134 | id?: string | null, 135 | createdAt?: string | null, 136 | content: string, 137 | userID: string, 138 | chatRoomID: string, 139 | }; 140 | 141 | export type ModelMessageConditionInput = { 142 | createdAt?: ModelStringInput | null, 143 | content?: ModelStringInput | null, 144 | userID?: ModelIDInput | null, 145 | chatRoomID?: ModelIDInput | null, 146 | and?: Array< ModelMessageConditionInput | null > | null, 147 | or?: Array< ModelMessageConditionInput | null > | null, 148 | not?: ModelMessageConditionInput | null, 149 | }; 150 | 151 | export type UpdateMessageInput = { 152 | id: string, 153 | createdAt?: string | null, 154 | content?: string | null, 155 | userID?: string | null, 156 | chatRoomID?: string | null, 157 | }; 158 | 159 | export type DeleteMessageInput = { 160 | id?: string | null, 161 | }; 162 | 163 | export type ModelUserFilterInput = { 164 | id?: ModelIDInput | null, 165 | name?: ModelStringInput | null, 166 | imageUri?: ModelStringInput | null, 167 | status?: ModelStringInput | null, 168 | and?: Array< ModelUserFilterInput | null > | null, 169 | or?: Array< ModelUserFilterInput | null > | null, 170 | not?: ModelUserFilterInput | null, 171 | }; 172 | 173 | export type ModelChatRoomUserFilterInput = { 174 | id?: ModelIDInput | null, 175 | userID?: ModelIDInput | null, 176 | chatRoomID?: ModelIDInput | null, 177 | and?: Array< ModelChatRoomUserFilterInput | null > | null, 178 | or?: Array< ModelChatRoomUserFilterInput | null > | null, 179 | not?: ModelChatRoomUserFilterInput | null, 180 | }; 181 | 182 | export type ModelChatRoomFilterInput = { 183 | id?: ModelIDInput | null, 184 | lastMessageID?: ModelIDInput | null, 185 | and?: Array< ModelChatRoomFilterInput | null > | null, 186 | or?: Array< ModelChatRoomFilterInput | null > | null, 187 | not?: ModelChatRoomFilterInput | null, 188 | }; 189 | 190 | export type ModelMessageFilterInput = { 191 | id?: ModelIDInput | null, 192 | createdAt?: ModelStringInput | null, 193 | content?: ModelStringInput | null, 194 | userID?: ModelIDInput | null, 195 | chatRoomID?: ModelIDInput | null, 196 | and?: Array< ModelMessageFilterInput | null > | null, 197 | or?: Array< ModelMessageFilterInput | null > | null, 198 | not?: ModelMessageFilterInput | null, 199 | }; 200 | 201 | export type ModelStringKeyConditionInput = { 202 | eq?: string | null, 203 | le?: string | null, 204 | lt?: string | null, 205 | ge?: string | null, 206 | gt?: string | null, 207 | between?: Array< string | null > | null, 208 | beginsWith?: string | null, 209 | }; 210 | 211 | export enum ModelSortDirection { 212 | ASC = "ASC", 213 | DESC = "DESC", 214 | } 215 | 216 | 217 | export type CreateUserMutationVariables = { 218 | input: CreateUserInput, 219 | condition?: ModelUserConditionInput | null, 220 | }; 221 | 222 | export type CreateUserMutation = { 223 | createUser: { 224 | __typename: "User", 225 | id: string, 226 | name: string, 227 | imageUri: string | null, 228 | status: string | null, 229 | chatRoomUser: { 230 | __typename: "ModelChatRoomUserConnection", 231 | items: Array< { 232 | __typename: "ChatRoomUser", 233 | id: string, 234 | userID: string, 235 | chatRoomID: string, 236 | createdAt: string, 237 | updatedAt: string, 238 | } | null > | null, 239 | nextToken: string | null, 240 | } | null, 241 | createdAt: string, 242 | updatedAt: string, 243 | } | null, 244 | }; 245 | 246 | export type UpdateUserMutationVariables = { 247 | input: UpdateUserInput, 248 | condition?: ModelUserConditionInput | null, 249 | }; 250 | 251 | export type UpdateUserMutation = { 252 | updateUser: { 253 | __typename: "User", 254 | id: string, 255 | name: string, 256 | imageUri: string | null, 257 | status: string | null, 258 | chatRoomUser: { 259 | __typename: "ModelChatRoomUserConnection", 260 | items: Array< { 261 | __typename: "ChatRoomUser", 262 | id: string, 263 | userID: string, 264 | chatRoomID: string, 265 | createdAt: string, 266 | updatedAt: string, 267 | } | null > | null, 268 | nextToken: string | null, 269 | } | null, 270 | createdAt: string, 271 | updatedAt: string, 272 | } | null, 273 | }; 274 | 275 | export type DeleteUserMutationVariables = { 276 | input: DeleteUserInput, 277 | condition?: ModelUserConditionInput | null, 278 | }; 279 | 280 | export type DeleteUserMutation = { 281 | deleteUser: { 282 | __typename: "User", 283 | id: string, 284 | name: string, 285 | imageUri: string | null, 286 | status: string | null, 287 | chatRoomUser: { 288 | __typename: "ModelChatRoomUserConnection", 289 | items: Array< { 290 | __typename: "ChatRoomUser", 291 | id: string, 292 | userID: string, 293 | chatRoomID: string, 294 | createdAt: string, 295 | updatedAt: string, 296 | } | null > | null, 297 | nextToken: string | null, 298 | } | null, 299 | createdAt: string, 300 | updatedAt: string, 301 | } | null, 302 | }; 303 | 304 | export type CreateChatRoomUserMutationVariables = { 305 | input: CreateChatRoomUserInput, 306 | condition?: ModelChatRoomUserConditionInput | null, 307 | }; 308 | 309 | export type CreateChatRoomUserMutation = { 310 | createChatRoomUser: { 311 | __typename: "ChatRoomUser", 312 | id: string, 313 | userID: string, 314 | chatRoomID: string, 315 | user: { 316 | __typename: "User", 317 | id: string, 318 | name: string, 319 | imageUri: string | null, 320 | status: string | null, 321 | chatRoomUser: { 322 | __typename: "ModelChatRoomUserConnection", 323 | nextToken: string | null, 324 | } | null, 325 | createdAt: string, 326 | updatedAt: string, 327 | } | null, 328 | chatRoom: { 329 | __typename: "ChatRoom", 330 | id: string, 331 | chatRoomUsers: { 332 | __typename: "ModelChatRoomUserConnection", 333 | nextToken: string | null, 334 | } | null, 335 | messages: { 336 | __typename: "ModelMessageConnection", 337 | nextToken: string | null, 338 | } | null, 339 | lastMessageID: string, 340 | lastMessage: { 341 | __typename: "Message", 342 | id: string, 343 | createdAt: string, 344 | content: string, 345 | userID: string, 346 | chatRoomID: string, 347 | updatedAt: string, 348 | } | null, 349 | createdAt: string, 350 | updatedAt: string, 351 | } | null, 352 | createdAt: string, 353 | updatedAt: string, 354 | } | null, 355 | }; 356 | 357 | export type UpdateChatRoomUserMutationVariables = { 358 | input: UpdateChatRoomUserInput, 359 | condition?: ModelChatRoomUserConditionInput | null, 360 | }; 361 | 362 | export type UpdateChatRoomUserMutation = { 363 | updateChatRoomUser: { 364 | __typename: "ChatRoomUser", 365 | id: string, 366 | userID: string, 367 | chatRoomID: string, 368 | user: { 369 | __typename: "User", 370 | id: string, 371 | name: string, 372 | imageUri: string | null, 373 | status: string | null, 374 | chatRoomUser: { 375 | __typename: "ModelChatRoomUserConnection", 376 | nextToken: string | null, 377 | } | null, 378 | createdAt: string, 379 | updatedAt: string, 380 | } | null, 381 | chatRoom: { 382 | __typename: "ChatRoom", 383 | id: string, 384 | chatRoomUsers: { 385 | __typename: "ModelChatRoomUserConnection", 386 | nextToken: string | null, 387 | } | null, 388 | messages: { 389 | __typename: "ModelMessageConnection", 390 | nextToken: string | null, 391 | } | null, 392 | lastMessageID: string, 393 | lastMessage: { 394 | __typename: "Message", 395 | id: string, 396 | createdAt: string, 397 | content: string, 398 | userID: string, 399 | chatRoomID: string, 400 | updatedAt: string, 401 | } | null, 402 | createdAt: string, 403 | updatedAt: string, 404 | } | null, 405 | createdAt: string, 406 | updatedAt: string, 407 | } | null, 408 | }; 409 | 410 | export type DeleteChatRoomUserMutationVariables = { 411 | input: DeleteChatRoomUserInput, 412 | condition?: ModelChatRoomUserConditionInput | null, 413 | }; 414 | 415 | export type DeleteChatRoomUserMutation = { 416 | deleteChatRoomUser: { 417 | __typename: "ChatRoomUser", 418 | id: string, 419 | userID: string, 420 | chatRoomID: string, 421 | user: { 422 | __typename: "User", 423 | id: string, 424 | name: string, 425 | imageUri: string | null, 426 | status: string | null, 427 | chatRoomUser: { 428 | __typename: "ModelChatRoomUserConnection", 429 | nextToken: string | null, 430 | } | null, 431 | createdAt: string, 432 | updatedAt: string, 433 | } | null, 434 | chatRoom: { 435 | __typename: "ChatRoom", 436 | id: string, 437 | chatRoomUsers: { 438 | __typename: "ModelChatRoomUserConnection", 439 | nextToken: string | null, 440 | } | null, 441 | messages: { 442 | __typename: "ModelMessageConnection", 443 | nextToken: string | null, 444 | } | null, 445 | lastMessageID: string, 446 | lastMessage: { 447 | __typename: "Message", 448 | id: string, 449 | createdAt: string, 450 | content: string, 451 | userID: string, 452 | chatRoomID: string, 453 | updatedAt: string, 454 | } | null, 455 | createdAt: string, 456 | updatedAt: string, 457 | } | null, 458 | createdAt: string, 459 | updatedAt: string, 460 | } | null, 461 | }; 462 | 463 | export type CreateChatRoomMutationVariables = { 464 | input: CreateChatRoomInput, 465 | condition?: ModelChatRoomConditionInput | null, 466 | }; 467 | 468 | export type CreateChatRoomMutation = { 469 | createChatRoom: { 470 | __typename: "ChatRoom", 471 | id: string, 472 | chatRoomUsers: { 473 | __typename: "ModelChatRoomUserConnection", 474 | items: Array< { 475 | __typename: "ChatRoomUser", 476 | id: string, 477 | userID: string, 478 | chatRoomID: string, 479 | createdAt: string, 480 | updatedAt: string, 481 | } | null > | null, 482 | nextToken: string | null, 483 | } | null, 484 | messages: { 485 | __typename: "ModelMessageConnection", 486 | items: Array< { 487 | __typename: "Message", 488 | id: string, 489 | createdAt: string, 490 | content: string, 491 | userID: string, 492 | chatRoomID: string, 493 | updatedAt: string, 494 | } | null > | null, 495 | nextToken: string | null, 496 | } | null, 497 | lastMessageID: string, 498 | lastMessage: { 499 | __typename: "Message", 500 | id: string, 501 | createdAt: string, 502 | content: string, 503 | userID: string, 504 | chatRoomID: string, 505 | user: { 506 | __typename: "User", 507 | id: string, 508 | name: string, 509 | imageUri: string | null, 510 | status: string | null, 511 | createdAt: string, 512 | updatedAt: string, 513 | } | null, 514 | chatRoom: { 515 | __typename: "ChatRoom", 516 | id: string, 517 | lastMessageID: string, 518 | createdAt: string, 519 | updatedAt: string, 520 | } | null, 521 | updatedAt: string, 522 | } | null, 523 | createdAt: string, 524 | updatedAt: string, 525 | } | null, 526 | }; 527 | 528 | export type UpdateChatRoomMutationVariables = { 529 | input: UpdateChatRoomInput, 530 | condition?: ModelChatRoomConditionInput | null, 531 | }; 532 | 533 | export type UpdateChatRoomMutation = { 534 | updateChatRoom: { 535 | __typename: "ChatRoom", 536 | id: string, 537 | chatRoomUsers: { 538 | __typename: "ModelChatRoomUserConnection", 539 | items: Array< { 540 | __typename: "ChatRoomUser", 541 | id: string, 542 | userID: string, 543 | chatRoomID: string, 544 | createdAt: string, 545 | updatedAt: string, 546 | } | null > | null, 547 | nextToken: string | null, 548 | } | null, 549 | messages: { 550 | __typename: "ModelMessageConnection", 551 | items: Array< { 552 | __typename: "Message", 553 | id: string, 554 | createdAt: string, 555 | content: string, 556 | userID: string, 557 | chatRoomID: string, 558 | updatedAt: string, 559 | } | null > | null, 560 | nextToken: string | null, 561 | } | null, 562 | lastMessageID: string, 563 | lastMessage: { 564 | __typename: "Message", 565 | id: string, 566 | createdAt: string, 567 | content: string, 568 | userID: string, 569 | chatRoomID: string, 570 | user: { 571 | __typename: "User", 572 | id: string, 573 | name: string, 574 | imageUri: string | null, 575 | status: string | null, 576 | createdAt: string, 577 | updatedAt: string, 578 | } | null, 579 | chatRoom: { 580 | __typename: "ChatRoom", 581 | id: string, 582 | lastMessageID: string, 583 | createdAt: string, 584 | updatedAt: string, 585 | } | null, 586 | updatedAt: string, 587 | } | null, 588 | createdAt: string, 589 | updatedAt: string, 590 | } | null, 591 | }; 592 | 593 | export type DeleteChatRoomMutationVariables = { 594 | input: DeleteChatRoomInput, 595 | condition?: ModelChatRoomConditionInput | null, 596 | }; 597 | 598 | export type DeleteChatRoomMutation = { 599 | deleteChatRoom: { 600 | __typename: "ChatRoom", 601 | id: string, 602 | chatRoomUsers: { 603 | __typename: "ModelChatRoomUserConnection", 604 | items: Array< { 605 | __typename: "ChatRoomUser", 606 | id: string, 607 | userID: string, 608 | chatRoomID: string, 609 | createdAt: string, 610 | updatedAt: string, 611 | } | null > | null, 612 | nextToken: string | null, 613 | } | null, 614 | messages: { 615 | __typename: "ModelMessageConnection", 616 | items: Array< { 617 | __typename: "Message", 618 | id: string, 619 | createdAt: string, 620 | content: string, 621 | userID: string, 622 | chatRoomID: string, 623 | updatedAt: string, 624 | } | null > | null, 625 | nextToken: string | null, 626 | } | null, 627 | lastMessageID: string, 628 | lastMessage: { 629 | __typename: "Message", 630 | id: string, 631 | createdAt: string, 632 | content: string, 633 | userID: string, 634 | chatRoomID: string, 635 | user: { 636 | __typename: "User", 637 | id: string, 638 | name: string, 639 | imageUri: string | null, 640 | status: string | null, 641 | createdAt: string, 642 | updatedAt: string, 643 | } | null, 644 | chatRoom: { 645 | __typename: "ChatRoom", 646 | id: string, 647 | lastMessageID: string, 648 | createdAt: string, 649 | updatedAt: string, 650 | } | null, 651 | updatedAt: string, 652 | } | null, 653 | createdAt: string, 654 | updatedAt: string, 655 | } | null, 656 | }; 657 | 658 | export type CreateMessageMutationVariables = { 659 | input: CreateMessageInput, 660 | condition?: ModelMessageConditionInput | null, 661 | }; 662 | 663 | export type CreateMessageMutation = { 664 | createMessage: { 665 | __typename: "Message", 666 | id: string, 667 | createdAt: string, 668 | content: string, 669 | userID: string, 670 | chatRoomID: string, 671 | user: { 672 | __typename: "User", 673 | id: string, 674 | name: string, 675 | imageUri: string | null, 676 | status: string | null, 677 | chatRoomUser: { 678 | __typename: "ModelChatRoomUserConnection", 679 | nextToken: string | null, 680 | } | null, 681 | createdAt: string, 682 | updatedAt: string, 683 | } | null, 684 | chatRoom: { 685 | __typename: "ChatRoom", 686 | id: string, 687 | chatRoomUsers: { 688 | __typename: "ModelChatRoomUserConnection", 689 | nextToken: string | null, 690 | } | null, 691 | messages: { 692 | __typename: "ModelMessageConnection", 693 | nextToken: string | null, 694 | } | null, 695 | lastMessageID: string, 696 | lastMessage: { 697 | __typename: "Message", 698 | id: string, 699 | createdAt: string, 700 | content: string, 701 | userID: string, 702 | chatRoomID: string, 703 | updatedAt: string, 704 | } | null, 705 | createdAt: string, 706 | updatedAt: string, 707 | } | null, 708 | updatedAt: string, 709 | } | null, 710 | }; 711 | 712 | export type UpdateMessageMutationVariables = { 713 | input: UpdateMessageInput, 714 | condition?: ModelMessageConditionInput | null, 715 | }; 716 | 717 | export type UpdateMessageMutation = { 718 | updateMessage: { 719 | __typename: "Message", 720 | id: string, 721 | createdAt: string, 722 | content: string, 723 | userID: string, 724 | chatRoomID: string, 725 | user: { 726 | __typename: "User", 727 | id: string, 728 | name: string, 729 | imageUri: string | null, 730 | status: string | null, 731 | chatRoomUser: { 732 | __typename: "ModelChatRoomUserConnection", 733 | nextToken: string | null, 734 | } | null, 735 | createdAt: string, 736 | updatedAt: string, 737 | } | null, 738 | chatRoom: { 739 | __typename: "ChatRoom", 740 | id: string, 741 | chatRoomUsers: { 742 | __typename: "ModelChatRoomUserConnection", 743 | nextToken: string | null, 744 | } | null, 745 | messages: { 746 | __typename: "ModelMessageConnection", 747 | nextToken: string | null, 748 | } | null, 749 | lastMessageID: string, 750 | lastMessage: { 751 | __typename: "Message", 752 | id: string, 753 | createdAt: string, 754 | content: string, 755 | userID: string, 756 | chatRoomID: string, 757 | updatedAt: string, 758 | } | null, 759 | createdAt: string, 760 | updatedAt: string, 761 | } | null, 762 | updatedAt: string, 763 | } | null, 764 | }; 765 | 766 | export type DeleteMessageMutationVariables = { 767 | input: DeleteMessageInput, 768 | condition?: ModelMessageConditionInput | null, 769 | }; 770 | 771 | export type DeleteMessageMutation = { 772 | deleteMessage: { 773 | __typename: "Message", 774 | id: string, 775 | createdAt: string, 776 | content: string, 777 | userID: string, 778 | chatRoomID: string, 779 | user: { 780 | __typename: "User", 781 | id: string, 782 | name: string, 783 | imageUri: string | null, 784 | status: string | null, 785 | chatRoomUser: { 786 | __typename: "ModelChatRoomUserConnection", 787 | nextToken: string | null, 788 | } | null, 789 | createdAt: string, 790 | updatedAt: string, 791 | } | null, 792 | chatRoom: { 793 | __typename: "ChatRoom", 794 | id: string, 795 | chatRoomUsers: { 796 | __typename: "ModelChatRoomUserConnection", 797 | nextToken: string | null, 798 | } | null, 799 | messages: { 800 | __typename: "ModelMessageConnection", 801 | nextToken: string | null, 802 | } | null, 803 | lastMessageID: string, 804 | lastMessage: { 805 | __typename: "Message", 806 | id: string, 807 | createdAt: string, 808 | content: string, 809 | userID: string, 810 | chatRoomID: string, 811 | updatedAt: string, 812 | } | null, 813 | createdAt: string, 814 | updatedAt: string, 815 | } | null, 816 | updatedAt: string, 817 | } | null, 818 | }; 819 | 820 | export type GetUserQueryVariables = { 821 | id: string, 822 | }; 823 | 824 | export type GetUserQuery = { 825 | getUser: { 826 | __typename: "User", 827 | id: string, 828 | name: string, 829 | imageUri: string | null, 830 | status: string | null, 831 | chatRoomUser: { 832 | __typename: "ModelChatRoomUserConnection", 833 | items: Array< { 834 | __typename: "ChatRoomUser", 835 | id: string, 836 | userID: string, 837 | chatRoomID: string, 838 | createdAt: string, 839 | updatedAt: string, 840 | } | null > | null, 841 | nextToken: string | null, 842 | } | null, 843 | createdAt: string, 844 | updatedAt: string, 845 | } | null, 846 | }; 847 | 848 | export type ListUsersQueryVariables = { 849 | filter?: ModelUserFilterInput | null, 850 | limit?: number | null, 851 | nextToken?: string | null, 852 | }; 853 | 854 | export type ListUsersQuery = { 855 | listUsers: { 856 | __typename: "ModelUserConnection", 857 | items: Array< { 858 | __typename: "User", 859 | id: string, 860 | name: string, 861 | imageUri: string | null, 862 | status: string | null, 863 | chatRoomUser: { 864 | __typename: "ModelChatRoomUserConnection", 865 | nextToken: string | null, 866 | } | null, 867 | createdAt: string, 868 | updatedAt: string, 869 | } | null > | null, 870 | nextToken: string | null, 871 | } | null, 872 | }; 873 | 874 | export type GetChatRoomUserQueryVariables = { 875 | id: string, 876 | }; 877 | 878 | export type GetChatRoomUserQuery = { 879 | getChatRoomUser: { 880 | __typename: "ChatRoomUser", 881 | id: string, 882 | userID: string, 883 | chatRoomID: string, 884 | user: { 885 | __typename: "User", 886 | id: string, 887 | name: string, 888 | imageUri: string | null, 889 | status: string | null, 890 | chatRoomUser: { 891 | __typename: "ModelChatRoomUserConnection", 892 | nextToken: string | null, 893 | } | null, 894 | createdAt: string, 895 | updatedAt: string, 896 | } | null, 897 | chatRoom: { 898 | __typename: "ChatRoom", 899 | id: string, 900 | chatRoomUsers: { 901 | __typename: "ModelChatRoomUserConnection", 902 | nextToken: string | null, 903 | } | null, 904 | messages: { 905 | __typename: "ModelMessageConnection", 906 | nextToken: string | null, 907 | } | null, 908 | lastMessageID: string, 909 | lastMessage: { 910 | __typename: "Message", 911 | id: string, 912 | createdAt: string, 913 | content: string, 914 | userID: string, 915 | chatRoomID: string, 916 | updatedAt: string, 917 | } | null, 918 | createdAt: string, 919 | updatedAt: string, 920 | } | null, 921 | createdAt: string, 922 | updatedAt: string, 923 | } | null, 924 | }; 925 | 926 | export type ListChatRoomUsersQueryVariables = { 927 | filter?: ModelChatRoomUserFilterInput | null, 928 | limit?: number | null, 929 | nextToken?: string | null, 930 | }; 931 | 932 | export type ListChatRoomUsersQuery = { 933 | listChatRoomUsers: { 934 | __typename: "ModelChatRoomUserConnection", 935 | items: Array< { 936 | __typename: "ChatRoomUser", 937 | id: string, 938 | userID: string, 939 | chatRoomID: string, 940 | user: { 941 | __typename: "User", 942 | id: string, 943 | name: string, 944 | imageUri: string | null, 945 | status: string | null, 946 | createdAt: string, 947 | updatedAt: string, 948 | } | null, 949 | chatRoom: { 950 | __typename: "ChatRoom", 951 | id: string, 952 | lastMessageID: string, 953 | createdAt: string, 954 | updatedAt: string, 955 | } | null, 956 | createdAt: string, 957 | updatedAt: string, 958 | } | null > | null, 959 | nextToken: string | null, 960 | } | null, 961 | }; 962 | 963 | export type GetChatRoomQueryVariables = { 964 | id: string, 965 | }; 966 | 967 | export type GetChatRoomQuery = { 968 | getChatRoom: { 969 | __typename: "ChatRoom", 970 | id: string, 971 | chatRoomUsers: { 972 | __typename: "ModelChatRoomUserConnection", 973 | items: Array< { 974 | __typename: "ChatRoomUser", 975 | id: string, 976 | userID: string, 977 | chatRoomID: string, 978 | createdAt: string, 979 | updatedAt: string, 980 | } | null > | null, 981 | nextToken: string | null, 982 | } | null, 983 | messages: { 984 | __typename: "ModelMessageConnection", 985 | items: Array< { 986 | __typename: "Message", 987 | id: string, 988 | createdAt: string, 989 | content: string, 990 | userID: string, 991 | chatRoomID: string, 992 | updatedAt: string, 993 | } | null > | null, 994 | nextToken: string | null, 995 | } | null, 996 | lastMessageID: string, 997 | lastMessage: { 998 | __typename: "Message", 999 | id: string, 1000 | createdAt: string, 1001 | content: string, 1002 | userID: string, 1003 | chatRoomID: string, 1004 | user: { 1005 | __typename: "User", 1006 | id: string, 1007 | name: string, 1008 | imageUri: string | null, 1009 | status: string | null, 1010 | createdAt: string, 1011 | updatedAt: string, 1012 | } | null, 1013 | chatRoom: { 1014 | __typename: "ChatRoom", 1015 | id: string, 1016 | lastMessageID: string, 1017 | createdAt: string, 1018 | updatedAt: string, 1019 | } | null, 1020 | updatedAt: string, 1021 | } | null, 1022 | createdAt: string, 1023 | updatedAt: string, 1024 | } | null, 1025 | }; 1026 | 1027 | export type ListChatRoomsQueryVariables = { 1028 | filter?: ModelChatRoomFilterInput | null, 1029 | limit?: number | null, 1030 | nextToken?: string | null, 1031 | }; 1032 | 1033 | export type ListChatRoomsQuery = { 1034 | listChatRooms: { 1035 | __typename: "ModelChatRoomConnection", 1036 | items: Array< { 1037 | __typename: "ChatRoom", 1038 | id: string, 1039 | chatRoomUsers: { 1040 | __typename: "ModelChatRoomUserConnection", 1041 | nextToken: string | null, 1042 | } | null, 1043 | messages: { 1044 | __typename: "ModelMessageConnection", 1045 | nextToken: string | null, 1046 | } | null, 1047 | lastMessageID: string, 1048 | lastMessage: { 1049 | __typename: "Message", 1050 | id: string, 1051 | createdAt: string, 1052 | content: string, 1053 | userID: string, 1054 | chatRoomID: string, 1055 | updatedAt: string, 1056 | } | null, 1057 | createdAt: string, 1058 | updatedAt: string, 1059 | } | null > | null, 1060 | nextToken: string | null, 1061 | } | null, 1062 | }; 1063 | 1064 | export type GetMessageQueryVariables = { 1065 | id: string, 1066 | }; 1067 | 1068 | export type GetMessageQuery = { 1069 | getMessage: { 1070 | __typename: "Message", 1071 | id: string, 1072 | createdAt: string, 1073 | content: string, 1074 | userID: string, 1075 | chatRoomID: string, 1076 | user: { 1077 | __typename: "User", 1078 | id: string, 1079 | name: string, 1080 | imageUri: string | null, 1081 | status: string | null, 1082 | chatRoomUser: { 1083 | __typename: "ModelChatRoomUserConnection", 1084 | nextToken: string | null, 1085 | } | null, 1086 | createdAt: string, 1087 | updatedAt: string, 1088 | } | null, 1089 | chatRoom: { 1090 | __typename: "ChatRoom", 1091 | id: string, 1092 | chatRoomUsers: { 1093 | __typename: "ModelChatRoomUserConnection", 1094 | nextToken: string | null, 1095 | } | null, 1096 | messages: { 1097 | __typename: "ModelMessageConnection", 1098 | nextToken: string | null, 1099 | } | null, 1100 | lastMessageID: string, 1101 | lastMessage: { 1102 | __typename: "Message", 1103 | id: string, 1104 | createdAt: string, 1105 | content: string, 1106 | userID: string, 1107 | chatRoomID: string, 1108 | updatedAt: string, 1109 | } | null, 1110 | createdAt: string, 1111 | updatedAt: string, 1112 | } | null, 1113 | updatedAt: string, 1114 | } | null, 1115 | }; 1116 | 1117 | export type ListMessagesQueryVariables = { 1118 | filter?: ModelMessageFilterInput | null, 1119 | limit?: number | null, 1120 | nextToken?: string | null, 1121 | }; 1122 | 1123 | export type ListMessagesQuery = { 1124 | listMessages: { 1125 | __typename: "ModelMessageConnection", 1126 | items: Array< { 1127 | __typename: "Message", 1128 | id: string, 1129 | createdAt: string, 1130 | content: string, 1131 | userID: string, 1132 | chatRoomID: string, 1133 | user: { 1134 | __typename: "User", 1135 | id: string, 1136 | name: string, 1137 | imageUri: string | null, 1138 | status: string | null, 1139 | createdAt: string, 1140 | updatedAt: string, 1141 | } | null, 1142 | chatRoom: { 1143 | __typename: "ChatRoom", 1144 | id: string, 1145 | lastMessageID: string, 1146 | createdAt: string, 1147 | updatedAt: string, 1148 | } | null, 1149 | updatedAt: string, 1150 | } | null > | null, 1151 | nextToken: string | null, 1152 | } | null, 1153 | }; 1154 | 1155 | export type MessagesByChatRoomQueryVariables = { 1156 | chatRoomID?: string | null, 1157 | createdAt?: ModelStringKeyConditionInput | null, 1158 | sortDirection?: ModelSortDirection | null, 1159 | filter?: ModelMessageFilterInput | null, 1160 | limit?: number | null, 1161 | nextToken?: string | null, 1162 | }; 1163 | 1164 | export type MessagesByChatRoomQuery = { 1165 | messagesByChatRoom: { 1166 | __typename: "ModelMessageConnection", 1167 | items: Array< { 1168 | __typename: "Message", 1169 | id: string, 1170 | createdAt: string, 1171 | content: string, 1172 | userID: string, 1173 | chatRoomID: string, 1174 | user: { 1175 | __typename: "User", 1176 | id: string, 1177 | name: string, 1178 | imageUri: string | null, 1179 | status: string | null, 1180 | createdAt: string, 1181 | updatedAt: string, 1182 | } | null, 1183 | chatRoom: { 1184 | __typename: "ChatRoom", 1185 | id: string, 1186 | lastMessageID: string, 1187 | createdAt: string, 1188 | updatedAt: string, 1189 | } | null, 1190 | updatedAt: string, 1191 | } | null > | null, 1192 | nextToken: string | null, 1193 | } | null, 1194 | }; 1195 | 1196 | export type OnCreateUserSubscription = { 1197 | onCreateUser: { 1198 | __typename: "User", 1199 | id: string, 1200 | name: string, 1201 | imageUri: string | null, 1202 | status: string | null, 1203 | chatRoomUser: { 1204 | __typename: "ModelChatRoomUserConnection", 1205 | items: Array< { 1206 | __typename: "ChatRoomUser", 1207 | id: string, 1208 | userID: string, 1209 | chatRoomID: string, 1210 | createdAt: string, 1211 | updatedAt: string, 1212 | } | null > | null, 1213 | nextToken: string | null, 1214 | } | null, 1215 | createdAt: string, 1216 | updatedAt: string, 1217 | } | null, 1218 | }; 1219 | 1220 | export type OnUpdateUserSubscription = { 1221 | onUpdateUser: { 1222 | __typename: "User", 1223 | id: string, 1224 | name: string, 1225 | imageUri: string | null, 1226 | status: string | null, 1227 | chatRoomUser: { 1228 | __typename: "ModelChatRoomUserConnection", 1229 | items: Array< { 1230 | __typename: "ChatRoomUser", 1231 | id: string, 1232 | userID: string, 1233 | chatRoomID: string, 1234 | createdAt: string, 1235 | updatedAt: string, 1236 | } | null > | null, 1237 | nextToken: string | null, 1238 | } | null, 1239 | createdAt: string, 1240 | updatedAt: string, 1241 | } | null, 1242 | }; 1243 | 1244 | export type OnDeleteUserSubscription = { 1245 | onDeleteUser: { 1246 | __typename: "User", 1247 | id: string, 1248 | name: string, 1249 | imageUri: string | null, 1250 | status: string | null, 1251 | chatRoomUser: { 1252 | __typename: "ModelChatRoomUserConnection", 1253 | items: Array< { 1254 | __typename: "ChatRoomUser", 1255 | id: string, 1256 | userID: string, 1257 | chatRoomID: string, 1258 | createdAt: string, 1259 | updatedAt: string, 1260 | } | null > | null, 1261 | nextToken: string | null, 1262 | } | null, 1263 | createdAt: string, 1264 | updatedAt: string, 1265 | } | null, 1266 | }; 1267 | 1268 | export type OnCreateChatRoomUserSubscription = { 1269 | onCreateChatRoomUser: { 1270 | __typename: "ChatRoomUser", 1271 | id: string, 1272 | userID: string, 1273 | chatRoomID: string, 1274 | user: { 1275 | __typename: "User", 1276 | id: string, 1277 | name: string, 1278 | imageUri: string | null, 1279 | status: string | null, 1280 | chatRoomUser: { 1281 | __typename: "ModelChatRoomUserConnection", 1282 | nextToken: string | null, 1283 | } | null, 1284 | createdAt: string, 1285 | updatedAt: string, 1286 | } | null, 1287 | chatRoom: { 1288 | __typename: "ChatRoom", 1289 | id: string, 1290 | chatRoomUsers: { 1291 | __typename: "ModelChatRoomUserConnection", 1292 | nextToken: string | null, 1293 | } | null, 1294 | messages: { 1295 | __typename: "ModelMessageConnection", 1296 | nextToken: string | null, 1297 | } | null, 1298 | lastMessageID: string, 1299 | lastMessage: { 1300 | __typename: "Message", 1301 | id: string, 1302 | createdAt: string, 1303 | content: string, 1304 | userID: string, 1305 | chatRoomID: string, 1306 | updatedAt: string, 1307 | } | null, 1308 | createdAt: string, 1309 | updatedAt: string, 1310 | } | null, 1311 | createdAt: string, 1312 | updatedAt: string, 1313 | } | null, 1314 | }; 1315 | 1316 | export type OnUpdateChatRoomUserSubscription = { 1317 | onUpdateChatRoomUser: { 1318 | __typename: "ChatRoomUser", 1319 | id: string, 1320 | userID: string, 1321 | chatRoomID: string, 1322 | user: { 1323 | __typename: "User", 1324 | id: string, 1325 | name: string, 1326 | imageUri: string | null, 1327 | status: string | null, 1328 | chatRoomUser: { 1329 | __typename: "ModelChatRoomUserConnection", 1330 | nextToken: string | null, 1331 | } | null, 1332 | createdAt: string, 1333 | updatedAt: string, 1334 | } | null, 1335 | chatRoom: { 1336 | __typename: "ChatRoom", 1337 | id: string, 1338 | chatRoomUsers: { 1339 | __typename: "ModelChatRoomUserConnection", 1340 | nextToken: string | null, 1341 | } | null, 1342 | messages: { 1343 | __typename: "ModelMessageConnection", 1344 | nextToken: string | null, 1345 | } | null, 1346 | lastMessageID: string, 1347 | lastMessage: { 1348 | __typename: "Message", 1349 | id: string, 1350 | createdAt: string, 1351 | content: string, 1352 | userID: string, 1353 | chatRoomID: string, 1354 | updatedAt: string, 1355 | } | null, 1356 | createdAt: string, 1357 | updatedAt: string, 1358 | } | null, 1359 | createdAt: string, 1360 | updatedAt: string, 1361 | } | null, 1362 | }; 1363 | 1364 | export type OnDeleteChatRoomUserSubscription = { 1365 | onDeleteChatRoomUser: { 1366 | __typename: "ChatRoomUser", 1367 | id: string, 1368 | userID: string, 1369 | chatRoomID: string, 1370 | user: { 1371 | __typename: "User", 1372 | id: string, 1373 | name: string, 1374 | imageUri: string | null, 1375 | status: string | null, 1376 | chatRoomUser: { 1377 | __typename: "ModelChatRoomUserConnection", 1378 | nextToken: string | null, 1379 | } | null, 1380 | createdAt: string, 1381 | updatedAt: string, 1382 | } | null, 1383 | chatRoom: { 1384 | __typename: "ChatRoom", 1385 | id: string, 1386 | chatRoomUsers: { 1387 | __typename: "ModelChatRoomUserConnection", 1388 | nextToken: string | null, 1389 | } | null, 1390 | messages: { 1391 | __typename: "ModelMessageConnection", 1392 | nextToken: string | null, 1393 | } | null, 1394 | lastMessageID: string, 1395 | lastMessage: { 1396 | __typename: "Message", 1397 | id: string, 1398 | createdAt: string, 1399 | content: string, 1400 | userID: string, 1401 | chatRoomID: string, 1402 | updatedAt: string, 1403 | } | null, 1404 | createdAt: string, 1405 | updatedAt: string, 1406 | } | null, 1407 | createdAt: string, 1408 | updatedAt: string, 1409 | } | null, 1410 | }; 1411 | 1412 | export type OnCreateChatRoomSubscription = { 1413 | onCreateChatRoom: { 1414 | __typename: "ChatRoom", 1415 | id: string, 1416 | chatRoomUsers: { 1417 | __typename: "ModelChatRoomUserConnection", 1418 | items: Array< { 1419 | __typename: "ChatRoomUser", 1420 | id: string, 1421 | userID: string, 1422 | chatRoomID: string, 1423 | createdAt: string, 1424 | updatedAt: string, 1425 | } | null > | null, 1426 | nextToken: string | null, 1427 | } | null, 1428 | messages: { 1429 | __typename: "ModelMessageConnection", 1430 | items: Array< { 1431 | __typename: "Message", 1432 | id: string, 1433 | createdAt: string, 1434 | content: string, 1435 | userID: string, 1436 | chatRoomID: string, 1437 | updatedAt: string, 1438 | } | null > | null, 1439 | nextToken: string | null, 1440 | } | null, 1441 | lastMessageID: string, 1442 | lastMessage: { 1443 | __typename: "Message", 1444 | id: string, 1445 | createdAt: string, 1446 | content: string, 1447 | userID: string, 1448 | chatRoomID: string, 1449 | user: { 1450 | __typename: "User", 1451 | id: string, 1452 | name: string, 1453 | imageUri: string | null, 1454 | status: string | null, 1455 | createdAt: string, 1456 | updatedAt: string, 1457 | } | null, 1458 | chatRoom: { 1459 | __typename: "ChatRoom", 1460 | id: string, 1461 | lastMessageID: string, 1462 | createdAt: string, 1463 | updatedAt: string, 1464 | } | null, 1465 | updatedAt: string, 1466 | } | null, 1467 | createdAt: string, 1468 | updatedAt: string, 1469 | } | null, 1470 | }; 1471 | 1472 | export type OnUpdateChatRoomSubscription = { 1473 | onUpdateChatRoom: { 1474 | __typename: "ChatRoom", 1475 | id: string, 1476 | chatRoomUsers: { 1477 | __typename: "ModelChatRoomUserConnection", 1478 | items: Array< { 1479 | __typename: "ChatRoomUser", 1480 | id: string, 1481 | userID: string, 1482 | chatRoomID: string, 1483 | createdAt: string, 1484 | updatedAt: string, 1485 | } | null > | null, 1486 | nextToken: string | null, 1487 | } | null, 1488 | messages: { 1489 | __typename: "ModelMessageConnection", 1490 | items: Array< { 1491 | __typename: "Message", 1492 | id: string, 1493 | createdAt: string, 1494 | content: string, 1495 | userID: string, 1496 | chatRoomID: string, 1497 | updatedAt: string, 1498 | } | null > | null, 1499 | nextToken: string | null, 1500 | } | null, 1501 | lastMessageID: string, 1502 | lastMessage: { 1503 | __typename: "Message", 1504 | id: string, 1505 | createdAt: string, 1506 | content: string, 1507 | userID: string, 1508 | chatRoomID: string, 1509 | user: { 1510 | __typename: "User", 1511 | id: string, 1512 | name: string, 1513 | imageUri: string | null, 1514 | status: string | null, 1515 | createdAt: string, 1516 | updatedAt: string, 1517 | } | null, 1518 | chatRoom: { 1519 | __typename: "ChatRoom", 1520 | id: string, 1521 | lastMessageID: string, 1522 | createdAt: string, 1523 | updatedAt: string, 1524 | } | null, 1525 | updatedAt: string, 1526 | } | null, 1527 | createdAt: string, 1528 | updatedAt: string, 1529 | } | null, 1530 | }; 1531 | 1532 | export type OnDeleteChatRoomSubscription = { 1533 | onDeleteChatRoom: { 1534 | __typename: "ChatRoom", 1535 | id: string, 1536 | chatRoomUsers: { 1537 | __typename: "ModelChatRoomUserConnection", 1538 | items: Array< { 1539 | __typename: "ChatRoomUser", 1540 | id: string, 1541 | userID: string, 1542 | chatRoomID: string, 1543 | createdAt: string, 1544 | updatedAt: string, 1545 | } | null > | null, 1546 | nextToken: string | null, 1547 | } | null, 1548 | messages: { 1549 | __typename: "ModelMessageConnection", 1550 | items: Array< { 1551 | __typename: "Message", 1552 | id: string, 1553 | createdAt: string, 1554 | content: string, 1555 | userID: string, 1556 | chatRoomID: string, 1557 | updatedAt: string, 1558 | } | null > | null, 1559 | nextToken: string | null, 1560 | } | null, 1561 | lastMessageID: string, 1562 | lastMessage: { 1563 | __typename: "Message", 1564 | id: string, 1565 | createdAt: string, 1566 | content: string, 1567 | userID: string, 1568 | chatRoomID: string, 1569 | user: { 1570 | __typename: "User", 1571 | id: string, 1572 | name: string, 1573 | imageUri: string | null, 1574 | status: string | null, 1575 | createdAt: string, 1576 | updatedAt: string, 1577 | } | null, 1578 | chatRoom: { 1579 | __typename: "ChatRoom", 1580 | id: string, 1581 | lastMessageID: string, 1582 | createdAt: string, 1583 | updatedAt: string, 1584 | } | null, 1585 | updatedAt: string, 1586 | } | null, 1587 | createdAt: string, 1588 | updatedAt: string, 1589 | } | null, 1590 | }; 1591 | 1592 | export type OnCreateMessageSubscription = { 1593 | onCreateMessage: { 1594 | __typename: "Message", 1595 | id: string, 1596 | createdAt: string, 1597 | content: string, 1598 | userID: string, 1599 | chatRoomID: string, 1600 | user: { 1601 | __typename: "User", 1602 | id: string, 1603 | name: string, 1604 | imageUri: string | null, 1605 | status: string | null, 1606 | chatRoomUser: { 1607 | __typename: "ModelChatRoomUserConnection", 1608 | nextToken: string | null, 1609 | } | null, 1610 | createdAt: string, 1611 | updatedAt: string, 1612 | } | null, 1613 | chatRoom: { 1614 | __typename: "ChatRoom", 1615 | id: string, 1616 | chatRoomUsers: { 1617 | __typename: "ModelChatRoomUserConnection", 1618 | nextToken: string | null, 1619 | } | null, 1620 | messages: { 1621 | __typename: "ModelMessageConnection", 1622 | nextToken: string | null, 1623 | } | null, 1624 | lastMessageID: string, 1625 | lastMessage: { 1626 | __typename: "Message", 1627 | id: string, 1628 | createdAt: string, 1629 | content: string, 1630 | userID: string, 1631 | chatRoomID: string, 1632 | updatedAt: string, 1633 | } | null, 1634 | createdAt: string, 1635 | updatedAt: string, 1636 | } | null, 1637 | updatedAt: string, 1638 | } | null, 1639 | }; 1640 | 1641 | export type OnUpdateMessageSubscription = { 1642 | onUpdateMessage: { 1643 | __typename: "Message", 1644 | id: string, 1645 | createdAt: string, 1646 | content: string, 1647 | userID: string, 1648 | chatRoomID: string, 1649 | user: { 1650 | __typename: "User", 1651 | id: string, 1652 | name: string, 1653 | imageUri: string | null, 1654 | status: string | null, 1655 | chatRoomUser: { 1656 | __typename: "ModelChatRoomUserConnection", 1657 | nextToken: string | null, 1658 | } | null, 1659 | createdAt: string, 1660 | updatedAt: string, 1661 | } | null, 1662 | chatRoom: { 1663 | __typename: "ChatRoom", 1664 | id: string, 1665 | chatRoomUsers: { 1666 | __typename: "ModelChatRoomUserConnection", 1667 | nextToken: string | null, 1668 | } | null, 1669 | messages: { 1670 | __typename: "ModelMessageConnection", 1671 | nextToken: string | null, 1672 | } | null, 1673 | lastMessageID: string, 1674 | lastMessage: { 1675 | __typename: "Message", 1676 | id: string, 1677 | createdAt: string, 1678 | content: string, 1679 | userID: string, 1680 | chatRoomID: string, 1681 | updatedAt: string, 1682 | } | null, 1683 | createdAt: string, 1684 | updatedAt: string, 1685 | } | null, 1686 | updatedAt: string, 1687 | } | null, 1688 | }; 1689 | 1690 | export type OnDeleteMessageSubscription = { 1691 | onDeleteMessage: { 1692 | __typename: "Message", 1693 | id: string, 1694 | createdAt: string, 1695 | content: string, 1696 | userID: string, 1697 | chatRoomID: string, 1698 | user: { 1699 | __typename: "User", 1700 | id: string, 1701 | name: string, 1702 | imageUri: string | null, 1703 | status: string | null, 1704 | chatRoomUser: { 1705 | __typename: "ModelChatRoomUserConnection", 1706 | nextToken: string | null, 1707 | } | null, 1708 | createdAt: string, 1709 | updatedAt: string, 1710 | } | null, 1711 | chatRoom: { 1712 | __typename: "ChatRoom", 1713 | id: string, 1714 | chatRoomUsers: { 1715 | __typename: "ModelChatRoomUserConnection", 1716 | nextToken: string | null, 1717 | } | null, 1718 | messages: { 1719 | __typename: "ModelMessageConnection", 1720 | nextToken: string | null, 1721 | } | null, 1722 | lastMessageID: string, 1723 | lastMessage: { 1724 | __typename: "Message", 1725 | id: string, 1726 | createdAt: string, 1727 | content: string, 1728 | userID: string, 1729 | chatRoomID: string, 1730 | updatedAt: string, 1731 | } | null, 1732 | createdAt: string, 1733 | updatedAt: string, 1734 | } | null, 1735 | updatedAt: string, 1736 | } | null, 1737 | }; 1738 | --------------------------------------------------------------------------------