Skip to content

Commit

Permalink
Merge pull request #909 from TeamHavit/release
Browse files Browse the repository at this point in the history
[RELEASE] v1.0.11 배포
  • Loading branch information
KxxHyoRim authored Mar 7, 2024
2 parents 258398c + 3f4e6d9 commit 42188cb
Show file tree
Hide file tree
Showing 23 changed files with 422 additions and 89 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,7 @@ release/

!/gradle/wrapper/gradle-wrapper.jar

# End of https://www.toptal.com/developers/gitignore/api/kotlin,androidstudio
# End of https://www.toptal.com/developers/gitignore/api/kotlin,androidstudio
/.idea/sonarlint/*
/.idea/dbnavigator.xml
/.idea/migrations.xml
7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
applicationId "org.sopt.havit"
minSdk 23
targetSdk 33
versionCode 110
versionName "1.0.10"
versionCode 111
versionName "1.0.11"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "HAVIT_BASE_URL_DEV", properties["HAVIT_BASE_URL_DEV"])
buildConfigField("String", "HAVIT_BASE_URL_PROD", properties["HAVIT_BASE_URL_PROD"])
Expand Down Expand Up @@ -137,13 +137,14 @@ dependencies {
implementation 'com.google.firebase:firebase-messaging-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-config-ktx'

// Jsoup
implementation 'org.jsoup:jsoup:1.13.1'

// Splash Screen
implementation 'androidx.core:core-splashscreen:1.0.0-rc01'


// gson
implementation "com.google.code.gson:gson:2.8.8" //to use SerializedName

Expand Down
17 changes: 12 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.sopt.havit">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<queries>
<package android:name="com.kakao.talk" />
Expand All @@ -24,7 +25,13 @@
android:roundIcon="@mipmap/ic_launcher_havit_round"
android:supportsRtl="true"
android:theme="@style/Theme.Havit"
android:usesCleartextTraffic="true">
android:usesCleartextTraffic="true"
tools:ignore="LockedOrientationActivity">

<activity
android:name=".ui.system_maintenance.SystemMaintenanceActivity"
android:exported="false" />

<activity
android:name=".ui.setting.SettingNoticeActivity"
android:configChanges="orientation"
Expand Down Expand Up @@ -64,9 +71,9 @@
<activity
android:name=".ui.setting.SettingModifyNicknameActivity"
android:configChanges="orientation"
android:windowSoftInputMode="stateVisible"
android:exported="false"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" />
<activity
android:name=".ui.setting.SettingActivity"
android:configChanges="orientation"
Expand Down Expand Up @@ -197,4 +204,4 @@
android:value="${KAKAO_NATIVE_APP_KEY}" />
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.sopt.havit.data.repository

import org.sopt.havit.data.source.remote.RemoteConfigDataSource
import org.sopt.havit.domain.repository.SystemMaintenanceRepository
import javax.inject.Inject

class SystemMaintenanceRepositoryImpl @Inject constructor(
private val systemMaintenanceRemoteDataSource: RemoteConfigDataSource,
) : SystemMaintenanceRepository {
override suspend fun isSystemMaintenance(): Boolean {
val isSystemUnderMaintenance = systemMaintenanceRemoteDataSource.fetchRemoteConfig(
IS_SYSTEM_UNDER_MAINTENANCE,
Boolean::class.java
) as? Boolean
return isSystemUnderMaintenance ?: false
}

override suspend fun getSystemMaintenanceMessage(): String {
val message = systemMaintenanceRemoteDataSource.fetchRemoteConfig(
SYSTEM_MAINTENANCE_MESSAGE,
String::class.java
).toString()
return message.ifEmpty { DEFAULT_MESSAGE }
}

companion object {
private const val IS_SYSTEM_UNDER_MAINTENANCE = "isSystemUnderMaintenance"
private const val SYSTEM_MAINTENANCE_MESSAGE = "systemMaintenanceMessage"
private const val DEFAULT_MESSAGE = "현재 시스템 점검중입니다.\\n불편을 끼쳐드려 죄송합니다."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.sopt.havit.data.source.remote

import java.lang.reflect.Type

interface RemoteConfigDataSource {
suspend fun fetchRemoteConfig(configKey: String, valueType: Type): Any
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.sopt.havit.data.source.remote

import com.google.firebase.ktx.Firebase
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.firebase.remoteconfig.ktx.remoteConfig
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings
import kotlinx.coroutines.suspendCancellableCoroutine
import java.lang.reflect.Type
import javax.inject.Inject

class RemoteConfigDataSourceImpl @Inject constructor() : RemoteConfigDataSource {

private val remoteConfig: FirebaseRemoteConfig = Firebase.remoteConfig.apply {
setConfigSettingsAsync(remoteConfigSettings { minimumFetchIntervalInSeconds = 60 })
}

override suspend fun fetchRemoteConfig(configKey: String, valueType: Type): Any {
return suspendCancellableCoroutine { continuation ->
remoteConfig.fetchAndActivate().addOnCompleteListener { task ->
if (task.isSuccessful) {
val remoteConfigValue = when (valueType) {
String::class.java -> remoteConfig.getString(configKey)
Boolean::class.java -> remoteConfig.getBoolean(configKey)
Long::class.java -> remoteConfig.getLong(configKey)
else -> throw IllegalArgumentException("Not supported type. Please check valueType")
}
continuation.resumeWith(Result.success(remoteConfigValue))
} else continuation.resumeWith(
Result.failure(task.exception ?: Exception("fetchRemoteConfig failed"))
)
}
}
}
}
7 changes: 7 additions & 0 deletions app/src/main/java/org/sopt/havit/di/DataSourceModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import org.sopt.havit.data.source.local.AuthLocalDataSource
import org.sopt.havit.data.source.local.AuthLocalDataSourceImpl
import org.sopt.havit.data.source.remote.AuthRemoteDataSource
import org.sopt.havit.data.source.remote.AuthRemoteDataSourceImpl
import org.sopt.havit.data.source.remote.RemoteConfigDataSource
import org.sopt.havit.data.source.remote.RemoteConfigDataSourceImpl
import org.sopt.havit.data.source.remote.SearchRemoteDataSource
import org.sopt.havit.data.source.remote.SearchRemoteDataSourceImpl
import org.sopt.havit.data.source.remote.category.CategoryRemoteDataSource
Expand Down Expand Up @@ -46,4 +48,9 @@ object DataSourceModule {
@Singleton
fun provideCategoryRemoteDataSource(api: HavitApi): CategoryRemoteDataSource =
CategoryRemoteDataSourceImpl(api)

@Provides
@Singleton
fun provideRemoteConfigDataSource(): RemoteConfigDataSource = RemoteConfigDataSourceImpl()

}
18 changes: 13 additions & 5 deletions app/src/main/java/org/sopt/havit/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.sopt.havit.data.mapper.ContentsMapper
import org.sopt.havit.data.repository.*
import org.sopt.havit.data.source.local.AuthLocalDataSourceImpl
import org.sopt.havit.data.source.remote.AuthRemoteDataSourceImpl
import org.sopt.havit.data.source.remote.RemoteConfigDataSourceImpl
import org.sopt.havit.data.source.remote.SearchRemoteDataSourceImpl
import org.sopt.havit.data.source.remote.category.CategoryRemoteDataSourceImpl
import org.sopt.havit.data.source.remote.contents.ContentsRemoteDataSourceImpl
Expand All @@ -22,34 +23,41 @@ object RepositoryModule {
@Singleton
fun provideSearchRepository(
searchRemoteDataSourceImpl: SearchRemoteDataSourceImpl,
contentsMapper: ContentsMapper
contentsMapper: ContentsMapper,
): SearchRepository =
SearchRepositoryImpl(searchRemoteDataSourceImpl, contentsMapper)

@Provides
@Singleton
fun provideMyPageRepository(
havitApi: HavitApi
havitApi: HavitApi,
): MyPageRepository = MyPageRepositoryImpl(havitApi)

@Provides
@Singleton
fun provideContentsRepository(
contentsRemoteDataSourceImpl: ContentsRemoteDataSourceImpl,
havitApi: HavitApi
havitApi: HavitApi,
): ContentsRepository =
ContentsRepositoryImpl(contentsRemoteDataSourceImpl, havitApi)

@Provides
@Singleton
fun provideCategoryRepository(
categoryRemoteDataSourceImpl: CategoryRemoteDataSourceImpl
categoryRemoteDataSourceImpl: CategoryRemoteDataSourceImpl,
): CategoryRepository = CategoryRepositoryImpl(categoryRemoteDataSourceImpl)

@Provides
@Singleton
fun provideAuthRepository(
authRemoteDataSourceImpl: AuthRemoteDataSourceImpl,
authLocalDataSourceImpl: AuthLocalDataSourceImpl
authLocalDataSourceImpl: AuthLocalDataSourceImpl,
): AuthRepository = AuthRepositoryImpl(authRemoteDataSourceImpl, authLocalDataSourceImpl)


@Provides
@Singleton
fun provideSystemMaintenanceRepository(
systemMaintenanceDataSource: RemoteConfigDataSourceImpl,
): SystemMaintenanceRepository = SystemMaintenanceRepositoryImpl(systemMaintenanceDataSource)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.sopt.havit.domain.repository

interface SystemMaintenanceRepository {

suspend fun isSystemMaintenance(): Boolean

suspend fun getSystemMaintenanceMessage(): String
}
17 changes: 15 additions & 2 deletions app/src/main/java/org/sopt/havit/ui/base/BaseBindingActivity.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package org.sopt.havit.ui.base

import android.content.Intent
import android.os.Bundle
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.Observer
import org.sopt.havit.ui.system_maintenance.SystemMaintenanceActivity

abstract class BaseBindingActivity<T : ViewDataBinding>(@LayoutRes private val layoutRes: Int) :
AppCompatActivity() {

abstract class BaseBindingActivity<T : ViewDataBinding>(
@LayoutRes private val layoutRes: Int,
) : AppCompatActivity() {
lateinit var binding: T

override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -16,5 +21,13 @@ abstract class BaseBindingActivity<T : ViewDataBinding>(@LayoutRes private val l
binding.lifecycleOwner = this
}

val systemMaintenanceObserver = Observer<Boolean> { isSystemMaintenance ->
if (isSystemMaintenance) startSystemMaintenanceActivity()
}

private fun startSystemMaintenanceActivity() {
startActivity(Intent(this, SystemMaintenanceActivity::class.java))
finish()
}
}

27 changes: 27 additions & 0 deletions app/src/main/java/org/sopt/havit/ui/base/BaseViewModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.sopt.havit.ui.base

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import org.sopt.havit.domain.repository.SystemMaintenanceRepository
import javax.inject.Inject

@HiltViewModel
open class BaseViewModel @Inject constructor(
private val systemMaintenanceRepository: SystemMaintenanceRepository,
) : ViewModel() {


private val _isSystemMaintenance: MutableLiveData<Boolean> = MutableLiveData()
val isSystemMaintenance: LiveData<Boolean> = _isSystemMaintenance


fun fetchIsSystemMaintenance() {
viewModelScope.launch {
_isSystemMaintenance.postValue(systemMaintenanceRepository.isSystemMaintenance())
}
}
}
Loading

0 comments on commit 42188cb

Please sign in to comment.