diff --git a/app/build.gradle b/app/build.gradle
index 7b3f4c9..b11d16b 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,6 +2,7 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
+ id 'com.google.firebase.crashlytics'
}
android {
@@ -14,8 +15,8 @@ android {
applicationId "com.dev.briefing"
minSdk 28
targetSdk 34
- versionCode 4
- versionName "2.0.0"
+ versionCode 5
+ versionName "2.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
@@ -24,13 +25,16 @@ android {
Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
buildConfigField "String", "BASE_URL", "\"${properties.getProperty("BASE_URL")}\""
-// buildConfigField "String", "DEV_BASE_URL", "\"${properties.getProperty("DEV_BASE_URL")}\""
buildConfigField "String", "WEB_URL", "\"${properties.getProperty("WEB_URL")}\""
buildConfigField "String", "NOTIFICATION_CHANNEL_ID", "\"NOTIFICATION_CHANNEL_ID\""
buildConfigField "String", "GOOGLE_CLIENT_ID", "\"${properties.getProperty("GOOGLE_CLIENT_ID")}\""
+ buildConfigField "String", "ADMOB_APP_ID", "\"${properties.getProperty("ADMOB_APP_ID")}\""
+ buildConfigField "String", "ADMOB_BANNER_ID", "\"${properties.getProperty("ADMOB_BANNER_ID")}\""
+ buildConfigField "String", "ADMOB_TEST_DEVICE_1", "\"${properties.getProperty("ADMOB_TEST_DEVICE_1")}\""
+ manifestPlaceholders = [admobAppId: "${properties.getProperty('ADMOB_APP_ID')}"]
}
- signingConfigs{
- config{
+ signingConfigs {
+ config {
keyAlias keyProperties['keyAlias']
keyPassword keyProperties['keyAlias']
storeFile file(keyProperties['storeFile'])
@@ -67,7 +71,6 @@ android {
}
dependencies {
-
implementation 'androidx.core:core-ktx:1.8.0'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
@@ -83,7 +86,7 @@ dependencies {
implementation 'androidx.compose.material3:material3-android:1.2.0-alpha12'
- implementation ("androidx.constraintlayout:constraintlayout-compose:1.0.1")
+ implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1")
implementation 'androidx.compose.ui:ui-tooling-android:1.5.4'
//Test Library
testImplementation 'junit:junit:4.13.2'
@@ -125,6 +128,8 @@ dependencies {
//analytics
implementation platform("com.google.firebase:firebase-bom:32.5.0")
implementation "com.google.firebase:firebase-analytics"
+ //crashlytics
+ implementation("com.google.firebase:firebase-crashlytics")
implementation "androidx.work:work-runtime-ktx:$work_version"
@@ -134,4 +139,7 @@ dependencies {
implementation("androidx.credentials:credentials:1.2.0")
implementation("androidx.credentials:credentials-play-services-auth:1.2.0")
+
+ // Google Admob
+ implementation 'com.google.android.gms:play-services-ads:22.6.0'
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a49721c..5413778 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -51,6 +51,10 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/dev/briefing/presentation/ad/AdmobBanner.kt b/app/src/main/java/com/dev/briefing/presentation/ad/AdmobBanner.kt
new file mode 100644
index 0000000..9f15f50
--- /dev/null
+++ b/app/src/main/java/com/dev/briefing/presentation/ad/AdmobBanner.kt
@@ -0,0 +1,24 @@
+package com.dev.briefing.presentation.ad
+
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.viewinterop.AndroidView
+import com.dev.briefing.BuildConfig
+import com.google.android.gms.ads.AdRequest
+import com.google.android.gms.ads.AdSize
+import com.google.android.gms.ads.AdView
+
+@Composable
+fun AdmobBanner(modifier: Modifier = Modifier) {
+ AndroidView(
+ modifier = Modifier.fillMaxWidth(),
+ factory = { context ->
+ AdView(context).apply {
+ setAdSize(AdSize.BANNER)
+ adUnitId = BuildConfig.ADMOB_BANNER_ID
+ loadAd(AdRequest.Builder().build())
+ }
+ }
+ )
+}
diff --git a/app/src/main/java/com/dev/briefing/presentation/detail/ArticleDetailScreen.kt b/app/src/main/java/com/dev/briefing/presentation/detail/ArticleDetailScreen.kt
index 5ee08d0..e1aee6e 100644
--- a/app/src/main/java/com/dev/briefing/presentation/detail/ArticleDetailScreen.kt
+++ b/app/src/main/java/com/dev/briefing/presentation/detail/ArticleDetailScreen.kt
@@ -28,6 +28,7 @@ import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.dev.briefing.R
import com.dev.briefing.model.RelatedArticle
+import com.dev.briefing.presentation.ad.AdmobBanner
import com.dev.briefing.presentation.login.SignInActivity
import com.dev.briefing.presentation.theme.BriefingTheme
import com.dev.briefing.presentation.theme.utils.CommonDialog
@@ -89,6 +90,7 @@ fun ArticleDetailScreen(
Column(
modifier = Modifier
.fillMaxSize()
+ .weight(1f)
.verticalScroll(rememberScrollState())
) {
val article = uiState.article
@@ -140,6 +142,7 @@ fun ArticleDetailScreen(
RelatedArticles(Modifier.padding(32.dp, 16.dp), article.relatedArticles)
}
+ AdmobBanner(Modifier.fillMaxWidth())
}
}
}
diff --git a/app/src/main/java/com/dev/briefing/presentation/home/HomeScreen.kt b/app/src/main/java/com/dev/briefing/presentation/home/HomeScreen.kt
index 7a32dd4..32339b3 100644
--- a/app/src/main/java/com/dev/briefing/presentation/home/HomeScreen.kt
+++ b/app/src/main/java/com/dev/briefing/presentation/home/HomeScreen.kt
@@ -40,6 +40,7 @@ import androidx.navigation.compose.rememberNavController
import com.dev.briefing.R
import com.dev.briefing.model.BriefingCompactArticle
import com.dev.briefing.navigation.HomeScreen
+import com.dev.briefing.presentation.ad.AdmobBanner
import com.dev.briefing.presentation.common.BriefingTabRow
import com.dev.briefing.presentation.home.HomeCategory
import com.dev.briefing.presentation.home.HomeViewModel
@@ -202,25 +203,30 @@ fun HomeScreenArticleList(
}
}
- Box(
- modifier = Modifier
- .fillMaxSize()
- .nestedScroll(pullRefreshState.nestedScrollConnection)
- ) {
- CategoryArticleList(
- createdAt = updatedAt?.let { formatBriefingDate(it) } ?: "",
- articles = articles,
- onArticleSelect = onArticleSelect,
- onRefresh = {
- onRefreshRequest.invoke()
- })
-
- PullToRefreshContainer(
+ Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.Bottom) {
+ Box(
modifier = Modifier
- .align(Alignment.TopCenter)
- .graphicsLayer(scaleX = scaleFraction, scaleY = scaleFraction),
- state = pullRefreshState
- )
+ .fillMaxSize()
+ .weight(1f)
+ .nestedScroll(pullRefreshState.nestedScrollConnection)
+ ) {
+ CategoryArticleList(
+ createdAt = updatedAt?.let { formatBriefingDate(it) } ?: "",
+ articles = articles,
+ onArticleSelect = onArticleSelect,
+ onRefresh = {
+ onRefreshRequest.invoke()
+ })
+
+ PullToRefreshContainer(
+ modifier = Modifier
+ .align(Alignment.TopCenter)
+ .graphicsLayer(scaleX = scaleFraction, scaleY = scaleFraction),
+ state = pullRefreshState
+ )
+ }
+
+ AdmobBanner(Modifier.fillMaxWidth())
}
}
diff --git a/app/src/main/java/com/dev/briefing/presentation/setting/SettingScreen.kt b/app/src/main/java/com/dev/briefing/presentation/setting/SettingScreen.kt
index 4f48daa..622e3f0 100644
--- a/app/src/main/java/com/dev/briefing/presentation/setting/SettingScreen.kt
+++ b/app/src/main/java/com/dev/briefing/presentation/setting/SettingScreen.kt
@@ -113,8 +113,7 @@ fun SettingScreen(
modifier = modifier
.fillMaxWidth()
.fillMaxHeight()
- .background(color = BriefingTheme.color.BackgrundGray)
- .padding(bottom = 40.dp),
+ .background(color = BriefingTheme.color.BackgrundGray),
horizontalAlignment = Alignment.Start,
) {
item {
@@ -225,9 +224,10 @@ fun SettingScreen(
}
)
+ SettingSection(R.string.setting_section_auth)
+
if (authPreferenceHelper.getMemberId() != -1) {
//로그 아웃 및 회원 탈퇴
- SettingSection(R.string.setting_section_auth)
SettingMenuItem(
type = SettingMenu(
isArrow = true,
@@ -249,7 +249,22 @@ fun SettingScreen(
openExitDialog.value = true
}
)
+ } else {
+ SettingMenuItem(
+ type = SettingMenu(
+ isArrow = true,
+ ),
+ title = R.string.setting_login,
+ onClick = {
+ val intent = Intent(context, SignInActivity::class.java)
+ startActivity(context, intent, null)
+ val activity = context as? Activity
+ activity?.finish()
+ }
+ )
}
+
+ Spacer(modifier = Modifier.height(40.dp))
}
}
}
diff --git a/app/src/main/java/com/dev/briefing/util/MainApplication.kt b/app/src/main/java/com/dev/briefing/util/MainApplication.kt
index 02dc0b9..920ec70 100644
--- a/app/src/main/java/com/dev/briefing/util/MainApplication.kt
+++ b/app/src/main/java/com/dev/briefing/util/MainApplication.kt
@@ -9,6 +9,7 @@ import com.dev.briefing.di.networkModule
import com.dev.briefing.di.preferenceModule
import com.dev.briefing.di.repositoryModule
import com.dev.briefing.di.viewModelModule
+import com.google.android.gms.ads.RequestConfiguration
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.Logger
import org.koin.android.ext.koin.androidContext
@@ -25,6 +26,8 @@ class MainApplication : Application() {
}
})
+ RequestConfiguration.Builder().setTestDeviceIds(listOf(BuildConfig.ADMOB_TEST_DEVICE_1))
+
startKoin {
androidContext(this@MainApplication)
modules(
diff --git a/app/src/main/java/com/dev/briefing/util/preference/DailyAlertTimePreferenceHelper.kt b/app/src/main/java/com/dev/briefing/util/preference/DailyAlertTimePreferenceHelper.kt
index 1a1a23d..746957b 100644
--- a/app/src/main/java/com/dev/briefing/util/preference/DailyAlertTimePreferenceHelper.kt
+++ b/app/src/main/java/com/dev/briefing/util/preference/DailyAlertTimePreferenceHelper.kt
@@ -25,6 +25,7 @@ class DailyAlertTimePreferenceHelper(val context: Context) {
fun saveAlarmTime(items: AlarmTime) {
val json = Gson().toJson(items)
editor.putString(KEY_DAILY_ALARM_TIME, json)
+ editor.apply()
}
companion object {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 47596c2..3b52906 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -13,6 +13,7 @@
유의 사항
로그 아웃
회원 탈퇴
+ 로그인
관련 기사
your_channel_id
Your Channel Name
diff --git a/build.gradle b/build.gradle
index 5cb0ba6..6864d5f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -18,4 +18,5 @@ plugins {
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
id 'com.google.gms.google-services' version '4.4.0' apply false
+ id 'com.google.firebase.crashlytics' version '2.9.9' apply false
}
\ No newline at end of file