Skip to content

Commit

Permalink
feat: Update to Expo SDK 40 (#900)
Browse files Browse the repository at this point in the history
* ncu -u

* Install sdk 40

* Fix upgrade problems

* Update package

* copy more files back

* Fix icons
  • Loading branch information
amaury1093 committed Feb 23, 2021
1 parent 0818d7f commit 5c0ef58
Show file tree
Hide file tree
Showing 35 changed files with 7,956 additions and 1,845 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
...require('@amaurymartiny/eslintrc'),
...require('@amaurym/eslintrc'),
// FIXME Turn these rules on again:
// https://github.com/amaurymartiny/shoot-i-smoke/issues/619
// https://github.com/amaurym/shoot-i-smoke/issues/619
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('@amaurymartiny/eslintrc/prettierrc');
module.exports = require('@amaurym/eslintrc/prettierrc');
6 changes: 3 additions & 3 deletions App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ import { sentryError } from './util/sentry';

// Add Sentry if available
if (IS_SENTRY_SET_UP) {
Sentry.init({
Sentry.Native.init({
dsn: Constants.manifest.extra.sentryPublicDsn as string,
debug: true,
release: RELEASE_CHANNEL,
});

Sentry.setRelease(RELEASE_CHANNEL);
if (Constants.manifest.revisionId) {
Sentry.setExtra('sisRevisionId', Constants.manifest.revisionId);
Sentry.Native.setExtra('sisRevisionId', Constants.manifest.revisionId);
}
}

Expand Down
6 changes: 3 additions & 3 deletions App/Screens/About/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import {
} from 'react-native';
import { ScrollIntoView, wrapScrollView } from 'react-native-scroll-into-view';
import { scale } from 'react-native-size-matters';
import { ConversionBox, DistanceUnit } from '@shootismoke/ui';
import { DistanceUnit } from '@shootismoke/ui';

import { BackButton } from '../../components';
import { ConversionBox, BackButton } from '../../components';
import { t } from '../../localization';
import { useDistanceUnit } from '../../stores/distanceUnit';
import { AmplitudeEvent, track, trackScreen } from '../../util/amplitude';
Expand Down Expand Up @@ -187,7 +187,7 @@ export function About(props: AboutProps): React.ReactElement {
¹
{'\u207E'}.
</Text>
<ConversionBox showFootnote={true} t={t} />
<ConversionBox showFootnote={true} />
<Text style={styles.articleLink}>
(1){' '}
<Text onPress={handleOpenBerkeley} style={theme.link}>
Expand Down
2 changes: 1 addition & 1 deletion App/Screens/Details/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function Details(props: DetailsProps): React.ReactElement {
);
}

const distance = distanceToStation(currentLocation, api, distanceUnit);
const distance = distanceToStation(currentLocation, api.pm25, distanceUnit);

const station = {
description: stationName(api.pm25),
Expand Down
2 changes: 1 addition & 1 deletion App/Screens/Details/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export function Header(props: HeaderProps): React.ReactElement {
`${pollutant.toUpperCase()} AQI:`,
convert(
pollutant as Pollutant,
'raw',
'ugm3',
'usaEpa',
averages[pollutant as Pollutant].average
),
Expand Down
4 changes: 2 additions & 2 deletions App/Screens/ErrorScreen/ErrorScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Sh**t! I Smoke. If not, see <http://www.gnu.org/licenses/>.

import { Ionicons } from '@expo/vector-icons';
import Ionicons from '@expo/vector-icons/build/Ionicons';
import { StackNavigationProp } from '@react-navigation/stack';
import { Button } from '@shootismoke/ui';
import errorPicture from '@shootismoke/ui/assets/images/error.png';
import React, { useContext, useEffect, useState } from 'react';
import {
Expand All @@ -28,6 +27,7 @@ import {
} from 'react-native';
import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler';

import { Button } from '../../components';
import { t } from '../../localization';
import { ErrorContext } from '../../stores';
import { track, trackScreen } from '../../util/amplitude';
Expand Down
2 changes: 1 addition & 1 deletion App/Screens/Home/AdditionalInfo/AdditionalInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function AdditionalInfo(
);
}

const isTooFar = isStationTooFar(currentLocation, api);
const isTooFar = isStationTooFar(currentLocation, api.pm25);

// Render a "station too far" warning
if (isTooFar) {
Expand Down
6 changes: 3 additions & 3 deletions App/Screens/Home/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import { StackNavigationProp } from '@react-navigation/stack';
import React, { useContext } from 'react';
import { StyleSheet, View, ViewProps } from 'react-native';
import { Button, isStationTooFar } from '@shootismoke/ui';
import { isStationTooFar } from '@shootismoke/ui';

import { CircleButton } from '../../../components';
import { Button, CircleButton } from '../../../components';
import { t } from '../../../localization';
import { ApiContext, CurrentLocationContext } from '../../../stores';
import { track } from '../../../util/amplitude';
Expand Down Expand Up @@ -61,7 +61,7 @@ export function Footer(props: FooterProps): React.ReactElement {
);
}

const isTooFar = isStationTooFar(currentLocation, api);
const isTooFar = isStationTooFar(currentLocation, api.pm25);

function goToAbout(): void {
track('HOME_SCREEN_ABOUT_CLICK');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with Sh**t! I Smoke. If not, see <http://www.gnu.org/licenses/>.

import Switch from '@dooboo-ui/native-switch-toggle';
import { FontAwesome } from '@expo/vector-icons';
import Ionicons from '@expo/vector-icons/build/Ionicons';
import { Frequency } from '@shootismoke/graphql';
import * as Notifications from 'expo-notifications';
import * as Localization from 'expo-localization';
Expand Down Expand Up @@ -274,7 +274,7 @@ export function SelectNotifications(
</Text>
<Text style={styles.labelFrequency}>
{t(`home_frequency_${notif}`)}{' '}
<FontAwesome name="caret-down" />
<Ionicons name="caret-down" />
</Text>
</View>
) : (
Expand Down
2 changes: 1 addition & 1 deletion App/Screens/Home/Footer/ShareButton/ShareButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function ShareButton(props: ShareButtonProps): React.ReactElement {
<View collapsable={false} ref={refViewShot} style={styles.viewShot}>
<ShareImage />
</View>
<CircleButton icon="ios-share-alt" onPress={handleShare} />
<CircleButton icon="ios-share-social" onPress={handleShare} />
</View>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

import React, { useContext } from 'react';
import { StyleSheet, View } from 'react-native';
import { CigarettesBlock } from '@shootismoke/ui';

import { t } from '../../../../../localization';
import { CurrentLocation } from '../../../../../components';
import { CigarettesBlock, CurrentLocation } from '../../../../../components';
import { ApiContext, CurrentLocationContext } from '../../../../../stores';
import * as theme from '../../../../../util/theme';

Expand Down Expand Up @@ -59,7 +57,6 @@ export function ShareImage(): React.ReactElement {
cigarettes={api.shootismoke.dailyCigarettes}
frequency="daily"
style={styles.cigaretteBlock}
t={t}
/>
<CurrentLocation
currentLocation={currentLocation}
Expand Down
4 changes: 2 additions & 2 deletions App/Screens/Home/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export function Header(props: HeaderProps): React.ReactElement {
);
}

const distance = distanceToStation(currentLocation, api, distanceUnit);
const isTooFar = isStationTooFar(currentLocation, api);
const distance = distanceToStation(currentLocation, api.pm25, distanceUnit);
const isTooFar = isStationTooFar(currentLocation, api.pm25);

return (
<View style={styles.container}>
Expand Down
5 changes: 2 additions & 3 deletions App/Screens/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import { StackNavigationProp } from '@react-navigation/stack';
import React, { useContext, useEffect, useState } from 'react';
import { ScrollView, StyleSheet, View, Dimensions } from 'react-native';
import { CigarettesBlock, Frequency, FrequencyContext } from '@shootismoke/ui';
import { Frequency, FrequencyContext } from '@shootismoke/ui';
import { scale } from 'react-native-size-matters';

import { t } from '../../localization';
import { CigarettesBlock } from '../../components';
import { ApiContext, CurrentLocationContext } from '../../stores';
import { track, trackScreen } from '../../util/amplitude';
import * as theme from '../../util/theme';
Expand Down Expand Up @@ -188,7 +188,6 @@ export function Home(props: HomeProps): React.ReactElement {
spacingHorizontal={getCigarettesMargin(cigarettes.count)}
spacingVertical={getCigarettesMargin(cigarettes.count)}
style={[theme.withPadding, styles.withMargin]}
t={t}
textStyle={[theme.shitText, styles.withMargin]}
/>
<SelectFrequency style={styles.withMargin} />
Expand Down
6 changes: 4 additions & 2 deletions App/Screens/Home/SelectFrequency/SelectFrequency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
// along with Sh**t! I Smoke. If not, see <http://www.gnu.org/licenses/>.

import React, { useContext, useRef, useState } from 'react';
import { ScrollView, ScrollViewProps, StyleSheet } from 'react-native';
import { BoxButton, Frequency, FrequencyContext } from '@shootismoke/ui';
import { ScrollView, ScrollViewProps, StyleSheet, Text } from 'react-native';
import { Frequency, FrequencyContext } from '@shootismoke/ui';

import { BoxButton } from '../../../components';
import { t } from '../../../localization';
import { track } from '../../../util/amplitude';
import * as theme from '../../../util/theme';
Expand Down
76 changes: 76 additions & 0 deletions App/components/BoxButton/BoxButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Sh**t! I Smoke
// Copyright (C) 2018-2020 Marcelo S. Coelho, Amaury Martiny

// Sh**t! I Smoke is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Sh**t! I Smoke is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Sh**t! I Smoke. If not, see <http://www.gnu.org/licenses/>.

import React from 'react';
import {
StyleSheet,
Text,
TouchableWithoutFeedback,
TouchableWithoutFeedbackProps,
View,
} from 'react-native';

import * as theme from '../../util/theme';

interface BoxButtonProps extends TouchableWithoutFeedbackProps {
active?: boolean;
children: string | JSX.Element;
}

const styles = StyleSheet.create({
activeText: {
opacity: 1,
},
boxButton: {
...theme.elevationShadowStyle(3),
backgroundColor: 'white',
borderColor: 'rgba(0, 0, 0, 0.1)',
borderRadius: 12,
borderWidth: 1,
marginBottom: theme.spacing.mini,
paddingHorizontal: theme.spacing.small,
paddingVertical: 6, // Padding for the shadow
shadowOpacity: 0.1,
},
boxButtonText: {
...theme.shitText,
opacity: theme.disabledOpacity,
textAlign: 'center',
},
});

export function BoxButton(props: BoxButtonProps): React.ReactElement {
const { active, children, onPress, style, ...rest } = props;

return (
<TouchableWithoutFeedback onPress={onPress} {...rest}>
<View style={[styles.boxButton, style]}>
{typeof children === 'string' ? (
<Text
style={[
styles.boxButtonText,
active ? styles.activeText : undefined,
]}
>
{children}
</Text>
) : (
children
)}
</View>
</TouchableWithoutFeedback>
);
}
17 changes: 17 additions & 0 deletions App/components/BoxButton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Sh**t! I Smoke
// Copyright (C) 2018-2020 Marcelo S. Coelho, Amaury Martiny

// Sh**t! I Smoke is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Sh**t! I Smoke is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Sh**t! I Smoke. If not, see <http://www.gnu.org/licenses/>.

export * from './BoxButton';

0 comments on commit 5c0ef58

Please sign in to comment.