Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jcw1031 committed Sep 25, 2024
2 parents 3eba01c + ba1ecf8 commit c9b7157
Show file tree
Hide file tree
Showing 70 changed files with 4,040 additions and 2,044 deletions.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Bug report
about: 개발 서버 오류
title: "[bug]"
labels: "\U0001F41BBug"
assignees: ''

---

## 🐛 오류 내용

- bugs
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: 신규 기능 구현
title: "[feature]"
labels: "\U0001F4ABFeature"
assignees: ''

---

## 📌 설명

## 🛠️ 구현 목록

✅ 구체적으로 작성하기

- [ ] TODO
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/hotfix-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Hotfix report
about: 운영 서버 오류
title: "[hotfix]"
labels: "\U0001FA93Hotfix"
assignees: ''

---

## 🐛 오류 내용

- bugs
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## 📌 간단 설명

한 줄 설명

## ✅ 변경 내용

- 변경 내용 (issues)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@

### System Architecture

![System Architecture](https://github.com/LikeKNU/.github/assets/69714701/0fe21330-7475-4d55-a4a7-f8bd8fec8cdd)
![System Architecture](https://github.com/LikeKNU/LikeKNU/assets/69714701/c014ad62-fb3a-4fa6-a62a-c8b6f2d74d4c)
23 changes: 22 additions & 1 deletion api/bus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCampus } from '@/common/contexts/CampusContext';
import { Campuses, campusName } from '@/constants/campus';
import { CityBusProps, ShuttleBusProps, ShuttleRouteProps } from '@/types/busTypes';
import { CityBusProps, CityBusRouteProps, ShuttleBusProps, ShuttleRouteProps } from '@/types/busTypes';
import { ValueNameType } from '@/types/common';
import http, { extractBodyFromResponse } from '@/utils/http';
import useSWR from 'swr';
Expand Down Expand Up @@ -37,3 +37,24 @@ export const useShuttleBuses = (shuttleId: string) => {

return useSWR(`/api/buses/shuttle-bus/${shuttleId}`, getShuttleBuses);
};

export const useCityBusRoutes = () => {
const { campus } = useCampus();
const getCityBusRoutes = async (uri: string, campus: Campuses | null) => {
if (campus) {
const response = await http.getWithParams<CityBusRouteProps[]>(uri, { campus: campusName[campus].value });
return extractBodyFromResponse<CityBusRouteProps[]>(response) ?? [];
}
};

return useSWR(['/api/buses/city-bus/routes', campus], ([uri, campus]) => getCityBusRoutes(uri, campus));
};

export const useCityBusArrivalTime = (routeId: string) => {
const getCityBusArrivalTime = async (uri: string) => {
const response = await http.get<CityBusProps>(uri);
return extractBodyFromResponse<CityBusProps>(response);
};

return useSWR(`/api/buses/city-bus/${routeId}/arrival-time`, getCityBusArrivalTime);
}
11 changes: 10 additions & 1 deletion api/home.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCampus } from '@/common/contexts/CampusContext';
import { Campuses, campusName } from '@/constants/campus';
import { HomeAnnouncementProps, HomeBusProps, HomeCalendarProps, HomeMealProps } from '@/types/homeType';
import http, { extractBodyFromResponse } from '@/utils/http';
import http, { extractBodyFromResponse, extractMessageFromResponse } from '@/utils/http';
import useSWR from 'swr';

export const useHomeAnnouncements = () => {
Expand Down Expand Up @@ -48,3 +48,12 @@ export const useHomeCalendar = () => {

return useSWR('/api/main/schedule', getHomeCalendar);
};

export const useHomeMessage = () => {
const getHomeMessage = async (uri: string) => {
const response = await http.get<string>(uri);
return extractMessageFromResponse(response) ?? '';
};

return useSWR('/api/main/messages', getHomeMessage);
};
12 changes: 9 additions & 3 deletions api/meal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import { Campuses, campusName } from '@/constants/campus';
import { cafeterias, Cafeterias } from '@/constants/meal';
import { MealProps } from '@/types/mealTypes';
import http, { extractBodyFromResponse } from '@/utils/http';
import useSWR from 'swr';
import useSWR, { SWRConfiguration } from 'swr';

export const useMeals = (cafeteria: Cafeterias) => {
interface UseMealsOptions extends SWRConfiguration {
enabled?: boolean;
}

export const useMeals = (cafeteria: Cafeterias, options: UseMealsOptions = {}) => {
const { campus } = useCampus();
const getMeals = async (uri: string, campus: Campuses | null, cafeteria: Cafeterias) => {
if (campus && cafeterias[campus].includes(cafeteria)) {
Expand All @@ -17,5 +21,7 @@ export const useMeals = (cafeteria: Cafeterias) => {
}
};

return useSWR(['/api/menus', campus, cafeteria], ([uri, campus, cafeteria]) => getMeals(uri, campus, cafeteria));
const shouldFetch = options.enabled !== false;

return useSWR(shouldFetch ? ['/api/menus', campus, cafeteria] : null, ([uri, campus, cafeteria]) => getMeals(uri, campus, cafeteria));
};
78 changes: 73 additions & 5 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"expo": {
"name": "공주대처럼",
"slug": "like-knu",
"version": "1.0.4",
"version": "1.4.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "automatic",
"assetBundlePatterns": [
"**/*"
],
"ios": {
"buildNumber": "1",
"buildNumber": "49",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
Expand All @@ -32,10 +32,11 @@
"CFBundleLocalizations": [
"ko"
]
}
},
"appStoreUrl": "https://apps.apple.com/kr/app/%EA%B3%B5%EC%A3%BC%EB%8C%80%EC%B2%98%EB%9F%BC/id6499512208"
},
"android": {
"versionCode": 24,
"versionCode": 49,
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
Expand All @@ -50,12 +51,14 @@
"backgroundColor": "#101012"
}
},
"package": "ac.knu.likeknu"
"package": "ac.knu.likeknu",
"playStoreUrl": "https://play.google.com/store/apps/details?id=ac.knu.likeknu"
},
"web": {
"favicon": "./assets/favicon.png"
},
"plugins": [
"expo-font",
"expo-router",
"@react-native-firebase/app",
[
Expand All @@ -68,6 +71,71 @@
"enableProguardInReleaseBuilds": true
}
}
],
[
"expo-tracking-transparency",
{
"userTrackingPermission": "이 식별자는 개인 맞춤형 광고를 제공하는 데 사용됩니다."
}
],
[
"react-native-google-mobile-ads",
{
"iosAppId": "ca-app-pub-2814557138984161~7500117117",
"androidAppId": "ca-app-pub-2814557138984161~2843844350",
"userTrackingUsageDescription": "이 식별자는 개인 맞춤형 광고를 제공하는 데 사용됩니다.",
"skAdNetworkItems": [
"cstr6suwn9.skadnetwork",
"4fzdc2evr5.skadnetwork",
"4pfyvq9l8r.skadnetwork",
"2fnua5tdw4.skadnetwork",
"ydx93a7ass.skadnetwork",
"5a6flpkh64.skadnetwork",
"p78axxw29g.skadnetwork",
"v72qych5uu.skadnetwork",
"ludvb6z3bs.skadnetwork",
"cp8zw746q7.skadnetwork",
"3sh42y64q3.skadnetwork",
"c6k4g5qg8m.skadnetwork",
"s39g8k73mm.skadnetwork",
"3qy4746246.skadnetwork",
"f38h382jlk.skadnetwork",
"hs6bdukanm.skadnetwork",
"v4nxqhlyqp.skadnetwork",
"wzmmz9fp6w.skadnetwork",
"yclnxrl5pm.skadnetwork",
"t38b2kh725.skadnetwork",
"7ug5zh24hu.skadnetwork",
"gta9lk7p23.skadnetwork",
"vutu7akeur.skadnetwork",
"y5ghdn5j9k.skadnetwork",
"n6fk4nfna4.skadnetwork",
"v9wttpbfk9.skadnetwork",
"n38lu8286q.skadnetwork",
"47vhws6wlr.skadnetwork",
"kbd757ywx3.skadnetwork",
"9t245vhmpl.skadnetwork",
"eh6m2bh4zr.skadnetwork",
"a2p9lx4jpn.skadnetwork",
"22mmun2rn5.skadnetwork",
"4468km3ulz.skadnetwork",
"2u9pt9hc89.skadnetwork",
"8s468mfl3y.skadnetwork",
"klf5c3l5u5.skadnetwork",
"ppxm28t8ap.skadnetwork",
"ecpz2srf59.skadnetwork",
"uw77j35x4d.skadnetwork",
"pwa73g5rt2.skadnetwork",
"mlmmfzh3r3.skadnetwork",
"578prtvx9j.skadnetwork",
"4dzt52r2t5.skadnetwork",
"e5fvkxwrpn.skadnetwork",
"8c4e2ghe7u.skadnetwork",
"zq492l623r.skadnetwork",
"3rd42ekr43.skadnetwork",
"3qcr597p9d.skadnetwork"
]
}
]
],
"scheme": "like-knu",
Expand Down
2 changes: 1 addition & 1 deletion app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const TabLayout = () => {
}}>
<Tabs.Screen name="index" options={{
tabBarIcon: ({ color }) => (
<HomeIcon fill={color} width={30} height={30} />
<HomeIcon fill={color} width={29} height={29} />
),
tabBarLabel: ({ color }) => (
<FontText style={[styles.label, { color: color }]}></FontText>
Expand Down
16 changes: 13 additions & 3 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import analytics from '@react-native-firebase/analytics';
import { useFonts } from 'expo-font';
import { Stack, usePathname } from 'expo-router';
import * as SplashScreen from 'expo-splash-screen';
import { requestTrackingPermissionsAsync } from 'expo-tracking-transparency';
import React, { useCallback, useEffect } from 'react';
import { AppState } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import mobileAds from 'react-native-google-mobile-ads';
import { RootSiblingParent } from 'react-native-root-siblings';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { AppStateStatus } from 'react-native/Libraries/AppState/AppState';
Expand Down Expand Up @@ -55,9 +57,7 @@ const AppLayout = () => {
<SWRConfig value={{
provider: () => new Map(),
isVisible: () => true,
initFocus(callback) {
return handleInitFocus(callback);
}
initFocus: (callback) => handleInitFocus(callback)
}}>
<RootSiblingParent>
<ThemeContextProvider>
Expand All @@ -82,9 +82,19 @@ const Content = () => {
useInitializeDevice();

useEffect(() => {
requestTrackingPermissionsAsync()
.then(() => {
});

mobileAds()
.initialize()
.then(() => {
});

analytics().logScreenView({
screen_name: pathname,
screen_class: pathname
}).then(() => {
});
}, [pathname]);

Expand Down
6 changes: 4 additions & 2 deletions app/announcement/Announcement.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useAnnouncements } from '@/api/announcement';
import BookmarkIcon from '@/assets/icons/bookmark-fill.svg';
import SearchIcon from '@/assets/icons/search.svg';
import AnnouncementBannerAd from '@/common/ads/AnnouncementBannerAd';
import AnimatedPressable from '@/common/components/AnimatedPressable';
import InfiniteScrollView from '@/common/components/InfiniteScrollView';
import PageLayout from '@/common/components/PageLayout';
Expand Down Expand Up @@ -56,12 +57,12 @@ const Announcement = () => {
<AnimatedPressable style={styles.bookmarkPressable}
animatedViewStyle={styles.bookmarkAnimatedPressable}
onPress={() => router.push('/announcement/bookmark')}>
<BookmarkIcon width={20} height={20} fill={colors[theme].gray200} />
<BookmarkIcon width={22} height={22} fill={colors[theme].gray200} />
</AnimatedPressable>
<AnimatedPressable style={styles.searchPressable}
animatedViewStyle={styles.searchAnimatedPressable}
onPress={() => router.push('/announcement/search')}>
<SearchIcon width={20} height={20} fill={colors[theme].gray200} />
<SearchIcon width={22} height={22} fill={colors[theme].gray200} />
</AnimatedPressable>
</View>
</TabHeader>
Expand All @@ -70,6 +71,7 @@ const Announcement = () => {
activeTab={category}
tabItems={Object.values(categories).map(value => value)}
/>
<AnnouncementBannerAd />
<InfiniteScrollView
data={announcements}
handleEndReached={loadMore}
Expand Down
10 changes: 8 additions & 2 deletions app/announcement/components/AnnouncementItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FontText from '@/common/text/FontText';
import colors from '@/constants/colors';
import { AnnouncementProps } from '@/types/announcementType';
import { getCurrentDate } from '@/utils/date';
import analytics from '@react-native-firebase/analytics';
import { useRouter } from 'expo-router';
import { useEffect, useState } from 'react';
import { StyleSheet, View } from 'react-native';
Expand All @@ -23,12 +24,17 @@ const AnnouncementItem = ({ announcement }: { announcement: AnnouncementProps })
}, [announcement]);

const handlePress = () => {
analytics().logSelectContent({
content_type: 'select_announcement',
item_id: `${announcement.announcementId}`
});

router.push({
pathname: '/announcement/details',
params: {
url: announcement.announcementUrl,
id: announcement.announcementId,
isBookmark: isBookmark
isBookmark: String(isBookmark)
}
});
};
Expand All @@ -51,7 +57,7 @@ const AnnouncementItem = ({ announcement }: { announcement: AnnouncementProps })
<FontText style={[{ color: colors[theme].gray100 }, styles.additional]}>
{announcement.announcementTag + ' | ' + announcement.announcementDate}
</FontText>
{isToday && <DotIcon fill={colors.red} width={14} height={14} />}
{isToday && <DotIcon fill={colors[theme].red} width={14} height={14} />}
</View>
</View>
<View style={{ flex: 1, alignItems: 'flex-end' }}>
Expand Down
6 changes: 6 additions & 0 deletions app/announcement/components/AnnouncementSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import FontText from '@/common/text/FontText';
import colors from '@/constants/colors';
import { AnnouncementProps } from '@/types/announcementType';
import { flatMapRemoveDuplicate } from '@/utils/data';
import analytics from '@react-native-firebase/analytics';
import { usePathname } from 'expo-router';
import { useEffect, useState } from 'react';
import { Keyboard, KeyboardAvoidingView, Platform, StyleSheet } from 'react-native';
Expand Down Expand Up @@ -38,6 +39,11 @@ const AnnouncementSearch = () => {
};

const handleSubmit = (keyword: string) => {
if (keyword.length !== 0) {
analytics().logSearch({
search_term: keyword
});
}
setKeyword(keyword);
};

Expand Down
Loading

0 comments on commit c9b7157

Please sign in to comment.