Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
android-components
Commits
bef19c08
Commit
bef19c08
authored
Oct 07, 2019
by
Sawyer Blatz
Browse files
For #4675: Adds category for shortcut intents
parent
3ab7c79c
Changes
4
Hide whitespace changes
Inline
Side-by-side
components/feature/pwa/src/main/java/mozilla/components/feature/pwa/WebAppLauncherActivity.kt
View file @
bef19c08
...
...
@@ -64,6 +64,7 @@ class WebAppLauncherActivity : AppCompatActivity() {
@VisibleForTesting
(
otherwise
=
PRIVATE
)
internal
fun
launchBrowser
(
startUrl
:
Uri
)
{
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
startUrl
).
apply
{
addCategory
(
SHORTCUT_CATEGORY
)
`package`
=
packageName
}
...
...
components/feature/pwa/src/main/java/mozilla/components/feature/pwa/WebAppShortcutManager.kt
View file @
bef19c08
...
...
@@ -38,6 +38,7 @@ import mozilla.components.feature.pwa.WebAppLauncherActivity.Companion.ACTION_PW
import
mozilla.components.feature.pwa.ext.installableManifest
private
val
pwaIconMemoryCache
=
IconMemoryCache
()
const
val
SHORTCUT_CATEGORY
=
"mozilla.components.pwa.category.SHORTCUT"
class
WebAppShortcutManager
(
context
:
Context
,
...
...
@@ -95,6 +96,7 @@ class WebAppShortcutManager(
/**
* Create a new basic pinned website shortcut using info from the session.
* Consuming `SHORTCUT_CATEGORY` in `AndroidManifest` is required for the package to be launched
*/
fun
buildBasicShortcut
(
context
:
Context
,
...
...
@@ -102,6 +104,7 @@ class WebAppShortcutManager(
overrideShortcutName
:
String
?
=
null
):
ShortcutInfoCompat
{
val
shortcutIntent
=
Intent
(
Intent
.
ACTION_VIEW
,
session
.
url
.
toUri
()).
apply
{
addCategory
(
SHORTCUT_CATEGORY
)
`package`
=
context
.
packageName
}
...
...
docs/changelog.md
View file @
bef19c08
...
...
@@ -12,6 +12,9 @@ permalink: /changelog/
*
[
Gecko
](
https://github.com/mozilla-mobile/android-components/blob/master/buildSrc/src/main/java/Gecko.kt
)
*
[
Configuration
](
https://github.com/mozilla-mobile/android-components/blob/master/buildSrc/src/main/java/Config.kt
)
*
**feature-pwa**
*
⚠️
**This is a breaking change**
: Intent sent from the
`WebAppShortcutManager`
now require the consumption of the
`SHORTCUT_CATEGORY`
in your manifest
*
**feature-customtabs**
*
'CustomTabIntentProcessor' can create private sessions now.
...
...
samples/browser/src/main/AndroidManifest.xml
View file @
bef19c08
...
...
@@ -47,6 +47,8 @@
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"mozilla.components.pwa.category.SHORTCUT"
/>
<data
android:scheme=
"http"
/>
<data
android:scheme=
"https"
/>
</intent-filter>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment