Add build flags and disable tabs for now

zio/stable
Paul Frazee 2022-11-20 12:00:40 -06:00
parent 63348807b5
commit a21bcf10dd
7 changed files with 35 additions and 18 deletions

View File

@ -0,0 +1,2 @@
export const LOGIN_INCLUDE_DEV_SERVERS = true
export const TABS_ENABLED = false

View File

@ -5,7 +5,6 @@ import {RootStoreModel} from './models/root-store'
import * as libapi from './lib/api' import * as libapi from './lib/api'
import * as storage from './lib/storage' import * as storage from './lib/storage'
export const IS_PROD_BUILD = true
export const LOCAL_DEV_SERVICE = 'http://localhost:2583' export const LOCAL_DEV_SERVICE = 'http://localhost:2583'
export const STAGING_SERVICE = 'https://pds.staging.bsky.dev' export const STAGING_SERVICE = 'https://pds.staging.bsky.dev'
export const PROD_SERVICE = 'https://bsky.social' export const PROD_SERVICE = 'https://bsky.social'

View File

@ -1,5 +1,5 @@
import {makeAutoObservable} from 'mobx' import {makeAutoObservable} from 'mobx'
import {isObj, hasProp} from '../lib/type-guards' import {TABS_ENABLED} from '../../build-flags'
let __id = 0 let __id = 0
function genId() { function genId() {
@ -226,6 +226,9 @@ export class NavigationModel {
// = // =
newTab(url: string, title?: string) { newTab(url: string, title?: string) {
if (!TABS_ENABLED) {
return this.navigate(url)
}
const tab = new NavigationTabModel() const tab = new NavigationTabModel()
tab.navigate(url, title) tab.navigate(url, title)
tab.isNewTab = true tab.isNewTab = true
@ -234,10 +237,16 @@ export class NavigationModel {
} }
setActiveTab(tabIndex: number) { setActiveTab(tabIndex: number) {
if (!TABS_ENABLED) {
return
}
this.tabIndex = Math.max(Math.min(tabIndex, this.tabs.length - 1), 0) this.tabIndex = Math.max(Math.min(tabIndex, this.tabs.length - 1), 0)
} }
closeTab(tabIndex: number) { closeTab(tabIndex: number) {
if (!TABS_ENABLED) {
return
}
this.tabs = [ this.tabs = [
...this.tabs.slice(0, tabIndex), ...this.tabs.slice(0, tabIndex),
...this.tabs.slice(tabIndex + 1), ...this.tabs.slice(tabIndex + 1),

View File

@ -5,11 +5,11 @@ import {BottomSheetScrollView, BottomSheetTextInput} from '@gorhom/bottom-sheet'
import {useStores} from '../../../state' import {useStores} from '../../../state'
import {s, colors} from '../../lib/styles' import {s, colors} from '../../lib/styles'
import { import {
IS_PROD_BUILD,
LOCAL_DEV_SERVICE, LOCAL_DEV_SERVICE,
STAGING_SERVICE, STAGING_SERVICE,
PROD_SERVICE, PROD_SERVICE,
} from '../../../state/index' } from '../../../state/index'
import {LOGIN_INCLUDE_DEV_SERVERS} from '../../../build-flags'
export const snapPoints = ['80%'] export const snapPoints = ['80%']
@ -36,7 +36,7 @@ export function Component({
<Text style={[s.textCenter, s.bold, s.f18]}>Choose Service</Text> <Text style={[s.textCenter, s.bold, s.f18]}>Choose Service</Text>
<BottomSheetScrollView style={styles.inner}> <BottomSheetScrollView style={styles.inner}>
<View style={styles.group}> <View style={styles.group}>
{!IS_PROD_BUILD ? ( {LOGIN_INCLUDE_DEV_SERVERS ? (
<> <>
<TouchableOpacity <TouchableOpacity
style={styles.btn} style={styles.btn}

View File

@ -15,6 +15,7 @@ import {UserGroupIcon} from '../../lib/icons'
import {useStores} from '../../../state' import {useStores} from '../../../state'
import {s} from '../../lib/styles' import {s} from '../../lib/styles'
import {SCENE_EXPLAINER, TABS_EXPLAINER} from '../../lib/assets' import {SCENE_EXPLAINER, TABS_EXPLAINER} from '../../lib/assets'
import {TABS_ENABLED} from '../../../build-flags'
const Intro = () => ( const Intro = () => (
<View style={styles.explainer}> <View style={styles.explainer}>
@ -85,8 +86,8 @@ export const FeatureExplainer = () => {
const routes = [ const routes = [
{key: 'intro', title: 'Intro'}, {key: 'intro', title: 'Intro'},
{key: 'scenes', title: 'Scenes'}, {key: 'scenes', title: 'Scenes'},
{key: 'tabs', title: 'Tabs'}, TABS_ENABLED ? {key: 'tabs', title: 'Tabs'} : undefined,
] ].filter(Boolean)
const onPressSkip = () => store.onboard.next() const onPressSkip = () => store.onboard.next()
const onPressNext = () => { const onPressNext = () => {

View File

@ -14,6 +14,7 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {colors} from '../../lib/styles' import {colors} from '../../lib/styles'
import {useStores} from '../../../state' import {useStores} from '../../../state'
import {SharePostModel, ConfirmModel} from '../../../state/models/shell-ui' import {SharePostModel, ConfirmModel} from '../../../state/models/shell-ui'
import {TABS_ENABLED} from '../../../build-flags'
export interface DropdownItem { export interface DropdownItem {
icon?: IconProp icon?: IconProp
@ -82,13 +83,15 @@ export function PostDropdownBtn({
const store = useStores() const store = useStores()
const dropdownItems: DropdownItem[] = [ const dropdownItems: DropdownItem[] = [
{ TABS_ENABLED
? {
icon: ['far', 'clone'], icon: ['far', 'clone'],
label: 'Open in new tab', label: 'Open in new tab',
onPress() { onPress() {
store.nav.newTab(itemHref) store.nav.newTab(itemHref)
}, },
}, }
: undefined,
{ {
icon: 'share', icon: 'share',
label: 'Share...', label: 'Share...',

View File

@ -26,6 +26,7 @@ import Animated, {
} from 'react-native-reanimated' } from 'react-native-reanimated'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {IconProp} from '@fortawesome/fontawesome-svg-core' import {IconProp} from '@fortawesome/fontawesome-svg-core'
import {TABS_ENABLED} from '../../../build-flags'
import {useStores} from '../../../state' import {useStores} from '../../../state'
import {NavigationModel} from '../../../state/models/navigation' import {NavigationModel} from '../../../state/models/navigation'
import {match, MatchResult} from '../../routes' import {match, MatchResult} from '../../routes'
@ -331,11 +332,13 @@ export const MobileShell: React.FC = observer(() => {
onPress={onPressSearch} onPress={onPressSearch}
onLongPress={doNewTab('/search')} onLongPress={doNewTab('/search')}
/> />
{TABS_ENABLED ? (
<Btn <Btn
icon={isTabsSelectorActive ? 'clone' : ['far', 'clone']} icon={isTabsSelectorActive ? 'clone' : ['far', 'clone']}
onPress={onPressTabs} onPress={onPressTabs}
tabCount={store.nav.tabCount} tabCount={store.nav.tabCount}
/> />
) : undefined}
<Btn <Btn
icon={isAtNotifications ? 'bell-solid' : 'bell'} icon={isAtNotifications ? 'bell-solid' : 'bell'}
onPress={onPressNotifications} onPress={onPressNotifications}