Skip to content

Commit

Permalink
Merge pull request #218 from Nexters/release/1.4.0_2
Browse files Browse the repository at this point in the history
Release/1.4.0
  • Loading branch information
mangbaam authored Apr 9, 2024
2 parents 48e7975 + b1475dc commit 0c7c430
Show file tree
Hide file tree
Showing 177 changed files with 4,531 additions and 1,955 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 핫한 공연 예매의 시작 불티

- 플레이 스토어 : https://play.google.com/store/apps/details?id=com.nexters.boolti
- 앱 스토어 : https://apps.apple.com/kr/app/%EB%B6%88%ED%8B%B0/id6476589322
- 주최자용 웹 : https://boolti.in

</br>

## Screenshots
<img width=20% src="https://github.com/Nexters/Boolti/assets/35232655/1720adc2-80aa-46aa-a079-cdf23bfd8a01">
<img width=20% src="https://github.com/Nexters/Boolti/assets/35232655/b218b684-7022-49a9-9b97-308d4d7a942b">
<img width=20% src="https://github.com/Nexters/Boolti/assets/35232655/bc784377-ec05-4d28-b578-1c638d2cd5b5">
<img width=20% src="https://github.com/Nexters/Boolti/assets/35232655/d080d5e0-e979-4e66-94f8-dcd8d49d3d78">

</br></br>

## Android developers

|Android|Android|
|:---:|:---:|
|[박명범](https://github.com/mangbaam)|[송준영](https://github.com/HamBP)|
|<img src="https://github.com/mangbaam.png?size=144">|<img src="https://github.com/HamBP.png?size=144">|

</br>

## Other repositories
- iOS Repository : https://github.com/Nexters/Boolti-iOS
- FE Repository : https://github.com/Nexters/boolti-web
- BE Repository : private
4 changes: 3 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/build
/build
*.jks
*keystore
29 changes: 27 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@
<activity
android:name=".presentation.screen.MainActivity"
android:exported="true"
android:theme="@style/Theme.Boolti" />
android:theme="@style/Theme.Boolti" >

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="app.boolti.in" />
<data android:host="preview.boolti.in" />
</intent-filter>
</activity>

<activity
android:name=".presentation.screen.splash.SplashActivity"
android:exported="true"
Expand Down Expand Up @@ -58,5 +71,17 @@
android:scheme="kakao${KAKAO_APP_KEY}" />
</intent-filter>
</activity>

<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />

<service
android:name=".presentation.service.BtFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
</manifest>
2 changes: 2 additions & 0 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ dependencies {
implementation(libs.bundles.network)

implementation(libs.firebase.config.ktx)
implementation(libs.bundles.firebase)
implementation(platform(libs.firebase.bom))

testImplementation(libs.junit)
testImplementation(libs.bundles.kotest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
import javax.inject.Inject

class AuthDataSource @Inject constructor(
internal class AuthDataSource @Inject constructor(
private val context: Context,
private val loginService: LoginService,
) {
Expand Down Expand Up @@ -48,7 +48,11 @@ class AuthDataSource @Inject constructor(
}

suspend fun logout(): Result<Unit> = runCatching {
localLogout()
loginService.logout()
}

suspend fun localLogout() {
dataStore.updateData {
it.copy(
userId = null,
Expand All @@ -58,7 +62,7 @@ class AuthDataSource @Inject constructor(
phoneNumber = null,
photo = null,
accessToken = "",
refreshToken = ""
refreshToken = "",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.nexters.boolti.data.datasource

import com.google.android.gms.tasks.OnCompleteListener
import com.google.firebase.messaging.FirebaseMessaging
import com.nexters.boolti.data.network.api.DeviceTokenService
import com.nexters.boolti.data.network.request.DeviceTokenRequest
import java.io.IOException
import javax.inject.Inject
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine

internal class DeviceTokenDataSource @Inject constructor(
private val deviceTokenService: DeviceTokenService,
) {
suspend fun sendFcmToken(): Result<Unit> = runCatching {
val response = deviceTokenService.postFcmToken(
DeviceTokenRequest(deviceToken = getFcmToken(), deviceType = "ANDROID")
)

if (!response.isSuccessful) throw IOException("fcm 토큰을 서버에 전송하는 데 실패했어요.")
}

private suspend fun getFcmToken(): String = suspendCoroutine { continuation ->
val firebaseMessaging = FirebaseMessaging.getInstance()
firebaseMessaging.token.addOnCompleteListener(OnCompleteListener { task ->
if (!task.isSuccessful) {
continuation.resumeWithException(IllegalStateException("fcm 토큰을 가져오는 데 실패했어요."))
return@OnCompleteListener
}

val token = task.result

continuation.resume(token)
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.nexters.boolti.domain.request.QrScanRequest
import retrofit2.Response
import javax.inject.Inject

class HostDataSource @Inject constructor(
internal class HostDataSource @Inject constructor(
private val apiService: HostService,
) {
suspend fun requestEntrance(request: QrScanRequest): Response<Boolean> = apiService.requestEntrance(request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import javax.inject.Inject

class PolicyDataSource @Inject constructor(
internal class PolicyDataSource @Inject constructor(
private val context: Context,
) {
private val dataStore: DataStore<AppSettings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import timber.log.Timber
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine

class RemoteConfigDataSource(
internal class RemoteConfigDataSource(
private val remoteConfig: FirebaseRemoteConfig,
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.nexters.boolti.data.network.response.ReservationResponse
import com.nexters.boolti.domain.request.RefundRequest
import javax.inject.Inject

class ReservationDataSource @Inject constructor(
internal class ReservationDataSource @Inject constructor(
private val reservationService: ReservationService,
) {
suspend fun getReservations(): List<ReservationResponse> = reservationService.getReservations()
Expand All @@ -15,4 +15,4 @@ class ReservationDataSource @Inject constructor(
reservationService.findReservationById(id)

suspend fun refund(request: RefundRequest) = reservationService.refund(request)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.nexters.boolti.data.network.response.ShowDetailResponse
import com.nexters.boolti.data.network.response.ShowResponse
import javax.inject.Inject

class ShowDataSource @Inject constructor(
internal class ShowDataSource @Inject constructor(
private val showService: ShowService,
) {
suspend fun search(keyword: String): Result<List<ShowResponse>> = runCatching {
Expand All @@ -15,4 +15,4 @@ class ShowDataSource @Inject constructor(
suspend fun findShowById(id: String): Result<ShowDetailResponse> = runCatching {
showService.findShowById(id)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import com.nexters.boolti.data.network.response.SignUpResponse
import com.nexters.boolti.domain.request.SignUpRequest
import javax.inject.Inject

class SignUpDataSource @Inject constructor(
internal class SignUpDataSource @Inject constructor(
private val signUpService: SignUpService,
) {
suspend fun signUp(signUpRequest: SignUpRequest): Result<SignUpResponse> = runCatching {
signUpService.signup(signUpRequest)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.nexters.boolti.data.network.api.TicketService
import com.nexters.boolti.domain.model.Ticket
import javax.inject.Inject

class TicketDataSource @Inject constructor(
internal class TicketDataSource @Inject constructor(
private val apiService: TicketService,
) {
suspend fun getTickets(): List<Ticket> = apiService.getTickets().map { it.toDomain() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.nexters.boolti.domain.request.TicketingInfoRequest
import retrofit2.Response
import javax.inject.Inject

class TicketingDataSource @Inject constructor(
internal class TicketingDataSource @Inject constructor(
private val ticketingService: TicketingService,
) {
suspend fun getSalesTickets(request: SalesTicketRequest): List<TicketWithQuantity> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import com.nexters.boolti.data.db.AppSettings
import com.nexters.boolti.data.db.dataStore
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.single
import kotlinx.coroutines.runBlocking
import javax.inject.Inject

class TokenDataSource @Inject constructor(
internal class TokenDataSource @Inject constructor(
private val context: Context,
) {
private val dataStore: DataStore<AppSettings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package com.nexters.boolti.data.datasource

import com.nexters.boolti.data.network.api.UserService
import com.nexters.boolti.data.network.response.UserResponse
import com.nexters.boolti.domain.request.SignoutRequest
import javax.inject.Inject

class UserDataSource @Inject constructor(
internal class UserDataSource @Inject constructor(
private val userService: UserService,
) {
suspend fun getUser(): UserResponse = userService.getUser()
}
suspend fun signout(request: SignoutRequest) = userService.signout(request)
}
4 changes: 2 additions & 2 deletions data/src/main/java/com/nexters/boolti/data/db/AppSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.io.InputStream
import java.io.OutputStream

@Serializable
data class AppSettings(
internal data class AppSettings(
val userId: String? = null,
val loginType: String? = null,
val nickname: String? = null,
Expand All @@ -20,7 +20,7 @@ data class AppSettings(
val refundPolicy: List<String> = emptyList(),
)

object AppSettingsSerializer : Serializer<AppSettings> {
internal object AppSettingsSerializer : Serializer<AppSettings> {

override val defaultValue: AppSettings = AppSettings()

Expand Down
2 changes: 1 addition & 1 deletion data/src/main/java/com/nexters/boolti/data/db/DataStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.dataStore

val Context.dataStore: DataStore<AppSettings> by dataStore(
internal val Context.dataStore: DataStore<AppSettings> by dataStore(
"app-settings.json",
AppSettingsSerializer,
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import javax.inject.Singleton

@InstallIn(SingletonComponent::class)
@Module
object DataSourceModule {
internal object DataSourceModule {
@Singleton
@Provides
fun provideRemoteConfigDataSource(remoteConfig: FirebaseRemoteConfig): RemoteConfigDataSource =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import javax.inject.Singleton

@InstallIn(SingletonComponent::class)
@Module
object FirebaseModule {
internal object FirebaseModule {
@Singleton
@Provides
fun provideRemoteConfig(): FirebaseRemoteConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.nexters.boolti.data.network.api.LoginService
import com.nexters.boolti.data.network.AuthAuthenticator
import com.nexters.boolti.data.datasource.AuthDataSource
import com.nexters.boolti.data.network.AuthInterceptor
import com.nexters.boolti.data.network.api.DeviceTokenService
import com.nexters.boolti.data.network.api.HostService
import com.nexters.boolti.data.network.api.ReservationService
import com.nexters.boolti.data.network.api.ShowService
Expand All @@ -30,7 +31,7 @@ import javax.inject.Singleton

@InstallIn(SingletonComponent::class)
@Module
object NetworkModule {
internal object NetworkModule {
@Singleton
@Provides
@Named("auth")
Expand Down Expand Up @@ -77,6 +78,11 @@ object NetworkModule {
@Provides
fun provideUserService(@Named("auth") retrofit: Retrofit): UserService = retrofit.create()

@Singleton
@Provides
fun provideDeviceTokenService(@Named("auth") retrofit: Retrofit): DeviceTokenService =
retrofit.create()

@Singleton
@Provides
fun provideSignUpService(retrofit: Retrofit): SignUpService = retrofit.create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import dagger.hilt.components.SingletonComponent

@InstallIn(SingletonComponent::class)
@Module
abstract class RepositoryModule {
internal abstract class RepositoryModule {
@Binds
abstract fun bindConfigRepository(repository: ConfigRepositoryImpl): ConfigRepository

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import okhttp3.Response
import okhttp3.Route
import javax.inject.Inject

class AuthAuthenticator @Inject constructor(
internal class AuthAuthenticator @Inject constructor(
private val tokenDataSource: TokenDataSource,
private val authDataSource: AuthDataSource,
) : Authenticator {
Expand All @@ -28,6 +28,9 @@ class AuthAuthenticator @Inject constructor(
refreshToken = it.refreshToken,
)
it.accessToken
} ?: run {
authDataSource.logout()
null
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import okhttp3.Interceptor
import okhttp3.Response
import javax.inject.Inject

class AuthInterceptor @Inject constructor(
internal class AuthInterceptor @Inject constructor(
private val tokenDataSource: TokenDataSource,
) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.nexters.boolti.data.network.api


import com.nexters.boolti.data.network.request.DeviceTokenRequest
import com.nexters.boolti.data.network.response.DeviceTokenResponse
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.POST

internal interface DeviceTokenService {
@POST("/app/papi/v1/device-token")
suspend fun postFcmToken(@Body request: DeviceTokenRequest): Response<DeviceTokenResponse>
}
Loading

0 comments on commit 0c7c430

Please sign in to comment.