diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/build-flags.ts | 2 | ||||
-rw-r--r-- | src/state/index.ts | 1 | ||||
-rw-r--r-- | src/state/models/navigation.ts | 11 | ||||
-rw-r--r-- | src/view/com/modals/ServerInput.tsx | 4 | ||||
-rw-r--r-- | src/view/com/onboard/FeatureExplainer.tsx | 5 | ||||
-rw-r--r-- | src/view/com/util/DropdownBtn.tsx | 17 | ||||
-rw-r--r-- | src/view/shell/mobile/index.tsx | 13 |
7 files changed, 35 insertions, 18 deletions
diff --git a/src/build-flags.ts b/src/build-flags.ts new file mode 100644 index 000000000..155230e5d --- /dev/null +++ b/src/build-flags.ts @@ -0,0 +1,2 @@ +export const LOGIN_INCLUDE_DEV_SERVERS = true +export const TABS_ENABLED = false diff --git a/src/state/index.ts b/src/state/index.ts index fd81bc842..872cd69f6 100644 --- a/src/state/index.ts +++ b/src/state/index.ts @@ -5,7 +5,6 @@ import {RootStoreModel} from './models/root-store' import * as libapi from './lib/api' import * as storage from './lib/storage' -export const IS_PROD_BUILD = true export const LOCAL_DEV_SERVICE = 'http://localhost:2583' export const STAGING_SERVICE = 'https://pds.staging.bsky.dev' export const PROD_SERVICE = 'https://bsky.social' diff --git a/src/state/models/navigation.ts b/src/state/models/navigation.ts index 0ec097afc..758ae37d8 100644 --- a/src/state/models/navigation.ts +++ b/src/state/models/navigation.ts @@ -1,5 +1,5 @@ import {makeAutoObservable} from 'mobx' -import {isObj, hasProp} from '../lib/type-guards' +import {TABS_ENABLED} from '../../build-flags' let __id = 0 function genId() { @@ -226,6 +226,9 @@ export class NavigationModel { // = newTab(url: string, title?: string) { + if (!TABS_ENABLED) { + return this.navigate(url) + } const tab = new NavigationTabModel() tab.navigate(url, title) tab.isNewTab = true @@ -234,10 +237,16 @@ export class NavigationModel { } setActiveTab(tabIndex: number) { + if (!TABS_ENABLED) { + return + } this.tabIndex = Math.max(Math.min(tabIndex, this.tabs.length - 1), 0) } closeTab(tabIndex: number) { + if (!TABS_ENABLED) { + return + } this.tabs = [ ...this.tabs.slice(0, tabIndex), ...this.tabs.slice(tabIndex + 1), diff --git a/src/view/com/modals/ServerInput.tsx b/src/view/com/modals/ServerInput.tsx index 0aa1a07e2..c885ff164 100644 --- a/src/view/com/modals/ServerInput.tsx +++ b/src/view/com/modals/ServerInput.tsx @@ -5,11 +5,11 @@ import {BottomSheetScrollView, BottomSheetTextInput} from '@gorhom/bottom-sheet' import {useStores} from '../../../state' import {s, colors} from '../../lib/styles' import { - IS_PROD_BUILD, LOCAL_DEV_SERVICE, STAGING_SERVICE, PROD_SERVICE, } from '../../../state/index' +import {LOGIN_INCLUDE_DEV_SERVERS} from '../../../build-flags' export const snapPoints = ['80%'] @@ -36,7 +36,7 @@ export function Component({ <Text style={[s.textCenter, s.bold, s.f18]}>Choose Service</Text> <BottomSheetScrollView style={styles.inner}> <View style={styles.group}> - {!IS_PROD_BUILD ? ( + {LOGIN_INCLUDE_DEV_SERVERS ? ( <> <TouchableOpacity style={styles.btn} diff --git a/src/view/com/onboard/FeatureExplainer.tsx b/src/view/com/onboard/FeatureExplainer.tsx index 0f8c52ea5..d9f70cf4f 100644 --- a/src/view/com/onboard/FeatureExplainer.tsx +++ b/src/view/com/onboard/FeatureExplainer.tsx @@ -15,6 +15,7 @@ import {UserGroupIcon} from '../../lib/icons' import {useStores} from '../../../state' import {s} from '../../lib/styles' import {SCENE_EXPLAINER, TABS_EXPLAINER} from '../../lib/assets' +import {TABS_ENABLED} from '../../../build-flags' const Intro = () => ( <View style={styles.explainer}> @@ -85,8 +86,8 @@ export const FeatureExplainer = () => { const routes = [ {key: 'intro', title: 'Intro'}, {key: 'scenes', title: 'Scenes'}, - {key: 'tabs', title: 'Tabs'}, - ] + TABS_ENABLED ? {key: 'tabs', title: 'Tabs'} : undefined, + ].filter(Boolean) const onPressSkip = () => store.onboard.next() const onPressNext = () => { diff --git a/src/view/com/util/DropdownBtn.tsx b/src/view/com/util/DropdownBtn.tsx index bef193f1d..85e8453fd 100644 --- a/src/view/com/util/DropdownBtn.tsx +++ b/src/view/com/util/DropdownBtn.tsx @@ -14,6 +14,7 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {colors} from '../../lib/styles' import {useStores} from '../../../state' import {SharePostModel, ConfirmModel} from '../../../state/models/shell-ui' +import {TABS_ENABLED} from '../../../build-flags' export interface DropdownItem { icon?: IconProp @@ -82,13 +83,15 @@ export function PostDropdownBtn({ const store = useStores() const dropdownItems: DropdownItem[] = [ - { - icon: ['far', 'clone'], - label: 'Open in new tab', - onPress() { - store.nav.newTab(itemHref) - }, - }, + TABS_ENABLED + ? { + icon: ['far', 'clone'], + label: 'Open in new tab', + onPress() { + store.nav.newTab(itemHref) + }, + } + : undefined, { icon: 'share', label: 'Share...', diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx index e0f7c07aa..32b1f35dd 100644 --- a/src/view/shell/mobile/index.tsx +++ b/src/view/shell/mobile/index.tsx @@ -26,6 +26,7 @@ import Animated, { } from 'react-native-reanimated' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {IconProp} from '@fortawesome/fontawesome-svg-core' +import {TABS_ENABLED} from '../../../build-flags' import {useStores} from '../../../state' import {NavigationModel} from '../../../state/models/navigation' import {match, MatchResult} from '../../routes' @@ -331,11 +332,13 @@ export const MobileShell: React.FC = observer(() => { onPress={onPressSearch} onLongPress={doNewTab('/search')} /> - <Btn - icon={isTabsSelectorActive ? 'clone' : ['far', 'clone']} - onPress={onPressTabs} - tabCount={store.nav.tabCount} - /> + {TABS_ENABLED ? ( + <Btn + icon={isTabsSelectorActive ? 'clone' : ['far', 'clone']} + onPress={onPressTabs} + tabCount={store.nav.tabCount} + /> + ) : undefined} <Btn icon={isAtNotifications ? 'bell-solid' : 'bell'} onPress={onPressNotifications} |