Skip to content

Commit

Permalink
fix: update handle back press
Browse files Browse the repository at this point in the history
  • Loading branch information
motionman committed Jul 27, 2022
1 parent def5a01 commit eacde70
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .idea/deploymentTargetDropDown.xml

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

2 changes: 1 addition & 1 deletion filestack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ afterEvaluate {

groupId = 'com.github.boykod'
artifactId = 'smartsuite-filestack'
version = '0.1.0'
version = '0.1.1'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package ua.motionman.filestack.ui

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import ua.motionman.filestack.R
import ua.motionman.filestack.databinding.FilestackActivityBinding
import ua.motionman.filestack.utils.client.ClientProvider
import ua.motionman.filestack.utils.delegate.viewBinding
Expand All @@ -27,6 +29,17 @@ class FilestackActivity : AppCompatActivity() {
}
}

override fun onBackPressed() {
val currentDestinationId = findNavController(R.id.nav_host_fragment).currentDestination?.id

if (currentDestinationId != null) {
when (currentDestinationId) {
R.id.uploadingProgressFragment -> {}
else -> super.onBackPressed()
}
}
}

companion object {
const val API_KEY = "api_key"
const val POLICY_KEY = "policy_key"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.activity.addCallback
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
Expand All @@ -28,7 +27,6 @@ class UploadingProgressFragment : Fragment(R.layout.uploading_progress) {
setupListeners()
initFlowSubscriber()
startUploadService()
disableOnBackPress()
}

private fun setupListeners() {
Expand Down Expand Up @@ -71,12 +69,6 @@ class UploadingProgressFragment : Fragment(R.layout.uploading_progress) {
activity?.finish()
}

private fun disableOnBackPress() {
activity?.onBackPressedDispatcher?.addCallback {
// do nothing
}
}

companion object {
const val SELECTIONS_KEY = "selections_bundle_key"
}
Expand Down

0 comments on commit eacde70

Please sign in to comment.