diff --git a/README.md b/README.md index edd2db1..43fb704 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ npm install Setup Supabase Project and configure [`supabaseClient.ts`](src/app/utils/supabaseClient.ts) -> Use the Database structure from [db_dump.sql](db_dump.sql) in Supabase. +> Use the Database structure from [db_structure.sql](db_structure.sql) in Supabase. Configure Cloudinary for Image Uploads. @@ -52,8 +52,8 @@ npm run android # To Do -- [ ] Messaging -- [ ] Caching +- [x] Messaging +- [ ] Better Caching - [ ] Filters for Posts - [ ] Stories - [ ] Better Navigation and State Persistence diff --git a/db_structure.sql b/db_structure.sql new file mode 100644 index 0000000..378cc81 --- /dev/null +++ b/db_structure.sql @@ -0,0 +1,1338 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 12.6 (Ubuntu 12.6-1.pgdg18.04+1) +-- Dumped by pg_dump version 12.6 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- Name: auth; Type: SCHEMA; Schema: -; Owner: supabase_admin +-- + +CREATE SCHEMA auth; + + +ALTER SCHEMA auth OWNER TO supabase_admin; + +-- +-- Name: extensions; Type: SCHEMA; Schema: -; Owner: postgres +-- + +CREATE SCHEMA extensions; + + +ALTER SCHEMA extensions OWNER TO postgres; + +-- +-- Name: pgbouncer; Type: SCHEMA; Schema: -; Owner: pgbouncer +-- + +CREATE SCHEMA pgbouncer; + + +ALTER SCHEMA pgbouncer OWNER TO pgbouncer; + +-- +-- Name: storage; Type: SCHEMA; Schema: -; Owner: supabase_admin +-- + +CREATE SCHEMA storage; + + +ALTER SCHEMA storage OWNER TO supabase_admin; + +-- +-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions; + + +-- +-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions'; + + +-- +-- Name: pgjwt; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pgjwt WITH SCHEMA extensions; + + +-- +-- Name: EXTENSION pgjwt; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION pgjwt IS 'JSON Web Token API for Postgresql'; + + +-- +-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA extensions; + + +-- +-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)'; + + +-- +-- Name: role(); Type: FUNCTION; Schema: auth; Owner: postgres +-- + +CREATE FUNCTION auth.role() RETURNS text + LANGUAGE sql STABLE + AS $$ + select nullif(current_setting('request.jwt.claim.role', true), '')::text; +$$; + + +ALTER FUNCTION auth.role() OWNER TO postgres; + +-- +-- Name: uid(); Type: FUNCTION; Schema: auth; Owner: postgres +-- + +CREATE FUNCTION auth.uid() RETURNS uuid + LANGUAGE sql STABLE + AS $$ + select nullif(current_setting('request.jwt.claim.sub', true), '')::uuid; +$$; + + +ALTER FUNCTION auth.uid() OWNER TO postgres; + +-- +-- Name: notify_api_restart(); Type: FUNCTION; Schema: extensions; Owner: postgres +-- + +CREATE FUNCTION extensions.notify_api_restart() RETURNS event_trigger + LANGUAGE plpgsql + AS $$ + BEGIN + NOTIFY ddl_command_end; + END; + $$; + + +ALTER FUNCTION extensions.notify_api_restart() OWNER TO postgres; + +-- +-- Name: FUNCTION notify_api_restart(); Type: COMMENT; Schema: extensions; Owner: postgres +-- + +COMMENT ON FUNCTION extensions.notify_api_restart() IS 'Sends a notification to the API to restart. If your database schema has changed, this is required so that Supabase can rebuild the relationships.'; + + +-- +-- Name: get_auth(text); Type: FUNCTION; Schema: pgbouncer; Owner: postgres +-- + +CREATE FUNCTION pgbouncer.get_auth(p_usename text) RETURNS TABLE(username text, password text) + LANGUAGE plpgsql SECURITY DEFINER + AS $$ +BEGIN + RAISE WARNING 'PgBouncer auth request: %', p_usename; + + RETURN QUERY + SELECT usename::TEXT, passwd::TEXT FROM pg_catalog.pg_shadow + WHERE usename = p_usename; +END; +$$; + + +ALTER FUNCTION pgbouncer.get_auth(p_usename text) OWNER TO postgres; + +-- +-- Name: extension(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE FUNCTION storage.extension(name text) RETURNS text + LANGUAGE plpgsql + AS $$ +DECLARE +_parts text[]; +_filename text; +BEGIN + select string_to_array(name, '/') into _parts; + select _parts[array_length(_parts,1)] into _filename; + -- @todo return the last part instead of 2 + return split_part(_filename, '.', 2); +END +$$; + + +ALTER FUNCTION storage.extension(name text) OWNER TO supabase_storage_admin; + +-- +-- Name: filename(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE FUNCTION storage.filename(name text) RETURNS text + LANGUAGE plpgsql + AS $$ +DECLARE +_parts text[]; +BEGIN + select string_to_array(name, '/') into _parts; + return _parts[array_length(_parts,1)]; +END +$$; + + +ALTER FUNCTION storage.filename(name text) OWNER TO supabase_storage_admin; + +-- +-- Name: foldername(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE FUNCTION storage.foldername(name text) RETURNS text[] + LANGUAGE plpgsql + AS $$ +DECLARE +_parts text[]; +BEGIN + select string_to_array(name, '/') into _parts; + return _parts[1:array_length(_parts,1)-1]; +END +$$; + + +ALTER FUNCTION storage.foldername(name text) OWNER TO supabase_storage_admin; + +-- +-- Name: get_size_by_bucket(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE FUNCTION storage.get_size_by_bucket() RETURNS TABLE(size bigint, bucket_id text) + LANGUAGE plpgsql + AS $$ +BEGIN + return query + select sum((metadata->>'size')::int) as size, obj.bucket_id + from "storage".objects as obj + group by obj.bucket_id; +END +$$; + + +ALTER FUNCTION storage.get_size_by_bucket() OWNER TO supabase_storage_admin; + +-- +-- Name: search(text, text, integer, integer, integer); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE FUNCTION storage.search(prefix text, bucketname text, limits integer DEFAULT 100, levels integer DEFAULT 1, offsets integer DEFAULT 0) RETURNS TABLE(name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) + LANGUAGE plpgsql + AS $$ +BEGIN + return query + with files_folders as ( + select path_tokens[levels] as folder + from storage.objects + where objects.name ilike prefix || '%' + and bucket_id = bucketname + GROUP by folder + limit limits + offset offsets + ) + select files_folders.folder as name, objects.id, objects.updated_at, objects.created_at, objects.last_accessed_at, objects.metadata from files_folders + left join storage.objects + on prefix || files_folders.folder = objects.name + where objects.id is null or objects.bucket_id=bucketname; +END +$$; + + +ALTER FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer) OWNER TO supabase_storage_admin; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- Name: audit_log_entries; Type: TABLE; Schema: auth; Owner: postgres +-- + +CREATE TABLE auth.audit_log_entries ( + instance_id uuid, + id uuid NOT NULL, + payload json, + created_at timestamp with time zone +); + + +ALTER TABLE auth.audit_log_entries OWNER TO postgres; + +-- +-- Name: TABLE audit_log_entries; Type: COMMENT; Schema: auth; Owner: postgres +-- + +COMMENT ON TABLE auth.audit_log_entries IS 'Auth: Audit trail for user actions.'; + + +-- +-- Name: instances; Type: TABLE; Schema: auth; Owner: postgres +-- + +CREATE TABLE auth.instances ( + id uuid NOT NULL, + uuid uuid, + raw_base_config text, + created_at timestamp with time zone, + updated_at timestamp with time zone +); + + +ALTER TABLE auth.instances OWNER TO postgres; + +-- +-- Name: TABLE instances; Type: COMMENT; Schema: auth; Owner: postgres +-- + +COMMENT ON TABLE auth.instances IS 'Auth: Manages users across multiple sites.'; + + +-- +-- Name: refresh_tokens; Type: TABLE; Schema: auth; Owner: postgres +-- + +CREATE TABLE auth.refresh_tokens ( + instance_id uuid, + id bigint NOT NULL, + token character varying(255), + user_id character varying(255), + revoked boolean, + created_at timestamp with time zone, + updated_at timestamp with time zone +); + + +ALTER TABLE auth.refresh_tokens OWNER TO postgres; + +-- +-- Name: TABLE refresh_tokens; Type: COMMENT; Schema: auth; Owner: postgres +-- + +COMMENT ON TABLE auth.refresh_tokens IS 'Auth: Store of tokens used to refresh JWT tokens once they expire.'; + + +-- +-- Name: refresh_tokens_id_seq; Type: SEQUENCE; Schema: auth; Owner: postgres +-- + +CREATE SEQUENCE auth.refresh_tokens_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE auth.refresh_tokens_id_seq OWNER TO postgres; + +-- +-- Name: refresh_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: auth; Owner: postgres +-- + +ALTER SEQUENCE auth.refresh_tokens_id_seq OWNED BY auth.refresh_tokens.id; + + +-- +-- Name: schema_migrations; Type: TABLE; Schema: auth; Owner: postgres +-- + +CREATE TABLE auth.schema_migrations ( + version character varying(255) NOT NULL +); + + +ALTER TABLE auth.schema_migrations OWNER TO postgres; + +-- +-- Name: TABLE schema_migrations; Type: COMMENT; Schema: auth; Owner: postgres +-- + +COMMENT ON TABLE auth.schema_migrations IS 'Auth: Manages updates to the auth system.'; + + +-- +-- Name: users; Type: TABLE; Schema: auth; Owner: postgres +-- + +CREATE TABLE auth.users ( + instance_id uuid, + id uuid NOT NULL, + aud character varying(255), + role character varying(255), + email character varying(255), + encrypted_password character varying(255), + confirmed_at timestamp with time zone, + invited_at timestamp with time zone, + confirmation_token character varying(255), + confirmation_sent_at timestamp with time zone, + recovery_token character varying(255), + recovery_sent_at timestamp with time zone, + email_change_token character varying(255), + email_change character varying(255), + email_change_sent_at timestamp with time zone, + last_sign_in_at timestamp with time zone, + raw_app_meta_data jsonb, + raw_user_meta_data jsonb, + is_super_admin boolean, + created_at timestamp with time zone, + updated_at timestamp with time zone +); + + +ALTER TABLE auth.users OWNER TO postgres; + +-- +-- Name: TABLE users; Type: COMMENT; Schema: auth; Owner: postgres +-- + +COMMENT ON TABLE auth.users IS 'Auth: Stores user login data within a secure schema.'; + + +-- +-- Name: comments; Type: TABLE; Schema: public; Owner: supabase_admin +-- + +CREATE TABLE public.comments ( + id integer NOT NULL, + "postId" integer NOT NULL, + "user" text NOT NULL, + "postedAt" timestamp with time zone DEFAULT now() NOT NULL, + comment text NOT NULL +); + + +ALTER TABLE public.comments OWNER TO supabase_admin; + +-- +-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE public.comments ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.comments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: followers; Type: TABLE; Schema: public; Owner: supabase_admin +-- + +CREATE TABLE public.followers ( + id integer NOT NULL, + follower text NOT NULL, + following text NOT NULL +); + + +ALTER TABLE public.followers OWNER TO supabase_admin; + +-- +-- Name: followers_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE public.followers ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.followers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: likes; Type: TABLE; Schema: public; Owner: supabase_admin +-- + +CREATE TABLE public.likes ( + id integer NOT NULL, + "postId" integer NOT NULL, + "user" text NOT NULL +); + + +ALTER TABLE public.likes OWNER TO supabase_admin; + +-- +-- Name: likes_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE public.likes ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.likes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: messages; Type: TABLE; Schema: public; Owner: supabase_admin +-- + +CREATE TABLE public.messages ( + "messageId" integer NOT NULL, + message_type character varying DEFAULT 'TEXT'::character varying NOT NULL, + text text, + "postId" integer, + "imageUrl" text, + sender text NOT NULL, + receiver text NOT NULL, + received_at timestamp with time zone DEFAULT now() NOT NULL +); + + +ALTER TABLE public.messages OWNER TO supabase_admin; + +-- +-- Name: COLUMN messages.message_type; Type: COMMENT; Schema: public; Owner: supabase_admin +-- + +COMMENT ON COLUMN public.messages.message_type IS 'TEXT or IMAGE or POST'; + + +-- +-- Name: messages_messageId_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE public.messages ALTER COLUMN "messageId" ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public."messages_messageId_seq" + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: posts; Type: TABLE; Schema: public; Owner: supabase_admin +-- + +CREATE TABLE public.posts ( + "postId" integer NOT NULL, + "imageUrl" text NOT NULL, + "user" text NOT NULL, + caption text, + "postedAt" timestamp with time zone DEFAULT now() NOT NULL +); + + +ALTER TABLE public.posts OWNER TO supabase_admin; + +-- +-- Name: posts_postId_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE public.posts ALTER COLUMN "postId" ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public."posts_postId_seq" + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: users; Type: TABLE; Schema: public; Owner: supabase_admin +-- + +CREATE TABLE public.users ( + username text NOT NULL, + name text NOT NULL, + bio text, + "profilePic" text, + email text NOT NULL +); + + +ALTER TABLE public.users OWNER TO supabase_admin; + +-- +-- Name: TABLE users; Type: COMMENT; Schema: public; Owner: supabase_admin +-- + +COMMENT ON TABLE public.users IS 'Users'; + + +-- +-- Name: COLUMN users.name; Type: COMMENT; Schema: public; Owner: supabase_admin +-- + +COMMENT ON COLUMN public.users.name IS 'Name'; + + +-- +-- Name: COLUMN users.bio; Type: COMMENT; Schema: public; Owner: supabase_admin +-- + +COMMENT ON COLUMN public.users.bio IS 'Bio'; + + +-- +-- Name: COLUMN users."profilePic"; Type: COMMENT; Schema: public; Owner: supabase_admin +-- + +COMMENT ON COLUMN public.users."profilePic" IS 'Profile Picture'; + + +-- +-- Name: buckets; Type: TABLE; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE TABLE storage.buckets ( + id text NOT NULL, + name text NOT NULL, + owner uuid, + created_at timestamp with time zone DEFAULT now(), + updated_at timestamp with time zone DEFAULT now() +); + + +ALTER TABLE storage.buckets OWNER TO supabase_storage_admin; + +-- +-- Name: migrations; Type: TABLE; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE TABLE storage.migrations ( + id integer NOT NULL, + name character varying(100) NOT NULL, + hash character varying(40) NOT NULL, + executed_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP +); + + +ALTER TABLE storage.migrations OWNER TO supabase_storage_admin; + +-- +-- Name: objects; Type: TABLE; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE TABLE storage.objects ( + id uuid DEFAULT extensions.uuid_generate_v4() NOT NULL, + bucket_id text, + name text, + owner uuid, + created_at timestamp with time zone DEFAULT now(), + updated_at timestamp with time zone DEFAULT now(), + last_accessed_at timestamp with time zone DEFAULT now(), + metadata jsonb, + path_tokens text[] GENERATED ALWAYS AS (string_to_array(name, '/'::text)) STORED +); + + +ALTER TABLE storage.objects OWNER TO supabase_storage_admin; + +-- +-- Name: refresh_tokens id; Type: DEFAULT; Schema: auth; Owner: postgres +-- + +ALTER TABLE ONLY auth.refresh_tokens ALTER COLUMN id SET DEFAULT nextval('auth.refresh_tokens_id_seq'::regclass); + + +-- +-- Name: audit_log_entries audit_log_entries_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres +-- + +ALTER TABLE ONLY auth.audit_log_entries + ADD CONSTRAINT audit_log_entries_pkey PRIMARY KEY (id); + + +-- +-- Name: instances instances_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres +-- + +ALTER TABLE ONLY auth.instances + ADD CONSTRAINT instances_pkey PRIMARY KEY (id); + + +-- +-- Name: refresh_tokens refresh_tokens_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres +-- + +ALTER TABLE ONLY auth.refresh_tokens + ADD CONSTRAINT refresh_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres +-- + +ALTER TABLE ONLY auth.schema_migrations + ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); + + +-- +-- Name: users users_email_key; Type: CONSTRAINT; Schema: auth; Owner: postgres +-- + +ALTER TABLE ONLY auth.users + ADD CONSTRAINT users_email_key UNIQUE (email); + + +-- +-- Name: users users_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres +-- + +ALTER TABLE ONLY auth.users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: comments comments_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.comments + ADD CONSTRAINT comments_pkey PRIMARY KEY (id); + + +-- +-- Name: followers followers_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.followers + ADD CONSTRAINT followers_pkey PRIMARY KEY (id); + + +-- +-- Name: likes likes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.likes + ADD CONSTRAINT likes_pkey PRIMARY KEY (id); + + +-- +-- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.messages + ADD CONSTRAINT messages_pkey PRIMARY KEY ("messageId"); + + +-- +-- Name: posts posts_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.posts + ADD CONSTRAINT posts_pkey PRIMARY KEY ("postId"); + + +-- +-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.users + ADD CONSTRAINT users_pkey PRIMARY KEY (username); + + +-- +-- Name: buckets buckets_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE ONLY storage.buckets + ADD CONSTRAINT buckets_pkey PRIMARY KEY (id); + + +-- +-- Name: migrations migrations_name_key; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE ONLY storage.migrations + ADD CONSTRAINT migrations_name_key UNIQUE (name); + + +-- +-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE ONLY storage.migrations + ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); + + +-- +-- Name: objects objects_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE ONLY storage.objects + ADD CONSTRAINT objects_pkey PRIMARY KEY (id); + + +-- +-- Name: audit_logs_instance_id_idx; Type: INDEX; Schema: auth; Owner: postgres +-- + +CREATE INDEX audit_logs_instance_id_idx ON auth.audit_log_entries USING btree (instance_id); + + +-- +-- Name: refresh_tokens_instance_id_idx; Type: INDEX; Schema: auth; Owner: postgres +-- + +CREATE INDEX refresh_tokens_instance_id_idx ON auth.refresh_tokens USING btree (instance_id); + + +-- +-- Name: refresh_tokens_instance_id_user_id_idx; Type: INDEX; Schema: auth; Owner: postgres +-- + +CREATE INDEX refresh_tokens_instance_id_user_id_idx ON auth.refresh_tokens USING btree (instance_id, user_id); + + +-- +-- Name: refresh_tokens_token_idx; Type: INDEX; Schema: auth; Owner: postgres +-- + +CREATE INDEX refresh_tokens_token_idx ON auth.refresh_tokens USING btree (token); + + +-- +-- Name: users_instance_id_email_idx; Type: INDEX; Schema: auth; Owner: postgres +-- + +CREATE INDEX users_instance_id_email_idx ON auth.users USING btree (instance_id, email); + + +-- +-- Name: users_instance_id_idx; Type: INDEX; Schema: auth; Owner: postgres +-- + +CREATE INDEX users_instance_id_idx ON auth.users USING btree (instance_id); + + +-- +-- Name: bname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE UNIQUE INDEX bname ON storage.buckets USING btree (name); + + +-- +-- Name: bucketid_objname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE UNIQUE INDEX bucketid_objname ON storage.objects USING btree (bucket_id, name); + + +-- +-- Name: name_prefix_search; Type: INDEX; Schema: storage; Owner: supabase_storage_admin +-- + +CREATE INDEX name_prefix_search ON storage.objects USING btree (name text_pattern_ops); + + +-- +-- Name: comments comments_postId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.comments + ADD CONSTRAINT "comments_postId_fkey" FOREIGN KEY ("postId") REFERENCES public.posts("postId"); + + +-- +-- Name: comments comments_user_key; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.comments + ADD CONSTRAINT comments_user_key FOREIGN KEY ("user") REFERENCES public.users(username) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: followers followers_follower_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.followers + ADD CONSTRAINT followers_follower_fkey FOREIGN KEY (follower) REFERENCES public.users(username) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: followers followers_following_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.followers + ADD CONSTRAINT followers_following_fkey FOREIGN KEY (following) REFERENCES public.users(username) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: likes likes_postId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.likes + ADD CONSTRAINT "likes_postId_fkey" FOREIGN KEY ("postId") REFERENCES public.posts("postId"); + + +-- +-- Name: likes likes_user_key; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.likes + ADD CONSTRAINT likes_user_key FOREIGN KEY ("user") REFERENCES public.users(username) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: messages messages_postId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.messages + ADD CONSTRAINT "messages_postId_fkey" FOREIGN KEY ("postId") REFERENCES public.posts("postId"); + + +-- +-- Name: messages messages_postid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.messages + ADD CONSTRAINT messages_postid_fkey FOREIGN KEY ("postId") REFERENCES public.posts("postId") ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: messages messages_receiver_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.messages + ADD CONSTRAINT messages_receiver_fkey FOREIGN KEY (receiver) REFERENCES public.users(username) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: messages messages_sender_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.messages + ADD CONSTRAINT messages_sender_fkey FOREIGN KEY (sender) REFERENCES public.users(username) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: posts posts_user_key; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin +-- + +ALTER TABLE ONLY public.posts + ADD CONSTRAINT posts_user_key FOREIGN KEY ("user") REFERENCES public.users(username) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: buckets buckets_owner_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE ONLY storage.buckets + ADD CONSTRAINT buckets_owner_fkey FOREIGN KEY (owner) REFERENCES auth.users(id); + + +-- +-- Name: objects objects_bucketId_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE ONLY storage.objects + ADD CONSTRAINT "objects_bucketId_fkey" FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); + + +-- +-- Name: objects objects_owner_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE ONLY storage.objects + ADD CONSTRAINT objects_owner_fkey FOREIGN KEY (owner) REFERENCES auth.users(id); + + +-- +-- Name: buckets; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE storage.buckets ENABLE ROW LEVEL SECURITY; + +-- +-- Name: migrations; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE storage.migrations ENABLE ROW LEVEL SECURITY; + +-- +-- Name: objects; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin +-- + +ALTER TABLE storage.objects ENABLE ROW LEVEL SECURITY; + +-- +-- Name: supabase_realtime; Type: PUBLICATION; Schema: -; Owner: postgres +-- + +CREATE PUBLICATION supabase_realtime FOR ALL TABLES WITH (publish = 'insert, update, delete, truncate'); + + +ALTER PUBLICATION supabase_realtime OWNER TO postgres; + +-- +-- Name: SCHEMA auth; Type: ACL; Schema: -; Owner: supabase_admin +-- + +GRANT ALL ON SCHEMA auth TO supabase_auth_admin; + + +-- +-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres +-- + +GRANT USAGE ON SCHEMA public TO anon; +GRANT USAGE ON SCHEMA public TO authenticated; +GRANT USAGE ON SCHEMA public TO service_role; + + +-- +-- Name: SCHEMA storage; Type: ACL; Schema: -; Owner: supabase_admin +-- + +GRANT USAGE ON SCHEMA storage TO postgres; +GRANT USAGE ON SCHEMA storage TO anon; +GRANT USAGE ON SCHEMA storage TO authenticated; +GRANT USAGE ON SCHEMA storage TO service_role; +GRANT ALL ON SCHEMA storage TO supabase_storage_admin; + + +-- +-- Name: FUNCTION get_auth(p_usename text); Type: ACL; Schema: pgbouncer; Owner: postgres +-- + +REVOKE ALL ON FUNCTION pgbouncer.get_auth(p_usename text) FROM PUBLIC; +GRANT ALL ON FUNCTION pgbouncer.get_auth(p_usename text) TO pgbouncer; + + +-- +-- Name: FUNCTION extension(name text); Type: ACL; Schema: storage; Owner: supabase_storage_admin +-- + +GRANT ALL ON FUNCTION storage.extension(name text) TO anon; +GRANT ALL ON FUNCTION storage.extension(name text) TO authenticated; +GRANT ALL ON FUNCTION storage.extension(name text) TO service_role; + + +-- +-- Name: FUNCTION filename(name text); Type: ACL; Schema: storage; Owner: supabase_storage_admin +-- + +GRANT ALL ON FUNCTION storage.filename(name text) TO anon; +GRANT ALL ON FUNCTION storage.filename(name text) TO authenticated; +GRANT ALL ON FUNCTION storage.filename(name text) TO service_role; + + +-- +-- Name: FUNCTION foldername(name text); Type: ACL; Schema: storage; Owner: supabase_storage_admin +-- + +GRANT ALL ON FUNCTION storage.foldername(name text) TO anon; +GRANT ALL ON FUNCTION storage.foldername(name text) TO authenticated; +GRANT ALL ON FUNCTION storage.foldername(name text) TO service_role; + + +-- +-- Name: FUNCTION search(prefix text, bucketname text, limits integer, levels integer, offsets integer); Type: ACL; Schema: storage; Owner: supabase_storage_admin +-- + +GRANT ALL ON FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer) TO anon; +GRANT ALL ON FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer) TO authenticated; +GRANT ALL ON FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer) TO service_role; + + +-- +-- Name: TABLE audit_log_entries; Type: ACL; Schema: auth; Owner: postgres +-- + +GRANT ALL ON TABLE auth.audit_log_entries TO supabase_auth_admin; + + +-- +-- Name: TABLE instances; Type: ACL; Schema: auth; Owner: postgres +-- + +GRANT ALL ON TABLE auth.instances TO supabase_auth_admin; + + +-- +-- Name: TABLE refresh_tokens; Type: ACL; Schema: auth; Owner: postgres +-- + +GRANT ALL ON TABLE auth.refresh_tokens TO supabase_auth_admin; + + +-- +-- Name: SEQUENCE refresh_tokens_id_seq; Type: ACL; Schema: auth; Owner: postgres +-- + +GRANT ALL ON SEQUENCE auth.refresh_tokens_id_seq TO supabase_auth_admin; + + +-- +-- Name: TABLE schema_migrations; Type: ACL; Schema: auth; Owner: postgres +-- + +GRANT ALL ON TABLE auth.schema_migrations TO supabase_auth_admin; + + +-- +-- Name: TABLE users; Type: ACL; Schema: auth; Owner: postgres +-- + +GRANT ALL ON TABLE auth.users TO supabase_auth_admin; + + +-- +-- Name: TABLE comments; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON TABLE public.comments TO postgres; +GRANT ALL ON TABLE public.comments TO anon; +GRANT ALL ON TABLE public.comments TO authenticated; +GRANT ALL ON TABLE public.comments TO service_role; + + +-- +-- Name: SEQUENCE comments_id_seq; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON SEQUENCE public.comments_id_seq TO postgres; +GRANT ALL ON SEQUENCE public.comments_id_seq TO anon; +GRANT ALL ON SEQUENCE public.comments_id_seq TO authenticated; +GRANT ALL ON SEQUENCE public.comments_id_seq TO service_role; + + +-- +-- Name: TABLE followers; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON TABLE public.followers TO postgres; +GRANT ALL ON TABLE public.followers TO anon; +GRANT ALL ON TABLE public.followers TO authenticated; +GRANT ALL ON TABLE public.followers TO service_role; + + +-- +-- Name: SEQUENCE followers_id_seq; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON SEQUENCE public.followers_id_seq TO postgres; +GRANT ALL ON SEQUENCE public.followers_id_seq TO anon; +GRANT ALL ON SEQUENCE public.followers_id_seq TO authenticated; +GRANT ALL ON SEQUENCE public.followers_id_seq TO service_role; + + +-- +-- Name: TABLE likes; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON TABLE public.likes TO postgres; +GRANT ALL ON TABLE public.likes TO anon; +GRANT ALL ON TABLE public.likes TO authenticated; +GRANT ALL ON TABLE public.likes TO service_role; + + +-- +-- Name: SEQUENCE likes_id_seq; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON SEQUENCE public.likes_id_seq TO postgres; +GRANT ALL ON SEQUENCE public.likes_id_seq TO anon; +GRANT ALL ON SEQUENCE public.likes_id_seq TO authenticated; +GRANT ALL ON SEQUENCE public.likes_id_seq TO service_role; + + +-- +-- Name: TABLE messages; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON TABLE public.messages TO postgres; +GRANT ALL ON TABLE public.messages TO anon; +GRANT ALL ON TABLE public.messages TO authenticated; +GRANT ALL ON TABLE public.messages TO service_role; + + +-- +-- Name: SEQUENCE "messages_messageId_seq"; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON SEQUENCE public."messages_messageId_seq" TO postgres; +GRANT ALL ON SEQUENCE public."messages_messageId_seq" TO anon; +GRANT ALL ON SEQUENCE public."messages_messageId_seq" TO authenticated; +GRANT ALL ON SEQUENCE public."messages_messageId_seq" TO service_role; + + +-- +-- Name: TABLE posts; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON TABLE public.posts TO postgres; +GRANT ALL ON TABLE public.posts TO anon; +GRANT ALL ON TABLE public.posts TO authenticated; +GRANT ALL ON TABLE public.posts TO service_role; + + +-- +-- Name: SEQUENCE "posts_postId_seq"; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON SEQUENCE public."posts_postId_seq" TO postgres; +GRANT ALL ON SEQUENCE public."posts_postId_seq" TO anon; +GRANT ALL ON SEQUENCE public."posts_postId_seq" TO authenticated; +GRANT ALL ON SEQUENCE public."posts_postId_seq" TO service_role; + + +-- +-- Name: TABLE users; Type: ACL; Schema: public; Owner: supabase_admin +-- + +GRANT ALL ON TABLE public.users TO postgres; +GRANT ALL ON TABLE public.users TO anon; +GRANT ALL ON TABLE public.users TO authenticated; +GRANT ALL ON TABLE public.users TO service_role; + + +-- +-- Name: TABLE buckets; Type: ACL; Schema: storage; Owner: supabase_storage_admin +-- + +GRANT ALL ON TABLE storage.buckets TO anon; +GRANT ALL ON TABLE storage.buckets TO authenticated; +GRANT ALL ON TABLE storage.buckets TO service_role; + + +-- +-- Name: TABLE objects; Type: ACL; Schema: storage; Owner: supabase_storage_admin +-- + +GRANT ALL ON TABLE storage.objects TO anon; +GRANT ALL ON TABLE storage.objects TO authenticated; +GRANT ALL ON TABLE storage.objects TO service_role; + + +-- +-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: postgres +-- + +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; + + +-- +-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin +-- + +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public REVOKE ALL ON SEQUENCES FROM supabase_admin; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO postgres; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; + + +-- +-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: postgres +-- + +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public REVOKE ALL ON FUNCTIONS FROM PUBLIC; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; + + +-- +-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin +-- + +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public REVOKE ALL ON FUNCTIONS FROM PUBLIC; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public REVOKE ALL ON FUNCTIONS FROM supabase_admin; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO postgres; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; + + +-- +-- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: postgres +-- + +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO anon; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO authenticated; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO service_role; + + +-- +-- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin +-- + +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public REVOKE ALL ON TABLES FROM supabase_admin; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO postgres; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO anon; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO authenticated; +ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO service_role; + + +-- +-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: storage; Owner: postgres +-- + +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO anon; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO authenticated; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO service_role; + + +-- +-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: storage; Owner: postgres +-- + +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage REVOKE ALL ON FUNCTIONS FROM PUBLIC; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO anon; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO authenticated; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO service_role; + + +-- +-- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: storage; Owner: postgres +-- + +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO anon; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO authenticated; +ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO service_role; + + +-- +-- Name: api_restart; Type: EVENT TRIGGER; Schema: -; Owner: postgres +-- + +CREATE EVENT TRIGGER api_restart ON ddl_command_end + EXECUTE FUNCTION extensions.notify_api_restart(); + + +ALTER EVENT TRIGGER api_restart OWNER TO postgres; + +-- +-- PostgreSQL database dump complete +-- + diff --git a/package.json b/package.json index 6d4b7c4..a177cd3 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,6 @@ "metro-react-native-babel-preset": "^0.65.2", "prettier": "^2.2.1", "react-scripts": "^4.0.3", - "reactotron-react-native": "^5.0.0", "typescript": "^4.2.3", "url-loader": "^4.1.1" }, diff --git a/src/app/App.native.tsx b/src/app/App.native.tsx index 6f304af..d0d4e4d 100644 --- a/src/app/App.native.tsx +++ b/src/app/App.native.tsx @@ -11,6 +11,7 @@ import { import SwipeTabNavigation from "./Routes/MainSwipeNavigation"; import SignInNavigation from "./Routes/SignInNavigation"; import AppContextProvider, { AppContext } from "./utils/appContext"; + // eslint-disable-next-line no-undef const theme: ReactNativePaper.Theme = { ...DarkTheme, diff --git a/src/app/Screens/Explore/index.tsx b/src/app/Screens/Explore/index.tsx index 6b10b55..116da31 100644 --- a/src/app/Screens/Explore/index.tsx +++ b/src/app/Screens/Explore/index.tsx @@ -7,14 +7,9 @@ import { useWindowDimensions, TouchableHighlight, RefreshControl, -} from "react-native"; -import { - Caption, - IconButton, - Text, TextInput, - useTheme, -} from "react-native-paper"; +} from "react-native"; +import { Caption, IconButton, Text, useTheme } from "react-native-paper"; import { UserAvatar } from "../../Components/UserAvatar"; import { ExploreStackNavigationParams } from "../../types/navigation"; @@ -121,18 +116,21 @@ const Explore: React.FC = ({ navigation }) => { style={{ marginTop: 12, marginRight: 8 }} /> )} + setSearchFocused(true)} - // onBlur={() => setSearchFocused(false)} + placeholderTextColor={"gray"} value={searchTerm} + onFocus={() => setSearchFocused(true)} onChangeText={(text) => searchUser(text)} + style={{ + flex: 1, + height: 40, + backgroundColor: "#2a2a2a", + borderRadius: 12, + paddingHorizontal: 16, + color: colors.text, + }} /> {searchFocused ? ( diff --git a/src/app/Screens/Profile/Edit/index.tsx b/src/app/Screens/Profile/Edit/index.tsx index fa7cd08..81a73de 100644 --- a/src/app/Screens/Profile/Edit/index.tsx +++ b/src/app/Screens/Profile/Edit/index.tsx @@ -10,7 +10,7 @@ import { useTheme, } from "react-native-paper"; import { ProfileStackParams } from "../../../types/navigation"; -import { Image, StatusBar, ToastAndroid, View } from "react-native"; +import { Image, Keyboard, StatusBar, ToastAndroid, View } from "react-native"; import { AppContext } from "../../../utils/appContext"; import Icon from "react-native-vector-icons/Ionicons"; import ImagePicker, { @@ -19,7 +19,6 @@ import ImagePicker, { } from "react-native-image-crop-picker"; import { TouchableHighlight } from "react-native-gesture-handler"; -import "react-native-get-random-values"; import UsersStore from "../../../store/UsersStore"; import supabaseClient from "../../../utils/supabaseClient"; import { definitions } from "../../../types/supabase"; @@ -91,6 +90,7 @@ const EditProfile: React.FC = ({ navigation }) => { console.error("No email"); return; } + Keyboard.dismiss(); setLoading(true); if (username !== currentUser.username) { @@ -135,6 +135,7 @@ const EditProfile: React.FC = ({ navigation }) => { updateName(name); updateBio(bio); + updateUsername(username); if (userImagePath) updateProfilePic(userImagePath); diff --git a/src/app/Screens/Profile/Settings/index.tsx b/src/app/Screens/Profile/Settings/index.tsx index 75e3b93..45b8b53 100644 --- a/src/app/Screens/Profile/Settings/index.tsx +++ b/src/app/Screens/Profile/Settings/index.tsx @@ -2,7 +2,7 @@ import { StackNavigationProp } from "@react-navigation/stack"; import React, { useContext } from "react"; import { Appbar, List, useTheme } from "react-native-paper"; import { ProfileStackParams } from "../../../types/navigation"; -import { StatusBar, View } from "react-native"; +import { Alert, Linking, StatusBar, View } from "react-native"; import { AppContext } from "../../../utils/appContext"; type Props = { @@ -12,7 +12,34 @@ const Settings: React.FC = ({ navigation }) => { const goBack = () => navigation.goBack(); const { colors } = useTheme(); const { signout } = useContext(AppContext); - const signOut = () => signout(); + + const openCode = async () => { + const supported = await Linking.canOpenURL( + "https://github.com/NiketanG/instaclone" + ); + if (supported) { + Linking.openURL("https://github.com/NiketanG/instaclone"); + } + }; + const signOut = () => + Alert.alert( + "Are you sure you wanna log out?", + "You will have to log in again to use the app", + [ + { + text: "Cancel", + style: "cancel", + }, + { + text: "Ok", + style: "destructive", + onPress: signout, + }, + ], + { + cancelable: true, + } + ); return ( <> @@ -36,6 +63,11 @@ const Settings: React.FC = ({ navigation }) => { onPress={signOut} left={(props) => } /> + } + /> ); diff --git a/src/app/utils/ReactotronConfig.ts b/src/app/utils/ReactotronConfig.ts deleted file mode 100644 index 415fdc6..0000000 --- a/src/app/utils/ReactotronConfig.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Reactotron from "reactotron-react-native"; -import AsyncStorage from "@react-native-async-storage/async-storage"; - -Reactotron.configure() // controls connection & communication settings - .useReactNative() // add all built-in react native plugins - .asyncStorageHandler(AsyncStorage) - .connect(); diff --git a/src/app/utils/supabaseUtils.ts b/src/app/utils/supabaseUtils.ts index 6034591..3acbe19 100644 --- a/src/app/utils/supabaseUtils.ts +++ b/src/app/utils/supabaseUtils.ts @@ -385,6 +385,8 @@ export const fetchUserFromDb = async ( export const editUserInDb = async (username: string, newData: User) => { if (!username) return null; try { + console.log("username", username); + console.log("newData", newData); const res = await supabaseClient .from("users") .update({ diff --git a/yarn.lock b/yarn.lock index 9c63b4d..3171b09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9118,11 +9118,6 @@ mississippi@^3.0.0: stream-each "^1.1.0" through2 "^2.0.0" -mitt@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/mitt/-/mitt-1.1.3.tgz#528c506238a05dce11cd914a741ea2cc332da9b8" - integrity sha512-mUDCnVNsAi+eD6qA0HkRkwYczbLHJ49z17BGe2PYRhZL4wpZUFZGJHU7/5tmvohoma+Hdn0Vh/oJTiPEmgSruA== - mixin-deep@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" @@ -10885,15 +10880,6 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -query-string@6.10.1: - version "6.10.1" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.10.1.tgz#30b3505f6fca741d5ae541964d1b3ae9dc2a0de8" - integrity sha512-SHTUV6gDlgMXg/AQUuLpTiBtW/etZ9JT6k6RCtCyqADquApLX0Aq5oK/s5UeTUAWBG50IExjIr587GqfXRfM4A== - dependencies: - decode-uri-component "^0.2.0" - split-on-first "^1.0.0" - strict-uri-encode "^2.0.0" - query-string@^4.1.0: version "4.3.4" resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb" @@ -11080,11 +11066,6 @@ react-native-config@^1.4.2: resolved "https://registry.yarnpkg.com/react-native-config/-/react-native-config-1.4.2.tgz#cc39f22ed72c5cb06af1adf0ba70ef01593900b4" integrity sha512-iTvCvThvFTH7SdiBcsxYtpLy86zglsh51ZBqFPPZ75tdrQMdlRnDNnb86kNjQf03KT0qs1nCMLRejfPMIim8iA== -react-native-flipper@^0.34.0: - version "0.34.0" - resolved "https://registry.yarnpkg.com/react-native-flipper/-/react-native-flipper-0.34.0.tgz#7df1f38ba5d97a9321125fe0fccbe47d99e6fa1d" - integrity sha512-48wgm29HJTOlZ0DibBsvXueEOY0EPIVL0wWKbwRfgrk86+luSEuLW3aZC50oJa95zSFb9qYShTV/6dWqh4Jamg== - react-native-gesture-handler@^1.10.3: version "1.10.3" resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.10.3.tgz#942bbf2963bbf49fa79593600ee9d7b5dab3cfc0" @@ -11311,23 +11292,6 @@ react@17.0.2: loose-envify "^1.1.0" object-assign "^4.1.1" -reactotron-core-client@2.8.10: - version "2.8.10" - resolved "https://registry.yarnpkg.com/reactotron-core-client/-/reactotron-core-client-2.8.10.tgz#798f2a7aa9fd7e18e7a510531a613e8ae3008eb0" - integrity sha512-SYRO4OCutJzfWMnaULUGVyETZnMDCU5ECNflXyM3Z5Gnfxp/wV6d7jYonhfxHdpU/aGb4Eg15C22myOCXSu6HQ== - -reactotron-react-native@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/reactotron-react-native/-/reactotron-react-native-5.0.0.tgz#e495630927cb720940f5d8cc7d768f162b32c1a7" - integrity sha512-7nLrMkLXU9jiHymbB6oBqf8z+vww1AbDcUdMmLqX0obdIHyC8XJB0yRazWajKQC92kamkL+q2q4mH9HRSsYCEA== - dependencies: - mitt "1.1.3" - query-string "6.10.1" - reactotron-core-client "2.8.10" - rn-host-detect "1.2.0" - optionalDependencies: - react-native-flipper "^0.34.0" - read-pkg-up@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" @@ -11765,11 +11729,6 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rn-host-detect@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/rn-host-detect/-/rn-host-detect-1.2.0.tgz#8b0396fc05631ec60c1cb8789e5070cdb04d0da0" - integrity sha512-btNg5kzHcjZZ7t7mvvV/4wNJ9e3MPgrWivkRgWURzXL0JJ0pwWlU4zrbmdlz3HHzHOxhBhHB4D+/dbMFfu4/4A== - rollup-plugin-babel@^4.3.3: version "4.4.0" resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz#d15bd259466a9d1accbdb2fe2fff17c52d030acb"