Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fenix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
The Tor Project
Applications
fenix
Commits
8b0f722f
Unverified
Commit
8b0f722f
authored
Sep 25, 2020
by
Matthew Finkel
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'acatgl/34378' into tor-browser-81.1.1-10.0-1
parents
7b11da27
67e28112
Branches
Branches containing commit
No related tags found
1 merge request
!20
Bug 34378: Port external helper app prompting
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/org/mozilla/fenix/HomeActivity.kt
+45
-0
45 additions, 0 deletions
app/src/main/java/org/mozilla/fenix/HomeActivity.kt
app/src/main/java/org/mozilla/fenix/share/ShareController.kt
+2
-1
2 additions, 1 deletion
app/src/main/java/org/mozilla/fenix/share/ShareController.kt
with
47 additions
and
1 deletion
app/src/main/java/org/mozilla/fenix/HomeActivity.kt
+
45
−
0
View file @
8b0f722f
...
...
@@ -4,6 +4,7 @@
package
org.mozilla.fenix
import
android.app.PendingIntent
import
android.content.BroadcastReceiver
import
android.content.Context
import
android.content.Intent
...
...
@@ -45,6 +46,8 @@ import mozilla.components.browser.state.state.SessionState
import
mozilla.components.browser.state.state.WebExtensionState
import
mozilla.components.concept.engine.EngineSession
import
mozilla.components.concept.engine.EngineView
import
mozilla.components.feature.app.links.RedirectDialogFragment
import
mozilla.components.feature.app.links.SimpleRedirectDialogFragment
import
mozilla.components.feature.contextmenu.DefaultSelectionActionDelegate
import
mozilla.components.feature.privatemode.notification.PrivateNotificationFeature
import
mozilla.components.feature.search.BrowserStoreSearchAdapter
...
...
@@ -58,6 +61,7 @@ import mozilla.components.support.ktx.kotlin.isUrl
import
mozilla.components.support.ktx.kotlin.toNormalizedUrl
import
mozilla.components.support.locale.LocaleAwareAppCompatActivity
import
mozilla.components.support.utils.SafeIntent
import
mozilla.components.support.utils.TorUtils
import
mozilla.components.support.utils.toSafeIntent
import
mozilla.components.support.webextensions.WebExtensionPopupFeature
import
org.mozilla.fenix.GleanMetrics.Metrics
...
...
@@ -154,6 +158,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
private
lateinit
var
navigationToolbar
:
Toolbar
private
var
dialog
:
RedirectDialogFragment
?
=
null
final
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
// Give Orbot the base Context
Prefs
.
setContext
(
applicationContext
)
...
...
@@ -387,6 +393,26 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
super
.
recreate
()
}
// Copied from mozac AppLinksFeature.kt
internal
fun
getOrCreateDialog
():
RedirectDialogFragment
{
val
existingDialog
=
dialog
if
(
existingDialog
!=
null
)
{
return
existingDialog
}
SimpleRedirectDialogFragment
.
newInstance
().
also
{
dialog
=
it
return
it
}
}
private
fun
isAlreadyADialogCreated
():
Boolean
{
return
findPreviousDialogFragment
()
!=
null
}
private
fun
findPreviousDialogFragment
():
RedirectDialogFragment
?
{
return
supportFragmentManager
.
findFragmentByTag
(
RedirectDialogFragment
.
FRAGMENT_TAG
)
as
?
RedirectDialogFragment
}
/**
* Handles intents received when the activity is open.
*/
...
...
@@ -394,6 +420,25 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
super
.
onNewIntent
(
intent
)
intent
?:
return
val
startIntent
=
intent
.
getParcelableExtra
<
PendingIntent
>(
TorUtils
.
TORBROWSER_START_ACTIVITY_PROMPT
)
if
(
startIntent
!=
null
)
{
if
(
startIntent
.
creatorPackage
==
applicationContext
.
packageName
)
{
val
dialog
=
getOrCreateDialog
()
dialog
.
onConfirmRedirect
=
{
try
{
startIntent
.
send
()
}
catch
(
error
:
PendingIntent
.
CanceledException
)
{
}
}
dialog
.
onCancelRedirect
=
{}
if
(!
isAlreadyADialogCreated
())
{
dialog
.
showNow
(
supportFragmentManager
,
RedirectDialogFragment
.
FRAGMENT_TAG
)
}
}
return
}
// Diagnostic breadcrumb for "Display already aquired" crash:
// https://github.com/mozilla-mobile/android-components/issues/7960
breadcrumb
(
...
...
...
...
This diff is collapsed.
Click to expand it.
app/src/main/java/org/mozilla/fenix/share/ShareController.kt
+
2
−
1
View file @
8b0f722f
...
...
@@ -25,6 +25,7 @@ import mozilla.components.concept.sync.TabData
import
mozilla.components.feature.accounts.push.SendTabUseCases
import
mozilla.components.feature.share.RecentAppsStorage
import
mozilla.components.support.ktx.kotlin.isExtensionUrl
import
mozilla.components.support.utils.TorUtils
import
org.mozilla.fenix.R
import
org.mozilla.fenix.components.FenixSnackbar
import
org.mozilla.fenix.components.metrics.Event
...
...
@@ -99,7 +100,7 @@ class DefaultShareController(
}
val
result
=
try
{
context
.
startActivity
(
intent
)
TorUtils
.
startActivity
Prompt
(
context
,
intent
)
ShareController
.
Result
.
SUCCESS
}
catch
(
e
:
SecurityException
)
{
snackbar
.
setText
(
context
.
getString
(
R
.
string
.
share_error_snackbar
))
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment