Skip to content

Commit

Permalink
Merge pull request #72 from iamport/feat/android-14-upgrade
Browse files Browse the repository at this point in the history
feat: android 14 대응 업데이트
  • Loading branch information
anymate98 authored Oct 12, 2023
2 parents 91f14eb + fdd3f15 commit e0b81b4
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 19 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
namespace 'com.iamport.sampleapp'

compileSdk 34
buildToolsVersion = '34.0.0'

defaultConfig {
applicationId "com.iamport.sdk"
applicationId "com.iamport.sampleapp"
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -40,8 +42,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

buildFeatures {
Expand All @@ -64,27 +66,27 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$Versions.kotlin_stdlib_jdk"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.4'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

// Android Support/Architecture
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation "com.google.android.material:material:1.5.0"
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
implementation "com.google.android.material:material:1.10.0"

// multidex
implementation 'androidx.multidex:multidex:2.0.1'

// Gson
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.google.code.gson:gson:2.10.1'

implementation project(':sdk') // 가맹점은 이 코드가 아닌 아래와 같은 "버전"을 통한 implementation 으로 반영해주세요
// implementation 'com.github.iamport:iamport-android:1.3.4'
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/java/com/iamport/sampleapp/ui/PaymentFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.iamport.sampleapp.ui
import android.app.AlertDialog.Builder
import android.content.Context
import android.content.IntentFilter
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
Expand All @@ -11,6 +12,7 @@ import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.activity.OnBackPressedCallback
import androidx.annotation.RequiresApi
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
Expand Down Expand Up @@ -64,6 +66,7 @@ class PaymentFragment : Fragment() {
// 차이 폴링중에 포그라운드 서비스 생성
// (* 포그라운드 서비스 직접 구현시에는 enableService = false 로 설정하고,
// Iamport.isPolling()?.observe 에서 true 전달 받을 시점에, 직접 포그라운드 서비스 만들어 띄우시면 됩니다.)
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
private fun registForegroundServiceReceiver(context: Context) {

// enableService = true 시, 폴링중 포그라운드 서비스를 보여줍니다.
Expand All @@ -74,7 +77,7 @@ class PaymentFragment : Fragment() {
context.registerReceiver(receiver, IntentFilter().apply {
addAction(CONST.BROADCAST_FOREGROUND_SERVICE)
addAction(CONST.BROADCAST_FOREGROUND_SERVICE_STOP)
})
}, Context.RECEIVER_EXPORTED)

}

Expand All @@ -101,12 +104,12 @@ class PaymentFragment : Fragment() {
}

val userCodeAdapter = ArrayAdapter(
requireContext(), R.layout.support_simple_spinner_dropdown_item,
requireContext(), android.R.layout.simple_spinner_dropdown_item,
Util.getUserCodeList()
)

val pgAdapter = ArrayAdapter(
requireContext(), R.layout.support_simple_spinner_dropdown_item,
requireContext(), android.R.layout.simple_spinner_dropdown_item,
PG.getPGNames()
)

Expand Down Expand Up @@ -242,7 +245,7 @@ class PaymentFragment : Fragment() {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
viewModel.pg = PG.values()[position]
binding.pgMethod.adapter = ArrayAdapter(
requireContext(), R.layout.support_simple_spinner_dropdown_item,
requireContext(), android.R.layout.simple_spinner_dropdown_item,
Util.convertPayMethodNames(PG.values()[position])
)

Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ allprojects {
}
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
17 changes: 6 additions & 11 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@

import Build_gradle.PluginVersion.GRADLE
import Build_gradle.PluginVersion.GRADLE_VERSIONS_PLUGIN
import Build_gradle.PluginVersion.KOTLIN

plugins {
`kotlin-dsl`
}
Expand All @@ -14,13 +9,13 @@ repositories {
}

object PluginVersion {
const val GRADLE = "7.0.4"
const val KOTLIN = "1.6.10"
const val GRADLE_VERSIONS_PLUGIN = "0.41.0"
const val GRADLE = "8.1.2"
const val KOTLIN = "1.9.10"
const val GRADLE_VERSIONS_PLUGIN = "0.49.0"
}

dependencies {
implementation("com.github.ben-manes:gradle-versions-plugin:${GRADLE_VERSIONS_PLUGIN}")
implementation("com.android.tools.build:gradle:${GRADLE}")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${KOTLIN}")
implementation("com.github.ben-manes:gradle-versions-plugin:${PluginVersion.GRADLE_VERSIONS_PLUGIN}")
implementation("com.android.tools.build:gradle:${PluginVersion.GRADLE}")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${PluginVersion.KOTLIN}")
}
47 changes: 24 additions & 23 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
// 디펜던시 업데이트 확인 ./gradlew dependencyUpdates

object Versions {
const val versionCode = 220420001 // yymmdd000
const val versionName = "1.3.5" // https://www.notion.so/chaifinance/QA-Process-d1a4be396337493b81c6e85fff2d5cd6
const val versionCode = 231012000 // yymmdd000
const val versionName = "1.4.0" // https://www.notion.so/chaifinance/QA-Process-d1a4be396337493b81c6e85fff2d5cd6

const val multidex = "2.0.1"
const val kotlin_stdlib_jdk = "1.6.10"
const val core_ktx = "1.7.0"
const val appcompat = "1.4.1"
const val kotlin_stdlib_jdk = "1.9.10"
const val core_ktx = "1.12.0"
const val appcompat = "1.6.1"

const val mokito = "4.3.1"
const val mokito_kotlin = "2.2.0"
const val mokito = "5.6.0"
const val mokito_kotlin = "5.1.0"

const val junit = "4.13.1"
const val testJunit = "1.1.3"
const val espresso_core = "3.4.0"
const val testJunit = "1.1.5"
const val espresso_core = "3.5.1"

const val androidx_test_core = "1.4.0"
const val androidx_test_runner = "1.1.0"
const val androidx_test_core = "1.5.0"
const val androidx_test_runner = "1.5.2"

const val constraintlayout = "2.1.3"
const val constraintlayout = "2.1.4"
const val lifecycle_extensions = "2.2.0"
const val lifecycle_common = "2.4.1"
const val lifecycle_common = "2.6.2"

const val material = "1.5.0"
const val material = "1.10.0"

const val activity_ktx = "1.4.0"
const val fragment_ktx = "1.4.1"
const val activity_ktx = "1.8.0"
const val fragment_ktx = "1.6.1"

const val koin_version = "3.1.6"
const val koin_version = "3.5.0"
const val retrofit_version = "2.9.0"
const val logging_interceptor = "4.9.3"

// Gson
const val gson = "2.9.0"
const val gson = "2.10.1"

// Logger
const val logger = "2.2.0"
Expand All @@ -48,22 +48,22 @@ object Versions {

const val robolectric = "4.7.3"

const val serialization = "1.3.2"
const val serialization = "1.6.0"

const val workRuntimeKtx = "2.7.1"
const val workRuntimeKtx = "2.8.1"
}

object Libs {
const val multidex = "androidx.multidex:multidex:${Versions.multidex}"
const val kotlin_stdlib_jdk = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Versions.kotlin_stdlib_jdk}"
const val kotlin_stdlib_jdk = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin_stdlib_jdk}"
const val core_ktx = "androidx.core:core-ktx:${Versions.core_ktx}"
const val appcompat = "androidx.appcompat:appcompat:${Versions.appcompat}"

const val robolectric = "org.robolectric:robolectric:${Versions.robolectric}"
const val mokito_core = "org.mockito:mockito-core:${Versions.mokito}"
const val mokito_inline = "org.mockito:mockito-inline:${Versions.mokito}"
const val mokito_android = "org.mockito:mockito-android:${Versions.mokito}"
const val mokito_kotlin = "com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mokito_kotlin}"
const val mokito_kotlin = "org.mockito.kotlin:mockito-kotlin:${Versions.mokito_kotlin}"


const val junit = "junit:junit:${Versions.junit}"
Expand All @@ -81,7 +81,7 @@ object Libs {
const val lifecycle_viewmodel_ktx = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle_extensions}"
const val lifecycle_livedata_ktx = "androidx.lifecycle:lifecycle-livedata-ktx:${Versions.lifecycle_extensions}"

const val lifecycle_common = "androidx.lifecycle:lifecycle-common-java8:${Versions.lifecycle_common}"
const val lifecycle_common = "androidx.lifecycle:lifecycle-common:${Versions.lifecycle_common}"

const val material = "com.google.android.material:material:${Versions.material}"

Expand All @@ -97,6 +97,7 @@ object Libs {

// Koin Java Compatibility
const val koin_android_compat = "io.insert-koin:koin-android-compat:${Versions.koin_version}"

// Koin for Jetpack Compose
const val koin_android_compose = "io.insert-koin:koin-androidx-compose:${Versions.koin_version}"

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Nov 03 10:26:38 KST 2020
#Wed Oct 11 17:35:03 KST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
2 changes: 1 addition & 1 deletion jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
jdk:
- openjdk11
- openjdk17
16 changes: 9 additions & 7 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ apply plugin: 'kotlinx-serialization'
apply plugin: 'maven-publish'

android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
namespace 'com.iamport.sdk'

compileSdk 34
buildToolsVersion = '34.0.0'

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
versionCode Versions.versionCode // yymmdd000
versionName Versions.versionName // prod(x.y.z), dev(x.y.z-dev00), poc(x.y.z-poc00)
targetSdk 34
versionCode = Versions.versionCode // yymmdd000
versionName = Versions.versionName // prod(x.y.z), dev(x.y.z-dev00), poc(x.y.z-poc00)
multiDexEnabled true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -38,8 +40,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class JudgeStrategy : BaseStrategy(), IamportKoinComponent {
failureFinish(payment = payment, msg = "judge :: payment status ERROR")
return Triple(JudgeKinds.ERROR, null, payment)
}
else -> {}
}

// 2. 결제요청의 경우 판단
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.iamport.sdk.domain.utils
import androidx.lifecycle.Observer

class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
event?.getContentIfNotHandled()?.let { value ->
override fun onChanged(event: Event<T>) {
event.getContentIfNotHandled()?.let { value ->
onEventUnhandledContent(value)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.iamport.sdk.domain.repository.StrategyRepository
import com.iamport.sdk.domain.utils.NativeLiveDataEventBus

class MainViewModelFactory(private val bus: NativeLiveDataEventBus, private val repository: StrategyRepository, private val app: Application) : ViewModelProvider.Factory {
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return if (modelClass.isAssignableFrom(MainViewModel::class.java)) {
MainViewModel(bus, repository, app) as T
} else {
Expand Down

0 comments on commit e0b81b4

Please sign in to comment.