From e090291e20493ffc82e654d312812aedefe64b08 Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Thu, 14 Nov 2024 12:47:28 +0900 Subject: [PATCH] =?UTF-8?q?[IDLE-000]=20AppsFlyer=20Deferred=20DeepLink=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 4 +- .../com/idle/presentation/MainActivity.kt | 49 +++++++++---------- .../main/res/layout/fragment_force_update.xml | 7 ++- 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f218a49e..a4154fc4 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,8 +11,8 @@ android { namespace = "com.idle.care" defaultConfig { - versionCode = 16 - versionName = "1.2.1" + versionCode = 17 + versionName = "1.2.2" targetSdk = 34 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/presentation/src/main/java/com/idle/presentation/MainActivity.kt b/presentation/src/main/java/com/idle/presentation/MainActivity.kt index ce8ef93a..5507c650 100644 --- a/presentation/src/main/java/com/idle/presentation/MainActivity.kt +++ b/presentation/src/main/java/com/idle/presentation/MainActivity.kt @@ -10,6 +10,7 @@ import android.net.Uri import android.os.Build import android.os.Bundle import android.provider.Settings.ACTION_WIFI_SETTINGS +import android.util.Log import android.view.View import android.view.ViewGroup import androidx.activity.result.contract.ActivityResultContracts @@ -21,15 +22,14 @@ import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.navigation.NavController import androidx.navigation.fragment.NavHostFragment import androidx.navigation.ui.setupWithNavController +import com.appsflyer.AppsFlyerConversionListener import com.appsflyer.AppsFlyerLib -import com.appsflyer.deeplink.DeepLink import com.appsflyer.deeplink.DeepLinkResult import com.idle.analytics.AnalyticsEvent import com.idle.analytics.businessmetric.AnalyticsHelper import com.idle.auth.AuthFragmentDirections import com.idle.binding.MainEvent import com.idle.binding.ShareJobPostingInfo -import com.idle.binding.ToastType import com.idle.binding.repeatOnStarted import com.idle.designsystem.binding.component.dismissToast import com.idle.designsystem.binding.component.showToast @@ -206,7 +206,7 @@ class MainActivity : AppCompatActivity() { private fun showForceUpdateDialog(info: ForceUpdate) { val currentVersion = packageManager.getPackageInfo(packageName, 0).versionName - if (!checkShouldUpdate(currentVersion, info.minVersion)) { + if (checkShouldUpdate(currentVersion, info.minVersion)) { forceUpdateFragment = ForceUpdateFragment(info).apply { isCancelable = false } forceUpdateFragment.show(supportFragmentManager, forceUpdateFragment.tag) } @@ -246,34 +246,33 @@ class MainActivity : AppCompatActivity() { private fun handleDeepLinking() { AppsFlyerLib.getInstance().subscribeForDeepLink { deepLinkResult -> when (deepLinkResult.status) { - DeepLinkResult.Status.FOUND -> handleDeepLink(deepLinkResult.deepLink) + DeepLinkResult.Status.FOUND -> { + val sharedJobPostingId = + deepLinkResult.deepLink.getStringValue("deep_link_value") + val sharedJobPostingType = + deepLinkResult.deepLink.getStringValue("deep_link_sub1") + + handleDeepLink(sharedJobPostingId, sharedJobPostingType) + } + DeepLinkResult.Status.NOT_FOUND -> viewModel.errorLoggingHelper.logError(Exception("AppsFlyer User Not Found")) - else -> viewModel.errorLoggingHelper.logError(Exception(deepLinkResult.error.toString())) + + else -> { + Log.d("test", "Error ${deepLinkResult.error}") + viewModel.errorLoggingHelper.logError(Exception(deepLinkResult.error.toString())) + } } } } - private fun handleDeepLink(deepLink: DeepLink) { - try { - val sharedJobPostingId = deepLink.deepLinkValue - val sharedJobPostingType = deepLink.getStringValue("deep_link_sub1") - - showToast( - this, - "sharedJobPostingId: $sharedJobPostingId, sharedJobPostingTpye : $sharedJobPostingType", - toastType = ToastType.SUCCESS, - paddingBottom = 50 + private fun handleDeepLink(sharedJobPostingId: String?, sharedJobPostingType: String?) { + Log.d("test", sharedJobPostingId+sharedJobPostingType) + viewModel.setSharedJobPostingInfo( + SharedJobPostingInfo( + jobPostingId = sharedJobPostingId ?: return, + jobPostingType = JobPostingType.create(sharedJobPostingType ?: return) ) - - viewModel.setSharedJobPostingInfo( - SharedJobPostingInfo( - jobPostingId = sharedJobPostingId ?: return, - jobPostingType = JobPostingType.create(sharedJobPostingType ?: return) - ) - ) - } catch (e: Exception) { - viewModel.errorLoggingHelper.logError(e) - } + ) } private fun showNetworkDialog() { diff --git a/presentation/src/main/res/layout/fragment_force_update.xml b/presentation/src/main/res/layout/fragment_force_update.xml index 16106cb4..f575adf6 100644 --- a/presentation/src/main/res/layout/fragment_force_update.xml +++ b/presentation/src/main/res/layout/fragment_force_update.xml @@ -36,11 +36,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="24dp" - android:text="유저분들의 의견을 반영해 앱을 더 발전시켰어요.\n -보다 좋은 서비스를 만나기 위해, 업데이트해주세요." - android:textAlignment="center" - android:maxLines="4" android:ellipsize="end" + android:maxLines="3" + android:text="@{viewModel.forceUpdate.noticeMsg}" + android:textAlignment="center" android:textColor="@color/gray_500" />