@@ -22,14 +22,12 @@ import androidx.navigation.NavController
2222import androidx.navigation.fragment.NavHostFragment
2323import androidx.navigation.ui.setupWithNavController
2424import com.appsflyer.AppsFlyerLib
25- import com.appsflyer.deeplink.DeepLink
2625import com.appsflyer.deeplink.DeepLinkResult
2726import com.idle.analytics.AnalyticsEvent
2827import com.idle.analytics.businessmetric.AnalyticsHelper
2928import com.idle.auth.AuthFragmentDirections
3029import com.idle.binding.MainEvent
3130import com.idle.binding.ShareJobPostingInfo
32- import com.idle.binding.ToastType
3331import com.idle.binding.repeatOnStarted
3432import com.idle.designsystem.binding.component.dismissToast
3533import com.idle.designsystem.binding.component.showToast
@@ -206,7 +204,7 @@ class MainActivity : AppCompatActivity() {
206204
207205 private fun showForceUpdateDialog (info : ForceUpdate ) {
208206 val currentVersion = packageManager.getPackageInfo(packageName, 0 ).versionName
209- if (! checkShouldUpdate(currentVersion, info.minVersion)) {
207+ if (checkShouldUpdate(currentVersion, info.minVersion)) {
210208 forceUpdateFragment = ForceUpdateFragment (info).apply { isCancelable = false }
211209 forceUpdateFragment.show(supportFragmentManager, forceUpdateFragment.tag)
212210 }
@@ -246,34 +244,28 @@ class MainActivity : AppCompatActivity() {
246244 private fun handleDeepLinking () {
247245 AppsFlyerLib .getInstance().subscribeForDeepLink { deepLinkResult ->
248246 when (deepLinkResult.status) {
249- DeepLinkResult .Status .FOUND -> handleDeepLink(deepLinkResult.deepLink)
247+ DeepLinkResult .Status .FOUND -> {
248+ val sharedJobPostingId =
249+ deepLinkResult.deepLink.getStringValue(" deep_link_value" )
250+ val sharedJobPostingType =
251+ deepLinkResult.deepLink.getStringValue(" deep_link_sub1" )
252+
253+ handleDeepLink(sharedJobPostingId, sharedJobPostingType)
254+ }
255+
250256 DeepLinkResult .Status .NOT_FOUND -> viewModel.errorLoggingHelper.logError(Exception (" AppsFlyer User Not Found" ))
251257 else -> viewModel.errorLoggingHelper.logError(Exception (deepLinkResult.error.toString()))
252258 }
253259 }
254260 }
255261
256- private fun handleDeepLink (deepLink : DeepLink ) {
257- try {
258- val sharedJobPostingId = deepLink.deepLinkValue
259- val sharedJobPostingType = deepLink.getStringValue(" deep_link_sub1" )
260-
261- showToast(
262- this ,
263- " sharedJobPostingId: $sharedJobPostingId , sharedJobPostingTpye : $sharedJobPostingType " ,
264- toastType = ToastType .SUCCESS ,
265- paddingBottom = 50
262+ private fun handleDeepLink (sharedJobPostingId : String? , sharedJobPostingType : String? ) {
263+ viewModel.setSharedJobPostingInfo(
264+ SharedJobPostingInfo (
265+ jobPostingId = sharedJobPostingId ? : return ,
266+ jobPostingType = JobPostingType .create(sharedJobPostingType ? : return )
266267 )
267-
268- viewModel.setSharedJobPostingInfo(
269- SharedJobPostingInfo (
270- jobPostingId = sharedJobPostingId ? : return ,
271- jobPostingType = JobPostingType .create(sharedJobPostingType ? : return )
272- )
273- )
274- } catch (e: Exception ) {
275- viewModel.errorLoggingHelper.logError(e)
276- }
268+ )
277269 }
278270
279271 private fun showNetworkDialog () {
0 commit comments