Skip to content

Commit

Permalink
[IDLE-000] AppsFlyer Deferred DeepLink 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Nov 14, 2024
1 parent 4be0904 commit e090291
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
49 changes: 24 additions & 25 deletions presentation/src/main/java/com/idle/presentation/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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() {
Expand Down
7 changes: 3 additions & 4 deletions presentation/src/main/res/layout/fragment_force_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />

<LinearLayout
Expand Down

0 comments on commit e090291

Please sign in to comment.