2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

Bug 1817726 - Add Recents url sharing

(cherry picked from commit c2586cba5091402723e4b4aaab7ac357a5e0b707)
This commit is contained in:
rahulsainani 2023-02-20 15:05:26 +05:30 committed by mergify[bot]
parent 127a9eddcd
commit 0a1f9b703c

View File

@ -4,11 +4,13 @@
package org.mozilla.fenix package org.mozilla.fenix
import android.app.assist.AssistContent
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.Intent.ACTION_MAIN import android.content.Intent.ACTION_MAIN
import android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT import android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
import android.content.res.Configuration import android.content.res.Configuration
import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.StrictMode import android.os.StrictMode
@ -25,6 +27,7 @@ import android.view.ViewConfiguration
import android.view.WindowManager.LayoutParams.FLAG_SECURE import android.view.WindowManager.LayoutParams.FLAG_SECURE
import androidx.annotation.CallSuper import androidx.annotation.CallSuper
import androidx.annotation.IdRes import androidx.annotation.IdRes
import androidx.annotation.RequiresApi
import androidx.annotation.VisibleForTesting import androidx.annotation.VisibleForTesting
import androidx.annotation.VisibleForTesting.Companion.PROTECTED import androidx.annotation.VisibleForTesting.Companion.PROTECTED
import androidx.appcompat.app.ActionBar import androidx.appcompat.app.ActionBar
@ -46,6 +49,7 @@ import mozilla.components.browser.state.action.ContentAction
import mozilla.components.browser.state.action.SearchAction import mozilla.components.browser.state.action.SearchAction
import mozilla.components.browser.state.search.SearchEngine import mozilla.components.browser.state.search.SearchEngine
import mozilla.components.browser.state.selector.getNormalOrPrivateTabs import mozilla.components.browser.state.selector.getNormalOrPrivateTabs
import mozilla.components.browser.state.selector.selectedTab
import mozilla.components.browser.state.state.SessionState import mozilla.components.browser.state.state.SessionState
import mozilla.components.browser.state.state.WebExtensionState import mozilla.components.browser.state.state.WebExtensionState
import mozilla.components.concept.engine.EngineSession import mozilla.components.concept.engine.EngineSession
@ -515,6 +519,13 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
BrowsersCache.resetAll() BrowsersCache.resetAll()
} }
@RequiresApi(Build.VERSION_CODES.M)
override fun onProvideAssistContent(outContent: AssistContent?) {
super.onProvideAssistContent(outContent)
val currentTabUrl = components.core.store.state.selectedTab?.content?.url
outContent?.webUri = currentTabUrl?.let { Uri.parse(it) }
}
private fun getBookmarkCount(node: BookmarkNode): Int { private fun getBookmarkCount(node: BookmarkNode): Int {
val children = node.children val children = node.children
return if (children == null) { return if (children == null) {