This is an Expo project created with create-expo-app.
create table conversations (
id uuid primary key default gen_random_uuid(),
label text null,
participants jsonb not null, -- Liste des participants sous forme de tableau JSON
admin_id uuid null references auth.users(id) on delete set null,
created_at timestamp default now()
);- Messages table
CREATE TABLE messages (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
conversation_id uuid REFERENCES conversations(id) ON DELETE CASCADE,
sender_id uuid NOT NULL REFERENCES profiles(id) ON DELETE CASCADE,
text text NOT NULL,
created_at timestamp DEFAULT now()
);CREATE INDEX idx_messages_conversation_id ON messages(conversation_id);CREATE POLICY "Allow users to read messages in their conversations"
ON messages
FOR SELECT
USING (
EXISTS (
SELECT 1
FROM conversations
WHERE conversations.id = messages.conversation_id
AND auth.uid() = ANY(conversations.participants)
)
);
CREATE POLICY "Allow users to send messages in their conversations"
ON messages
FOR INSERT
WITH CHECK (
EXISTS (
SELECT 1
FROM conversations
WHERE conversations.id = messages.conversation_id
AND auth.uid() = ANY(conversations.participants)
)
);-
Install dependencies
npm install
-
Start the app
npx expo start
In the output, you'll find options to open the app in a
- development build
- Android emulator
- iOS simulator
- Expo Go, a limited sandbox for trying out app development with Expo
You can start developing by editing the files inside the app directory. This project uses file-based routing.
When you're ready, run:
npm run reset-projectThis command will move the starter code to the app-example directory and create a blank app directory where you can start developing.
Requirements :
- Eas-cli
npm install -g eas-cli - Add the .env values into eas, for each env values
eas secret:create Make the build with Expo cloud builder:
- Android build
eas build -p android --profile preview