about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.env1
-rw-r--r--.env.development1
-rw-r--r--.env.production1
-rw-r--r--babel.config.js2
-rw-r--r--package.json2
-rw-r--r--src/env.native.ts13
-rw-r--r--src/env.ts11
-rw-r--r--src/state/index.ts10
-rw-r--r--src/view/screens/Home.tsx6
-rw-r--r--src/view/screens/Login.tsx5
-rw-r--r--todos.txt5
11 files changed, 42 insertions, 15 deletions
diff --git a/.env b/.env
deleted file mode 100644
index bed6a2d88..000000000
--- a/.env
+++ /dev/null
@@ -1 +0,0 @@
-REACT_APP_AUTH_LOBBY = 'http://localhost:3001'
diff --git a/.env.development b/.env.development
new file mode 100644
index 000000000..d0f279676
--- /dev/null
+++ b/.env.development
@@ -0,0 +1 @@
+REACT_APP_BUILD = 'staging'
diff --git a/.env.production b/.env.production
new file mode 100644
index 000000000..d0f279676
--- /dev/null
+++ b/.env.production
@@ -0,0 +1 @@
+REACT_APP_BUILD = 'staging'
diff --git a/babel.config.js b/babel.config.js
index c21f570c3..16f63e6c1 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -4,7 +4,7 @@ module.exports = {
     [
       'module:react-native-dotenv',
       {
-        // envName: 'APP_ENV',
+        envName: 'APP_ENV',
         moduleName: '@env',
         path: '.env',
         blocklist: null,
diff --git a/package.json b/package.json
index df93583c7..bac4265f1 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
     "ios": "react-native run-ios --simulator=\"iPhone 14\"",
     "web": "react-scripts start",
     "start": "react-native start",
-    "dev-env": "dev-env",
+    "clean-cache": "rm -rf node_modules/.cache/babel-loader/*",
     "test": "jest",
     "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
   },
diff --git a/src/env.native.ts b/src/env.native.ts
index 581b211ca..a2ec3a4dc 100644
--- a/src/env.native.ts
+++ b/src/env.native.ts
@@ -1,8 +1,13 @@
 // @ts-ignore types not available -prf
-import {REACT_APP_AUTH_LOBBY} from '@env'
+import {REACT_APP_BUILD} from '@env'
 
-if (typeof REACT_APP_AUTH_LOBBY !== 'string') {
-  throw new Error('ENV: No auth lobby provided')
+if (typeof REACT_APP_BUILD !== 'string') {
+  throw new Error('ENV: No env provided')
+}
+if (!['dev', 'staging', 'prod'].includes(REACT_APP_BUILD)) {
+  throw new Error(
+    `ENV: Env must be "dev", "staging", or "prod," got "${REACT_APP_BUILD}"`,
+  )
 }
 
-export const AUTH_LOBBY = REACT_APP_AUTH_LOBBY
+export const BUILD = REACT_APP_BUILD
diff --git a/src/env.ts b/src/env.ts
index 78fb88acc..a379e435f 100644
--- a/src/env.ts
+++ b/src/env.ts
@@ -1,5 +1,10 @@
-if (typeof process.env.REACT_APP_AUTH_LOBBY !== 'string') {
-  throw new Error('ENV: No auth lobby provided')
+if (typeof process.env.REACT_APP_BUILD !== 'string') {
+  throw new Error('ENV: No env provided')
+}
+if (!['dev', 'staging', 'prod'].includes(process.env.REACT_APP_BUILD)) {
+  throw new Error(
+    `ENV: Env must be "dev", "staging", or "prod," got "${process.env.REACT_APP_BUILD}"`,
+  )
 }
 
-export const AUTH_LOBBY = process.env.REACT_APP_AUTH_LOBBY
+export const BUILD = process.env.REACT_APP_BUILD
diff --git a/src/state/index.ts b/src/state/index.ts
index 2c3df7d07..a886e7611 100644
--- a/src/state/index.ts
+++ b/src/state/index.ts
@@ -3,8 +3,14 @@ import {sessionClient as AtpApi} from '../third-party/api'
 import {RootStoreModel} from './models/root-store'
 import * as libapi from './lib/api'
 import * as storage from './lib/storage'
-
-export const DEFAULT_SERVICE = 'http://localhost:2583'
+import {BUILD} from '../env'
+
+export const DEFAULT_SERVICE =
+  BUILD === 'prod'
+    ? 'http://localhost:2583' // TODO
+    : BUILD === 'staging'
+    ? 'https://pds.staging.bsky.dev' // TODO
+    : 'http://localhost:2583'
 const ROOT_STATE_STORAGE_KEY = 'root'
 const STATE_FETCH_INTERVAL = 15e3
 
diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx
index 178b01dc2..9fca96461 100644
--- a/src/view/screens/Home.tsx
+++ b/src/view/screens/Home.tsx
@@ -8,6 +8,7 @@ import {useStores} from '../../state'
 import {FeedModel} from '../../state/models/feed-view'
 import {ScreenParams} from '../routes'
 import {s} from '../lib/styles'
+import {BUILD} from '../../env'
 
 export const Home = observer(function Home({
   visible,
@@ -53,7 +54,10 @@ export const Home = observer(function Home({
 
   return (
     <View style={s.flex1}>
-      <ViewHeader title="Bluesky" subtitle="Private Beta" />
+      <ViewHeader
+        title="Bluesky"
+        subtitle={`Private Beta${BUILD !== 'prod' ? ` [${BUILD}]` : ''}`}
+      />
       <Feed key="default" feed={defaultFeedView} scrollElRef={scrollElRef} />
       <FAB icon="pen-nib" onPress={onComposePress} />
     </View>
diff --git a/src/view/screens/Login.tsx b/src/view/screens/Login.tsx
index 759efd435..e386c8548 100644
--- a/src/view/screens/Login.tsx
+++ b/src/view/screens/Login.tsx
@@ -18,6 +18,7 @@ import {s, colors} from '../lib/styles'
 import {makeValidHandle, createFullHandle} from '../lib/strings'
 import {useStores, DEFAULT_SERVICE} from '../../state'
 import {ServiceDescription} from '../../state/models/session'
+import {BUILD} from '../../env'
 
 enum ScreenState {
   SigninOrCreateAccount,
@@ -71,7 +72,9 @@ const SigninOrCreateAccount = ({
       <View style={styles.hero}>
         <Logo />
         <Text style={styles.title}>Bluesky</Text>
-        <Text style={styles.subtitle}>[ private beta ]</Text>
+        <Text style={styles.subtitle}>
+          [ private beta {BUILD !== 'prod' ? `- ${BUILD} ` : ''}]
+        </Text>
       </View>
       <View style={s.flex1}>
         <TouchableOpacity style={styles.btn} onPress={onPressCreateAccount}>
diff --git a/todos.txt b/todos.txt
index cac992e4b..e9879bf4c 100644
--- a/todos.txt
+++ b/todos.txt
@@ -33,4 +33,7 @@ Paul's todo list
 - Bugs
   - Auth token refresh seems broken
   - Check that sub components arent reloading too much
-  - Titles are getting screwed up (possibly swipe related)
\ No newline at end of file
+  - Titles are getting screwed up (possibly swipe related)
+  > Dont suggest self for follows
+  > Double post on post?
+  > Handle no displayname everywhere
\ No newline at end of file