Skip to content

Commit

Permalink
feat: 바코드 5분에 한번씩 자동 활성화
Browse files Browse the repository at this point in the history
  • Loading branch information
potados99 committed Nov 25, 2021
1 parent d6f808e commit 22cae95
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/presentation/features/membership/Barcode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {Dimensions, Image, Platform, ScrollView, StyleSheet, Text, View} from 'react-native';
import useApi from '../../../hooks/useApi';
import colors from '../../../res/colors';
import palette from '../../../res/palette';
import CardView from '../../../components/CardView';
import {observer} from 'mobx-react';
import useInterval from '../../../hooks/useInterval';
import useUserState from '../../../hooks/useUserState';
import handleApiError from '../../../../common/utils/handleApiError';
import BarcodeBuilder from 'react-native-barcode-builder';
import VerticalShadow from '../../../components/VerticalShadow';
import ActivateBarcode from '../../../../domain/usecases/ActivateBarcode';
import React, {useEffect} from 'react';
import useScreenBrightness from '../../../hooks/useScreenBrightness';
import {Dimensions, Image, Platform, ScrollView, StyleSheet, Text, View} from 'react-native';

function Barcode() {
const {barcode, studentId} = useUserState();
Expand All @@ -37,9 +39,13 @@ function Barcode() {
const [, activateBarcode] = useApi(() => ActivateBarcode.run());

useEffect(() => {
activateBarcode();
activateBarcode().catch(handleApiError);
}, []);

useInterval(() => {
activateBarcode().catch();
}, 1000 * 60 * 5 /* 5분에 한번씩 */);

const header = (
<View style={styles.header}>
<Image
Expand Down

0 comments on commit 22cae95

Please sign in to comment.