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 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'

View File

@ -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),

View File

@ -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}

View File

@ -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 = () => {

View File

@ -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...',

View File

@ -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}