Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=
EXPO_PUBLIC_SUPABASE_URL=
EXPO_PUBLIC_SUPABASE_ANON_KEY=
EXPO_PUBLIC_ACCOUNT_DELETION_URL=

# Server-side only. Set these in Supabase Edge Function secrets, never in Expo public env.
SUPABASE_SERVICE_ROLE_KEY=
CLERK_SECRET_KEY=
62 changes: 29 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,46 @@
# Welcome to your Expo app 👋
# DearDiary

This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).
DearDiary is an Expo, React Native, TypeScript, Expo Router, NativeWind, Zustand, Clerk, and Supabase journaling app.

## Get started
## Setup

1. Install dependencies

```bash
npm install
```

2. Start the app

```bash
npx expo start
```
```bash
npm install
```

In the output, you'll find options to open the app in a
Copy `.env.example` to your local environment file and fill the public Expo values. Keep server secrets out of the mobile app.

- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
## Account Deletion

You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
The app includes a production-readiness deletion flow:

## Get a fresh project
- Profile action: **Delete My Data and Account**
- Supabase Edge Function: `delete-account`
- Database RPC: `delete_deardiary_user_data(target_user_id)`
- Local cleanup: `lib/account/clearLocalUserData.ts`

When you're ready, run:
Required Edge Function secrets:

```bash
npm run reset-project
```txt
SUPABASE_URL
SUPABASE_SERVICE_ROLE_KEY
CLERK_SECRET_KEY
```

This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
Deploy the function and migration with your normal Supabase workflow. Do not put service-role or Clerk secret keys in `EXPO_PUBLIC_*` variables.

## Learn more
Related docs:

To learn more about developing your project with Expo, look at the following resources:
- `docs/user-data-inventory.md`
- `docs/database.md`
- `docs/privacy.md`
- `docs/play-store-account-deletion.md`

- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
## Legal Drafts

## Join the community
Privacy Policy and Terms screens exist at:

Join our community of developers creating universal apps.
- `/legal/privacy-policy`
- `/legal/terms`

- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
They contain visible placeholders and require legal review before public release.
2 changes: 2 additions & 0 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function RootNavigator() {
options={{ headerShown: false }}
/>
<Stack.Screen name="journal" options={{ headerShown: false }} />
<Stack.Screen name="legal/privacy-policy" options={{ headerShown: false }} />
<Stack.Screen name="legal/terms" options={{ headerShown: false }} />
<Stack.Screen name="settings" options={{ headerShown: false }} />
</Stack>
);
Expand Down
17 changes: 17 additions & 0 deletions app/legal/privacy-policy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LegalDocumentScreen } from "@/components/legal/legal-document-screen";
import { privacyPolicy } from "@/content/legal/privacyPolicy";

const accountDeletionUrl =
process.env.EXPO_PUBLIC_ACCOUNT_DELETION_URL?.trim() || null;

export default function PrivacyPolicyScreen() {
return (
<LegalDocumentScreen
accountDeletionUrl={accountDeletionUrl}
effectiveDate={privacyPolicy.effectiveDate}
sections={privacyPolicy.sections}
title={privacyPolicy.title}
version={privacyPolicy.version}
/>
);
}
13 changes: 13 additions & 0 deletions app/legal/terms.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { LegalDocumentScreen } from "@/components/legal/legal-document-screen";
import { termsAndConditions } from "@/content/legal/termsAndConditions";

export default function TermsScreen() {
return (
<LegalDocumentScreen
effectiveDate={termsAndConditions.effectiveDate}
sections={termsAndConditions.sections}
title={termsAndConditions.title}
version={termsAndConditions.version}
/>
);
}
34 changes: 34 additions & 0 deletions app/settings/privacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import { useAppLockSettings } from "@/hooks/useAppLockSettings";
import type { AppLockDelay } from "@/types/appLock";

const changePinHref = "/settings/app-lock/change-pin" as Href;
const privacyPolicyHref = "/legal/privacy-policy" as Href;
const termsHref = "/legal/terms" as Href;
const accountDeletionUrl =
process.env.EXPO_PUBLIC_ACCOUNT_DELETION_URL?.trim() || null;

const delayOptions: { label: string; value: AppLockDelay }[] = [
{ label: "Immediately", value: "immediately" },
Expand Down Expand Up @@ -90,6 +94,36 @@ export default function PrivacySettingsScreen() {
</View>

<View className="pt-9">
<SectionTitle>Privacy & Data</SectionTitle>
<SettingsCard>
<SettingsRow
icon="file-text"
label="Privacy Policy"
onPress={() => router.push(privacyPolicyHref)}
value=""
/>
<Divider />
<SettingsRow
icon="clipboard"
label="Terms & Conditions"
onPress={() => router.push(termsHref)}
value=""
/>
{accountDeletionUrl ? (
<>
<Divider />
<SettingsRow
icon="external-link"
label="External Deletion Page"
onPress={() => router.push(privacyPolicyHref)}
value="View"
/>
Comment thread
aryansoni-dev marked this conversation as resolved.
</>
) : null}
</SettingsCard>
</View>

<View className="pt-8">
<SettingsCard>
<SettingsRow
icon="lock"
Expand Down
Loading