Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Replace share text with an image on iOS #242

Merged
merged 17 commits into from
Oct 3, 2019
Merged
Prev Previous commit
Next Next commit
Linting
  • Loading branch information
James Pearson committed Oct 3, 2019
commit 58c8cc3f16b81bb44dfc745a1b30647eb6f25721
40 changes: 20 additions & 20 deletions App/Screens/Home/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,32 @@ import * as theme from '../../../util/theme';

interface FooterProps extends NavigationInjectedProps, ViewProps { }

export function Footer(props: FooterProps) {
export function Footer (props: FooterProps) {
const { api } = useContext(ApiContext)!;
const { currentLocation } = useContext(CurrentLocationContext);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { navigation, style, ...rest } = props;

const isTooFar = isStationTooFar(currentLocation!, api!);

function goToAbout() {
function goToAbout () {
track('HOME_SCREEN_ABOUT_CLICK');
navigation.navigate('About');
}

function goToAboutWhySoFar() {
function goToAboutWhySoFar () {
track('HOME_SCREEN_ABOUT_WHY_SO_FAR_CLICK');
navigation.navigate('About', {
scrollInto: aboutSections.aboutWhyIsTheStationSoFarTitle
});
}

function goToDetails() {
function goToDetails () {
track('HOME_SCREEN_DETAILS_CLICK');
navigation.navigate('Details');
}

function handleShare() {
function handleShare () {
track('HOME_SCREEN_SHARE_CLICK');

// Share doesn't currently support images on Android, so the text version
Expand All @@ -72,30 +72,30 @@ export function Footer(props: FooterProps) {
const renderBigButton = () => {
return isTooFar ? (
<Button onPress={goToAboutWhySoFar}>
{i18n.t('home_btn_why_is_station_so_far').toUpperCase()}
{i18n.t('home_btn_why_is_station_so_far').toUpperCase()}
</Button>
) : (
<Button onPress={goToDetails}>
{i18n.t('home_btn_see_detailed_info').toUpperCase()}
</Button>
);
<Button onPress={goToDetails}>
{i18n.t('home_btn_see_detailed_info').toUpperCase()}
</Button>
);
};

const renderSmallButtons = () => {
return (
<View style={styles.smallButtons}>
{isTooFar ? (
<Button icon="plus-circle" onPress={goToDetails} type="secondary">
{i18n.t('home_btn_more_details').toUpperCase()}
</Button>
) : (
<Button icon="question-circle" onPress={goToAbout} type="secondary">
{i18n.t('home_btn_faq_about').toUpperCase()}
</Button>
)}
<Button icon="share-alt" onPress={handleShare} type="secondary">
{i18n.t('home_btn_share').toUpperCase()}
</Button>
{i18n.t('home_btn_more_details').toUpperCase()}
</Button>
) : (
<Button icon="question-circle" onPress={goToAbout} type="secondary">
{i18n.t('home_btn_faq_about').toUpperCase()}
</Button>
)}
<Button icon="share-alt" onPress={handleShare} type="secondary">
{i18n.t('home_btn_share').toUpperCase()}
</Button>
</View>
);
};
Expand Down
2 changes: 1 addition & 1 deletion App/Screens/ShareScreen/ShareScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import * as theme from '../../util/theme';

interface ShareScreenProps extends NavigationInjectedProps { }

export function ShareScreen(props: ShareScreenProps) {
export function ShareScreen (props: ShareScreenProps) {
const refViewShot = createRef();

useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion App/components/CigaretteBlock/CigaretteBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export function CigaretteBlock (props: CigaretteBlockProps) {
cigarettes
});

console.log('text :', text);
const [firstPartText, secondPartText] = text.split('<');

const frequencyText = displayFrequency ? (<Text>{i18n.t(`frequency_${frequency}`)}</Text>) : null;
Expand Down