Skip to content

Commit

Permalink
Merge pull request #58 from Team-Shaka/develop
Browse files Browse the repository at this point in the history
2.0.1
  • Loading branch information
gomsang authored Jan 7, 2024
2 parents 0483d16 + 62a4380 commit bf75937
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 28 deletions.
22 changes: 15 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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'])
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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"

Expand All @@ -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'
}
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="${admobAppId}"/>
</application>

</manifest>
24 changes: 24 additions & 0 deletions app/src/main/java/com/dev/briefing/presentation/ad/AdmobBanner.kt
Original file line number Diff line number Diff line change
@@ -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())
}
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -89,6 +90,7 @@ fun ArticleDetailScreen(
Column(
modifier = Modifier
.fillMaxSize()
.weight(1f)
.verticalScroll(rememberScrollState())
) {
val article = uiState.article
Expand Down Expand Up @@ -140,6 +142,7 @@ fun ArticleDetailScreen(

RelatedArticles(Modifier.padding(32.dp, 16.dp), article.relatedArticles)
}
AdmobBanner(Modifier.fillMaxWidth())
}
}
}
Expand Down
42 changes: 24 additions & 18 deletions app/src/main/java/com/dev/briefing/presentation/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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))
}
}
}
3 changes: 3 additions & 0 deletions app/src/main/java/com/dev/briefing/util/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,6 +26,8 @@ class MainApplication : Application() {
}
})

RequestConfiguration.Builder().setTestDeviceIds(listOf(BuildConfig.ADMOB_TEST_DEVICE_1))

startKoin {
androidContext(this@MainApplication)
modules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<string name="setting_caution">유의 사항</string>
<string name="setting_logout">로그 아웃</string>
<string name="setting_signout">회원 탈퇴</string>
<string name="setting_login">로그인</string>
<string name="detail_article_header">관련 기사</string>
<string name="notification_channel_id">your_channel_id</string>
<string name="notification_channel_name">Your Channel Name</string>
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit bf75937

Please sign in to comment.