Create homescreen shortcut for installed app

VERIFIED FIXED in Firefox 15

Status

()

Firefox for Android
Web Apps
--
major
VERIFIED FIXED
6 years ago
a year ago

People

(Reporter: Harald, Assigned: mfinkle)

Tracking

unspecified
Firefox 15
ARM
Android
Points:
---
Dependency tree / graph
Bug Flags:
in-moztrap +

Firefox Tracking Flags

(blocking-kilimanjaro:+, firefox15 verified)

Details

(Whiteboard: [Phase1])

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

6 years ago
On app install, create a launch shortcut on the homescreen.

It should not create duplicates, use the correct device-specific icon size.

When added, the shortcut should use the WEBAPP intent.
(Reporter)

Updated

6 years ago
Blocks: 738546
Whiteboard: [WebRT:Phase1]

Updated

6 years ago
Depends on: 741435

Updated

6 years ago
Whiteboard: [WebRT:Phase1] → [Phase1]

Updated

6 years ago
Whiteboard: [Phase1]

Updated

6 years ago
Whiteboard: [Phase1]
Dupe of bug 741431?
Yeah. bug 741431 already encompasses the task for this bug.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 741431
(Reporter)

Comment 3

6 years ago
I'd disagree, bug 741431 is about additional install options because Soup had them, but is a UX bug, which is to be solved by UX at this point. As those options did not pop up during the UX flows so far, I'd rather go with no options and create a shortcut by default; at least until we have a flow defined.

Though this bug is a basic implementation bug, and just describes the behavior we have defined for now.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---

Updated

6 years ago
Status: REOPENED → NEW

Updated

6 years ago
Whiteboard: [Phase1] → [Phase1] [marketplace-beta?]
(In reply to Harald Kirschner from comment #0)
> On app install, create a launch shortcut on the homescreen.
> 
> It should not create duplicates, use the correct device-specific icon size.

We don't have a way to tell if a shortcut exists

Updated

6 years ago
Whiteboard: [Phase1] [marketplace-beta?] → [Phase1]
(Reporter)

Comment 5

6 years ago
(In reply to Mark Finkle (:mfinkle) from comment #4)
> (In reply to Harald Kirschner from comment #0)
> > On app install, create a launch shortcut on the homescreen.
> > 
> > It should not create duplicates, use the correct device-specific icon size.
> 
> We don't have a way to tell if a shortcut exists

There is a hidden flag for shortcut creation that prevents dups: https://github.com/mozilla/soup/blob/master/src/org/mozilla/labs/Soup/plugins/MozAppsPlugin.java#L323 . It is not silent; when the shortcut already exists, the user will get a toast.
Created attachment 621356 [details] [diff] [review]
patch

Throwing Wes onto the WebApp scene. This patch will create a homescreen shortcut for an app when installed.

It uses the same code I was using for the about:apps page. In fact, I moved the code into WebappsUI so it could be used by both features.

If no shortcut exists, Android will make one, potentially on a different homescreen if it is full. If a shortcut for the app already exists, Android will display a message stating that it exists and won't make a dupe.
Assignee: nobody → mark.finkle
Attachment #621356 - Flags: review?(wjohnston)
Nominating for k9o, as this relates to basic functionality for the android web runtime for web apps on app install.
blocking-kilimanjaro: --- → ?
Comment on attachment 621356 [details] [diff] [review]
patch

Review of attachment 621356 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/chrome/content/browser.js
@@ +4770,5 @@
>    }
>  };
>  
>  var WebappsUI = {
> +  init: function init() {

Happy to have names! We should probably prefix them?

@@ +4807,2 @@
>        DOMApplicationRegistry.confirmInstall(aData);
> +      this.createShortcut(manifest.name, manifest.fullLaunchPath(), manifest.iconURLForSize("64"), "webapp");

Hmm... Still looking through this code. Is it possible for things to fail? Maybe we should just have an observer listening for the webapps-sync-install notification and when that happens we create a shortcut.

Updated

6 years ago
blocking-kilimanjaro: ? → +
Comment on attachment 621356 [details] [diff] [review]
patch

Review of attachment 621356 [details] [diff] [review]:
-----------------------------------------------------------------

I'd like to know if there is some event sent when the install is complete. It looks like from:

http://mxr.mozilla.org/mozilla-central/source/dom/base/Webapps.jsm#195

that confirmInstall does some async file writing. I think we need better messages/callbacks/promises/etc sent if that succeeds or fails? Can the webapps guys comment?
Attachment #621356 - Flags: review?(wjohnston) → review-
(In reply to Wesley Johnston (:wesj) from comment #9)
> Comment on attachment 621356 [details] [diff] [review]
> patch
> 
> Review of attachment 621356 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I'd like to know if there is some event sent when the install is complete.
> It looks like from:

There is no event sent to chrome after install.


> http://mxr.mozilla.org/mozilla-central/source/dom/base/Webapps.jsm#195
> 
> that confirmInstall does some async file writing. I think we need better
> messages/callbacks/promises/etc sent if that succeeds or fails? Can the
> webapps guys comment?

The appObject is cached in memory here:
http://mxr.mozilla.org/mozilla-central/source/dom/base/Webapps.jsm#192

That is what's used to access the app data after install, so we should be good to go.
Created attachment 625148 [details] [diff] [review]
patch 2

This patch uses "webapps-sync-install" to wait for a successful install before adding the homescreen shortcut. Seems to work OK.
Attachment #621356 - Attachment is obsolete: true
Attachment #625148 - Flags: review?(wjohnston)
Comment on attachment 625148 [details] [diff] [review]
patch 2

Review of attachment 625148 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/chrome/content/browser.js
@@ +5004,5 @@
> +        // Wait until we know the app install worked, then make a homescreen shortcut
> +        DOMApplicationRegistry.getManifestFor(data.origin, (function(aManifest) {
> +	   if (!aManifest)
> +	     return;
> +          dump("XXXX make a homescreen shortcut")

Remove this
Attachment #625148 - Flags: review?(wjohnston) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/80f607fa91eb

Updated

6 years ago
Flags: in-moztrap?(aaron.train)
MozTrap: https://moztrap.mozilla.org/manage/case/257/
Flags: in-moztrap?(aaron.train) → in-moztrap+
https://hg.mozilla.org/mozilla-central/rev/80f607fa91eb
Status: NEW → RESOLVED
Last Resolved: 6 years ago6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 15

Updated

6 years ago
Whiteboard: [Phase1] → [Phase1], [qa+]

Updated

6 years ago
Whiteboard: [Phase1], [qa+] → [Phase1], [qa+:AaronMT]
Verified Fixed

Via:

--
Nightly (06/02)
Samsung Galaxy Nexus (Android 4.0.4)
Status: RESOLVED → VERIFIED
status-firefox15: --- → verified
Whiteboard: [Phase1], [qa+:AaronMT] → [Phase1]
You need to log in before you can comment on or make changes to this bug.