Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import com.yapp.app.setNamespace
plugins {
id("yapp.android.application")
alias(libs.plugins.google.services)
alias(libs.plugins.firebase.crashlytics)
}

android {
setNamespace("app.official")

defaultConfig {
applicationId = "com.yapp.app.official"
versionCode = 1
versionCode = 2
versionName = "1.0.0"

targetSdk = 35
Expand All @@ -24,13 +24,15 @@ dependencies {
implementation(projects.feature.login)
implementation(projects.core.designsystem)
implementation(projects.core.data) // For di
implementation(projects.core.dataApi) // For di
implementation(projects.core.dataApi)
implementation(projects.core.domain)
implementation(projects.core.commonAndroid)
implementation(projects.detekt)

implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics)
implementation(libs.firebase.messaging)
implementation(libs.firebase.crashlytics)

implementation(libs.androidx.activity.compose)
implementation(libs.androidx.navigation.runtime.ktx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import com.yapp.app.official.MainActivity
import com.yapp.app.official.R
import com.yapp.core.common.android.record
import com.yapp.core.data.data.Dispatcher
import com.yapp.core.data.data.YappDispatchers
import com.yapp.dataapi.AlarmRepository
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.retry
Expand All @@ -41,6 +43,7 @@ class FirebaseMessagingService : FirebaseMessagingService() {

flow<Unit> { alarmRepository.updateFcmToken(token) }
.retry(3)
.catch { e -> e.record() }
.launchIn(scope)
}

Expand Down
1 change: 1 addition & 0 deletions build-logic/src/main/java/yapp.android.feature.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ dependencies {
implementation(project(":core:model"))
implementation(project(":core:domain"))
implementation(project(":core:data-api"))
implementation(project(":core:common-android"))
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ plugins {
alias(libs.plugins.protobuf) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.detekt) apply false
alias(libs.plugins.firebase.crashlytics) apply false
}
1 change: 1 addition & 0 deletions core/common-android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
16 changes: 16 additions & 0 deletions core/common-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import com.yapp.app.setNamespace

plugins {
id("yapp.android.library")
}

android {
setNamespace("core.core.common.android")
}

dependencies {

implementation(platform(libs.firebase.bom))
implementation(libs.firebase.crashlytics)
implementation(libs.timber)
}
Empty file.
21 changes: 21 additions & 0 deletions core/common-android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
4 changes: 4 additions & 0 deletions core/common-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.yapp.core.common.android

import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
import timber.log.Timber

fun Throwable.record() {
recordException(RuntimeException(this))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwable을 rethrow하는 경우 stack trace에 rethrow한 위치가 남지 않아 RuntimeException으로 감샀습니다. 이러면 throw, rethrow의 stack trace 정보가 모두 남게 됩니다.

}

private fun recordException(
e: Throwable,
) {
Timber.e(e)
Firebase.crashlytics.recordException(e)
}
2 changes: 1 addition & 1 deletion core/model/src/main/java/com/yapp/model/Regex.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.yapp.model

object Regex {
val password = Regex("^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@\$!%*?&])[A-Za-z\\d@\$!%*?&]{8,20}\$")
val password = Regex("^(?=.*[A-Za-z])(?=.*\\d)(?=.*[^A-Za-z\\d])[A-Za-z\\d\\S]{8,20}$")
val email = Regex(
"^(?:[a-zA-Z0-9!#\$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#\$%&'*+/=?^_`{|}~-]+)*|" +
"\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.yapp.feature.home
import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.yapp.core.common.android.record
import com.yapp.core.ui.component.UserRole
import com.yapp.core.ui.mvi.MviIntentStore
import com.yapp.core.ui.mvi.mviIntentStore
Expand Down Expand Up @@ -37,8 +38,6 @@ class HomeViewModel @Inject constructor(
reduce: (HomeState.() -> HomeState) -> Unit,
postSideEffect: (HomeSideEffect) -> Unit,
) {
Log.d("HomeViewModel", "intent :: $intent")

when (intent) {
HomeIntent.ClickMoreButton -> postSideEffect(HomeSideEffect.NavigateToNotice)
HomeIntent.ClickSettingButton -> postSideEffect(HomeSideEffect.NavigateToSetting)
Expand All @@ -55,7 +54,7 @@ class HomeViewModel @Inject constructor(
.catch { error->
when(error) {
is UserNotFoundForEmailException, is InvalidTokenException -> postSideEffect(HomeSideEffect.NavigateToLogin)
else -> throw error
else -> error.record()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앞으로 예외는 이렇게 처리하시면 됩니다.

}
}
.collectLatest{ userInfo ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class EmailViewModel @Inject constructor(
reduce { newState }
postSideEffect(EmailSideEffect.EmailChanged(intent.email))

if (newState.email.isEmpty()) return
if (newState.isEmailRegexFailed) return

checkEmailJob = viewModelScope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -49,6 +51,7 @@ fun PasswordContent(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 20.dp)
.verticalScroll(rememberScrollState())
) {
Text(
text = stringResource(R.string.signup_screen_step_3),
Expand Down
7 changes: 5 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ compose-stable-marker = "1.0.3"

composeBom = "2024.12.01"
firebaseBom = "32.1.1"
firebaseCrashlytics = "2.9.9"
coroutinesPlayServices = "1.7.3"

junit = "4.13.2"
Expand Down Expand Up @@ -100,8 +101,9 @@ room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" }
room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" }

firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebaseBom" }
firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics" }
firebase-messaging = { group = "com.google.firebase", name = "firebase-messaging" }
firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics-ktx" }
firebase-messaging = { group = "com.google.firebase", name = "firebase-messaging-ktx" }
firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics-ktx" }

coroutines-play-services = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-play-services", version = "coroutinesPlayServices" }
detekt = { group = "io.gitlab.arturbosch.detekt", name = "detekt-api", version.ref = "detekt" }
Expand All @@ -118,3 +120,4 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }
google-services = { id = "com.google.gms.google-services", version.ref = "googleService" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlytics" }
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ include(
":feature:signup",
":feature:login"
)
include(":core:common-android")