Skip to content

Commit

Permalink
Hide beta features for production on iOS
Browse files Browse the repository at this point in the history
Closes #1

List of changes:
 - Add isIOSProduction function in Properties service
 - Hide beta features in the Home, Discover, Learn and Play modules
   if the app is running in production on iOS
  • Loading branch information
chico committed May 26, 2019
1 parent 90cebc5 commit e63bc34
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 100 deletions.
50 changes: 27 additions & 23 deletions App/Modules/Discover/Home/Screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { Component } from 'react'
import { ScrollView } from 'react-native'
import PropTypes from 'prop-types'

import { isIOSProduction } from 'App/Services/Properties'

import {
Container,
Footer,
Expand All @@ -27,29 +29,31 @@ export default class Screen extends Component {
onPress } = this.props
return (
<Container>
<ScrollView style={{ marginBottom: 210 }}>
<List title='Featured' cols={2}>
<FeaturedListItem
image={Images.featured.led}
title='Blink'
onPress={() => { onPress('Blink') }} />
<FeaturedListItem
icon={'heartbeat'}
iconColor={Colors.red}
title='Heart Beat'
onPress={() => { onPress('Heart Beat') }} />
</List>
<List title='Projects'>
<CompactListItem
icon='circle-o'
title='Hello World'
onPress={() => { onPress('Hello World') }} />
<CompactListItem
icon='circle-o'
title='Dance Show'
onPress={() => { onPress('Dance Show') }} />
</List>
</ScrollView>
{!isIOSProduction() &&
<ScrollView style={{ marginBottom: 210 }}>
<List title='Featured' cols={2}>
<FeaturedListItem
image={Images.featured.led}
title='Blink'
onPress={() => { onPress('Blink') }} />
<FeaturedListItem
icon={'heartbeat'}
iconColor={Colors.red}
title='Heart Beat'
onPress={() => { onPress('Heart Beat') }} />
</List>
<List title='Projects'>
<CompactListItem
icon='circle-o'
title='Hello World'
onPress={() => { onPress('Hello World') }} />
<CompactListItem
icon='circle-o'
title='Dance Show'
onPress={() => { onPress('Dance Show') }} />
</List>
</ScrollView>
}
<Modal
navigation={this.props.navigation}
show={showNotReadyModal}
Expand Down
67 changes: 45 additions & 22 deletions App/Modules/Home/Screen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'

import { isIOSProduction } from 'App/Services/Properties'

import { Container, List, ListItem, BottomNav } from 'App/Components'

export default class Screen extends Component {
Expand All @@ -12,28 +14,49 @@ export default class Screen extends Component {
const { onNavigatePress } = this.props
return (
<Container>
<List>
<ListItem
title='Play & Explore'
text='Let’s play'
button='Play'
onPress={() => { onNavigatePress('PlayScreen') }} />
<ListItem
title='Discover'
text='Let’s see what you can do'
button='Discover'
onPress={() => { onNavigatePress('DiscoverScreen') }} />
<ListItem
title='Learn'
text='You’ll be a guru in no time'
button='Learn'
onPress={() => { onNavigatePress('LearnScreen') }} />
<ListItem
title='Lab'
text='Get under the hood'
button='Lab'
onPress={() => { onNavigatePress('LabScreen') }} />
</List>
{!isIOSProduction() &&
<List>
<ListItem
title='Play & Explore'
text='Let’s play'
button='Play'
onPress={() => { onNavigatePress('PlayScreen') }} />
<ListItem
title='Discover'
text='Let’s see what you can do'
button='Discover'
onPress={() => { onNavigatePress('DiscoverScreen') }} />
<ListItem
title='Learn'
text='You’ll be a guru in no time'
button='Learn'
onPress={() => { onNavigatePress('LearnScreen') }} />
<ListItem
title='Lab'
text='Get under the hood'
button='Lab'
onPress={() => { onNavigatePress('LabScreen') }} />
</List>
}
{isIOSProduction() &&
<List>
<ListItem
title='Play & Explore'
text='Let’s play'
button='Play'
onPress={() => { onNavigatePress('PlayScreen') }} />
<ListItem
title='Discover'
text='Let’s see what you can do'
button='Discover'
onPress={() => { onNavigatePress('DiscoverScreen') }} />
<ListItem
title='Learn'
text='You’ll be a guru in no time'
button='Learn'
onPress={() => { onNavigatePress('LearnScreen') }} />
</List>
}
<BottomNav
onRatePress={() => { onNavigatePress('RateScreen') }}
onHomePress={() => {}}
Expand Down
51 changes: 32 additions & 19 deletions App/Modules/Learn/Lessons/Screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { Component } from 'react'
import { ScrollView } from 'react-native'
import PropTypes from 'prop-types'

import { isIOSProduction } from 'App/Services/Properties'

import {
Container,
Footer,
Expand All @@ -28,25 +30,36 @@ export default class Screen extends Component {
return (
<Container>
<ScrollView style={{ marginBottom: 210 }}>
<List>
<ListHeader title='Lessons' />
<CompactListItem
icon='circle-o'
title='Get Started'
onPress={() => { onPress('Get Started') }} />
<CompactListItem
icon='circle-o'
title='Play Time'
onPress={() => { onPress('Play Time') }} />
<CompactListItem
icon='circle-o'
title='Customize'
onPress={() => { onPress('Customize') }} />
<CompactListItem
icon='circle-o'
title='Code Remix'
onPress={() => { onPress('Code Remix') }} />
</List>
{!isIOSProduction() &&
<List>
<ListHeader title='Lessons' />
<CompactListItem
icon='circle-o'
title='Get Started'
onPress={() => { onPress('Get Started') }} />
<CompactListItem
icon='circle-o'
title='Play Time'
onPress={() => { onPress('Play Time') }} />
<CompactListItem
icon='circle-o'
title='Customize'
onPress={() => { onPress('Customize') }} />
<CompactListItem
icon='circle-o'
title='Code Remix'
onPress={() => { onPress('Code Remix') }} />
</List>
}
{isIOSProduction() &&
<List>
<ListHeader title='Lessons' />
<CompactListItem
icon='circle-o'
title='Get Started'
onPress={() => { onPress('Get Started') }} />
</List>
}
</ScrollView>
<Modal
navigation={this.props.navigation}
Expand Down
87 changes: 51 additions & 36 deletions App/Modules/Play/Home/Screen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'

import { isIOSProduction } from 'App/Services/Properties'

import {
Container,
Modal,
Expand All @@ -26,21 +28,32 @@ export default class Screen extends Component {
onPress } = this.props
return (
<Container scrollable>
<List>
<ListHeader title='Level 1' count={3} completed={0} />
<CompactListItem
icon='circle-o'
title='Get Started'
onPress={onPress.getStarted} />
<CompactListItem
icon='circle-o'
title='Explore'
onPress={onPress.explore} />
<CompactListItem
icon='circle-o'
title='Play a game'
onPress={onPress.playGame} />
</List>
{!isIOSProduction() &&
<List>
<ListHeader title='Level 1' count={3} completed={0} />
<CompactListItem
icon='circle-o'
title='Get Started'
onPress={onPress.getStarted} />
<CompactListItem
icon='circle-o'
title='Explore'
onPress={onPress.explore} />
<CompactListItem
icon='circle-o'
title='Play a game'
onPress={onPress.playGame} />
</List>
}
{isIOSProduction() &&
<List>
<ListHeader title='Level 1' count={1} completed={0} />
<CompactListItem
icon='circle-o'
title='Get Started'
onPress={onPress.getStarted} />
</List>
}
<List title='Explore'>
<ListItem
image={Images.controls}
Expand All @@ -55,27 +68,29 @@ export default class Screen extends Component {
text='Beep bop boopity beep'
onPress={onPress.beep} />
</List>
<List title='Games' cols={2}>
<SquareListItem
icon='play'
iconStyle={{marginLeft: 4}}
title='Drive'
text='Vroom vroom'
onPress={onPress.drive} />
<SquareListItem
icon='play'
iconStyle={{marginLeft: 4}}
title='Dance'
text='Let’s boogie'
onPress={onPress.dance} />
<SquareListItem
icon='play'
iconStyle={{marginLeft: 4}}
title='Find a friend'
text='Humans are nice'
disabled
onPress={onPress.findAFriend} />
</List>
{!isIOSProduction() &&
<List title='Games' cols={2}>
<SquareListItem
icon='play'
iconStyle={{marginLeft: 4}}
title='Drive'
text='Vroom vroom'
onPress={onPress.drive} />
<SquareListItem
icon='play'
iconStyle={{marginLeft: 4}}
title='Dance'
text='Let’s boogie'
onPress={onPress.dance} />
<SquareListItem
icon='play'
iconStyle={{marginLeft: 4}}
title='Find a friend'
text='Humans are nice'
disabled
onPress={onPress.findAFriend} />
</List>
}
<Modal
navigation={this.props.navigation}
show={showNotReadyModal}
Expand Down
4 changes: 4 additions & 0 deletions App/Services/Properties/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export const isIOS12OrHigher = () => {
return (majorVersionIOS >= 12)
}

export const isIOSProduction = () => {
return (Platform.OS === 'ios' && Config.ENV === 'production')
}

export const enrichProperties = (properties) => {
if (!properties) {
properties = {}
Expand Down

0 comments on commit e63bc34

Please sign in to comment.