mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] Bug 1812605 - Continue to handle activity results from AC startActivityForResult calls.
This commit is contained in:
parent
6fedd6780d
commit
f762fc6a87
@ -58,6 +58,7 @@ import mozilla.components.feature.media.ext.findActiveMediaTab
|
||||
import mozilla.components.feature.privatemode.notification.PrivateNotificationFeature
|
||||
import mozilla.components.feature.search.BrowserStoreSearchAdapter
|
||||
import mozilla.components.service.fxa.sync.SyncReason
|
||||
import mozilla.components.support.base.feature.ActivityResultHandler
|
||||
import mozilla.components.support.base.feature.UserInteractionHandler
|
||||
import mozilla.components.support.base.log.logger.Logger
|
||||
import mozilla.components.support.ktx.android.arch.lifecycle.addObservers
|
||||
@ -681,6 +682,18 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
||||
super.getOnBackPressedDispatcher().onBackPressed()
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
// https://github.com/mozilla-mobile/fenix/issues/19919
|
||||
final override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
supportFragmentManager.primaryNavigationFragment?.childFragmentManager?.fragments?.forEach {
|
||||
if (it is ActivityResultHandler && it.onActivityResult(requestCode, data, resultCode)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
@Suppress("DEPRECATION")
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
|
||||
private fun shouldUseCustomBackLongPress(): Boolean {
|
||||
val isAndroidN =
|
||||
Build.VERSION.SDK_INT == Build.VERSION_CODES.N || Build.VERSION.SDK_INT == Build.VERSION_CODES.N_MR1
|
||||
|
@ -88,6 +88,7 @@ import mozilla.components.lib.state.ext.flowScoped
|
||||
import mozilla.components.service.glean.private.NoExtras
|
||||
import mozilla.components.service.sync.autofill.DefaultCreditCardValidationDelegate
|
||||
import mozilla.components.service.sync.logins.DefaultLoginValidationDelegate
|
||||
import mozilla.components.support.base.feature.ActivityResultHandler
|
||||
import mozilla.components.support.base.feature.PermissionsFeature
|
||||
import mozilla.components.support.base.feature.UserInteractionHandler
|
||||
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
|
||||
@ -157,6 +158,7 @@ import mozilla.components.feature.session.behavior.ToolbarPosition as MozacToolb
|
||||
abstract class BaseBrowserFragment :
|
||||
Fragment(),
|
||||
UserInteractionHandler,
|
||||
ActivityResultHandler,
|
||||
OnBackLongPressedListener,
|
||||
AccessibilityManager.AccessibilityStateChangeListener {
|
||||
|
||||
@ -256,7 +258,9 @@ abstract class BaseBrowserFragment :
|
||||
listOf(
|
||||
promptsFeature,
|
||||
webAuthnFeature,
|
||||
).any { it.onActivityResult(PIN_REQUEST, result.data, result.resultCode) }
|
||||
).any {
|
||||
it.onActivityResult(PIN_REQUEST, result.data, result.resultCode)
|
||||
}
|
||||
}
|
||||
|
||||
// DO NOT MOVE ANYTHING BELOW THIS addMarker CALL!
|
||||
@ -1185,6 +1189,16 @@ abstract class BaseBrowserFragment :
|
||||
removeSessionIfNeeded()
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards activity results to the [ActivityResultHandler] features.
|
||||
*/
|
||||
override fun onActivityResult(requestCode: Int, data: Intent?, resultCode: Int): Boolean {
|
||||
return listOf(
|
||||
promptsFeature,
|
||||
webAuthnFeature,
|
||||
).any { it.onActivityResult(requestCode, data, resultCode) }
|
||||
}
|
||||
|
||||
override fun onBackLongPressed(): Boolean {
|
||||
findNavController().navigate(
|
||||
NavGraphDirections.actionGlobalTabHistoryDialogFragment(
|
||||
|
Loading…
Reference in New Issue
Block a user