Permalink
Browse files

Bug 807529 - Gaia homescreen app: do not wait for mozApps to start pa…

…inting. r=vingtetun
  • Loading branch information...
1 parent f94a5dd commit 56b368723178521be7f6d417e7944fa7b909d1a8 @philikon philikon committed with vingtetun Nov 14, 2012
View
@@ -9,6 +9,7 @@ manifest.appcache
/apps/system/camera
/apps/settings/resources/gaia_commit.txt
/apps/homescreen/js/init.json
+/apps/homescreen/js/hiddenapps.js
/apps/costcontrol/js/config.json
/apps/sms/js/blacklist.json
/test_apps/test-agent/test/config.json
@@ -12,8 +12,8 @@
"launch_path": "/dialer/index.html#keyboard-view",
"name": "Phone",
"icons": {
- "120": "/style/icons/Dialer.png",
- "60": "/style/icons/60/Dialer.png"
+ "120": "/dialer/style/icons/Dialer.png",
+ "60": "/dialer/style/icons/60/Dialer.png"
},
"locales": {
"ar": {
@@ -38,8 +38,8 @@
"launch_path": "/contacts/index.html",
"name": "Contacts",
"icons": {
- "120": "/style/icons/Contacts.png",
- "60": "/style/icons/60/Contacts.png"
+ "120": "/contacts/style/icons/Contacts.png",
+ "60": "/contacts/style/icons/60/Contacts.png"
},
"locales": {
"ar": {
@@ -80,10 +80,6 @@
"wifi":{},
"time": {}
},
- "icons": {
- "120": "/dialer/style/icons/Dialer.png",
- "60": "/dialer/style/icons/60/Dialer.png"
- },
"orientation": "portrait-primary",
"activities": {
"pick": {
@@ -767,7 +767,7 @@ Evme.Brain = new function() {
this.appRedirectExecute = function(data){
var appIcon = Evme.Utils.formatImageData(data.icon);
if (data.installed) {
- Applications.launch(data.appUrl, '');
+ GridManager.getAppByOrigin(data.appUrl).launch();
} else {
Evme.Utils.getRoundIcon(appIcon, 49, function(appIcon) {
Evme.Utils.sendToFFOS(Evme.Utils.FFOSMessages.APP_CLICK, {
@@ -6,7 +6,7 @@ var EvmeManager = (function() {
function openApp(params) {
var evmeApp = new EvmeApp({
- url: params.originUrl,
+ bookmarkURL: params.originUrl,
name: params.title,
icon: params.icon
});
@@ -18,21 +18,11 @@ var EvmeManager = (function() {
}
function addBookmark(params) {
- var data = {
- url: params.originUrl,
+ GridManager.install({
+ bookmarkURL: params.originUrl,
name: params.title,
icon: params.icon
- }
-
- function success() {
- Applications.installBookmark(new Bookmark(data));
- }
-
- function error() {
- // Anything to do in case of error?
- }
-
- HomeState.saveBookmark(data, success, error);
+ });
}
function openUrl(url) {
@@ -61,14 +51,29 @@ var EvmeManager = (function() {
}
function getApps() {
- return Applications.getAll();
+ return GridManager.getApps();
}
-
+
function getAppIcon(app) {
- return Applications.getIcon(app.origin);
+ var iconsForApp = GridManager.getIconsForApp(app);
+ for (var entryPoint in iconsForApp) {
+ return iconsForApp[entryPoint].descriptor.icon;
+ }
}
function getAppName(app) {
- return Applications.getName(app.origin);
+ var manifest = app.manifest;
+ if (!manifest) {
+ return null;
+ }
+
+ if ('locales' in manifest) {
+ var locale = manifest.locales[document.documentElement.lang];
+ if (locale && locale.name) {
+ return locale.name;
+ }
+ }
+
+ return manifest.name;
}
return {
@@ -77,7 +82,7 @@ var EvmeManager = (function() {
addBookmark: addBookmark,
isAppInstalled: function isAppInstalled(url) {
- return Applications.isInstalled(url);
+ return !!GridManager.getAppByOrigin(url);
},
getApps: getApps,
getAppIcon: getAppIcon,
@@ -96,3 +101,34 @@ var EvmeApp = function createEvmeApp(params) {
};
extend(EvmeApp, Bookmark);
+
+EvmeApp.prototype.launch = function evmeapp_launch(url, name) {
+ var features = {
+ name: this.manifest.name.replace(/\s/g, ' '),
+ icon: this.manifest.icons['60']
+ };
+
+ if (!GridManager.getIconForBookmark(this.origin)) {
+ features.origin = {
+ name: features.name,
+ url: encodeURIComponent(this.origin)
+ };
+ }
+
+ if (url && url !== this.origin && !GridManager.getIconForBookmark(url)) {
+ var searchName = navigator.mozL10n.get('wrapper-search-name', {
+ topic: name,
+ name: this.manifest.name
+ }).replace(/\s/g, ' ');
+
+ features.name = searchName;
+ features.search = {
+ name: searchName,
+ url: encodeURIComponent(url)
+ };
+ }
+
+ // The third parameter is received in window_manager without whitespaces
+ // so we decice replace them for  
+ return window.open(url || this.origin, '_blank', JSON.stringify(features));
+};
@@ -35,6 +35,7 @@
<script type="text/javascript" defer src="everything.me/js/everything.me.js"></script>
<script type="text/javascript" defer src="js/homescreen.js"></script>
<script type="text/javascript" defer src="js/wallpaper.js"></script>
+ <script type="text/javascript" defer src="js/hiddenapps.js"></script>
<link rel="resource" type="application/l10n" href="locales/locales.ini">
<link rel="resource" type="application/l10n" href="shared/locales/date.ini">
Oops, something went wrong.

0 comments on commit 56b3687

Please sign in to comment.