Skip to content

Commit

Permalink
Merge pull request #151 from coldsurfers/release/billets-app-v1.6.0
Browse files Browse the repository at this point in the history
release(billets-app): 🚀 v1.6.0
  • Loading branch information
yungblud authored Dec 17, 2024
2 parents 5791fff + 524a1e5 commit 5f12e16
Show file tree
Hide file tree
Showing 115 changed files with 1,825 additions and 901 deletions.
2 changes: 1 addition & 1 deletion apps/billets-app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 14
versionName "1.5.0"
versionName "1.6.0"
resValue "string", "CodePushDeploymentKey", project.env.get("ANDROID_CODE_PUSH_DEPLOYMENT_KEY") ?: ""
}

Expand Down
6 changes: 3 additions & 3 deletions apps/billets-app/ios/FstvlLifeApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.6.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -632,7 +632,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.6.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -923,7 +923,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.6.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
6 changes: 6 additions & 0 deletions apps/billets-app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,8 @@ PODS:
- Yoga
- RNStoreReview (0.4.3):
- React-Core
- RNSVG (15.10.1):
- React-Core
- SDWebImage (5.11.1):
- SDWebImage/Core (= 5.11.1)
- SDWebImage/Core (5.11.1)
Expand Down Expand Up @@ -2035,6 +2037,7 @@ DEPENDENCIES:
- RNReanimated (from `../../../node_modules/react-native-reanimated`)
- RNScreens (from `../../../node_modules/react-native-screens`)
- RNStoreReview (from `../../../node_modules/react-native-store-review`)
- RNSVG (from `../../../node_modules/react-native-svg`)
- Yoga (from `../../../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -2247,6 +2250,8 @@ EXTERNAL SOURCES:
:path: "../../../node_modules/react-native-screens"
RNStoreReview:
:path: "../../../node_modules/react-native-store-review"
RNSVG:
:path: "../../../node_modules/react-native-svg"
Yoga:
:path: "../../../node_modules/react-native/ReactCommon/yoga"

Expand Down Expand Up @@ -2365,6 +2370,7 @@ SPEC CHECKSUMS:
RNReanimated: f2083d93a37ce46bfc46dba51498b5a40273e246
RNScreens: 16b782596e80e475b7f3ec769c9a97d789d9b0ed
RNStoreReview: 31dbfd0dac2eea9675f0b84f1dd3261c2110c337
RNSVG: 7ff26379b2d1871b8571e6f9bc9630de6baf9bdf
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Expand Down
11 changes: 10 additions & 1 deletion apps/billets-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coldsurfers/billets-app",
"version": "1.5.0",
"version": "1.6.0",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand Down Expand Up @@ -52,7 +52,11 @@
"axios": "*",
"date-fns": "^2.29.3",
"jwt-decode": "^4.0.0",
"lodash.uniqby": "^4.7.0",
"lucide-react-native": "*",
"ngeohash": "*",
"openapi-fetch": "^0.12.2",
"openapi-react-query": "^0.2.8",
"react": "18.3.1",
"react-native": "*",
"react-native-bootsplash": "^6.1.3",
Expand All @@ -71,7 +75,9 @@
"react-native-safe-area-context": "^4.11.0",
"react-native-screens": "^3.34.0",
"react-native-store-review": "^0.4.3",
"react-native-svg": "*",
"react-native-webview": "^11.26.1",
"supercluster": "^8.0.1",
"ts-pattern": "*",
"zustand": "*"
},
Expand All @@ -84,8 +90,11 @@
"@react-native/metro-config": "0.75.3",
"@react-native/typescript-config": "0.75.3",
"@tanstack/eslint-plugin-query": "^5.58.1",
"@types/lodash.uniqby": "^4",
"@types/ngeohash": "*",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"@types/supercluster": "^7.1.3",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"babel-jest": "^29.6.3",
Expand Down
8 changes: 5 additions & 3 deletions apps/billets-app/src/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { MainStackNavigation, MainStackNavigationParamList } from '@/navigations
import { NavigationContainer, NavigationContainerRef } from '@react-navigation/native'
import React, { useCallback, useEffect, useRef } from 'react'
import { ActivityIndicator } from 'react-native'
import { useSendFCMTokenMutation } from './lib/react-query'
import { $api } from './lib/api/openapi-client'

const AppContainer = () => {
const { logScreenView } = useFirebaseAnalytics()
const { requestPermission, getFCMToken, subscribeTopic } = useFirebaseMessaging()
const { mutate: sendFCMToken } = useSendFCMTokenMutation()
const { mutate: sendFCMToken } = $api.useMutation('post', '/v1/fcm/token')

useAppleAuth()

Expand All @@ -21,7 +21,9 @@ const AppContainer = () => {
getFCMToken().then((token) => {
// send fcm token to server
sendFCMToken({
fcmToken: token,
body: {
fcmToken: token,
},
})
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { ConcertVenueMapView } from '@/features/map/ui/concert-venue-map-view/co
import { ArtistSubscribeButton, VenueSubscribeButton } from '@/features/subscribe'
import { useConcertDetailScreenNavigation } from '@/screens/concert-detail-screen/concert-detail-screen.hooks'
import { colors } from '@coldsurfers/ocean-road'
import { Button, ProfileThumbnail, Text } from '@coldsurfers/ocean-road/native'
import { ProfileThumbnail, Text } from '@coldsurfers/ocean-road/native'
import Clipboard from '@react-native-clipboard/clipboard'
import { format } from 'date-fns'
import { Copy, MapPin } from 'lucide-react-native'
import { memo } from 'react'
import { Dimensions, Linking, StyleSheet, TouchableOpacity, View } from 'react-native'
import { VENUE_MAP_HEIGHT } from './concert-detail-section-list-item.constants'
Expand Down Expand Up @@ -121,16 +122,11 @@ ConcertDetailSectionListItem.VenueMapItem = memo(
/>
</TouchableOpacity>
<View style={styles.venueMapAddressWrapper}>
<Text style={styles.venueMapAddressText}>
{'📍'} {address}
</Text>
<Button
theme="transparent"
onPress={() => Clipboard.setString(address)}
style={styles.venueMapAddressCopyBtn}
>
복사하기
</Button>
<MapPin />
<Text style={styles.venueMapAddressText}>{address}</Text>
<TouchableOpacity onPress={() => Clipboard.setString(address)} style={styles.venueMapAddressCopyBtn}>
<Copy />
</TouchableOpacity>
</View>
<ConcertVenueMapView
region={{
Expand Down Expand Up @@ -198,11 +194,13 @@ const styles = StyleSheet.create({
venueMapAddressWrapper: {
flexDirection: 'row',
alignItems: 'center',
paddingBottom: 12,
paddingHorizontal: 12,
paddingTop: 4,
},
venueMapAddressText: {
fontSize: 16,
marginBottom: 8,
marginLeft: 4,
},
venueMapAddressCopyBtn: {
marginLeft: 'auto',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import {
BottomSheetView,
} from '@gorhom/bottom-sheet'
import Clipboard from '@react-native-clipboard/clipboard'
import { Copy } from 'lucide-react-native'
import React, { forwardRef, useCallback } from 'react'
import { Platform, StyleSheet, View } from 'react-native'
import { Platform, StyleSheet, TouchableOpacity, View } from 'react-native'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import { ConcertDetailVenueMapBottomSheetProps } from './concert-detail-venue-map-bottom-sheet.types'

Expand Down Expand Up @@ -41,9 +42,9 @@ export const ConcertDetailVenueMapBottomSheet = forwardRef<BottomSheetModal, Con
</Text>
<Text style={{ fontSize: 14 }}>{address}</Text>
</View>
<Button theme="transparent" onPress={() => Clipboard.setString(address)} style={{ marginLeft: 'auto' }}>
복사하기
</Button>
<TouchableOpacity onPress={() => Clipboard.setString(address)} style={{ marginLeft: 'auto' }}>
<Copy />
</TouchableOpacity>
</View>
<View style={styles.lineView}>
<Button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Text } from '@coldsurfers/ocean-road/native'
import commonStyles from '@/lib/common-styles'
import { colors } from '@coldsurfers/ocean-road'
import { MapPin } from 'lucide-react-native'
import { StyleSheet, TouchableOpacity, View } from 'react-native'

export const LocationSelector = ({ onPress }: { onPress: () => void }) => (
Expand All @@ -13,13 +15,22 @@ export const LocationSelector = ({ onPress }: { onPress: () => void }) => (
}}
style={styles.button}
>
<Text style={styles.emoji}>📍</Text>
<MapPin size={24} />
</TouchableOpacity>
</View>
)

const styles = StyleSheet.create({
wrapper: { display: 'flex', flexDirection: 'row' },
button: { marginLeft: 'auto', marginRight: 12 },
emoji: { fontSize: 24 },
wrapper: { display: 'flex', flexDirection: 'row', paddingBottom: 12 },
button: {
marginLeft: 'auto',
marginRight: 12,
backgroundColor: colors.oc.white.value,
width: 36,
height: 36,
borderRadius: 18,
alignItems: 'center',
justifyContent: 'center',
...commonStyles.shadowBox,
},
})
4 changes: 4 additions & 0 deletions apps/billets-app/src/features/map/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './use-map-points'
export * from './use-map-region-with-zoom-level'
export * from './use-map-region-with-zoom-level.types'
export * from './use-super-cluster'
64 changes: 64 additions & 0 deletions apps/billets-app/src/features/map/hooks/use-map-points.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { $api } from '@/lib/api/openapi-client'
import uniqBy from 'lodash.uniqby'
import { useEffect, useState } from 'react'
import { z } from 'zod'
import { mapPointSchema } from '../map.types'
import { MapRegionWithZoomLevel } from './use-map-region-with-zoom-level.types'

export const useMapPoints = ({ mapRegionWithZoomLevel }: { mapRegionWithZoomLevel: MapRegionWithZoomLevel }) => {
const { data: locationConcerts, isLoading: isLoadingLocationConcerts } = $api.useQuery(
'get',
'/v1/location/concert',
{
params: {
query: {
latitude: `${mapRegionWithZoomLevel.latitude}`,
latitudeDelta: `${mapRegionWithZoomLevel.latitudeDelta}`,
longitude: `${mapRegionWithZoomLevel.longitude}`,
longitudeDelta: `${mapRegionWithZoomLevel.longitudeDelta}`,
zoomLevel: `${mapRegionWithZoomLevel.zoomLevel}`,
},
},
},
)

const [points, setPoints] = useState<z.infer<typeof mapPointSchema>[]>([])
const [visiblePoints, setVisiblePoints] = useState<z.infer<typeof mapPointSchema>[]>([])

useEffect(() => {
if (!locationConcerts) {
return
}
const newPoints = locationConcerts.map((locationConcert, index) => {
return {
id: index,
originalId: locationConcert.id,
type: 'Feature',
properties: { cluster_id: index },
geometry: {
type: 'Point',
coordinates: [locationConcert.longitude, locationConcert.latitude],
},
} satisfies z.infer<typeof mapPointSchema>
})
setVisiblePoints(newPoints)
setPoints((prevPoints) => {
const validation = mapPointSchema.array().safeParse(newPoints)
if (validation.error) {
console.error(validation.error)
return prevPoints
}

const newValue = uniqBy([...prevPoints, ...validation.data], 'originalId')
return newValue
})
}, [locationConcerts])

return {
locationConcerts,
isLoadingLocationConcerts,
points,
setPoints,
visiblePoints,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useState } from 'react'
import { getZoomLevel } from '../utils'
import { MapRegionWithZoomLevel, UseMapRegionWithZoomLevelParams } from './use-map-region-with-zoom-level.types'

export const useMapRegionWithZoomLevel = ({ latitude, longitude }: UseMapRegionWithZoomLevelParams) => {
const [mapRegionWithZoomLevel, setMapRegionWithZoomLevel] = useState<MapRegionWithZoomLevel>({
latitude: latitude,
longitude: longitude,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
zoomLevel: getZoomLevel(0.0922),
})

return {
mapRegionWithZoomLevel,
setMapRegionWithZoomLevel,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Region } from 'react-native-maps'

export type MapRegionWithZoomLevel = Region & {
zoomLevel: number
}

export type UseMapRegionWithZoomLevelParams = {
latitude: number
longitude: number
}
52 changes: 52 additions & 0 deletions apps/billets-app/src/features/map/hooks/use-super-cluster.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { useEffect, useState } from 'react'
import Supercluster from 'supercluster'
import { z } from 'zod'
import { mapPointSchema } from '../map.types'
import { getZoomLevel } from '../utils'
import { MapRegionWithZoomLevel } from './use-map-region-with-zoom-level.types'

export const useSuperCluster = ({
mapRegionWithZoomLevel,
points,
}: {
mapRegionWithZoomLevel: MapRegionWithZoomLevel
points: z.infer<typeof mapPointSchema>[]
}) => {
const [supercluster] = useState(
() =>
new Supercluster({
radius: 40,
maxZoom: 16,
minZoom: 1,
}),
)

const [clusters, setClusters] = useState<z.infer<typeof mapPointSchema>[]>([])

useEffect(() => {
const region = mapRegionWithZoomLevel
const zoomLevel = getZoomLevel(region.latitudeDelta)

const bbox = [
region.longitude - region.longitudeDelta,
region.latitude - region.latitudeDelta,
region.longitude + region.longitudeDelta,
region.latitude + region.latitudeDelta,
] as [number, number, number, number]

supercluster.load(points)
const clusters = supercluster.getClusters(bbox, zoomLevel)
const clustersValidation = mapPointSchema.array().safeParse(clusters)

if (clustersValidation.success) {
setClusters(clustersValidation.data)
} else {
console.error(clustersValidation.error)
}
}, [mapRegionWithZoomLevel, points, supercluster])

return {
clusters,
supercluster,
}
}
Loading

0 comments on commit 5f12e16

Please sign in to comment.